[PATCH 0/3] exec: Transform exec_update_mutex into a rw_semaphore

Eric W. Biederman
2020-12-03T20:11:03Z

Recently syzbot reported[0] that there is a deadlock amongst the users
of exec_update_mutex.

The simplest and most robust solution appears to be making
exec_update_mutex a read/write lock and having everything execept for
exec take the lock for read.

This set of changes upgrades rwsem so it has the functionality needed
and uses a rw_semaphore to replace the current mutex.

Eric W. Biederman (3):
rwsem: Implement down_read_killable_nested
rwsem: Implement down_read_interruptible
exec: Transform exec_update_mutex into a rw_semaphore

fs/exec.c | 12 ++++++------
fs/proc/base.c | 10 +++++-----
include/linux/rwsem.h | 3 +++
include/linux/sched/signal.h | 11 ++++++-----
init/init_task.c | 2 +-
kernel/events/core.c | 12 ++++++------
kernel/fork.c | 6 +++---
kernel/kcmp.c | 30 +++++++++++++++---------------
kernel/locking/rwsem.c | 40 ++++++++++++++++++++++++++++++++++++++++
kernel/pid.c | 4 ++--
10 files changed, 87 insertions(+), 43 deletions(-)

[0] https://lkml.kernel.org/r/00000000000063640c05ade8e3de@google.com

Eric