diff options
author | Kyle McMartin <kyle@shortfin.cabal.ca> | 2008-03-01 13:25:52 -0500 |
---|---|---|
committer | Kyle McMartin <kyle@shortfin.cabal.ca> | 2008-03-15 22:12:17 -0400 |
commit | c20a84c91048c76c1379011c96b1a5cee5c7d9a0 (patch) | |
tree | ffc1f1795b9e156ce54f3f9d8915730d1c60635a /include/asm-parisc | |
parent | dc39455e7948ec9bc5f3f2dced5c2f5ac8a8dfd9 (diff) |
[PARISC] futex: special case cmpxchg NULL in kernel space
Commit a0c1e9073ef7428a14309cba010633a6cd6719ea added code to futex.c
to detect whether futex_atomic_cmpxchg_inatomic was implemented at run
time:
+ curval = cmpxchg_futex_value_locked(NULL, 0, 0);
+ if (curval == -EFAULT)
+ futex_cmpxchg_enabled = 1;
This is bogus on parisc, since page zero in kernel virtual space is the
gateway page for syscall entry, and should not be read from the kernel.
(That, and we really don't like the kernel faulting on its own address
space...)
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
Diffstat (limited to 'include/asm-parisc')
-rw-r--r-- | include/asm-parisc/futex.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/asm-parisc/futex.h b/include/asm-parisc/futex.h index dbee6e60aa81..fdc6d055ef7f 100644 --- a/include/asm-parisc/futex.h +++ b/include/asm-parisc/futex.h | |||
@@ -56,6 +56,12 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | |||
56 | int err = 0; | 56 | int err = 0; |
57 | int uval; | 57 | int uval; |
58 | 58 | ||
59 | /* futex.c wants to do a cmpxchg_inatomic on kernel NULL, which is | ||
60 | * our gateway page, and causes no end of trouble... | ||
61 | */ | ||
62 | if (segment_eq(KERNEL_DS, get_fs()) && !uaddr) | ||
63 | return -EFAULT; | ||
64 | |||
59 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) | 65 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) |
60 | return -EFAULT; | 66 | return -EFAULT; |
61 | 67 | ||
@@ -67,5 +73,5 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | |||
67 | return uval; | 73 | return uval; |
68 | } | 74 | } |
69 | 75 | ||
70 | #endif | 76 | #endif /*__KERNEL__*/ |
71 | #endif | 77 | #endif /*_ASM_PARISC_FUTEX_H*/ |