-
Notifications
You must be signed in to change notification settings - Fork 376
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: nspid assign is not correct #3267
base: main
Are you sure you want to change the base?
Conversation
5c31503
to
0423e03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch, please put the PR description into commit changelog
FUNC_INLINE __u32 get_task_pid_vnr_curr(void) | ||
{ | ||
struct task_struct *task = (struct task_struct *)get_current_task(); | ||
return get_task_pid_vnr_by_task(task); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please put extra line after declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there needs to be empty line after declrations, so something like:
--- a/bpf/lib/bpf_task.h
+++ b/bpf/lib/bpf_task.h
@@ -98,6 +98,7 @@ FUNC_INLINE __u32 get_task_pid_vnr_by_task(struct task_struct *task)
FUNC_INLINE __u32 get_task_pid_vnr_curr(void)
{
struct task_struct *task = (struct task_struct *)get_current_task();
+
return get_task_pid_vnr_by_task(task);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done modify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, also please add the missing changelog, thanks
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Signed-off-by: arthur-zhang <[email protected]>
Description
curr->nspid
should be obtained from the childtask
arguments, not from the currenttask_struct
(the parent process).This will lead to a mismatch between
pid
andnspid
.for example. if we run in docker, we run a app which fork process every second, the pid in container will be like this
but when we get from bpf side, pid is the real host pid ,but nspid is always 1(the root parent process in container)
Changelog
Description
curr->nspid
should be obtained from the childtask
arguments, not from the currenttask_struct
(the parent process).This will lead to a mismatch between
pid
andnspid
.for example. if we run in docker, we run a app which fork process every second, the pid in container will be like this
but when we get from bpf side, pid is the real host pid ,but nspid is always 1(the root parent process in container)