[PATCH 0/3] arm64: uapi: Provide correct __BITS_PER_LONG for the compat vDSO

Thomas Weißschuh posted 3 patches 1 month, 1 week ago
arch/arm64/include/uapi/asm/bitsperlong.h |  5 +++++
arch/arm64/kernel/vdso32/Makefile         | 13 +------------
2 files changed, 6 insertions(+), 12 deletions(-)
[PATCH 0/3] arm64: uapi: Provide correct __BITS_PER_LONG for the compat vDSO
Posted by Thomas Weißschuh 1 month, 1 week ago
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.

The first patch should go into the 6.17 tree.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Thomas Weißschuh (3):
      arm64: uapi: Provide correct __BITS_PER_LONG for the compat vDSO
      arm64: vdso32: Stop suppressing warnings
      arm64: vdso32: Respect -Werror from kbuild

 arch/arm64/include/uapi/asm/bitsperlong.h |  5 +++++
 arch/arm64/kernel/vdso32/Makefile         | 13 +------------
 2 files changed, 6 insertions(+), 12 deletions(-)
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250820-vdso-arm64-compat-bitsperlong-4f59ae7ef6e7

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh@linutronix.de>

Re: [PATCH 0/3] arm64: uapi: Provide correct __BITS_PER_LONG for the compat vDSO
Posted by Will Deacon 3 weeks, 4 days ago
On Thu, 21 Aug 2025 09:56:43 +0200, 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.
> 
> The first patch should go into the 6.17 tree.
> 
> 
> [...]

Applied to arm64 (for-next/vdso), thanks!

[2/3] arm64: vdso32: Stop suppressing warnings
      https://git.kernel.org/arm64/c/80c4e1948908
[3/3] arm64: vdso32: Respect -Werror from kbuild
      https://git.kernel.org/arm64/c/281817dffe28

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
Re: [PATCH 0/3] arm64: uapi: Provide correct __BITS_PER_LONG for the compat vDSO
Posted by Thomas Weißschuh 1 month ago
Hi arm64 folks,

On Thu, Aug 21, 2025 at 09:56:43AM +0200, 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.
> 
> The first patch should go into the 6.17 tree.

Could you take this series?


Thanks,

> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> Thomas Weißschuh (3):
>       arm64: uapi: Provide correct __BITS_PER_LONG for the compat vDSO
>       arm64: vdso32: Stop suppressing warnings
>       arm64: vdso32: Respect -Werror from kbuild
> 
>  arch/arm64/include/uapi/asm/bitsperlong.h |  5 +++++
>  arch/arm64/kernel/vdso32/Makefile         | 13 +------------
>  2 files changed, 6 insertions(+), 12 deletions(-)
> ---
> base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
> change-id: 20250820-vdso-arm64-compat-bitsperlong-4f59ae7ef6e7
> 
> Best regards,
> -- 
> Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> 
Re: (subset) [PATCH 0/3] arm64: uapi: Provide correct __BITS_PER_LONG for the compat vDSO
Posted by Catalin Marinas 1 month ago
On Thu, 21 Aug 2025 09:56:43 +0200, 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.
> 
> The first patch should go into the 6.17 tree.
> 
> 
> [...]

Applied to arm64 (for-next/fixes), thanks! And sorry for the delay,
missed it due to holidays.

[1/3] arm64: uapi: Provide correct __BITS_PER_LONG for the compat vDSO
      https://git.kernel.org/arm64/c/9a6d3ff10f7f

I'll leave the other two patches to Will for the upcoming merging
window.

-- 
Catalin