Page MenuHomeFreeBSD

syslogd: Use process descriptors
ClosedPublic

Authored by jfree on Aug 8 2023, 3:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 1, 3:40 AM
Unknown Object (File)
Mon, Oct 21, 5:25 AM
Unknown Object (File)
Mon, Oct 21, 5:25 AM
Unknown Object (File)
Mon, Oct 21, 5:14 AM
Unknown Object (File)
Mon, Oct 21, 3:35 AM
Unknown Object (File)
Mon, Oct 21, 3:22 AM
Unknown Object (File)
Sat, Oct 19, 12:03 AM
Unknown Object (File)
Sat, Oct 19, 12:02 AM
Subscribers

Details

Summary
Prepare for program Capsicumization by storing process descriptors
instead of pids. Signal delivery is not permitted in capability mode,
so we can use pdkill(2) to terminate child processes.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jfree requested review of this revision.Aug 8 2023, 3:33 PM
jfree added a child revision: D41370: syslogd: Merge loops.

Process descriptors for piped processes are registered with kevent() in this patch:

https://reviews.freebsd.org/D41389

This revision is now accepted and ready to land.Aug 9 2023, 7:36 PM
This revision now requires review to proceed.Aug 10 2023, 11:11 PM
usr.sbin/syslogd/syslogd.c
1958–1959

deadq_enter() saves the process descriptor in the entry, but the subsequent close_filed() call will close the process descriptor, so we're left with a dangling fd.

Move procdesc closure into deadq_remove() so we avoid dangling, invalid procdescs

deadq_enter() and close_filed() are now always called together. Should the latter call the former directly? If not, I'd suggest adding a comment to close_filed() explaining that the procdesc is closed elsewhere, otherwise it looks like it's being leaked.

This revision is now accepted and ready to land.Aug 14 2023, 2:21 PM

Move deadq_enter() into close_filed()

This revision now requires review to proceed.Aug 14 2023, 3:42 PM
This revision is now accepted and ready to land.Aug 16 2023, 8:47 PM
This revision was automatically updated to reflect the committed changes.