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] [thread-next>] [day] [month] [year] [list]
Date: Thu, 04 Jan 2024 21:43:56 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Leonardo Bras" <leobras@...hat.com>,
 "Catalin Marinas" <catalin.marinas@....com>, "Will Deacon" <will@...nel.org>,
 "Oleg Nesterov" <oleg@...hat.com>, "Ard Biesheuvel" <ardb@...nel.org>,
 "Teo Couprie Diaz" <teo.coupriediaz@....com>,
 "Mark Rutland" <mark.rutland@....com>, "Mark Brown" <broonie@...nel.org>,
 "Steven Rostedt" <rostedt@...dmis.org>, "Guo Hui" <guohui@...ontech.com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v1 1/1] arm64: add compile-time test into is_compat_task()

On Thu, Jan 4, 2024, at 20:24, Leonardo Bras wrote:
> Currently some parts of the codebase will test for CONFIG_COMPAT before
> testing is_compat_task(), probably in order to avoid a run-time test into
> the task structure, while other parts of codebase will just test even when
> the option is not compiled in.
>
> Since is_compat_task() is an inlined function, it would be helpful to add a
> !CONFIG_COMPAT version of the helper, allowing compile-time optimization.
>
> With this, the compiler is able to understand in build-time that
> is_compat_task() will always return 0, and optimize-out some of the extra
> code introduced by the option.
>
> This allows optimizing-out code when the option is not selected, and
> otherwise removing a lot #ifdefs that were introduced, making the code
> more clean.
>
> Signed-off-by: Leonardo Bras <leobras@...hat.com>

This looks like a useful cleanup to me, with one change:

> ---
>  arch/arm64/include/asm/compat.h | 5 +++++
>  arch/arm64/kernel/ptrace.c      | 6 ++----
>  arch/arm64/kernel/syscall.c     | 5 +----
>  3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
> index ae904a1ad5293..3cc61cbbb9062 100644
> --- a/arch/arm64/include/asm/compat.h
> +++ b/arch/arm64/include/asm/compat.h
> @@ -100,6 +100,11 @@ long compat_arm_syscall(struct pt_regs *regs, int scno);
> 
>  #else /* !CONFIG_COMPAT */
> 
> +static inline int is_compat_task(void)
> +{
> +	return 0;
> +}
> +

I think this bit is not even needed as long as users
include linux/compat.h rather than asm/compat.h, as there
is already a macro definition in the common file:

 #define is_compat_task() (0)


    Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ