Bug 292739 - pdrfork leaves no audit trail
Summary: pdrfork leaves no audit trail
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 16.0-CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Alan Somers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-26 17:50 UTC by Alan Somers
Modified: 2026-05-07 20:50 UTC (History)
3 users (show)

See Also:
asomers: mfc-stable15+
asomers: mfc-stable14?


Attachments
Add ATF tests for auditability of procdesc-related syscalls (7.14 KB, patch)
2026-01-26 17:51 UTC, Alan Somers
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer freebsd_triage 2026-01-26 17:50:39 UTC
The new pdrfork syscall leaves no audit trail, as far as I can tell.  Other related functions, like pdfork and pdwait, do.

Steps to Reproduce
==================
1) Build and install the attached patch
2) cd /usr/tests/sys/audit
3) sudo kyua debug process-control:pdrfork_succes

Looking for 'pdrfork.*0.*return,success' in 'header,77,11,exit(2),0,Mon Jan 26 17:50:14 2026, + 406 msec,exit,Error 0,0,subject,-1,root,wheel,root,wheel,59764,0,0,0.0.0.0,return,success,0,trailer,77,'
Looking for 'pdrfork.*0.*return,success' in 'header,68,11,thr_exit(2),0,Mon Jan 26 17:50:14 2026, + 651 msec,subject,-1,somers,somers,somers,somers,52024,0,0,0.0.0.0,return,success,0,trailer,68,'
Looking for 'pdrfork.*0.*return,success' in 'header,68,11,thr_exit(2),0,Mon Jan 26 17:50:14 2026, + 879 msec,subject,-1,somers,somers,somers,somers,52024,0,0,0.0.0.0,return,success,0,trailer,68,'
auditd(8) is running.
process-control:pdrfork_success  ->  failed: pdrfork.*0.*return,success not found in auditpipe within the time limit
Comment 1 Alan Somers freebsd_committer freebsd_triage 2026-01-26 17:51:28 UTC
Created attachment 267516 [details]
Add ATF tests for auditability of procdesc-related syscalls
Comment 2 Alan Somers freebsd_committer freebsd_triage 2026-01-26 17:51:52 UTC
CC kib, who created pdrfork.
Comment 3 Konstantin Belousov freebsd_committer freebsd_triage 2026-01-26 18:28:23 UTC
Did you checked what actual events are read from the audit pipe?
I have no idea how to monitor it.

I want to know if the issue occurs in kernel, as in not creating the records at all,
vs. something in userland not understanding the reported records, might be because
something is not correct in the content.
Comment 4 Alan Somers freebsd_committer freebsd_triage 2026-01-26 18:44:49 UTC
I think the problem might be a missing definition in contrib/openbsm/etc/audit_event .  If that's true, then auditing pdwait() only works by coincidence, since a pdwait() entry was created way back in 2012, in git rev c5119f5dec6ac1aac7c290cbe194ca9d2cadad99 .  I'm testing this theory now.
Comment 5 Konstantin Belousov freebsd_committer freebsd_triage 2026-01-26 19:32:30 UTC
(In reply to Alan Somers from comment #4)
But tests open the audit_pipe directly, there is no openbsm involvement?
I might mis-read the code, though.
Comment 6 commit-hook freebsd_committer freebsd_triage 2026-01-26 21:04:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6253212608b4f513b1e298f11a630d9d0596560d

commit 6253212608b4f513b1e298f11a630d9d0596560d
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2026-01-26 19:10:50 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2026-01-26 21:03:47 +0000

    Add pdrfork to OpenBSM

    It's necessary for auditd to be able to log its events.  Note that the
    recently added pdwait() syscall is only auditable because an audit event
    of that name was preemptively added back in 2012.

    PR:             292739
    MFC after:      1 week
    Fixes:          5c2ee618d5e "sys: add pdrfork(2)"
    Sponsored by:   ConnectWise
    Reviewed by:    kib
    Differential Revision: https://reviews.freebsd.org/D54897

 contrib/openbsm/etc/audit_event         | 1 +
 contrib/openbsm/sys/bsm/audit_kevents.h | 1 +
 2 files changed, 2 insertions(+)
Comment 7 commit-hook freebsd_committer freebsd_triage 2026-02-01 21:42:11 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=4aead2abdae203ce2da455ca831a44f8b323ca60

commit 4aead2abdae203ce2da455ca831a44f8b323ca60
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2026-01-26 19:10:50 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-02-01 21:38:50 +0000

    Add pdrfork to OpenBSM

    PR:             292739

    (cherry picked from commit 6253212608b4f513b1e298f11a630d9d0596560d)

 contrib/openbsm/etc/audit_event         | 1 +
 contrib/openbsm/sys/bsm/audit_kevents.h | 1 +
 2 files changed, 2 insertions(+)
Comment 8 Alan Somers freebsd_committer freebsd_triage 2026-05-07 20:50:02 UTC
Merged to stable/15 in 4aead2abdae203ce2da455ca831a44f8b323ca60