mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
Use SPP (Supervisor Previous Privilege) bit in the sstatus
register to determine if trap is from userspace. Otherwise if we jump to kernel address from userspace, then TRAPF_USERMODE failed to detect usermode and then do_ast triggers a panic "ast in kernel mode". Reviewed by: markj@ Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16469
This commit is contained in:
parent
6c85795a25
commit
b51092c7ec
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336766
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 2015-2016 Ruslan Bukin <br@bsdpad.com>
|
||||
* Copyright (c) 2015-2018 Ruslan Bukin <br@bsdpad.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions of this software were developed by SRI International and the
|
||||
|
@ -41,7 +41,7 @@
|
|||
#include <machine/frame.h>
|
||||
|
||||
#define TRAPF_PC(tfp) ((tfp)->tf_ra)
|
||||
#define TRAPF_USERMODE(tfp) (((tfp)->tf_sepc & (1ul << 63)) == 0)
|
||||
#define TRAPF_USERMODE(tfp) (((tfp)->tf_sstatus & SSTATUS_SPP) == 0)
|
||||
|
||||
#define cpu_getstack(td) ((td)->td_frame->tf_sp)
|
||||
#define cpu_setstack(td, sp) ((td)->td_frame->tf_sp = (sp))
|
||||
|
|
Loading…
Reference in a new issue