All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: Remove usercopy_warn()
@ 2022-02-07 11:05 Christophe Leroy
  2022-02-07 12:25 ` Miaohe Lin
  2022-02-08  8:16 ` Muchun Song
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe Leroy @ 2022-02-07 11:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christophe Leroy, linux-kernel, linux-mm, Stephen Kitt, Kees Cook

Users of usercopy_warn() were removed by
commit 53944f171a89 ("mm: remove HARDENED_USERCOPY_FALLBACK")

Remote it.

Cc: Stephen Kitt <steve@sk2.org>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 include/linux/uaccess.h |  2 --
 mm/usercopy.c           | 11 -----------
 2 files changed, 13 deletions(-)

diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index ac0394087f7d..bca27b4e5eb2 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -401,8 +401,6 @@ static inline void user_access_restore(unsigned long flags) { }
 #endif
 
 #ifdef CONFIG_HARDENED_USERCOPY
-void usercopy_warn(const char *name, const char *detail, bool to_user,
-		   unsigned long offset, unsigned long len);
 void __noreturn usercopy_abort(const char *name, const char *detail,
 			       bool to_user, unsigned long offset,
 			       unsigned long len);
diff --git a/mm/usercopy.c b/mm/usercopy.c
index d0d268135d96..e7b0cb49daa1 100644
--- a/mm/usercopy.c
+++ b/mm/usercopy.c
@@ -70,17 +70,6 @@ static noinline int check_stack_object(const void *obj, unsigned long len)
  * kmem_cache_create_usercopy() function to create the cache (and
  * carefully audit the whitelist range).
  */
-void usercopy_warn(const char *name, const char *detail, bool to_user,
-		   unsigned long offset, unsigned long len)
-{
-	WARN_ONCE(1, "Bad or missing usercopy whitelist? Kernel memory %s attempt detected %s %s%s%s%s (offset %lu, size %lu)!\n",
-		 to_user ? "exposure" : "overwrite",
-		 to_user ? "from" : "to",
-		 name ? : "unknown?!",
-		 detail ? " '" : "", detail ? : "", detail ? "'" : "",
-		 offset, len);
-}
-
 void __noreturn usercopy_abort(const char *name, const char *detail,
 			       bool to_user, unsigned long offset,
 			       unsigned long len)
-- 
2.33.1


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

* Re: [PATCH] mm: Remove usercopy_warn()
  2022-02-07 11:05 [PATCH] mm: Remove usercopy_warn() Christophe Leroy
@ 2022-02-07 12:25 ` Miaohe Lin
  2022-02-07 20:25   ` Stephen Kitt
  2022-02-08  8:16 ` Muchun Song
  1 sibling, 1 reply; 4+ messages in thread
From: Miaohe Lin @ 2022-02-07 12:25 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: linux-kernel, linux-mm, Stephen Kitt, Kees Cook, Andrew Morton

On 2022/2/7 19:05, Christophe Leroy wrote:
> Users of usercopy_warn() were removed by
> commit 53944f171a89 ("mm: remove HARDENED_USERCOPY_FALLBACK")
> 
> Remote it.

s/Remote/Remove/

Except the above nit, this patch looks good to me. Thanks.

Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>

> 
> Cc: Stephen Kitt <steve@sk2.org>
> Cc: Kees Cook <keescook@chromium.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>  include/linux/uaccess.h |  2 --
>  mm/usercopy.c           | 11 -----------
>  2 files changed, 13 deletions(-)
> 
> diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
> index ac0394087f7d..bca27b4e5eb2 100644
> --- a/include/linux/uaccess.h
> +++ b/include/linux/uaccess.h
> @@ -401,8 +401,6 @@ static inline void user_access_restore(unsigned long flags) { }
>  #endif
>  
>  #ifdef CONFIG_HARDENED_USERCOPY
> -void usercopy_warn(const char *name, const char *detail, bool to_user,
> -		   unsigned long offset, unsigned long len);
>  void __noreturn usercopy_abort(const char *name, const char *detail,
>  			       bool to_user, unsigned long offset,
>  			       unsigned long len);
> diff --git a/mm/usercopy.c b/mm/usercopy.c
> index d0d268135d96..e7b0cb49daa1 100644
> --- a/mm/usercopy.c
> +++ b/mm/usercopy.c
> @@ -70,17 +70,6 @@ static noinline int check_stack_object(const void *obj, unsigned long len)
>   * kmem_cache_create_usercopy() function to create the cache (and
>   * carefully audit the whitelist range).
>   */
> -void usercopy_warn(const char *name, const char *detail, bool to_user,
> -		   unsigned long offset, unsigned long len)
> -{
> -	WARN_ONCE(1, "Bad or missing usercopy whitelist? Kernel memory %s attempt detected %s %s%s%s%s (offset %lu, size %lu)!\n",
> -		 to_user ? "exposure" : "overwrite",
> -		 to_user ? "from" : "to",
> -		 name ? : "unknown?!",
> -		 detail ? " '" : "", detail ? : "", detail ? "'" : "",
> -		 offset, len);
> -}
> -
>  void __noreturn usercopy_abort(const char *name, const char *detail,
>  			       bool to_user, unsigned long offset,
>  			       unsigned long len)
> 


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

* Re: [PATCH] mm: Remove usercopy_warn()
  2022-02-07 12:25 ` Miaohe Lin
@ 2022-02-07 20:25   ` Stephen Kitt
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Kitt @ 2022-02-07 20:25 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Miaohe Lin, linux-kernel, linux-mm, Kees Cook, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 2416 bytes --]

On Mon, 7 Feb 2022 20:25:19 +0800, Miaohe Lin <linmiaohe@huawei.com> wrote:

> On 2022/2/7 19:05, Christophe Leroy wrote:
> > Users of usercopy_warn() were removed by
> > commit 53944f171a89 ("mm: remove HARDENED_USERCOPY_FALLBACK")
> > 
> > Remote it.  
> 
> s/Remote/Remove/
> 
> Except the above nit, this patch looks good to me. Thanks.
> 
> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>

Likewise,

Reviewed-by: Stephen Kitt <steve@sk2.org>


> > 
> > Cc: Stephen Kitt <steve@sk2.org>
> > Cc: Kees Cook <keescook@chromium.org>
> > Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> > ---
> >  include/linux/uaccess.h |  2 --
> >  mm/usercopy.c           | 11 -----------
> >  2 files changed, 13 deletions(-)
> > 
> > diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
> > index ac0394087f7d..bca27b4e5eb2 100644
> > --- a/include/linux/uaccess.h
> > +++ b/include/linux/uaccess.h
> > @@ -401,8 +401,6 @@ static inline void user_access_restore(unsigned long
> > flags) { } #endif
> >  
> >  #ifdef CONFIG_HARDENED_USERCOPY
> > -void usercopy_warn(const char *name, const char *detail, bool to_user,
> > -		   unsigned long offset, unsigned long len);
> >  void __noreturn usercopy_abort(const char *name, const char *detail,
> >  			       bool to_user, unsigned long offset,
> >  			       unsigned long len);
> > diff --git a/mm/usercopy.c b/mm/usercopy.c
> > index d0d268135d96..e7b0cb49daa1 100644
> > --- a/mm/usercopy.c
> > +++ b/mm/usercopy.c
> > @@ -70,17 +70,6 @@ static noinline int check_stack_object(const void
> > *obj, unsigned long len)
> >   * kmem_cache_create_usercopy() function to create the cache (and
> >   * carefully audit the whitelist range).
> >   */
> > -void usercopy_warn(const char *name, const char *detail, bool to_user,
> > -		   unsigned long offset, unsigned long len)
> > -{
> > -	WARN_ONCE(1, "Bad or missing usercopy whitelist? Kernel memory
> > %s attempt detected %s %s%s%s%s (offset %lu, size %lu)!\n",
> > -		 to_user ? "exposure" : "overwrite",
> > -		 to_user ? "from" : "to",
> > -		 name ? : "unknown?!",
> > -		 detail ? " '" : "", detail ? : "", detail ? "'" : "",
> > -		 offset, len);
> > -}
> > -
> >  void __noreturn usercopy_abort(const char *name, const char *detail,
> >  			       bool to_user, unsigned long offset,
> >  			       unsigned long len)
> >   
> 

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] mm: Remove usercopy_warn()
  2022-02-07 11:05 [PATCH] mm: Remove usercopy_warn() Christophe Leroy
  2022-02-07 12:25 ` Miaohe Lin
@ 2022-02-08  8:16 ` Muchun Song
  1 sibling, 0 replies; 4+ messages in thread
From: Muchun Song @ 2022-02-08  8:16 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Andrew Morton, LKML, Linux Memory Management List, Stephen Kitt,
	Kees Cook

On Mon, Feb 7, 2022 at 7:16 PM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
> Users of usercopy_warn() were removed by
> commit 53944f171a89 ("mm: remove HARDENED_USERCOPY_FALLBACK")
>
> Remote it.
>
> Cc: Stephen Kitt <steve@sk2.org>
> Cc: Kees Cook <keescook@chromium.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.

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

end of thread, other threads:[~2022-02-08  8:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07 11:05 [PATCH] mm: Remove usercopy_warn() Christophe Leroy
2022-02-07 12:25 ` Miaohe Lin
2022-02-07 20:25   ` Stephen Kitt
2022-02-08  8:16 ` Muchun Song

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.