diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2007-01-09 04:18:50 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2007-01-09 04:18:50 -0500 |
commit | d8ad075ef60ca33f1bd8e227eed2202108fd6cd8 (patch) | |
tree | af7763b3cef733e8b98c72067aa457d74af33f5b | |
parent | de338a3795bbcb3c3d77591f65118cbec776cc39 (diff) |
[S390] don't call handle_mm_fault() if in an atomic context.
There are several places in the futex code where a spin_lock is held
and still uaccesses happen. Deadlocks are avoided by increasing the
preempt count. The pagefault handler will then not take any locks
but will immediately search the fixup tables.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/lib/uaccess_pt.c | 3 | ||||
-rw-r--r-- | arch/s390/lib/uaccess_std.c | 3 | ||||
-rw-r--r-- | include/asm-s390/futex.h | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c index 633249c3ba91..49c3e46b4065 100644 --- a/arch/s390/lib/uaccess_pt.c +++ b/arch/s390/lib/uaccess_pt.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/hardirq.h> | ||
11 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
12 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
13 | #include <asm/futex.h> | 14 | #include <asm/futex.h> |
@@ -18,6 +19,8 @@ static inline int __handle_fault(struct mm_struct *mm, unsigned long address, | |||
18 | struct vm_area_struct *vma; | 19 | struct vm_area_struct *vma; |
19 | int ret = -EFAULT; | 20 | int ret = -EFAULT; |
20 | 21 | ||
22 | if (in_atomic()) | ||
23 | return ret; | ||
21 | down_read(&mm->mmap_sem); | 24 | down_read(&mm->mmap_sem); |
22 | vma = find_vma(mm, address); | 25 | vma = find_vma(mm, address); |
23 | if (unlikely(!vma)) | 26 | if (unlikely(!vma)) |
diff --git a/arch/s390/lib/uaccess_std.c b/arch/s390/lib/uaccess_std.c index bbaca66fa293..56a0214e9928 100644 --- a/arch/s390/lib/uaccess_std.c +++ b/arch/s390/lib/uaccess_std.c | |||
@@ -258,8 +258,6 @@ int futex_atomic_op(int op, int __user *uaddr, int oparg, int *old) | |||
258 | { | 258 | { |
259 | int oldval = 0, newval, ret; | 259 | int oldval = 0, newval, ret; |
260 | 260 | ||
261 | pagefault_disable(); | ||
262 | |||
263 | switch (op) { | 261 | switch (op) { |
264 | case FUTEX_OP_SET: | 262 | case FUTEX_OP_SET: |
265 | __futex_atomic_op("lr %2,%5\n", | 263 | __futex_atomic_op("lr %2,%5\n", |
@@ -284,7 +282,6 @@ int futex_atomic_op(int op, int __user *uaddr, int oparg, int *old) | |||
284 | default: | 282 | default: |
285 | ret = -ENOSYS; | 283 | ret = -ENOSYS; |
286 | } | 284 | } |
287 | pagefault_enable(); | ||
288 | *old = oldval; | 285 | *old = oldval; |
289 | return ret; | 286 | return ret; |
290 | } | 287 | } |
diff --git a/include/asm-s390/futex.h b/include/asm-s390/futex.h index 5e261e1de671..5c5d02de49e9 100644 --- a/include/asm-s390/futex.h +++ b/include/asm-s390/futex.h | |||
@@ -4,8 +4,8 @@ | |||
4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
5 | 5 | ||
6 | #include <linux/futex.h> | 6 | #include <linux/futex.h> |
7 | #include <linux/uaccess.h> | ||
7 | #include <asm/errno.h> | 8 | #include <asm/errno.h> |
8 | #include <asm/uaccess.h> | ||
9 | 9 | ||
10 | static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | 10 | static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) |
11 | { | 11 | { |
@@ -21,7 +21,9 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
21 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) | 21 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) |
22 | return -EFAULT; | 22 | return -EFAULT; |
23 | 23 | ||
24 | pagefault_disable(); | ||
24 | ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval); | 25 | ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval); |
26 | pagefault_enable(); | ||
25 | 27 | ||
26 | if (!ret) { | 28 | if (!ret) { |
27 | switch (cmp) { | 29 | switch (cmp) { |