Skip to content

Commit

Permalink
proc: io_accounting: Use new infrastructure to fix deadlocks in execve
Browse files Browse the repository at this point in the history
This changes do_io_accounting to use the new exec_update_mutex
instead of cred_guard_mutex.

This fixes possible deadlocks when the trace is accessing
/proc/$pid/io for instance.

This should be safe, as the credentials are only used for reading.

Signed-off-by: Bernd Edlinger <[email protected]>
Signed-off-by: Eric W. Biederman <[email protected]>
  • Loading branch information
bernd-edlinger authored and ebiederm committed Mar 25, 2020
1 parent 2db9dbf commit 76518d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2883,7 +2883,7 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh
unsigned long flags;
int result;

result = mutex_lock_killable(&task->signal->cred_guard_mutex);
result = mutex_lock_killable(&task->signal->exec_update_mutex);
if (result)
return result;

Expand Down Expand Up @@ -2919,7 +2919,7 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh
result = 0;

out_unlock:
mutex_unlock(&task->signal->cred_guard_mutex);
mutex_unlock(&task->signal->exec_update_mutex);
return result;
}

Expand Down

0 comments on commit 76518d3

Please sign in to comment.