Don't forget to set sa->narg for CloudABI system calls.

It turns out that this value is not used within the system call code
under normal conditions, except when using tracing tools like ktrace.
If we forget to set this value, it is set to random garbage. This may
cause ktrace to hang indefinitely, making it impossible to kill.

Reported by: Michael Plass
PR: 210800
MFC before: 11.0-RELEASE
This commit is contained in:
Ed Schouten 2016-07-08 20:09:21 +00:00
parent 155a72b58a
commit d96aeddf2f
2 changed files with 2 additions and 0 deletions

View File

@ -96,6 +96,7 @@ cloudabi64_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL)
return (ENOSYS);
sa->callp = &cloudabi64_sysent[sa->code];
sa->narg = sa->callp->sy_narg;
/* Fetch system call arguments. */
sa->args[0] = frame->tf_rdi;

View File

@ -77,6 +77,7 @@ cloudabi64_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL)
return (ENOSYS);
sa->callp = &cloudabi64_sysent[sa->code];
sa->narg = sa->callp->sy_narg;
/* Fetch system call arguments. */
for (i = 0; i < MAXARGS; i++)