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

Sending executable path for processes that have exited #278

Open
christos68k opened this issue Dec 12, 2024 · 0 comments
Open

Sending executable path for processes that have exited #278

christos68k opened this issue Dec 12, 2024 · 0 comments
Assignees

Comments

@christos68k
Copy link
Member

christos68k commented Dec 12, 2024

The solution I implemented in #253 doesn't account for a process exiting while there are still trace events for that process to be processed and reported. If that happens then the executable path retrieval logic will return the empty string and there will be no executable path attribute attached to the profile.

Some possible solutions:

  1. Retrieve executable path in the kernel and send it with the trace (same as with comm).
  2. Delay cleaning up pidToProcessInfo after a PID exit event.
  3. Cleanup pidToProcessInfo immediately on PID exit, but store pidToExecutablePath in a secondary cache. Then do secondary lookups in that cache if the primary lookup in pidToProcessInfo fails.

Note that we only care about process exit since there is no race for newly created processes: in order for userspace to receive a trace belonging to a particular PID, pidToProcessInfo has to be populated for that PID (therefore the executable path is guaranteed to exist).

Option 3. seems to be the simplest. Option 1. will probably involve walking filesystem datastructures and dealing with task_struct without BTF/CO-RE. Option 2. introduces a PID reuse concern (albeit theoretical with current trace poll interval).

If option 3. is chosen then we should probably also decouple executable path storage from pidToProcessInfo and just use a single LRU for paths e.g. pidToExecutableInfo.

@christos68k christos68k self-assigned this Dec 12, 2024
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

No branches or pull requests

1 participant