[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <8eac39c8-9db6-4dd8-92bb-3dbaee9d80ea@app.fastmail.com>
Date: Thu, 21 Aug 2025 19:33:24 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
"Catalin Marinas" <catalin.marinas@....com>, "Will Deacon" <will@...nel.org>,
"Thomas Gleixner" <tglx@...utronix.de>, "Andy Lutomirski" <luto@...nel.org>,
"Vincenzo Frascino" <vincenzo.frascino@....com>
Cc: "John Stultz" <jstultz@...gle.com>, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] arm64: uapi: Provide correct __BITS_PER_LONG for the compat
vDSO
On Thu, Aug 21, 2025, at 09:56, Thomas Weißschuh wrote:
> The generic vDSO library uses the UAPI headers. On arm64 __BITS_PER_LONG is
> always '64' even when used from the compat vDSO. In that case __GENMASK()
> does an illegal bitshift, invoking undefined behaviour.
>
> Change __BITS_PER_LONG to also work when used from the comapt vDSO.
> To not confuse real userspace, only do this when building the kernel.
>
> Reported-by: John Stultz <jstultz@...gle.com>
> Closes:
> https://lore.kernel.org/lkml/CANDhNCqvKOc9JgphQwr0eDyJiyG4oLFS9R8rSFvU0fpurrJFDg@mail.gmail.com/
> Fixes: cd3557a7618b ("vdso/gettimeofday: Add support for auxiliary
> clocks")
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Acked-by: Arnd Bergmann <arnd@...db.de>
> +#if defined(__KERNEL__) && !defined(__aarch64__)
> +/* Used by the compat vDSO */
> +#define __BITS_PER_LONG 32
> +#else
> #define __BITS_PER_LONG 64
> +#endif
This should be fine as a hotfix, but I'm worried about this
coming back since there is not enough isolation between
uapi/asm/ headers and the vdso. We've had problems here
before, and arm64 more likely to be affected here than others
because the asm/ headers are not meant to be included from
32-bit compilation units.
A better approach might be either to build the arm64 compat vdso
against the arm32 headers, or to change the vdso code enough
that it only needs headers from the vdso namespace and not
include the uapi/asm/ namespace at all.
Unfortunately both of those require a substantial amount of
work, and are not an option for the current release.
Arnd
Powered by blists - more mailing lists