Page MenuHomeFreeBSD

Log ENOSYS in init
ClosedPublic

Authored by brooks on Sep 1 2020, 8:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 31, 3:26 AM
Unknown Object (File)
Nov 30 2024, 1:02 PM
Unknown Object (File)
Nov 24 2024, 10:32 PM
Unknown Object (File)
Nov 23 2024, 7:46 PM
Unknown Object (File)
Nov 23 2024, 9:15 AM
Unknown Object (File)
Nov 22 2024, 4:25 AM
Unknown Object (File)
Nov 21 2024, 6:47 AM
Unknown Object (File)
Nov 16 2024, 9:03 PM
Subscribers
None

Details

Summary

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 log
such events for pid 1.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

brooks requested review of this revision.Sep 1 2020, 8:58 PM
brooks created this revision.

I ran into this on a CHERI system where we've added new revocation related system calls used in malloc. Unfortunately, we call malloc in strdup even before the (rather questionable) badsys hander is installed. Due to someone changing the kernel configs and me not noticing I lost a half day to not having those syscalls...

badsys is a piece of work...

This revision is now accepted and ready to land.Sep 1 2020, 9:08 PM

It might not be a bad idea to make it (p->p_pid == 1 && (kern_lognosys & 3) == 0) -- kern.lognosys is RWTUN, so one could theoretically have chosen an explicit behavior in loader or static kenv and that should probably be followed. OTOH, with the current check, the behavior's OK:

kern.lognosys=0: Log to console
kern.lognosys=1: Log to both
kern.lognosys=2: Log to console
kern.lognosys=3: Log to both

Obviously the only one that would change is lognosys=1 to keep the message on ctty only. Either way, I agree that it should be logged even if it's explicitly set to 0 and don't insist on the above at all.

sys/kern/kern_sig.c
3798 ↗(On Diff #76514)

As an aside, it'd be nice to document the values for lognosys somewhere or differently; as far as I can tell, they're only documented in the commit message of rS321627.

  • Honor kern.lognosys if non-zero.
This revision now requires review to proceed.Sep 2 2020, 10:17 PM
This revision is now accepted and ready to land.Sep 2 2020, 10:19 PM
This revision was automatically updated to reflect the committed changes.