cilium / tetragon

eBPF-based Security Observability and Runtime Enforcement
https://tetragon.io
Apache License 2.0
3.67k stars 370 forks source link

fix(fork-test.c) Call MANAGERPID from env var when systemd run with `--user` flag #3149

Open ScriptSathi opened 5 days ago

ScriptSathi commented 5 days ago

Fix https://github.com/cilium/tetragon/issues/3148

Description

A nil pointer is returned by ctx.Err() because ctx 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

ScriptSathi commented 4 days ago

@kkourt, here is the fix working for me on Archlinux.

I manage to get the output of make test by now.

fork_test.go:62: failed to parse child2 PID

Thank you for your help on this :100:

netlify[bot] commented 3 days ago

Deploy Preview for tetragon ready!

Name Link
Latest commit 96abbdcd737707f0f9fbebf41331c863a642db5f
Latest deploy log https://app.netlify.com/sites/tetragon/deploys/6741e600f67d7c0007eb3187
Deploy Preview https://deploy-preview-3149--tetragon.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.