Page MenuHomeFreeBSD

PR 224503: rpcbind: Do not use signal-unsafe functions in SIGTERM handler
ClosedPublic

Authored by cem on Jan 1 2018, 9:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 18, 2:23 AM
Unknown Object (File)
Mar 12 2024, 1:44 AM
Unknown Object (File)
Mar 12 2024, 1:44 AM
Unknown Object (File)
Mar 12 2024, 1:44 AM
Unknown Object (File)
Mar 12 2024, 1:44 AM
Unknown Object (File)
Mar 8 2024, 4:17 AM
Unknown Object (File)
Jan 8 2024, 2:51 PM
Unknown Object (File)
Jan 4 2024, 3:34 AM
Subscribers

Details

Summary

syslog(), routines used in write_warmstart(), and exit(3) are all signal-unsafe. Disable the former two (which are already off by default after r317168) and convert the latter to an _exit(2) to make rpcbind exit safely on signal delivery.

Diff Detail

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

Event Timeline

The _exit() bit looks right to me.

Note that warmstart has always been off by default (not just as of r317168), and this change effectively renders the feature useless, so if you're going to touch it you might as well just delete it entirely (or fix it :)).

This change makes the WARMSTART option non-functional.

Proper fix would be to set a flag in the signal handler and check for it in my_svc_run() loop, doing the dump of the rpc registrations in the context of the main loop.

In D13728#287214, @kib wrote:

This change makes the WARMSTART option non-functional.

Proper fix would be to set a flag in the signal handler and check for it in my_svc_run() loop, doing the dump of the rpc registrations in the context of the main loop.

That's fine, if that's the only place we care about detecting exiting on such signal.

Move shutdown code to main loop and use signal-safe flag to induce shutdown.

This revision is now accepted and ready to land.Jan 2 2018, 12:24 AM
This revision was automatically updated to reflect the committed changes.