PERFORCE change 79890 for review
Christian S.J. Peron
csjp at FreeBSD.org
Sun Jul 10 04:39:31 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=79890
Change 79890 by csjp at csjp_xor on 2005/07/10 04:38:31
Activate mac_syscall_enter and mac_syscall_exit for all other
supported architectures.
It should be noted that syscall value (or code) is greater than
p->p_sysent->sv_size, we change code to zero. This might have
an impact on kernel tracing mechanisms, however at least we
will be tracing the accurate syscall now. (nosys).
Anyone who could test these to make sure everything builds
alright, that would be great! I do not have access to half
this hardware.
Affected files ...
.. //depot/projects/trustedbsd/mac/sys/alpha/alpha/trap.c#26 edit
.. //depot/projects/trustedbsd/mac/sys/amd64/amd64/trap.c#16 edit
.. //depot/projects/trustedbsd/mac/sys/arm/arm/trap.c#6 edit
.. //depot/projects/trustedbsd/mac/sys/ia64/ia32/ia32_trap.c#4 edit
.. //depot/projects/trustedbsd/mac/sys/ia64/ia64/trap.c#29 edit
.. //depot/projects/trustedbsd/mac/sys/powerpc/powerpc/trap.c#19 edit
.. //depot/projects/trustedbsd/mac/sys/sparc64/sparc64/trap.c#29 edit
Differences ...
==== //depot/projects/trustedbsd/mac/sys/alpha/alpha/trap.c#26 (text+ko) ====
@@ -32,6 +32,7 @@
/* #include "opt_fix_unaligned_vax_fp.h" */
#include "opt_ddb.h"
#include "opt_ktrace.h"
+#include "opt_mac.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -42,6 +43,7 @@
#include <sys/proc.h>
#include <sys/exec.h>
#include <sys/lock.h>
+#include <sys/mac.h>
#include <sys/mutex.h>
#include <sys/smp.h>
#include <sys/vmmeter.h>
@@ -687,10 +689,9 @@
if (p->p_sysent->sv_mask)
code &= p->p_sysent->sv_mask;
- if (code >= p->p_sysent->sv_size)
- callp = &p->p_sysent->sv_table[0];
- else
- callp = &p->p_sysent->sv_table[code];
+ if (code >= p->p_sysent->sv_size)
+ code = 0;
+ callp = &p->p_sysent->sv_table[code];
nargs = (callp->sy_narg & SYF_ARGMASK) + hidden;
switch (nargs) {
@@ -734,7 +735,14 @@
PTRACESTOP_SC(p, td, S_PT_SCE);
+#ifdef MAC
+ error = mac_syscall_enter(td, args + hidden, code);
+ if (error == 0)
+ error = (*callp->sy_call)(td, args + hidden);
+ mac_syscall_exit(td, args + hidden, code, error);
+#else
error = (*callp->sy_call)(td, args + hidden);
+#endif
}
==== //depot/projects/trustedbsd/mac/sys/amd64/amd64/trap.c#16 (text+ko) ====
@@ -48,6 +48,7 @@
#include "opt_cpu.h"
#include "opt_isa.h"
#include "opt_ktrace.h"
+#include "opt_mac.h"
#include <sys/param.h>
#include <sys/bus.h>
@@ -59,6 +60,7 @@
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/lock.h>
+#include <sys/mac.h>
#include <sys/mutex.h>
#include <sys/resourcevar.h>
#include <sys/signalvar.h>
@@ -740,10 +742,9 @@
if (p->p_sysent->sv_mask)
code &= p->p_sysent->sv_mask;
- if (code >= p->p_sysent->sv_size)
- callp = &p->p_sysent->sv_table[0];
- else
- callp = &p->p_sysent->sv_table[code];
+ if (code >= p->p_sysent->sv_size)
+ code = 0;
+ callp = &p->p_sysent->sv_table[code];
narg = callp->sy_narg & SYF_ARGMASK;
@@ -779,12 +780,18 @@
PTRACESTOP_SC(p, td, S_PT_SCE);
- if ((callp->sy_narg & SYF_MPSAFE) == 0) {
+ if ((callp->sy_narg & SYF_MPSAFE) == 0)
mtx_lock(&Giant);
+#ifdef MAC
+ error = mac_syscall_enter(td, argp, code);
+ if (error == 0)
error = (*callp->sy_call)(td, argp);
+ mac_syscall_exit(td, argp, code, error);
+#else
+ error = (*callp->sy_call)(td, argp);
+#endif
+ if ((callp->sy_narg & SYF_MPSAFE) == 0)
mtx_unlock(&Giant);
- } else
- error = (*callp->sy_call)(td, argp);
}
switch (error) {
==== //depot/projects/trustedbsd/mac/sys/arm/arm/trap.c#6 (text+ko) ====
@@ -80,6 +80,7 @@
#include "opt_ktrace.h"
+#include "opt_mac.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/arm/arm/trap.c,v 1.15 2005/05/25 13:46:32 cognet Exp $");
@@ -91,6 +92,7 @@
#include <sys/proc.h>
#include <sys/kernel.h>
#include <sys/lock.h>
+#include <sys/mac.h>
#include <sys/mutex.h>
#include <sys/syscall.h>
#include <sys/sysent.h>
@@ -894,9 +896,8 @@
if (p->p_sysent->sv_mask)
code &= p->p_sysent->sv_mask;
if (code >= p->p_sysent->sv_size)
- callp = &p->p_sysent->sv_table[0];
- else
- callp = &p->p_sysent->sv_table[code];
+ code = 0;
+ callp = &p->p_sysent->sv_table[code];
nargs = callp->sy_narg & SYF_ARGMASK;
memcpy(copyargs, ap, nap * sizeof(register_t));
if (nargs > nap) {
@@ -922,7 +923,14 @@
td->td_retval[1] = 0;
STOPEVENT(p, S_SCE, (callp->sy_narg & SYF_ARGMASK));
PTRACESTOP_SC(p, td, S_PT_SCE);
+#ifdef MAC
+ error = mac_syscall_enter(td, args, code);
+ if (error == 0)
+ error = (*callp->sy_call)(td, args);
+ mac_syscall_exit(td, args, code, error);
+#else
error = (*callp->sy_call)(td, args);
+#endif
}
switch (error) {
case 0:
==== //depot/projects/trustedbsd/mac/sys/ia64/ia32/ia32_trap.c#4 (text+ko) ====
@@ -27,12 +27,15 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/ia64/ia32/ia32_trap.c,v 1.5 2005/04/12 23:18:54 jhb Exp $");
+#include "opt_mac.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ktr.h>
#include <sys/sysproto.h>
#include <sys/kernel.h>
#include <sys/lock.h>
+#include <sys/mac.h>
#include <sys/mutex.h>
#include <sys/pioctl.h>
#include <sys/proc.h>
@@ -92,9 +95,8 @@
code &= p->p_sysent->sv_mask;
if (code >= p->p_sysent->sv_size)
- callp = &p->p_sysent->sv_table[0];
- else
- callp = &p->p_sysent->sv_table[code];
+ code = 0;
+ callp = &p->p_sysent->sv_table[code];
narg = callp->sy_narg & SYF_ARGMASK;
@@ -124,7 +126,14 @@
STOPEVENT(p, S_SCE, narg);
+#ifdef MAC
+ eror = mac_syscall_enter(td, args64, code);
+ if (error == 0)
+ error = (*callp->sy_call)(td, args64);
+ mac_syscall_exit(td, args64, code, error);
+#else
error = (*callp->sy_call)(td, args64);
+#endif
}
switch (error) {
==== //depot/projects/trustedbsd/mac/sys/ia64/ia64/trap.c#29 (text+ko) ====
@@ -33,6 +33,7 @@
#include "opt_ddb.h"
#include "opt_ktrace.h"
+#include "opt_mac.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -43,6 +44,7 @@
#include <sys/proc.h>
#include <sys/exec.h>
#include <sys/lock.h>
+#include <sys/mac.h>
#include <sys/mutex.h>
#include <sys/smp.h>
#include <sys/vmmeter.h>
@@ -928,10 +930,9 @@
if (p->p_sysent->sv_mask)
code &= p->p_sysent->sv_mask;
- if (code >= p->p_sysent->sv_size)
- callp = &p->p_sysent->sv_table[0];
- else
- callp = &p->p_sysent->sv_table[code];
+ if (code >= p->p_sysent->sv_size)
+ code = 0;
+ callp = &p->p_sysent->sv_table[code]
#ifdef KTRACE
if (KTRPOINT(td, KTR_SYSCALL))
@@ -949,12 +950,18 @@
/*
* Grab Giant if the syscall is not flagged as MP safe.
*/
- if ((callp->sy_narg & SYF_MPSAFE) == 0) {
+ if ((callp->sy_narg & SYF_MPSAFE) == 0)
mtx_lock(&Giant);
+#ifdef MAC
+ error = mac_syscall_enter(td, args, code);
+ if (error == 0)
error = (*callp->sy_call)(td, args);
+ mac_syscall_exit(td, args, code, error);
+#else
+ error = (*callp->sy_call)(td, args);
+#endif
+ if ((callp->sy_narg & SYF_MPSAFE) == 0)
mtx_unlock(&Giant);
- } else
- error = (*callp->sy_call)(td, args);
if (error != EJUSTRETURN) {
/*
==== //depot/projects/trustedbsd/mac/sys/powerpc/powerpc/trap.c#19 (text+ko) ====
@@ -35,12 +35,14 @@
__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/trap.c,v 1.54 2005/04/20 20:52:46 ps Exp $");
#include "opt_ktrace.h"
+#include "opt_mac.h"
#include <sys/param.h>
#include <sys/kdb.h>
#include <sys/proc.h>
#include <sys/ktr.h>
#include <sys/lock.h>
+#include <sys/mac.h>
#include <sys/mutex.h>
#include <sys/pioctl.h>
#include <sys/reboot.h>
@@ -373,10 +375,9 @@
if (p->p_sysent->sv_mask)
code &= p->p_sysent->sv_mask;
- if (code >= p->p_sysent->sv_size)
- callp = &p->p_sysent->sv_table[0];
- else
- callp = &p->p_sysent->sv_table[code];
+ if (code >= p->p_sysent->sv_size)
+ code = 0;
+ callp = &p->p_sysent->sv_table[code];
narg = callp->sy_narg & SYF_ARGMASK;
@@ -410,7 +411,14 @@
STOPEVENT(p, S_SCE, narg);
+#ifdef MAC
+ error = mac_syscall_enter(td, params, code);
+ if (error == 0)
+ error = (*callp->sy_call)(td, params);
+ mac_syscall_exit(td, params, code, error);
+#else
error = (*callp->sy_call)(td, params);
+#endif
CTR3(KTR_SYSC, "syscall: p=%s %s ret=%x", p->p_comm,
syscallnames[code], td->td_retval[0]);
==== //depot/projects/trustedbsd/mac/sys/sparc64/sparc64/trap.c#29 (text+ko) ====
@@ -43,6 +43,7 @@
#include "opt_ddb.h"
#include "opt_ktr.h"
#include "opt_ktrace.h"
+#include "opt_mac.h"
#include <sys/param.h>
#include <sys/kdb.h>
@@ -51,6 +52,7 @@
#include <sys/interrupt.h>
#include <sys/ktr.h>
#include <sys/lock.h>
+#include <sys/mac.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <sys/pioctl.h>
@@ -547,10 +549,9 @@
if (p->p_sysent->sv_mask)
code &= p->p_sysent->sv_mask;
- if (code >= p->p_sysent->sv_size)
- callp = &p->p_sysent->sv_table[0];
- else
- callp = &p->p_sysent->sv_table[code];
+ if (code >= p->p_sysent->sv_size)
+ code = 0;
+ callp = &p->p_sysent->sv_table[code];
narg = callp->sy_narg & SYF_ARGMASK;
@@ -589,7 +590,14 @@
PTRACESTOP_SC(p, td, S_PT_SCE);
+#ifdef MAC
+ error = mac_syscall_enter(td, argp, code);
+ if (error == 0)
+ error = (*callp->sy_call)(td, argp);
+ mac_syscall_exit(td, argp, code, error);
+#else
error = (*callp->sy_call)(td, argp);
+#endif
CTR5(KTR_SYSC, "syscall: p=%p error=%d %s return %#lx %#lx ", p,
error, syscallnames[code], td->td_retval[0],
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list