[patch 1/9] s390: kernel faults.
From: Martin Schwidefsky <[email protected]>
Correct check for user space faults. If the failing address space is in
the secondary address space and uaccess has been switched to KERNEL_DS
with set_fs, check_user_space() erroneously returns 1.
Signed-off-by: Martin Schwidefsky <[email protected]>
diffstat:
arch/s390/mm/fault.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff -urpN linux-2.6/arch/s390/mm/fault.c linux-2.6-patched/arch/s390/mm/fault.c
--- linux-2.6/arch/s390/mm/fault.c 2005-03-02 08:38:38.000000000 +0100
+++ linux-2.6-patched/arch/s390/mm/fault.c 2005-03-24 14:02:59.000000000 +0100
@@ -87,6 +87,7 @@ static int __check_access_register(struc
if (areg == 0)
/* Access via access register 0 -> kernel address */
return 0;
+ save_access_regs(current->thread.acrs);
if (regs && areg < NUM_ACRS && current->thread.acrs[areg] <= 1)
/*
* access register contains 0 -> kernel address,
@@ -115,11 +116,11 @@ static inline int check_user_space(struc
* 3: Home Segment Table Descriptor
*/
int descriptor = S390_lowcore.trans_exc_code & 3;
- if (descriptor == 1) {
- save_access_regs(current->thread.acrs);
+ if (unlikely(descriptor == 1))
return __check_access_register(regs, error_code);
- }
- return descriptor >> 1;
+ if (descriptor == 2)
+ return current->thread.mm_segment.ar4;
+ return descriptor != 0;
}
/*