Page MenuHomeFreeBSD

syslogd: Watch for dead pipe processes
ClosedPublic

Authored by jfree on Aug 16 2023, 12:10 AM.
Tags
None
Referenced Files
F106166572: D41477.diff
Thu, Dec 26, 11:52 AM
Unknown Object (File)
Sat, Dec 21, 11:39 PM
Unknown Object (File)
Thu, Dec 19, 7:21 AM
Unknown Object (File)
Wed, Dec 18, 9:50 PM
Unknown Object (File)
Mon, Dec 16, 4:12 AM
Unknown Object (File)
Tue, Dec 10, 6:24 PM
Unknown Object (File)
Tue, Dec 3, 2:34 PM
Unknown Object (File)
Tue, Dec 3, 11:09 AM

Details

Summary
For each new pipe process, add its process descriptor into the kqueue
with the EVFILT_PROCDESC filter and NOTE_EXIT event. When the pipe
process exits, the main kqueue loop will catch this, logging exit errors
and cleaning up the pipe process' filed node.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Add boolean reload parameter to close_filed(). When set to true, remove kevents that reference the filed.

Remove reload parameter in close_filed(). Move kqueue deletion into closelogfiles() instead.

Update after rebase conflicts

usr.sbin/syslogd/syslogd.c
2499

What's the point of deleting the kevent if we're about to close the fd anyway? Does that simplify cleanup somehow?

usr.sbin/syslogd/syslogd.c
2499

What's the point of deleting the kevent if we're about to close the fd anyway? Does that simplify cleanup somehow?

If we're reloading, it is possible that piped processes are still alive. In init(), this closelogfiles() is called and all fileds are freed. If we don't remove the piped process' kevent from the kqueue, then EVFILT_PROCDESC will be triggered upon the procdesc closure in close_filed(). Back in main(), the EVFILT_PROCDESC will attempt to call close_filed() again with an invalid, freed filed (stored in its udata).

This revision is now accepted and ready to land.Aug 23 2023, 3:50 PM

Update to avoid rebase conflicts.

This revision now requires review to proceed.Sep 3 2023, 3:27 AM
This revision is now accepted and ready to land.Oct 6 2024, 2:21 PM
This revision was automatically updated to reflect the committed changes.