Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/sparc64 Add a few assertions to verify non-...
details: https://anonhg.NetBSD.org/src/rev/f7ce8cd75cf0
branches: trunk
changeset: 341443:f7ce8cd75cf0
user: martin <martin%NetBSD.org@localhost>
date: Fri Nov 06 15:25:42 2015 +0000
description:
Add a few assertions to verify non-privileged processor state for userland
and 32bit address mapping for 32bit processes.
diffstat:
sys/arch/sparc64/sparc64/syscall.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diffs (40 lines):
diff -r 7f0d0fd17ec2 -r f7ce8cd75cf0 sys/arch/sparc64/sparc64/syscall.c
--- a/sys/arch/sparc64/sparc64/syscall.c Fri Nov 06 15:23:23 2015 +0000
+++ b/sys/arch/sparc64/sparc64/syscall.c Fri Nov 06 15:25:42 2015 +0000
@@ -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 @@
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) {
Home |
Main Index |
Thread Index |
Old Index