Always report ENOSYS in init

While rare, encountering an unimplemented system call early in init is
catastrophic and difficult to debug.  Even after a SIGSYS handler is
registered, such configurations are problematic.  As such, always report
such events for pid 1 (following kern.lognosys if non-zero).

Reviewed by:	kevans, imp
Obtained from:	CheriBSD (plus suggestions from kevans)
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26288
This commit is contained in:
Brooks Davis 2020-09-02 23:17:33 +00:00
parent 85b29fea3c
commit 18f917a90e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365284

View File

@ -3794,7 +3794,8 @@ nosys(struct thread *td, struct nosys_args *args)
uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
td->td_sa.code);
}
if (kern_lognosys == 2 || kern_lognosys == 3) {
if (kern_lognosys == 2 || kern_lognosys == 3 ||
(p->p_pid == 1 && (kern_lognosys & 3) == 0)) {
printf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
td->td_sa.code);
}