Add a few assertions to verify non-privileged processor state for userland
and 32bit address mapping for 32bit processes.
This commit is contained in:
parent
6e1ae27534
commit
79ee181a4a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: syscall.c,v 1.43 2014/03/07 22:51:27 nakayama Exp $ */
|
||||
/* $NetBSD: syscall.c,v 1.44 2015/11/06 15:25:42 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
@ -79,7 +79,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.43 2014/03/07 22:51:27 nakayama Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.44 2015/11/06 15:25:42 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -309,6 +309,21 @@ syscall(struct trapframe64 *tf, register_t code, register_t pc)
|
||||
rval[0] = 0;
|
||||
rval[1] = tf->tf_out[1];
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
KASSERT(p->p_pid != 0);
|
||||
KASSERTMSG(!(tf->tf_tstate & TSTATE_PRIV),
|
||||
"syscall %ld, pid %d trap frame %p tstate %lx is privileged %s\n",
|
||||
code, p->p_pid, tf, tf->tf_tstate,
|
||||
(tf->tf_tstate & TSTATE_PRIV)?"yes":"no");
|
||||
if (p->p_flag & PK_32) {
|
||||
KASSERTMSG(tf->tf_tstate & TSTATE_AM,
|
||||
"32bit syscall %ld, pid %d trap frame %p tstate %lx "
|
||||
"has AM %s\n",
|
||||
code, p->p_pid, tf, tf->tf_tstate,
|
||||
(tf->tf_tstate & TSTATE_AM)?"yes":"no");
|
||||
}
|
||||
#endif
|
||||
|
||||
error = sy_invoke(callp, l, args.r, rval, code);
|
||||
|
||||
switch (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user