summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2008-08-24 20:02:18 +0000
committermarius <marius@FreeBSD.org>2008-08-24 20:02:18 +0000
commit504a0eb6a5625b677eb19c22ebc8aa8d39764e44 (patch)
tree695dee1f84d3aefaf56724be4cbf1e219810057b /sys/sparc64
parent7815fba39ce6f74cc464897ee3447ac267c8ed3d (diff)
downloadFreeBSD-src-504a0eb6a5625b677eb19c22ebc8aa8d39764e44.zip
FreeBSD-src-504a0eb6a5625b677eb19c22ebc8aa8d39764e44.tar.gz
MFamd64: r133413
In syscall, always make a copy of parameters from trapframe, this becauses some syscalls using set_mcontext can sneakily change parameters and later when those syscalls references parameters, they will wrongly use register values in mcontext_t. PR: 72998 MFC after: 3 days
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/sparc64/trap.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c
index 1149e4f..44eed95 100644
--- a/sys/sparc64/sparc64/trap.c
+++ b/sys/sparc64/sparc64/trap.c
@@ -560,18 +560,15 @@ syscall(struct trapframe *tf)
narg = callp->sy_narg;
- if (narg <= regcnt) {
- argp = &tf->tf_out[reg];
- error = 0;
- } else {
- KASSERT(narg <= sizeof(args) / sizeof(args[0]),
- ("Too many syscall arguments!"));
- argp = args;
- bcopy(&tf->tf_out[reg], args, sizeof(args[0]) * regcnt);
+ KASSERT(narg <= sizeof(args) / sizeof(args[0]),
+ ("Too many syscall arguments!"));
+ error = 0;
+ argp = args;
+ bcopy(&tf->tf_out[reg], args, sizeof(args[0]) * regcnt);
+ if (narg > regcnt)
error = copyin((void *)(tf->tf_out[6] + SPOFF +
offsetof(struct frame, fr_pad[6])),
&args[regcnt], (narg - regcnt) * sizeof(args[0]));
- }
CTR5(KTR_SYSC, "syscall: td=%p %s(%#lx, %#lx, %#lx)", td,
syscallnames[code], argp[0], argp[1], argp[2]);
OpenPOWER on IntegriCloud