Skip to contentSkip to conversation

sh: uaccess: Handle exception on second instruction of __put_user_u64

PATCH New Ben Hutchings 1 participant 1 message May 6 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: uaccess: Handle exception on second instruction of __put_user_u64

Each entry in the exception table only covers a single instruction, but there are 2 instructions that could fault in __put_user_u64.

__get_user_u64 never had this bug.

---
I noticed and meant to fix this bug in 2019, but then the patch lingered in a git branch since then. Today I found and rewrote it to match the way Adrian did the exception table for __get_user_u64. I have not tested this version at all, though.

Ben.

 arch/sh/include/asm/uaccess_32.h | 2 ++
 1 file changed, 2 insertions(+)
arch/sh/include/asm/uaccess_32.h +2 -0
index 5d7ddc092afd..26096258e43b 100644
@@ -194,6 +194,7 @@ __asm__ __volatile__( \
 	".previous\n" \
 	".section	__ex_table,\"a\"\n\t" \
 	".long	1b, 3b\n\t" \
+	".long	1b + 2, 3b\n\t" \
 	".previous" \
 	: "=r" (retval) \
 	: "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
@@ -216,6 +217,7 @@ __asm__ __volatile__( \
 	".previous\n" \
 	".section	__ex_table,\"a\"\n\t" \
 	".long	1b, 3b\n\t" \
+	".long	1b + 2, 3b\n\t" \
 	".previous" \
 	: "=r" (retval) \
 	: "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \