From: "Arnd Bergmann" <arnd@arndb.de>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Andy Lutomirski" <luto@kernel.org>,
"Vincenzo Frascino" <vincenzo.frascino@arm.com>
Cc: "John Stultz" <jstultz@google.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] arm64: uapi: Provide correct __BITS_PER_LONG for the compat vDSO
Date: Thu, 21 Aug 2025 19:33:24 +0200 [thread overview]
Message-ID: <8eac39c8-9db6-4dd8-92bb-3dbaee9d80ea@app.fastmail.com> (raw)
In-Reply-To: <20250821-vdso-arm64-compat-bitsperlong-v1-1-700bcabe7732@linutronix.de>
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@google.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@linutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.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
next prev parent reply other threads:[~2025-08-21 17:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-21 7:56 [PATCH 0/3] " Thomas Weißschuh
2025-08-21 7:56 ` [PATCH 1/3] " Thomas Weißschuh
2025-08-21 17:09 ` John Stultz
2025-08-21 17:33 ` Arnd Bergmann [this message]
2025-08-21 7:56 ` [PATCH 2/3] arm64: vdso32: Stop suppressing warnings Thomas Weißschuh
2025-08-21 7:56 ` [PATCH 3/3] arm64: vdso32: Respect -Werror from kbuild Thomas Weißschuh
2025-09-03 10:49 ` [PATCH 0/3] arm64: uapi: Provide correct __BITS_PER_LONG for the compat vDSO Thomas Weißschuh
2025-09-03 11:21 ` (subset) " Catalin Marinas
2025-09-08 15:55 ` Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8eac39c8-9db6-4dd8-92bb-3dbaee9d80ea@app.fastmail.com \
--to=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=jstultz@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=tglx@linutronix.de \
--cc=thomas.weissschuh@linutronix.de \
--cc=vincenzo.frascino@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®