Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tetragon: another exit fix #1802

Merged
merged 2 commits into from
Nov 28, 2023
Merged

tetragon: another exit fix #1802

merged 2 commits into from
Nov 28, 2023

Conversation

olsajiri
Copy link
Contributor

backport of #1509

[upstream commit 0c60ef2]

Djalal and Anastasios found another way we could race in exit
event hook, so we could receive multiple exit events with same
pid value.

Anastasios suggested to hook acct_process instead, which is
called only for the last task in the thread group.

The acct_process depends on CONFIG_BSD_PROCESS_ACCT config
option but it seems to be present on all supported kernels.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
[upstream commit 9a8f892]

The previous commit fixes the exit event race that might cause
tetragon to receive multiple exit events with same pid values.

The contrib/tester-progs/threads-exit program tries to exploit
this by creating multi threads and synchronize all their exit
calls so it's likely to hit the race window.

The TestEventExitThreads test itself spawn several executions of
threads-exit program (to push the luck a bit and hit the race
window at least once) and records their pid values and then check
we receive single exit event for any given pid value.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
@kkourt kkourt marked this pull request as ready for review November 28, 2023 06:31
@kkourt kkourt requested a review from a team as a code owner November 28, 2023 06:31
@kkourt kkourt requested review from kevsecurity and removed request for a team November 28, 2023 06:31
@kkourt kkourt added the kind/backport This PR provides functionality previously merged into master. label Nov 28, 2023
@kkourt kkourt merged commit e263eaf into v0.10 Nov 28, 2023
17 checks passed
@kkourt kkourt deleted the pr/olsajiri/another_exit_fix_0_10 branch November 28, 2023 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/backport This PR provides functionality previously merged into master.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants