RE: [PATCH v2] mm: Uninline copy_overflow()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
> 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)






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux