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

get the pid namespace by following task_active_pid_ns() #3647

Merged
merged 1 commit into from
Oct 20, 2021

Conversation

ChengyuanLiCY
Copy link
Contributor

@ChengyuanLiCY ChengyuanLiCY commented Oct 7, 2021

When unsharing of pid namespace, though nsproxy->pid_ns_for_children is
new, the process is still in the orignal pid namespace, only the forked
children processes will be in the new pid namespace.
So it's not correct to get process's pid namespace by nsproxy->pid_ns_for_children,
should get pid namespace by task_active_pid_ns() way, i.e.
pid->numbers[pid->level].ns

When unsharing of pid namespace, though nsproxy->pid_ns_for_children is
new, the process is still in the orignal pid namespace, only the forked
children processes will be in the new pid namespace.
So it's not correct to get process's pid namespace by nsproxy->pid_ns_for_children,
should get pid namespace by task_active_pid_ns() way, i.e.
pid->numbers[pid->level].ns

Signed-off-by: Li Chengyuan chengyuanli@hotmail.com
@yonghong-song
Copy link
Collaborator

[buildbot, test this please]

@yonghong-song
Copy link
Collaborator

@ChengyuanLiCY Thanks for the patch, I think you are correct. But let me dig into the kernel source a little bit and tried a couple of experiments to ensure it is correct. The original tool's result should mostly be correct too and most unsharing probably happened at bash level, which won't incur a lot of scheduling events. BTW, bcc python tools have the same issue.

@ChengyuanLiCY
Copy link
Contributor Author

ChengyuanLiCY commented Oct 20, 2021

@yonghong-song Thanks for your effort to dive into the details!

BTW, bcc python tools have the same issue.

I'll try to fix bcc python tool after this PR is approved.

@yonghong-song yonghong-song merged commit bced75a into iovisor:master Oct 20, 2021
@yonghong-song
Copy link
Collaborator

@ChengyuanLiCY I merged the patch. Please submit a pull request for python tool runqlat.py. thanks!

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

Successfully merging this pull request may close these issues.

2 participants