Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Mar 2016 08:36:25 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297184 - head/sys/arm64/include
Message-ID:  <201603220836.u2M8aPV6032958@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Tue Mar 22 08:36:25 2016
New Revision: 297184
URL: https://svnweb.freebsd.org/changeset/base/297184

Log:
  Use the saved program state register to detect when an exception frame is
  from userpsace. Previously we could have triggered a panic by trying to
  jump to a kernel address from userland as the trap handling code thought we
  received an ast in kernel mode.
  
  Obtained from:	ABT Systems Ltd
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/arm64/include/cpu.h

Modified: head/sys/arm64/include/cpu.h
==============================================================================
--- head/sys/arm64/include/cpu.h	Tue Mar 22 08:12:45 2016	(r297183)
+++ head/sys/arm64/include/cpu.h	Tue Mar 22 08:36:25 2016	(r297184)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
- * Copyright (c) 2014 The FreeBSD Foundation
+ * Copyright (c) 2014-2016 The FreeBSD Foundation
  * All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
@@ -46,7 +46,7 @@
 #include <machine/armreg.h>
 
 #define	TRAPF_PC(tfp)		((tfp)->tf_lr)
-#define	TRAPF_USERMODE(tfp)	(((tfp)->tf_elr & (1ul << 63)) == 0)
+#define	TRAPF_USERMODE(tfp)	(((tfp)->tf_spsr & PSR_M_MASK) == PSR_M_EL0t)
 
 #define	cpu_getstack(td)	((td)->td_frame->tf_sp)
 #define	cpu_setstack(td, sp)	((td)->td_frame->tf_sp = (sp))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603220836.u2M8aPV6032958>