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

fix locking pids_lock timing of do_exit #2300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ShoichiroKitano
Copy link
Contributor

@ShoichiroKitano ShoichiroKitano commented Dec 10, 2023

I have corrected the timing of locking the pids_lock in the do_exit function to be before mm_release.

The reason for this fix is that there was a potential for invalid memory access when executing processes related to /proc/{pid}, specifically when memory for the struct task member is freed during the process (this issue occurred during the execution of tmux). Additionally, there was a problem where resources locked during operations on /proc/{pid} were being released in do_exit, leading to further issues, so I addressed and fixed that as well.

@tbodt
Copy link
Member

tbodt commented Dec 13, 2023

Unfortunately this violates the lock ordering of always taking a task group lock after taking pids_lock.

@ShoichiroKitano
Copy link
Contributor Author

ShoichiroKitano commented Dec 13, 2023

@tbodt
I'm sorry. Since I can't understand the issue, could you provide a bit more information?
To the best of my understanding, in this fix, it appears that the lock on group->lock will be acquired after acquiring the lock on pids_lock.

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.

None yet

2 participants