Skip to content

Commit 9a6d3ff

Browse files
t-8chctmarinas
authored andcommitted
arm64: uapi: Provide correct __BITS_PER_LONG for the compat vDSO
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 <[email protected]> Closes: https://lore.kernel.org/lkml/CANDhNCqvKOc9JgphQwr0eDyJiyG4oLFS9R8rSFvU0fpurrJFDg@mail.gmail.com/ Fixes: cd3557a ("vdso/gettimeofday: Add support for auxiliary clocks") Signed-off-by: Thomas Weißschuh <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Tested-by: John Stultz <[email protected]> Link: https://lore.kernel.org/r/20250821-vdso-arm64-compat-bitsperlong-v1-1-700bcabe7732@linutronix.de Signed-off-by: Catalin Marinas <[email protected]>
1 parent d82aa5d commit 9a6d3ff

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/arm64/include/uapi/asm/bitsperlong.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
#ifndef __ASM_BITSPERLONG_H
1818
#define __ASM_BITSPERLONG_H
1919

20+
#if defined(__KERNEL__) && !defined(__aarch64__)
21+
/* Used by the compat vDSO */
22+
#define __BITS_PER_LONG 32
23+
#else
2024
#define __BITS_PER_LONG 64
25+
#endif
2126

2227
#include <asm-generic/bitsperlong.h>
2328

0 commit comments

Comments
 (0)