Patch "af_unix: split 'u->readlock' into two: 'iolock' and 'bindlock'" has been added to the 4.7-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
af_unix: split 'u->readlock' into two: 'iolock' and 'bindlock'
to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
af_unix-split-u-readlock-into-two-iolock-and-bindlock.patch
and it can be found in the queue-4.7 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Wed Sep 21 10:05:18 CEST 2016
From: Linus Torvalds <[email protected]>
Date: Thu, 1 Sep 2016 14:43:53 -0700
Subject: af_unix: split 'u->readlock' into two: 'iolock' and 'bindlock'
From: Linus Torvalds <[email protected]>
[ Upstream commit 6e1ce3c3451291142a57c4f3f6f999a29fb5b3bc ]
Right now we use the 'readlock' both for protecting some of the af_unix IO path and for making the bind be single-threaded.
The two are independent, but using the same lock makes for a nasty deadlock due to ordering with regards to filesystem locking. The bind locking would want to nest outside the VSF pathname locking, but the IO locking wants to nest inside some of those same locks.
We tried to fix this earlier with commit c845acb324aa ("af_unix: Fix splice-bind deadlock") which moved the readlock inside the vfs locks, but that caused problems with overlayfs that will then call back into filesystem routines that take the lock in the wrong order anyway.
Splitting the locks means that we can go back to having the bind lock be the outermost lock, and we don't have any deadlocks with lock ordering.
--- include/net/af_unix.h | 2 +- net/unix/af_unix.c | 45 +++++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 23 deletions(-)
include/net/af_unix.h +1 -1
@@ -52,7 +52,7 @@ struct unix_sock {struct sock sk;struct unix_address *addr;struct path path; -struct mutex readlock; +struct mutex iolock, bindlock;struct sock *peer;struct list_head link;atomic_long_t inflight;
net/unix/af_unix.c +23 -22
165 lines not on this page · raw message
Patches currently in stable-queue which might be from [email protected] are
queue-4.7/revert-af_unix-fix-splice-bind-deadlock.patch queue-4.7/af_unix-split-u-readlock-into-two-iolock-and-bindlock.patch