Skip to content

Use _exit in forked children after exec failure#538

Merged
stevegrubb merged 1 commit into
linux-audit:masterfrom
sergio-correia:exit
Jul 17, 2026
Merged

Use _exit in forked children after exec failure#538
stevegrubb merged 1 commit into
linux-audit:masterfrom
sergio-correia:exit

Conversation

@sergio-correia

@sergio-correia sergio-correia commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Forked children that called exit() after a failed execve() would run the parent's atexit handlers. In auditd the clean_exit() handler calls audit_set_pid(fd, 0), which deregisters the daemon from the kernel, and unlinks the PID file. When the real parent keeps running it silently stops receiving audit events.

The same class of problem was fixed for the sendmail helper in 7965bc1 ("Use _exit after sendmail exec failure"). Apply the identical fix to every remaining site:

  • common/common.c change_runlevel() child
  • audisp/plugins/ids/reactions.c safe_exec() child
  • audisp/plugins/remote/audisp-remote.c safe_exec() child
  • audisp/plugins/filter/audisp-filter.c execve() child

@sergio-correia
sergio-correia marked this pull request as draft July 15, 2026 20:39
@sergio-correia
sergio-correia marked this pull request as ready for review July 15, 2026 20:50
@stevegrubb

Copy link
Copy Markdown
Contributor

The filter plugin needs the same treatment. Otherwise looks good.

Forked children that called exit() after a failed execve() would
run the parent's atexit handlers.  In auditd the clean_exit()
handler calls audit_set_pid(fd, 0), which deregisters the daemon
from the kernel, and unlinks the PID file.  When the real parent
keeps running it silently stops receiving audit events.

The same class of problem was fixed for the sendmail helper in
7965bc1 ("Use _exit after sendmail exec failure") and for the
dispatcher in 7ee8c56.  Apply the identical fix to every
remaining site:

  - common/common.c       change_runlevel() child
  - audisp/plugins/ids/reactions.c  safe_exec() child
  - audisp/plugins/remote/audisp-remote.c  safe_exec() child
  - audisp/plugins/filter/audisp-filter.c  execve() child

Assisted-by: Claude Opus 4.6
Signed-off-by: Sergio Correia <scorreia@redhat.com>
@sergio-correia

Copy link
Copy Markdown
Contributor Author

The filter plugin needs the same treatment. Otherwise looks good.

Updated, thanks for the review.

@stevegrubb

Copy link
Copy Markdown
Contributor

Thanks!

@stevegrubb
stevegrubb merged commit 14fe8ba into linux-audit:master Jul 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants