Page MenuHomeFreeBSD

fix devctl core file name
Needs ReviewPublic

Authored by aurelien.cazuc.external_stormshield.eu on Feb 13 2025, 1:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 21, 6:55 PM
Unknown Object (File)
Fri, Jun 20, 11:43 AM
Unknown Object (File)
Sun, Jun 15, 10:39 PM
Unknown Object (File)
Sun, Jun 15, 8:36 AM
Unknown Object (File)
Fri, Jun 13, 12:55 AM
Unknown Object (File)
Tue, Jun 3, 9:18 AM
Unknown Object (File)
May 28 2025, 8:51 PM
Unknown Object (File)
May 25 2025, 10:11 PM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

the name of the core file written to the devctl socket is invalid when rotation occurs:
the effective core file is the oldest one, but the name sent to the devctl is the last tested one

in the following situation, files are scanned from test-0.core to test-4.core, but the oldest is test-2.core
the core file will be written to test-2.core, but the devctl will receive test-4.core

-rw-r--r--   1 root wheel  0 Feb 13 14:32 test-0.core
-rw-r--r--   1 root wheel  0 Feb 13 14:32 test-1.core
-rw-r--r--   1 root wheel  0 Feb 13 14:31 test-2.core
-rw-r--r--   1 root wheel  0 Feb 13 14:31 test-3.core
-rw-r--r--   1 root wheel  0 Feb 13 14:31 test-4.core

with the fix, test-2.core will be sent to the devctl socket

Sponsored by: Stormshield

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/kern/kern_sig.c
3881–3882

We can likely drop the (void) cast here and below

3923

I dislike this repetition. It's full of magic and wonder. It's too clever by half, I think, to copy since there's a lot of subtle things going on here. Making it a static inline function seems much safer.