uaccess: fix parameters inversion for __copy_from_user_inatomic()
PATCH 1/1 uaccess: fix parameters inversion for __copy_from_user_inatomic()
From: Hiroshi Shimamoto <[email protected]>
The following patch changes to use __copy_from_user_inatomic(), but the passing parameters incorrect.
x86: some lock annotations for user copy paths, v3
- add annotation back to clear_user()
- change probe_kernel_address() to _inatomic*() method
--- include/linux/uaccess.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/uaccess.h +1 -1
@@ -78,7 +78,7 @@ static inline unsigned long __copy_from_user_nocache(void *to, \set_fs (KERNEL_DS ); \pagefault_disable (); \ - ret = __copy_from_user_inatomic((__force typeof(retval) __user *)(addr), &(retval), sizeof(retval)); \ + ret = __copy_from_user_inatomic(&(retval), (__force typeof(retval) __user *)(addr), sizeof(retval)); \pagefault_enable (); \set_fs (old_fs); \ ret; \
Signature · 1 line
1.5.6
Quoted 11 lines · Hiroshi Shimamoto
From: Hiroshi Shimamoto <[email protected]>
The following patch changes to use
__copy_from_user_inatomic(), but the passing parameters incorrect.x86: some lock annotations for user copy paths, v3
- add annotation back to
clear_user()
- changeprobe_kernel_address()to _inatomic*() methodSigned-off-by Hiroshi Shimamoto <[email protected]>
Thank you! This issue was causing a kernel panic on my machine when netfilter was enabled.
- Steven
Quoted 20 lines · Hiroshi Shimamoto
From: Hiroshi Shimamoto <[email protected]>
The following patch changes to use
__copy_from_user_inatomic(), but the passing parameters incorrect.x86: some lock annotations for user copy paths, v3
- add annotation back to
clear_user()
- changeprobe_kernel_address()to _inatomic*() methodSigned-off-by Hiroshi Shimamoto <[email protected]>--- include/linux/uaccess.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/linux/uaccess.h +0
-0
include/linux/uaccess.h static inline unsigned long __copy_from_user_nocache(void *to, · line 81
Quoted 5 lines
include/linux/uaccess.h +1
-1@@ -78,7 +78,7 @@ static inline unsigned long __copy_from_user_nocache(void *to, \set_fs (KERNEL_DS ); \pagefault_disable (); \ - ret = __copy_from_user_inatomic((__force typeof(retval) __user *)(addr), &(retval), sizeof(retval)); \ + ret = __copy_from_user_inatomic(&(retval), (__force typeof(retval) __user *)(addr), sizeof(retval)); \
*blush*. Thanks!
Ingo
Quoted 20 lines · On Mon, 15 Sep 2008 18:04:26 -0700 Hiroshi Shimamoto…
From: Hiroshi Shimamoto <[email protected]>
The following patch changes to use
__copy_from_user_inatomic(), but the passing parameters incorrect.x86: some lock annotations for user copy paths, v3
- add annotation back to
clear_user()
- changeprobe_kernel_address()to _inatomic*() methodSigned-off-by Hiroshi Shimamoto <[email protected]>--- include/linux/uaccess.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/linux/uaccess.h +0
-0
include/linux/uaccess.h static inline unsigned long __copy_from_user_nocache(void *to, · line 84
Quoted 8 lines
include/linux/uaccess.h +1
-1@@ -78,7 +78,7 @@ static inline unsigned long __copy_from_user_nocache(void *to, \set_fs (KERNEL_DS ); \pagefault_disable (); \ - ret = __copy_from_user_inatomic((__force typeof(retval) __user *)(addr), &(retval), sizeof(retval)); \ + ret = __copy_from_user_inatomic(&(retval), (__force typeof(retval) __user *)(addr), sizeof(retval)); \pagefault_enable (); \set_fs (old_fs); \ ret; \
The bug which this fixes was merged into linux-next-20080918, and manifests as squillions of messages like
[ 58.693759] SLAB: cache with size 65536 has lost its name [ 58.693926] SLAB: cache with size 65536 has lost its name [ 58.694095] SLAB: cache with size 32768 has lost its name [ 58.694261] SLAB: cache with size 32768 has lost its name [ 58.694434] SLAB: cache with size 16384 has lost its name [ 58.694606] SLAB: cache with size 16384 has lost its name [ 58.694773] SLAB: cache with size 8192 has lost its name [ 58.694940] SLAB: cache with size 8192 has lost its name [ 58.695101] SLAB: cache with size 4096 has lost its name
so this version of linux-next (which will be the most-recent version of linux-next for the next three weeks) will need this patch:
include/linux/uaccess.h renamed from include/linux/uaccess.h~uaccess-fix-parameters-inversion-for-__copy_from_user_inatomic +1 -1
@@ -78,7 +78,7 @@ static inline unsigned long __copy_from_ \set_fs (KERNEL_DS ); \pagefault_disable (); \ - ret = __copy_from_user_inatomic((__force typeof(retval) __user *)(addr), &(retval), sizeof(retval)); \ + ret = __copy_from_user_inatomic(&(retval), (__force typeof(retval) __user *)(addr), sizeof(retval)); \pagefault_enable (); \set_fs (old_fs); \ ret; \
_
Ingo Molnar
Tested-by Steven NoonanQuoted 45 lines · Andrew Morton
Quoted 20 lines · On Mon, 15 Sep 2008 18:04:26 -0700 Hiroshi Shimamoto…
From: Hiroshi Shimamoto <[email protected]>
The following patch changes to use
__copy_from_user_inatomic(), but the passing parameters incorrect.x86: some lock annotations for user copy paths, v3
- add annotation back to
clear_user()
- changeprobe_kernel_address()to _inatomic*() methodSigned-off-by Hiroshi Shimamoto <[email protected]>--- include/linux/uaccess.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/linux/uaccess.h +0
-0include/linux/uaccess.h static inline unsigned long __copy_from_user_nocache(void *to, · line 84
Quoted 8 lines
include/linux/uaccess.h +1
-1@@ -78,7 +78,7 @@ static inline unsigned long __copy_from_user_nocache(void *to, \set_fs (KERNEL_DS ); \pagefault_disable (); \ - ret = __copy_from_user_inatomic((__force typeof(retval) __user *)(addr), &(retval), sizeof(retval)); \ + ret = __copy_from_user_inatomic(&(retval), (__force typeof(retval) __user *)(addr), sizeof(retval)); \pagefault_enable (); \set_fs (old_fs); \ ret; \The bug which this fixes was merged into linux-next-20080918, and manifests as squillions of messages like
[ 58.693759] SLAB: cache with size 65536 has lost its name [ 58.693926] SLAB: cache with size 65536 has lost its name [ 58.694095] SLAB: cache with size 32768 has lost its name [ 58.694261] SLAB: cache with size 32768 has lost its name [ 58.694434] SLAB: cache with size 16384 has lost its name [ 58.694606] SLAB: cache with size 16384 has lost its name [ 58.694773] SLAB: cache with size 8192 has lost its name [ 58.694940] SLAB: cache with size 8192 has lost its name [ 58.695101] SLAB: cache with size 4096 has lost its name
Quoted 2 lines
so this version of linux-next (which will be the most-recent version of linux-next for the next three weeks) will need this patch:
that's already fixed via the commit below 4 days ago - i should have pushed it into tip/auto-core-next - did that now.
Ingo
------------------->
Quoted 1 line
From
fb71e45338453698bd7460f7e8f171ea0304d218Mon Sep 17 00:00:00 2001
From: Hiroshi Shimamoto <[email protected]>
Date: Mon, 15 Sep 2008 18:04:26 -0700
Subject: [PATCH] uaccess: fix parameters inversion for __copy_from_user_inatomic()
The following patch changes to use __copy_from_user_inatomic(), but the passing parameters incorrect:
x86: some lock annotations for user copy paths, v3
This fixes the netfilter crash reported by Steven Noonan.
--- include/linux/uaccess.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/uaccess.h +1 -1
@@ -78,7 +78,7 @@ static inline unsigned long __copy_from_user_nocache(void *to, \set_fs (KERNEL_DS ); \pagefault_disable (); \ - ret = __copy_from_user_inatomic((__force typeof(retval) __user *)(addr), &(retval), sizeof(retval)); \ + ret = __copy_from_user_inatomic(&(retval), (__force typeof(retval) __user *)(addr), sizeof(retval)); \pagefault_enable (); \set_fs (old_fs); \ ret; \