Date: Fri, 17 Aug 2018 16:04:59 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r337976 - stable/11/sys/x86/x86 Message-ID: <201808171604.w7HG4xRN009908@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Fri Aug 17 16:04:59 2018 New Revision: 337976 URL: https://svnweb.freebsd.org/changeset/base/337976 Log: MFC r337230: Verify that each frame pointer lies within the thread's kstack. Modified: stable/11/sys/x86/x86/stack_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/stack_machdep.c ============================================================================== --- stable/11/sys/x86/x86/stack_machdep.c Fri Aug 17 16:04:20 2018 (r337975) +++ stable/11/sys/x86/x86/stack_machdep.c Fri Aug 17 16:04:59 2018 (r337976) @@ -82,16 +82,16 @@ stack_capture(struct thread *td, struct stack *st, reg stack_zero(st); frame = (x86_frame_t)fp; while (1) { - if (!INKERNEL((long)frame)) + if ((vm_offset_t)frame < td->td_kstack || + (vm_offset_t)frame >= td->td_kstack + + td->td_kstack_pages * PAGE_SIZE) break; callpc = frame->f_retaddr; if (!INKERNEL(callpc)) break; if (stack_put(st, callpc) == -1) break; - if (frame->f_frame <= frame || - (vm_offset_t)frame->f_frame >= td->td_kstack + - td->td_kstack_pages * PAGE_SIZE) + if (frame->f_frame <= frame) break; frame = frame->f_frame; } @@ -106,7 +106,7 @@ stack_nmi_handler(struct trapframe *tf) if (nmi_stack == NULL || curthread != nmi_pending) return (0); - if (INKERNEL(TF_PC(tf)) && (TF_FLAGS(tf) & PSL_I) != 0) + if (!TRAPF_USERMODE(tf) && (TF_FLAGS(tf) & PSL_I) != 0) stack_capture(curthread, nmi_stack, TF_FP(tf)); else /* We were running in usermode or had interrupts disabled. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808171604.w7HG4xRN009908>