Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amd64/amd64 If the frame is not aligned, leave righ...



details:   https://anonhg.NetBSD.org/src/rev/8bf0d7248ab0
branches:  trunk
changeset: 934063:8bf0d7248ab0
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jun 06 07:03:21 2020 +0000

description:
If the frame is not aligned, leave right away. This place probably needs
to be revisited, because %rbp could easily contain garbage.

Reported-by: syzbot+ecb40cf7f8acc102c29b%syzkaller.appspotmail.com@localhost

diffstat:

 sys/arch/amd64/amd64/db_machdep.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r fe7b7e4ddac4 -r 8bf0d7248ab0 sys/arch/amd64/amd64/db_machdep.c
--- a/sys/arch/amd64/amd64/db_machdep.c Sat Jun 06 06:42:54 2020 +0000
+++ b/sys/arch/amd64/amd64/db_machdep.c Sat Jun 06 07:03:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_machdep.c,v 1.7 2020/05/14 16:57:53 maxv Exp $      */
+/*     $NetBSD: db_machdep.c,v 1.8 2020/06/06 07:03:21 maxv Exp $      */
 
 /*
  * Mach Operating System
@@ -26,7 +26,7 @@
  * rights to redistribute these changes.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.7 2020/05/14 16:57:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.8 2020/06/06 07:03:21 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -151,6 +151,8 @@
                        db_get_value((long)&tf->tf_rbp, 8, false);
                if (fp == NULL)
                        return 0;
+               if (((uintptr_t)fp & 7) != 0)
+                       return 0;
                *nextframe = (long *)&fp->f_frame;
                *retaddr = (long *)&fp->f_retaddr;
                *arg0 = (long *)&fp->f_arg0;



Home | Main Index | Thread Index | Old Index