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
This commit is contained in:
Marius Strobl 2008-08-24 20:02:18 +00:00
parent e08f2b26f4
commit e560e52d1d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182119

View file

@ -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]);