https://github.com/torvalds/linux
Revision 3ed1f8a99d70ea1cd1508910eb107d0edcae5009 authored by Manfred Spraul on 14 August 2015, 22:35:10 UTC, committed by Linus Torvalds on 14 August 2015, 22:56:32 UTC
sem_lock() did not properly pair memory barriers:

!spin_is_locked() and spin_unlock_wait() are both only control barriers.
The code needs an acquire barrier, otherwise the cpu might perform read
operations before the lock test.

As no primitive exists inside <include/spinlock.h> and since it seems
noone wants another primitive, the code creates a local primitive within
ipc/sem.c.

With regards to -stable:

The change of sem_wait_array() is a bugfix, the change to sem_lock() is a
nop (just a preprocessor redefinition to improve the readability).  The
bugfix is necessary for all kernels that use sem_wait_array() (i.e.:
starting from 3.10).

Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Reported-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Kirill Tkhai <ktkhai@parallels.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: <stable@vger.kernel.org>	[3.10+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7f6bf39
History
Tip revision: 3ed1f8a99d70ea1cd1508910eb107d0edcae5009 authored by Manfred Spraul on 14 August 2015, 22:35:10 UTC
ipc/sem.c: update/correct memory barriers
Tip revision: 3ed1f8a
File Mode Size
mpu401
opl3
opl4
pcsp
vx
Kconfig -rw-r--r-- 6.8 KB
Makefile -rw-r--r-- 788 bytes
aloop.c -rw-r--r-- 35.4 KB
dummy.c -rw-r--r-- 32.0 KB
ml403-ac97cr.c -rw-r--r-- 39.6 KB
mtpav.c -rw-r--r-- 19.8 KB
mts64.c -rw-r--r-- 26.3 KB
pcm-indirect2.c -rw-r--r-- 16.8 KB
pcm-indirect2.h -rw-r--r-- 5.1 KB
portman2x4.c -rw-r--r-- 25.2 KB
serial-u16550.c -rw-r--r-- 30.7 KB
virmidi.c -rw-r--r-- 5.5 KB

back to top