lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sun, 13 Feb 2022 02:46:16 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Christophe Leroy' <christophe.leroy@...roup.eu>,
        Andrew Morton <akpm@...ux-foundation.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>
Subject: RE: [PATCH v2] mm: Uninline copy_overflow()

From: Christophe Leroy
> Sent: 11 February 2022 10:16
...
> copy_overflow() is a non conditional warning called by
> check_copy_size() on an error path.
> 
> check_copy_size() have to remain inlined in order to benefit
> from constant folding, but copy_overflow() is not worth inlining.
> 
> Uninline it.
> 
> This reduces the size of vmlinux by almost 4kbytes.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
> ---
> v2: Added missing EXPORT_SYMBOL() and enhanced commit message
> ---
>  include/linux/thread_info.h | 5 +----
>  mm/maccess.c                | 6 ++++++
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
> index 73a6f34b3847..1087d1e2be5c 100644
> --- a/include/linux/thread_info.h
> +++ b/include/linux/thread_info.h
> @@ -209,10 +209,7 @@ __bad_copy_from(void);
>  extern void __compiletime_error("copy destination size is too small")
>  __bad_copy_to(void);
> 
> -static inline void copy_overflow(int size, unsigned long count)
> -{
> -	WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
> -}
> +void copy_overflow(int size, unsigned long count);
> 
>  static __always_inline __must_check bool
>  check_copy_size(const void *addr, size_t bytes, bool is_source)
> diff --git a/mm/maccess.c b/mm/maccess.c
> index d3f1a1f0b1c1..6b11a22f4b01 100644
> --- a/mm/maccess.c
> +++ b/mm/maccess.c
> @@ -335,3 +335,9 @@ long strnlen_user_nofault(const void __user *unsafe_addr, long count)
> 
>  	return ret;
>  }
> +
> +void copy_overflow(int size, unsigned long count)
> +{
> +	WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
> +}
> +EXPORT_SYMBOL_GPL(copy_overflow)

Can you remove the _GPL ????

I think that basically stops you compiling any non-gpl code if the
copy_protection is enabled in the kernel build.
I'm guessing that most of the inline wrappers calling this are non-FPL
functions.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ