-
Notifications
You must be signed in to change notification settings - Fork 370
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
fix(fork-test.c) Call MANAGERPID from env var when systemd run with --user
flag
#3149
Open
ScriptSathi
wants to merge
2
commits into
cilium:main
Choose a base branch
from
ScriptSathi:pr/ScriptSathi/fix-fork_test-return-nil-on-error
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix(fork-test.c) Call MANAGERPID from env var when systemd run with --user
flag
#3149
ScriptSathi
wants to merge
2
commits into
cilium:main
from
ScriptSathi:pr/ScriptSathi/fix-fork_test-return-nil-on-error
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ScriptSathi
force-pushed
the
pr/ScriptSathi/fix-fork_test-return-nil-on-error
branch
2 times, most recently
from
November 21, 2024 16:15
8e71878
to
d245eec
Compare
@kkourt, here is the fix working for me on Archlinux. I manage to get the output of
Thank you for your help on this 💯 |
ScriptSathi
force-pushed
the
pr/ScriptSathi/fix-fork_test-return-nil-on-error
branch
from
November 21, 2024 16:37
d245eec
to
109719d
Compare
ScriptSathi
changed the title
[fork_test.go:55] Remove ctx.Err() to avoid waiting ctx to be done
[fork-test.c] Call MANAGERPID from env var when systemd run with Nov 21, 2024
--user
flag
ScriptSathi
changed the title
[fork-test.c] Call MANAGERPID from env var when systemd run with
fix(fork-test.c) Call MANAGERPID from env var when systemd run with Nov 21, 2024
--user
flag--user
flag
kkourt
requested changes
Nov 21, 2024
mtardy
added
the
release-note/misc
This PR makes changes that have no direct user impact.
label
Nov 21, 2024
ScriptSathi
force-pushed
the
pr/ScriptSathi/fix-fork_test-return-nil-on-error
branch
from
November 21, 2024 20:41
109719d
to
ad77730
Compare
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
ScriptSathi
force-pushed
the
pr/ScriptSathi/fix-fork_test-return-nil-on-error
branch
from
November 21, 2024 20:58
ad77730
to
6c0b4b3
Compare
kkourt
reviewed
Nov 22, 2024
ScriptSathi
force-pushed
the
pr/ScriptSathi/fix-fork_test-return-nil-on-error
branch
2 times, most recently
from
November 22, 2024 11:59
f154425
to
987c58e
Compare
…ppid The initial goal of fork-tester.c is to test that subchild (child2) find systemd pid has new parent with hardcoded pid 1. But we can produce the same behaviour by controlling the new parent of a subchild process when his parent dies by using `PR_SET_CHILD_SUBREAPER`. The main process register as reaper, which means that any childrens and childrens of childrens will have this main process as parent when their closest parent dies. So here with have main process as reaper, child1 creates a subchild (child2) then dies. But child2 is no more orphan with systemd as parent, main process catch it. This add more control over the process tree and should work for any cases. Signed-off-by: Tristan d'Audibert <[email protected]>
This update comes after updating the `fork-tester.c`. The parent inherent grand children child 2 when child 1 dies. In order to ensure that this specific behaviour occurs, we need to compare parent PID with new parent PID of child 2 which is suppose to be parent PID instead of child PID. Signed-off-by: Tristan d'Audibert <[email protected]>
ScriptSathi
force-pushed
the
pr/ScriptSathi/fix-fork_test-return-nil-on-error
branch
from
November 23, 2024 14:26
987c58e
to
96abbdc
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #3148
Description
A nil pointer is returned by
ctx.Err()
becausectx
is not done when the error is displayed.More details
On some distributions, like Archlinux, systemd run with the flag
--user
. Thus, makes the user manager process a child of systemd process 1. So when you search for PPID, it will always be this child process.According to the documentation below, systemd expose an environnement variable to help finding this children. So if we compare the value of this environment variable with the ppid, we should get the same result as doing
ppid == 1
https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#%24MANAGERPID