Date: Mon, 21 Aug 2017 15:44:57 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322755 - stable/10/sys/i386/i386 Message-ID: <201708211544.v7LFivHB078700@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Aug 21 15:44:57 2017 New Revision: 322755 URL: https://svnweb.freebsd.org/changeset/base/322755 Log: MFC r322667,r322706: Improve i386 #UD low-level kdtrace hook. Approved by: re (marius) Modified: stable/10/sys/i386/i386/exception.s Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/i386/i386/exception.s ============================================================================== --- stable/10/sys/i386/i386/exception.s Mon Aug 21 15:39:48 2017 (r322754) +++ stable/10/sys/i386/i386/exception.s Mon Aug 21 15:44:57 2017 (r322755) @@ -185,21 +185,29 @@ calltrap: #ifdef KDTRACE_HOOKS SUPERALIGN_TEXT IDTVEC(ill) - /* Check if there is no DTrace hook registered. */ - cmpl $0,dtrace_invop_jump_addr + /* + * Check if a DTrace hook is registered. The default (data) segment + * cannot be used for this since %ds is not known good until we + * verify that the entry was from kernel mode. + */ + cmpl $0,%ss:dtrace_invop_jump_addr je norm_ill - /* Check if this is a user fault. */ - cmpl $GSEL_KPL, 4(%esp) /* Check the code segment. */ - - /* If so, just handle it as a normal trap. */ + /* + * Check if this is a user fault. If so, just handle it as a normal + * trap. + */ + cmpl $GSEL_KPL, 4(%esp) /* Check the code segment */ jne norm_ill + testl $PSL_VM, 8(%esp) /* and vm86 mode. */ + jnz norm_ill /* * This is a kernel instruction fault that might have been caused * by a DTrace provider. */ - pushal /* Push all registers onto the stack. */ + pushal + cld /* * Set our jump address for the jump back in the event that
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708211544.v7LFivHB078700>