add a sanity check to the system call registration code
A system call number should be at least reserved. We do not expect an attempt to register a fixed number system call when nothing at all is known about it. MFC after: 3 weeks Sponsored by: Panzura
This commit is contained in:
parent
c590fd27de
commit
64ebbdd54d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355611
@ -120,11 +120,14 @@ kern_syscall_register(struct sysent *sysents, int *offset,
|
||||
if (i == SYS_MAXSYSCALL)
|
||||
return (ENFILE);
|
||||
*offset = i;
|
||||
} else if (*offset < 0 || *offset >= SYS_MAXSYSCALL)
|
||||
} else if (*offset < 0 || *offset >= SYS_MAXSYSCALL) {
|
||||
return (EINVAL);
|
||||
else if (sysents[*offset].sy_call != (sy_call_t *)lkmnosys &&
|
||||
sysents[*offset].sy_call != (sy_call_t *)lkmressys)
|
||||
} else if (sysents[*offset].sy_call != (sy_call_t *)lkmnosys &&
|
||||
sysents[*offset].sy_call != (sy_call_t *)lkmressys) {
|
||||
KASSERT(sysents[*offset].sy_call != NULL,
|
||||
("undefined syscall %d", *offset));
|
||||
return (EEXIST);
|
||||
}
|
||||
|
||||
KASSERT(sysents[*offset].sy_thrcnt == SY_THR_ABSENT,
|
||||
("dynamic syscall is not protected"));
|
||||
|
Loading…
Reference in New Issue
Block a user