diff mbox series

mm: Remove usercopy_warn()

Message ID 5f26643fc70b05f8455b60b99c30c17d635fa640.1644231910.git.christophe.leroy@csgroup.eu (mailing list archive)
State New
Headers show
Series mm: Remove usercopy_warn() | expand

Commit Message

Christophe Leroy Feb. 7, 2022, 11:05 a.m. UTC
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(-)

Comments

Miaohe Lin Feb. 7, 2022, 12:25 p.m. UTC | #1
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)
>
Stephen Kitt Feb. 7, 2022, 8:25 p.m. UTC | #2
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)
> >   
>
Muchun Song Feb. 8, 2022, 8:16 a.m. UTC | #3
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.
diff mbox series

Patch

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)