public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -tip] uaccess: fix parameters inversion for __copy_from_user_inatomic()
@ 2008-09-16  1:04 Hiroshi Shimamoto
  2008-09-16  1:21 ` Steven Noonan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hiroshi Shimamoto @ 2008-09-16  1:04 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel

From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

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

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
 include/linux/uaccess.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 2062293..6b58367 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -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;					\
-- 
1.5.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -tip] uaccess: fix parameters inversion for __copy_from_user_inatomic()
  2008-09-16  1:04 [PATCH -tip] uaccess: fix parameters inversion for __copy_from_user_inatomic() Hiroshi Shimamoto
@ 2008-09-16  1:21 ` Steven Noonan
  2008-09-16  5:42 ` Ingo Molnar
  2008-09-18 22:19 ` Andrew Morton
  2 siblings, 0 replies; 5+ messages in thread
From: Steven Noonan @ 2008-09-16  1:21 UTC (permalink / raw)
  To: Hiroshi Shimamoto; +Cc: Ingo Molnar, linux-kernel

On Mon, Sep 15, 2008 at 6:04 PM, Hiroshi Shimamoto
<h-shimamoto@ct.jp.nec.com> wrote:
> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>
> 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
>
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

Thank you! This issue was causing a kernel panic on my machine when
netfilter was enabled.

- Steven

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -tip] uaccess: fix parameters inversion for __copy_from_user_inatomic()
  2008-09-16  1:04 [PATCH -tip] uaccess: fix parameters inversion for __copy_from_user_inatomic() Hiroshi Shimamoto
  2008-09-16  1:21 ` Steven Noonan
@ 2008-09-16  5:42 ` Ingo Molnar
  2008-09-18 22:19 ` Andrew Morton
  2 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2008-09-16  5:42 UTC (permalink / raw)
  To: Hiroshi Shimamoto; +Cc: linux-kernel, Steven Noonan


* Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:

> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> 
> 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
> 
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> ---
>  include/linux/uaccess.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
> index 2062293..6b58367 100644
> --- a/include/linux/uaccess.h
> +++ b/include/linux/uaccess.h
> @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -tip] uaccess: fix parameters inversion for __copy_from_user_inatomic()
  2008-09-16  1:04 [PATCH -tip] uaccess: fix parameters inversion for __copy_from_user_inatomic() Hiroshi Shimamoto
  2008-09-16  1:21 ` Steven Noonan
  2008-09-16  5:42 ` Ingo Molnar
@ 2008-09-18 22:19 ` Andrew Morton
  2008-09-19  8:53   ` Ingo Molnar
  2 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2008-09-18 22:19 UTC (permalink / raw)
  To: Hiroshi Shimamoto; +Cc: mingo, linux-kernel, linux-next

On Mon, 15 Sep 2008 18:04:26 -0700
Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:

> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> 
> 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
> 
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> ---
>  include/linux/uaccess.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
> index 2062293..6b58367 100644
> --- a/include/linux/uaccess.h
> +++ b/include/linux/uaccess.h
> @@ -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:


--- a/include/linux/uaccess.h~uaccess-fix-parameters-inversion-for-__copy_from_user_inatomic
+++ a/include/linux/uaccess.h
@@ -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;					\
_


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -tip] uaccess: fix parameters inversion for __copy_from_user_inatomic()
  2008-09-18 22:19 ` Andrew Morton
@ 2008-09-19  8:53   ` Ingo Molnar
  0 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2008-09-19  8:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Hiroshi Shimamoto, linux-kernel, linux-next


* Andrew Morton <akpm@linux-foundation.org> wrote:

> On Mon, 15 Sep 2008 18:04:26 -0700
> Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:
> 
> > From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> > 
> > 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
> > 
> > Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> > ---
> >  include/linux/uaccess.h |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
> > index 2062293..6b58367 100644
> > --- a/include/linux/uaccess.h
> > +++ b/include/linux/uaccess.h
> > @@ -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:

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

------------------->
>From fb71e45338453698bd7460f7e8f171ea0304d218 Mon Sep 17 00:00:00 2001
From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
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.

Reported-by: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Tested-by: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/uaccess.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 2062293..6b58367 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -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;					\


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-09-19  8:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-16  1:04 [PATCH -tip] uaccess: fix parameters inversion for __copy_from_user_inatomic() Hiroshi Shimamoto
2008-09-16  1:21 ` Steven Noonan
2008-09-16  5:42 ` Ingo Molnar
2008-09-18 22:19 ` Andrew Morton
2008-09-19  8:53   ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox