48 lines
1.4 KiB
Diff
48 lines
1.4 KiB
Diff
From 0b23a271be007ed8bed48ce446ed0ba53ef6022b Mon Sep 17 00:00:00 2001
|
|
From: David Hildenbrand <dahi@linux.vnet.ibm.com>
|
|
Date: Mon, 11 May 2015 17:52:13 +0200
|
|
Subject: [PATCH 08/14] futex: UP futex_atomic_op_inuser() relies on disabled
|
|
preemption
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.0/patches-4.0.5-rt3.tar.xz
|
|
|
|
Let's explicitly disable/enable preemption in the !CONFIG_SMP version
|
|
of futex_atomic_op_inuser, to prepare for pagefault_disable() not
|
|
touching preemption anymore.
|
|
|
|
Otherwise we might break mutual exclusion when relying on a get_user()/
|
|
put_user() implementation.
|
|
|
|
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
|
|
---
|
|
include/asm-generic/futex.h | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
--- a/include/asm-generic/futex.h
|
|
+++ b/include/asm-generic/futex.h
|
|
@@ -8,8 +8,7 @@
|
|
#ifndef CONFIG_SMP
|
|
/*
|
|
* The following implementation only for uniprocessor machines.
|
|
- * For UP, it's relies on the fact that pagefault_disable() also disables
|
|
- * preemption to ensure mutual exclusion.
|
|
+ * It relies on preempt_disable() ensuring mutual exclusion.
|
|
*
|
|
*/
|
|
|
|
@@ -38,6 +37,7 @@ futex_atomic_op_inuser(int encoded_op, u
|
|
if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
|
|
oparg = 1 << oparg;
|
|
|
|
+ preempt_disable();
|
|
pagefault_disable();
|
|
|
|
ret = -EFAULT;
|
|
@@ -72,6 +72,7 @@ futex_atomic_op_inuser(int encoded_op, u
|
|
|
|
out_pagefault_enable:
|
|
pagefault_enable();
|
|
+ preempt_enable();
|
|
|
|
if (ret == 0) {
|
|
switch (cmp) {
|