Skip to content

Commit 05d9d0b

Browse files
Vineet GuptaAl Viro
authored andcommitted
ARC: uaccess: get_user to zero out dest in cause of fault
Al reported potential issue with ARC get_user() as it wasn't clearing out destination pointer in case of fault due to bad address etc. Verified using following | { | u32 bogus1 = 0xdeadbeef; | u64 bogus2 = 0xdead; | int rc1, rc2; | | pr_info("Orig values %x %llx\n", bogus1, bogus2); | rc1 = get_user(bogus1, (u32 __user *)0x40000000); | rc2 = get_user(bogus2, (u64 __user *)0x50000000); | pr_info("access %d %d, new values %x %llx\n", | rc1, rc2, bogus1, bogus2); | } | [ARCLinux]# insmod /mnt/kernel-module/qtn.ko | Orig values deadbeef dead | access -14 -14, new values 0 0 Reported-by: Al Viro <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Vineet Gupta <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 8ae95ed commit 05d9d0b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

arch/arc/include/asm/uaccess.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@
8383
"2: ;nop\n" \
8484
" .section .fixup, \"ax\"\n" \
8585
" .align 4\n" \
86-
"3: mov %0, %3\n" \
86+
"3: # return -EFAULT\n" \
87+
" mov %0, %3\n" \
88+
" # zero out dst ptr\n" \
89+
" mov %1, 0\n" \
8790
" j 2b\n" \
8891
" .previous\n" \
8992
" .section __ex_table, \"a\"\n" \
@@ -101,7 +104,11 @@
101104
"2: ;nop\n" \
102105
" .section .fixup, \"ax\"\n" \
103106
" .align 4\n" \
104-
"3: mov %0, %3\n" \
107+
"3: # return -EFAULT\n" \
108+
" mov %0, %3\n" \
109+
" # zero out dst ptr\n" \
110+
" mov %1, 0\n" \
111+
" mov %R1, 0\n" \
105112
" j 2b\n" \
106113
" .previous\n" \
107114
" .section __ex_table, \"a\"\n" \

0 commit comments

Comments
 (0)