riscv: uaccess: fix __put_kernel_nofault()
PATCH 1/1 riscv: uaccess: fix __put_kernel_nofault()
The copy_from_kernel_nofault() is broken on riscv because the 'dst' and 'src' are mistakenly reversed in __put_kernel_nofault() macro.
copy_to_kernel_nofault:
...0xffffffe0003159b8 <+30>: sd a4,0(a1) # a1 aka 'src'
--- arch/riscv/include/asm/uaccess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/include/asm/uaccess.h +1 -1
@@ -476,7 +476,7 @@ do { \do { \long __kr_err; \ \ -__put_user_nocheck (*((type *)(dst)), (type *)(src), __kr_err); \ +__put_user_nocheck (*((type *)(src)), (type *)(dst), __kr_err); \if (unlikely (__kr_err)) \ goto err_label; \ }while (0 )
Signature · 1 line
2.17.1
Looks good,
Quoted 29 lines · Changbin Du
The
copy_from_kernel_nofault()is broken on riscv because the 'dst' and 'src' are mistakenly reversed in__put_kernel_nofault()macro.
copy_to_kernel_nofault:
...0xffffffe0003159b8<+30>: sd a4,0(a1) # a1 aka 'src'Fixes d464118cdc ("riscv: implement __get_kernel_nofault and __put_user_nofault")Signed-off-by Changbin Du <[email protected]>Cc Christoph Hellwig <[email protected]>--- arch/riscv/include/asm/uaccess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/include/asm/uaccess.h +1
-2@@ -476,7 +476,7 @@ do { \do { \long __kr_err; \ \ -__put_user_nocheck (*((type *)(dst)), (type *)(src), __kr_err); \ +__put_user_nocheck (*((type *)(src)), (type *)(dst), __kr_err); \if (unlikely (__kr_err)) \ goto err_label; \ }while (0 ) --
Quoted 3 lines
2.17.1
Looks good to me.
@Palmer Dabbelt , This patch fixes jump label implementation in Linux-5.10-rc2. In general, this patch fixes all kernel instruction patching related features. Can you take this for Linux-5.10-rcX ??
Regards,
Anup
Palmer Dabbelt
maintainerQuoted 19 lines · On Sun, 01 Nov 2020 23:30:52 PST (-0800), [email protected] wrote:
The
copy_from_kernel_nofault()is broken on riscv because the 'dst' and 'src' are mistakenly reversed in__put_kernel_nofault()macro.
copy_to_kernel_nofault:
...0xffffffe0003159b8<+30>: sd a4,0(a1) # a1 aka 'src'Fixes d464118cdc ("riscv: implement __get_kernel_nofault and __put_user_nofault")Signed-off-by Changbin Du <[email protected]>Cc Christoph Hellwig <[email protected]>--- arch/riscv/include/asm/uaccess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/include/asm/uaccess.h +0
-0
arch/riscv/include/asm/uaccess.h do { \ · line 482
Quoted 8 lines
arch/riscv/include/asm/uaccess.h +1
-1@@ -476,7 +476,7 @@ do { \do { \long __kr_err; \ \ -__put_user_nocheck (*((type *)(dst)), (type *)(src), __kr_err); \ +__put_user_nocheck (*((type *)(src)), (type *)(dst), __kr_err); \if (unlikely (__kr_err)) \ goto err_label; \ }while (0 )
Thanks, this is on fixes.