From 504a0eb6a5625b677eb19c22ebc8aa8d39764e44 Mon Sep 17 00:00:00 2001 From: marius Date: Sun, 24 Aug 2008 20:02:18 +0000 Subject: 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 --- sys/sparc64/sparc64/trap.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'sys/sparc64') 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]); -- cgit v1.1