Skip to content

Commit 454e312

Browse files
bernd-edlingerebiederm
authored andcommitted
kernel/kcmp.c: Use new infrastructure to fix deadlocks in execve
This changes kcmp_epoll_target to use the new exec_update_mutex instead of cred_guard_mutex. This should be safe, as the credentials are only used for reading, and furthermore ->mm and ->sighand are updated on execve, but only under the new exec_update_mutex. Signed-off-by: Bernd Edlinger <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
1 parent aa884c1 commit 454e312

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kernel/kcmp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ SYSCALL_DEFINE5(kcmp, pid_t, pid1, pid_t, pid2, int, type,
173173
/*
174174
* One should have enough rights to inspect task details.
175175
*/
176-
ret = kcmp_lock(&task1->signal->cred_guard_mutex,
177-
&task2->signal->cred_guard_mutex);
176+
ret = kcmp_lock(&task1->signal->exec_update_mutex,
177+
&task2->signal->exec_update_mutex);
178178
if (ret)
179179
goto err;
180180
if (!ptrace_may_access(task1, PTRACE_MODE_READ_REALCREDS) ||
@@ -229,8 +229,8 @@ SYSCALL_DEFINE5(kcmp, pid_t, pid1, pid_t, pid2, int, type,
229229
}
230230

231231
err_unlock:
232-
kcmp_unlock(&task1->signal->cred_guard_mutex,
233-
&task2->signal->cred_guard_mutex);
232+
kcmp_unlock(&task1->signal->exec_update_mutex,
233+
&task2->signal->exec_update_mutex);
234234
err:
235235
put_task_struct(task1);
236236
put_task_struct(task2);

0 commit comments

Comments
 (0)