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.

Approved by: peter
This commit is contained in:
David Xu 2004-08-09 23:57:59 +00:00
parent 73f3c121b6
commit d421c2dc36
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133413

View File

@ -729,21 +729,18 @@ syscall(frame)
/*
* copyin and the ktrsyscall()/ktrsysret() code is MP-aware
*/
if (narg <= regcnt) {
argp = &frame.tf_rdi;
argp += reg;
error = 0;
} else {
KASSERT(narg <= sizeof(args) / sizeof(args[0]),
("Too many syscall arguments!"));
KASSERT(narg <= sizeof(args) / sizeof(args[0]),
("Too many syscall arguments!"));
error = 0;
argp = &frame.tf_rdi;
argp += reg;
bcopy(argp, args, sizeof(args[0]) * regcnt);
if (narg > regcnt) {
KASSERT(params != NULL, ("copyin args with no params!"));
argp = &frame.tf_rdi;
argp += reg;
bcopy(argp, args, sizeof(args[0]) * regcnt);
error = copyin(params, &args[regcnt],
(narg - regcnt) * sizeof(args[0]));
argp = &args[0];
(narg - regcnt) * sizeof(args[0]));
}
argp = &args[0];
#ifdef KTRACE
if (KTRPOINT(td, KTR_SYSCALL))