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:   Fri, 18 Mar 2022 12:37:12 +0000
From:   James Morse <james.morse@....com>
To:     Arnd Bergmann <arnd@...nel.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>
Cc:     Arnd Bergmann <arnd@...db.de>,
        "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        llvm@...ts.linux.dev
Subject: Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS

Hi Arnd,

On 3/16/22 6:38 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> The newly introduced TRAMP_VALIAS definition causes a build warning
> with clang-14:
> 
> arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
>                  return (char *)TRAMP_VALIAS + SZ_2K * slot;

It is? Good to know!
(clang 11 doesn't seem to be so fussy)

Just for some more background:
TRAMP_VALIAS existed before, but it wasn't defined if KPTI is disabled at compile time, you can't
do that without CONFIG_EXPERT.
I thought these dummy definitions would be cleaner than #ifdef'ing the code.


> Change the addition to something clang does not complain about.

Acked-by: James Morse <james.morse@....com>


Thanks!

James



> I see this warning on 5.17-rc8, but did not test it on linux-next,
> which may already have a fix.
> 
> diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vectors.h
> index f64613a96d53..bc9a2145f419 100644
> --- a/arch/arm64/include/asm/vectors.h
> +++ b/arch/arm64/include/asm/vectors.h
> @@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors {
>   DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector);
>   
>   #ifndef CONFIG_UNMAP_KERNEL_AT_EL0
> -#define TRAMP_VALIAS	0
> +#define TRAMP_VALIAS	0ul
>   #endif
>   
>   static inline const char *
>   arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot)
>   {
>   	if (arm64_kernel_unmapped_at_el0())
> -		return (char *)TRAMP_VALIAS + SZ_2K * slot;
> +		return (char *)(TRAMP_VALIAS + SZ_2K * slot);
>   
>   	WARN_ON_ONCE(slot == EL1_VECTOR_KPTI);
>   
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ