* [PATCH v2 1/5] x86/vdso: Use 32-bit CHECKFLAGS for compat vDSO
2026-03-02 7:58 [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO Thomas Weißschuh
@ 2026-03-02 7:58 ` Thomas Weißschuh
2026-03-11 9:31 ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh
2026-03-02 7:58 ` [PATCH v2 2/5] sparc64: vdso: " Thomas Weißschuh
` (4 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Thomas Weißschuh @ 2026-03-02 7:58 UTC (permalink / raw)
To: David S. Miller, Andreas Larsson, Andy Lutomirski,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Arnd Bergmann, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP)
Cc: sparclinux, linux-kernel, linux-arch, linux-s390, David Laight,
linuxppc-dev, Thomas Weißschuh, Sun Jian, kernel test robot,
Dan Carpenter
When building the compat vDSO the CHECKFLAGS from the 64-bit kernel
are used. These are combined with the 32-bit CFLAGS. This confuses
sparse, producing false-positive warnings or potentially missing
real issues.
Manually override the CHECKFLAGS for the compat vDSO with the correct
32-bit configuration.
Reported-by: Sun Jian <sun.jian.kdev@gmail.com>
Closes: https://lore.kernel.org/lkml/20260114084529.1676356-1-sun.jian.kdev@gmail.com/
Closes: https://lore.kernel.org/lkml/20260117215542.342638347@kernel.org/
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202602111941.PIhubgrb-lkp@intel.com/
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/entry/vdso/vdso32/Makefile | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/entry/vdso/vdso32/Makefile b/arch/x86/entry/vdso/vdso32/Makefile
index add6afb484ba..ded4fc6a48cd 100644
--- a/arch/x86/entry/vdso/vdso32/Makefile
+++ b/arch/x86/entry/vdso/vdso32/Makefile
@@ -15,6 +15,10 @@ flags-y := -DBUILD_VDSO32 -m32 -mregparm=0
flags-$(CONFIG_X86_64) += -include $(src)/fake_32bit_build.h
flags-remove-y := -m64
+# Checker flags
+CHECKFLAGS := $(subst -m64,-m32,$(CHECKFLAGS))
+CHECKFLAGS := $(subst -D__x86_64__,-D__i386__,$(CHECKFLAGS))
+
# The location of this include matters!
include $(src)/../common/Makefile.include
--
2.53.0
^ permalink raw reply [flat|nested] 16+ messages in thread* [tip: timers/vdso] x86/vdso: Use 32-bit CHECKFLAGS for compat vDSO
2026-03-02 7:58 ` [PATCH v2 1/5] x86/vdso: " Thomas Weißschuh
@ 2026-03-11 9:31 ` tip-bot2 for Thomas Weißschuh
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot2 for Thomas Weißschuh @ 2026-03-11 9:31 UTC (permalink / raw)
To: linux-tip-commits
Cc: Sun Jian, kernel test robot, Dan Carpenter, thomas.weissschuh,
Thomas Gleixner, Arnd Bergmann, x86, linux-kernel
The following commit has been merged into the timers/vdso branch of tip:
Commit-ID: 56f85f67b3e20b105fa23bf97bfc8b6d5cdbbef0
Gitweb: https://git.kernel.org/tip/56f85f67b3e20b105fa23bf97bfc8b6d5cdbbef0
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate: Mon, 02 Mar 2026 08:58:37 +01:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Wed, 11 Mar 2026 10:15:42 +01:00
x86/vdso: Use 32-bit CHECKFLAGS for compat vDSO
When building the compat vDSO the CHECKFLAGS from the 64-bit kernel
are used. These are combined with the 32-bit CFLAGS. This confuses
sparse, producing false-positive warnings or potentially missing
real issues.
Manually override the CHECKFLAGS for the compat vDSO with the correct
32-bit configuration.
Reported-by: Sun Jian <sun.jian.kdev@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260302-vdso-compat-checkflags-v2-1-78e55baa58ba@linutronix.de
Closes: https://lore.kernel.org/lkml/20260114084529.1676356-1-sun.jian.kdev@gmail.com/
Closes: https://lore.kernel.org/lkml/20260117215542.342638347@kernel.org/
Closes: https://lore.kernel.org/r/202602111941.PIhubgrb-lkp@intel.com/
---
arch/x86/entry/vdso/vdso32/Makefile | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/entry/vdso/vdso32/Makefile b/arch/x86/entry/vdso/vdso32/Makefile
index add6afb..ded4fc6 100644
--- a/arch/x86/entry/vdso/vdso32/Makefile
+++ b/arch/x86/entry/vdso/vdso32/Makefile
@@ -15,6 +15,10 @@ flags-y := -DBUILD_VDSO32 -m32 -mregparm=0
flags-$(CONFIG_X86_64) += -include $(src)/fake_32bit_build.h
flags-remove-y := -m64
+# Checker flags
+CHECKFLAGS := $(subst -m64,-m32,$(CHECKFLAGS))
+CHECKFLAGS := $(subst -D__x86_64__,-D__i386__,$(CHECKFLAGS))
+
# The location of this include matters!
include $(src)/../common/Makefile.include
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 2/5] sparc64: vdso: Use 32-bit CHECKFLAGS for compat vDSO
2026-03-02 7:58 [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO Thomas Weißschuh
2026-03-02 7:58 ` [PATCH v2 1/5] x86/vdso: " Thomas Weißschuh
@ 2026-03-02 7:58 ` Thomas Weißschuh
2026-03-11 9:31 ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh
2026-03-02 7:58 ` [PATCH v2 3/5] s390: Add -m64 to KBUILD_CPPFLAGS Thomas Weißschuh
` (3 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Thomas Weißschuh @ 2026-03-02 7:58 UTC (permalink / raw)
To: David S. Miller, Andreas Larsson, Andy Lutomirski,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Arnd Bergmann, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP)
Cc: sparclinux, linux-kernel, linux-arch, linux-s390, David Laight,
linuxppc-dev, Thomas Weißschuh, kernel test robot
When building the compat vDSO the CHECKFLAGS from the 64-bit kernel
are used. These are combined with the 32-bit CFLAGS. This confuses
sparse, producing false-positive warnings or potentially missing
real issues.
Manually override the CHECKFLAGS for the compat vDSO with the correct
32-bit configuration.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/lkml/202511030021.9v1mIgts-lkp@intel.com/
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
The actual false-positive is only reported when SPARC is converted over
to the generic vDSO library. However the issue is already present.
To avoid dependencies between different patch queues, I have this patch
in this one.
---
arch/sparc/vdso/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile
index 13f1d7be00f1..7d6e3097ebfc 100644
--- a/arch/sparc/vdso/Makefile
+++ b/arch/sparc/vdso/Makefile
@@ -90,6 +90,9 @@ KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING
KBUILD_CFLAGS_32 += -mv8plus
$(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
+CHECKFLAGS_32 := $(filter-out -m64 -D__sparc_v9__ -D__arch64__, $(CHECKFLAGS)) -m32
+$(obj)/vdso32.so.dbg: CHECKFLAGS = $(CHECKFLAGS_32)
+
$(obj)/vdso32.so.dbg: FORCE \
$(obj)/vdso32/vdso32.lds \
$(obj)/vdso32/vclock_gettime.o \
--
2.53.0
^ permalink raw reply [flat|nested] 16+ messages in thread* [tip: timers/vdso] sparc64: vdso: Use 32-bit CHECKFLAGS for compat vDSO
2026-03-02 7:58 ` [PATCH v2 2/5] sparc64: vdso: " Thomas Weißschuh
@ 2026-03-11 9:31 ` tip-bot2 for Thomas Weißschuh
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot2 for Thomas Weißschuh @ 2026-03-11 9:31 UTC (permalink / raw)
To: linux-tip-commits
Cc: kernel test robot, thomas.weissschuh, Thomas Gleixner,
Arnd Bergmann, x86, linux-kernel
The following commit has been merged into the timers/vdso branch of tip:
Commit-ID: 273aaa8ef8e347c08865effcd8917e20f049e612
Gitweb: https://git.kernel.org/tip/273aaa8ef8e347c08865effcd8917e20f049e612
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate: Mon, 02 Mar 2026 08:58:38 +01:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Wed, 11 Mar 2026 10:15:42 +01:00
sparc64: vdso: Use 32-bit CHECKFLAGS for compat vDSO
When building the compat vDSO the CHECKFLAGS from the 64-bit kernel
are used. These are combined with the 32-bit CFLAGS. This confuses
sparse, producing false-positive warnings or potentially missing
real issues.
Manually override the CHECKFLAGS for the compat vDSO with the correct
32-bit configuration.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260302-vdso-compat-checkflags-v2-2-78e55baa58ba@linutronix.de
Closes: https://lore.kernel.org/lkml/202511030021.9v1mIgts-lkp@intel.com/
---
arch/sparc/vdso/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile
index 683b2d4..d2811f1 100644
--- a/arch/sparc/vdso/Makefile
+++ b/arch/sparc/vdso/Makefile
@@ -90,6 +90,9 @@ KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING
KBUILD_CFLAGS_32 += -mv8plus
$(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
+CHECKFLAGS_32 := $(filter-out -m64 -D__sparc_v9__ -D__arch64__, $(CHECKFLAGS)) -m32
+$(obj)/vdso32.so.dbg: CHECKFLAGS = $(CHECKFLAGS_32)
+
$(obj)/vdso32.so.dbg: FORCE \
$(obj)/vdso32/vdso32.lds \
$(obj)/vdso32/vclock_gettime.o \
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 3/5] s390: Add -m64 to KBUILD_CPPFLAGS
2026-03-02 7:58 [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO Thomas Weißschuh
2026-03-02 7:58 ` [PATCH v2 1/5] x86/vdso: " Thomas Weißschuh
2026-03-02 7:58 ` [PATCH v2 2/5] sparc64: vdso: " Thomas Weißschuh
@ 2026-03-02 7:58 ` Thomas Weißschuh
2026-03-02 8:42 ` Arnd Bergmann
2026-03-11 9:31 ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh
2026-03-02 7:58 ` [PATCH v2 4/5] powerpc/audit: directly include unistd_32.h from compat_audit.c Thomas Weißschuh
` (2 subsequent siblings)
5 siblings, 2 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-03-02 7:58 UTC (permalink / raw)
To: David S. Miller, Andreas Larsson, Andy Lutomirski,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Arnd Bergmann, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP)
Cc: sparclinux, linux-kernel, linux-arch, linux-s390, David Laight,
linuxppc-dev, Thomas Weißschuh
Some non-code files, like linkescripts, are preprocessed with the C
preprocessor and make use of regular kernel headers.
As -m64 is not passed to those preprocessor invocations this leads
to an inconsistency between __BITS_PER_LONG and the C type 'long'.
An upcoming consistency check will be tripped by this.
Make sure -m64 is also defined for those preprocessing steps.
As KBUILD_CPPFLAGS is inherited by both KBUILD_AFLAGS and KBUILD_CFLAGS,
drop -m64 from these variables.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
arch/s390/Makefile | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index d78ad6885ca2..02bc948a4a56 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -12,8 +12,7 @@ LD_BFD := elf64-s390
KBUILD_LDFLAGS := -m elf64_s390
KBUILD_AFLAGS_MODULE += -fPIC
KBUILD_CFLAGS_MODULE += -fPIC
-KBUILD_AFLAGS += -m64
-KBUILD_CFLAGS += -m64
+KBUILD_CPPFLAGS += -m64
KBUILD_CFLAGS += -fPIC
LDFLAGS_vmlinux := $(call ld-option,-no-pie)
extra_tools := relocs
--
2.53.0
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH v2 3/5] s390: Add -m64 to KBUILD_CPPFLAGS
2026-03-02 7:58 ` [PATCH v2 3/5] s390: Add -m64 to KBUILD_CPPFLAGS Thomas Weißschuh
@ 2026-03-02 8:42 ` Arnd Bergmann
2026-03-11 9:31 ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh
1 sibling, 0 replies; 16+ messages in thread
From: Arnd Bergmann @ 2026-03-02 8:42 UTC (permalink / raw)
To: Thomas Weißschuh, David S . Miller, Andreas Larsson,
Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy
Cc: sparclinux, linux-kernel, Linux-Arch, linux-s390, David Laight,
linuxppc-dev
On Mon, Mar 2, 2026, at 08:58, Thomas Weißschuh wrote:
> Some non-code files, like linkescripts, are preprocessed with the C
> preprocessor and make use of regular kernel headers.
> As -m64 is not passed to those preprocessor invocations this leads
> to an inconsistency between __BITS_PER_LONG and the C type 'long'.
> An upcoming consistency check will be tripped by this.
>
> Make sure -m64 is also defined for those preprocessing steps.
>
> As KBUILD_CPPFLAGS is inherited by both KBUILD_AFLAGS and KBUILD_CFLAGS,
> drop -m64 from these variables.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [tip: timers/vdso] s390: Add -m64 to KBUILD_CPPFLAGS
2026-03-02 7:58 ` [PATCH v2 3/5] s390: Add -m64 to KBUILD_CPPFLAGS Thomas Weißschuh
2026-03-02 8:42 ` Arnd Bergmann
@ 2026-03-11 9:31 ` tip-bot2 for Thomas Weißschuh
1 sibling, 0 replies; 16+ messages in thread
From: tip-bot2 for Thomas Weißschuh @ 2026-03-11 9:31 UTC (permalink / raw)
To: linux-tip-commits
Cc: thomas.weissschuh, Thomas Gleixner, Arnd Bergmann, x86, linux-kernel
The following commit has been merged into the timers/vdso branch of tip:
Commit-ID: 08b5dcb6139975f3fd754c27f4943720c3c43ae2
Gitweb: https://git.kernel.org/tip/08b5dcb6139975f3fd754c27f4943720c3c43ae2
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate: Mon, 02 Mar 2026 08:58:39 +01:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Wed, 11 Mar 2026 10:15:42 +01:00
s390: Add -m64 to KBUILD_CPPFLAGS
Some non-code files, like linkescripts, are preprocessed with the C
preprocessor and make use of regular kernel headers.
As -m64 is not passed to those preprocessor invocations this leads
to an inconsistency between __BITS_PER_LONG and the C type 'long'.
An upcoming consistency check will be tripped by this.
Make sure -m64 is also defined for those preprocessing steps.
As KBUILD_CPPFLAGS is inherited by both KBUILD_AFLAGS and KBUILD_CFLAGS,
drop -m64 from these variables.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260302-vdso-compat-checkflags-v2-3-78e55baa58ba@linutronix.de
---
arch/s390/Makefile | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index d78ad68..02bc948 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -12,8 +12,7 @@ LD_BFD := elf64-s390
KBUILD_LDFLAGS := -m elf64_s390
KBUILD_AFLAGS_MODULE += -fPIC
KBUILD_CFLAGS_MODULE += -fPIC
-KBUILD_AFLAGS += -m64
-KBUILD_CFLAGS += -m64
+KBUILD_CPPFLAGS += -m64
KBUILD_CFLAGS += -fPIC
LDFLAGS_vmlinux := $(call ld-option,-no-pie)
extra_tools := relocs
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 4/5] powerpc/audit: directly include unistd_32.h from compat_audit.c
2026-03-02 7:58 [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO Thomas Weißschuh
` (2 preceding siblings ...)
2026-03-02 7:58 ` [PATCH v2 3/5] s390: Add -m64 to KBUILD_CPPFLAGS Thomas Weißschuh
@ 2026-03-02 7:58 ` Thomas Weißschuh
2026-03-02 8:41 ` Arnd Bergmann
2026-03-11 9:31 ` [tip: timers/vdso] powerpc/audit: Directly " tip-bot2 for Thomas Weißschuh
2026-03-02 7:58 ` [PATCH v2 5/5] asm-generic/bitsperlong.h: Add sanity checks for __BITS_PER_LONG Thomas Weißschuh
2026-03-06 10:43 ` [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO Christophe Leroy (CS GROUP)
5 siblings, 2 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-03-02 7:58 UTC (permalink / raw)
To: David S. Miller, Andreas Larsson, Andy Lutomirski,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Arnd Bergmann, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP)
Cc: sparclinux, linux-kernel, linux-arch, linux-s390, David Laight,
linuxppc-dev, Thomas Weißschuh
This source file undefines '__powerpc64__' to get the 32-bit system call
numbers from asm/unistd.h. However this symbol is also evaluated by
other headers, among them is asm/bitsperlong.h. The undefinition leads
to an inconsistency between __BITS_PER_LONG and the C type 'long'.
An upcoming consistency check will be tripped by this.
Directly include asm/unistd_32.h to get access to the 32-bit system call
numbers instead.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
arch/powerpc/kernel/compat_audit.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/compat_audit.c b/arch/powerpc/kernel/compat_audit.c
index 57b38c592b9f..b4d81a57b2d9 100644
--- a/arch/powerpc/kernel/compat_audit.c
+++ b/arch/powerpc/kernel/compat_audit.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
-#undef __powerpc64__
#include <linux/audit_arch.h>
-#include <asm/unistd.h>
+#include <asm/unistd_32.h>
#include "audit_32.h"
--
2.53.0
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH v2 4/5] powerpc/audit: directly include unistd_32.h from compat_audit.c
2026-03-02 7:58 ` [PATCH v2 4/5] powerpc/audit: directly include unistd_32.h from compat_audit.c Thomas Weißschuh
@ 2026-03-02 8:41 ` Arnd Bergmann
2026-03-11 9:31 ` [tip: timers/vdso] powerpc/audit: Directly " tip-bot2 for Thomas Weißschuh
1 sibling, 0 replies; 16+ messages in thread
From: Arnd Bergmann @ 2026-03-02 8:41 UTC (permalink / raw)
To: Thomas Weißschuh, David S . Miller, Andreas Larsson,
Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy
Cc: sparclinux, linux-kernel, Linux-Arch, linux-s390, David Laight,
linuxppc-dev
On Mon, Mar 2, 2026, at 08:58, Thomas Weißschuh wrote:
> This source file undefines '__powerpc64__' to get the 32-bit system call
> numbers from asm/unistd.h. However this symbol is also evaluated by
> other headers, among them is asm/bitsperlong.h. The undefinition leads
> to an inconsistency between __BITS_PER_LONG and the C type 'long'.
> An upcoming consistency check will be tripped by this.
>
> Directly include asm/unistd_32.h to get access to the 32-bit system call
> numbers instead.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [tip: timers/vdso] powerpc/audit: Directly include unistd_32.h from compat_audit.c
2026-03-02 7:58 ` [PATCH v2 4/5] powerpc/audit: directly include unistd_32.h from compat_audit.c Thomas Weißschuh
2026-03-02 8:41 ` Arnd Bergmann
@ 2026-03-11 9:31 ` tip-bot2 for Thomas Weißschuh
1 sibling, 0 replies; 16+ messages in thread
From: tip-bot2 for Thomas Weißschuh @ 2026-03-11 9:31 UTC (permalink / raw)
To: linux-tip-commits
Cc: thomas.weissschuh, Thomas Gleixner, Arnd Bergmann, x86, linux-kernel
The following commit has been merged into the timers/vdso branch of tip:
Commit-ID: 9b444349a2e96745fc172e161539594ee1f0239e
Gitweb: https://git.kernel.org/tip/9b444349a2e96745fc172e161539594ee1f0239e
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate: Mon, 02 Mar 2026 08:58:40 +01:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Wed, 11 Mar 2026 10:15:43 +01:00
powerpc/audit: Directly include unistd_32.h from compat_audit.c
This source file undefines '__powerpc64__' to get the 32-bit system call
numbers from asm/unistd.h. However this symbol is also evaluated by
other headers, among them is asm/bitsperlong.h. The undefinition leads
to an inconsistency between __BITS_PER_LONG and the C type 'long'.
An upcoming consistency check will be tripped by this.
Directly include asm/unistd_32.h to get access to the 32-bit system call
numbers instead.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260302-vdso-compat-checkflags-v2-4-78e55baa58ba@linutronix.de
---
arch/powerpc/kernel/compat_audit.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/compat_audit.c b/arch/powerpc/kernel/compat_audit.c
index 57b38c5..b4d81a5 100644
--- a/arch/powerpc/kernel/compat_audit.c
+++ b/arch/powerpc/kernel/compat_audit.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
-#undef __powerpc64__
#include <linux/audit_arch.h>
-#include <asm/unistd.h>
+#include <asm/unistd_32.h>
#include "audit_32.h"
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 5/5] asm-generic/bitsperlong.h: Add sanity checks for __BITS_PER_LONG
2026-03-02 7:58 [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO Thomas Weißschuh
` (3 preceding siblings ...)
2026-03-02 7:58 ` [PATCH v2 4/5] powerpc/audit: directly include unistd_32.h from compat_audit.c Thomas Weißschuh
@ 2026-03-02 7:58 ` Thomas Weißschuh
2026-03-11 9:31 ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh
2026-03-06 10:43 ` [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO Christophe Leroy (CS GROUP)
5 siblings, 1 reply; 16+ messages in thread
From: Thomas Weißschuh @ 2026-03-02 7:58 UTC (permalink / raw)
To: David S. Miller, Andreas Larsson, Andy Lutomirski,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Arnd Bergmann, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP)
Cc: sparclinux, linux-kernel, linux-arch, linux-s390, David Laight,
linuxppc-dev, Thomas Weißschuh
The value of __BITS_PER_LONG from architecture-specific logic should
always match the generic one if that is available. It should also match
the actual C type 'long'.
Mismatches can happen for example when building the compat vDSO. Either
during the compilation, see commit 9a6d3ff10f7f ("arm64: uapi: Provide
correct __BITS_PER_LONG for the compat vDSO"), or when running sparse
when mismatched CHECKFLAGS are inherited from the kernel build.
Add some consistency checks which detect such issues early and clearly.
The kernel-internal BITS_PER_LONG is not checked as it is derived from
CONFIG_64BIT and therefore breaks for the compat vDSO. See the similar,
deactivated check above.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
include/asm-generic/bitsperlong.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h
index 1023e2a4bd37..90e8aeebfd2f 100644
--- a/include/asm-generic/bitsperlong.h
+++ b/include/asm-generic/bitsperlong.h
@@ -19,6 +19,15 @@
#error Inconsistent word size. Check asm/bitsperlong.h
#endif
+#if __CHAR_BIT__ * __SIZEOF_LONG__ != __BITS_PER_LONG
+#error Inconsistent word size. Check asm/bitsperlong.h
+#endif
+
+#ifndef __ASSEMBLER__
+_Static_assert(sizeof(long) * 8 == __BITS_PER_LONG,
+ "Inconsistent word size. Check asm/bitsperlong.h");
+#endif
+
#ifndef BITS_PER_LONG_LONG
#define BITS_PER_LONG_LONG 64
#endif
--
2.53.0
^ permalink raw reply [flat|nested] 16+ messages in thread* [tip: timers/vdso] asm-generic/bitsperlong.h: Add sanity checks for __BITS_PER_LONG
2026-03-02 7:58 ` [PATCH v2 5/5] asm-generic/bitsperlong.h: Add sanity checks for __BITS_PER_LONG Thomas Weißschuh
@ 2026-03-11 9:31 ` tip-bot2 for Thomas Weißschuh
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot2 for Thomas Weißschuh @ 2026-03-11 9:31 UTC (permalink / raw)
To: linux-tip-commits
Cc: thomas.weissschuh, Thomas Gleixner, Arnd Bergmann, x86, linux-kernel
The following commit has been merged into the timers/vdso branch of tip:
Commit-ID: 62357a5888ea6ef81f718eee20ad962a1101fb96
Gitweb: https://git.kernel.org/tip/62357a5888ea6ef81f718eee20ad962a1101fb96
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate: Mon, 02 Mar 2026 08:58:41 +01:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Wed, 11 Mar 2026 10:15:43 +01:00
asm-generic/bitsperlong.h: Add sanity checks for __BITS_PER_LONG
The value of __BITS_PER_LONG from architecture-specific logic should
always match the generic one if that is available. It should also match
the actual C type 'long'.
Mismatches can happen for example when building the compat vDSO. Either
during the compilation, see commit 9a6d3ff10f7f ("arm64: uapi: Provide
correct __BITS_PER_LONG for the compat vDSO"), or when running sparse
when mismatched CHECKFLAGS are inherited from the kernel build.
Add some consistency checks which detect such issues early and clearly.
The kernel-internal BITS_PER_LONG is not checked as it is derived from
CONFIG_64BIT and therefore breaks for the compat vDSO. See the similar,
deactivated check above.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260302-vdso-compat-checkflags-v2-5-78e55baa58ba@linutronix.de
---
include/asm-generic/bitsperlong.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h
index 1023e2a..90e8aee 100644
--- a/include/asm-generic/bitsperlong.h
+++ b/include/asm-generic/bitsperlong.h
@@ -19,6 +19,15 @@
#error Inconsistent word size. Check asm/bitsperlong.h
#endif
+#if __CHAR_BIT__ * __SIZEOF_LONG__ != __BITS_PER_LONG
+#error Inconsistent word size. Check asm/bitsperlong.h
+#endif
+
+#ifndef __ASSEMBLER__
+_Static_assert(sizeof(long) * 8 == __BITS_PER_LONG,
+ "Inconsistent word size. Check asm/bitsperlong.h");
+#endif
+
#ifndef BITS_PER_LONG_LONG
#define BITS_PER_LONG_LONG 64
#endif
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO
2026-03-02 7:58 [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO Thomas Weißschuh
` (4 preceding siblings ...)
2026-03-02 7:58 ` [PATCH v2 5/5] asm-generic/bitsperlong.h: Add sanity checks for __BITS_PER_LONG Thomas Weißschuh
@ 2026-03-06 10:43 ` Christophe Leroy (CS GROUP)
2026-03-06 13:08 ` Thomas Weißschuh
5 siblings, 1 reply; 16+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-03-06 10:43 UTC (permalink / raw)
To: Thomas Weißschuh, David S. Miller, Andreas Larsson,
Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, Arnd Bergmann, Heiko Carstens,
Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
Sven Schnelle, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin
Cc: sparclinux, linux-kernel, linux-arch, linux-s390, David Laight,
linuxppc-dev, Sun Jian, kernel test robot, Dan Carpenter
Le 02/03/2026 à 08:58, Thomas Weißschuh a écrit :
> When building the compat vDSO the CHECKFLAGS from the 64-bit kernel
> are used. These are combined with the 32-bit CFLAGS. This confuses
> sparse, producing false-positive warnings or potentially missing
> real issues.
>
> Manually override the CHECKFLAGS for the compat vDSO with the correct
> 32-bit configuration.
>
> Not all architectures are supported, as many do not use sparse for their
> (compat) vDSO. These can be enabled later.
>
> Also add some checks to bitsperlong.h to detect such issues earlier.
>
> Based on tip/timers/vdso.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> Changes in v2:
> - Simplify __BITS_PER_LONG consistency checks
> - Fix an inconsistency in the powerpc audit code
The powerpc audit code should be replaced by generic
AUDIT_ARCH_COMPAT_GENERIC, as there is no difference between them
apparently.
A tentative was made in the past but was declined by audit maintainers
because we were not able to test it allthought the failure was the same
before and after the patch, see
https://github.com/linuxppc/issues/issues/412
Christophe
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO
2026-03-06 10:43 ` [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO Christophe Leroy (CS GROUP)
@ 2026-03-06 13:08 ` Thomas Weißschuh
2026-03-06 13:26 ` Christophe Leroy (CS GROUP)
0 siblings, 1 reply; 16+ messages in thread
From: Thomas Weißschuh @ 2026-03-06 13:08 UTC (permalink / raw)
To: Christophe Leroy (CS GROUP)
Cc: David S. Miller, Andreas Larsson, Andy Lutomirski,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Arnd Bergmann, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
sparclinux, linux-kernel, linux-arch, linux-s390, David Laight,
linuxppc-dev, Sun Jian, kernel test robot, Dan Carpenter
On Fri, Mar 06, 2026 at 11:43:24AM +0100, Christophe Leroy (CS GROUP) wrote:
>
>
> Le 02/03/2026 à 08:58, Thomas Weißschuh a écrit :
> > When building the compat vDSO the CHECKFLAGS from the 64-bit kernel
> > are used. These are combined with the 32-bit CFLAGS. This confuses
> > sparse, producing false-positive warnings or potentially missing
> > real issues.
> >
> > Manually override the CHECKFLAGS for the compat vDSO with the correct
> > 32-bit configuration.
> >
> > Not all architectures are supported, as many do not use sparse for their
> > (compat) vDSO. These can be enabled later.
> >
> > Also add some checks to bitsperlong.h to detect such issues earlier.
> >
> > Based on tip/timers/vdso.
> >
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > ---
> > Changes in v2:
> > - Simplify __BITS_PER_LONG consistency checks
> > - Fix an inconsistency in the powerpc audit code
>
> The powerpc audit code should be replaced by generic
> AUDIT_ARCH_COMPAT_GENERIC, as there is no difference between them
> apparently.
Agreed.
> A tentative was made in the past but was declined by audit maintainers
> because we were not able to test it allthought the failure was the same
> before and after the patch, see
> https://github.com/linuxppc/issues/issues/412
On v7.0-rc1 the test failure of filter_exclude/test is gone.
It also keeps working when applying your patch. Some other tests are
broken, but it looks that is due to missing dependencies on Debian.
So maybe it is time to resubmit your patch.
In any case, I don't really want to entangle my series with the switch
to AUDIT_ARCH_COMPAT_GENERIC. My proposed cleanup does not make the code
worse and if both patches are applied the conflict will be trivial to
resolve.
Thomas
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 0/5] vDSO: Use 32-bit CHECKFLAGS for compat vDSO
2026-03-06 13:08 ` Thomas Weißschuh
@ 2026-03-06 13:26 ` Christophe Leroy (CS GROUP)
0 siblings, 0 replies; 16+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-03-06 13:26 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: David S. Miller, Andreas Larsson, Andy Lutomirski,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Arnd Bergmann, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
sparclinux, linux-kernel, linux-arch, linux-s390, David Laight,
linuxppc-dev, Sun Jian, kernel test robot, Dan Carpenter
Le 06/03/2026 à 14:08, Thomas Weißschuh a écrit :
> On Fri, Mar 06, 2026 at 11:43:24AM +0100, Christophe Leroy (CS GROUP) wrote:
>>
>>
>> Le 02/03/2026 à 08:58, Thomas Weißschuh a écrit :
>>> When building the compat vDSO the CHECKFLAGS from the 64-bit kernel
>>> are used. These are combined with the 32-bit CFLAGS. This confuses
>>> sparse, producing false-positive warnings or potentially missing
>>> real issues.
>>>
>>> Manually override the CHECKFLAGS for the compat vDSO with the correct
>>> 32-bit configuration.
>>>
>>> Not all architectures are supported, as many do not use sparse for their
>>> (compat) vDSO. These can be enabled later.
>>>
>>> Also add some checks to bitsperlong.h to detect such issues earlier.
>>>
>>> Based on tip/timers/vdso.
>>>
>>> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
>>> ---
>>> Changes in v2:
>>> - Simplify __BITS_PER_LONG consistency checks
>>> - Fix an inconsistency in the powerpc audit code
>>
>> The powerpc audit code should be replaced by generic
>> AUDIT_ARCH_COMPAT_GENERIC, as there is no difference between them
>> apparently.
>
> Agreed.
>
>> A tentative was made in the past but was declined by audit maintainers
>> because we were not able to test it allthought the failure was the same
>> before and after the patch, see
>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flinuxppc%2Fissues%2Fissues%2F412&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7Cca6c85b42bd44c6a80c608de7b81819d%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639083993321723266%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=VxTy22klpH9H8Altgcthr%2F%2ByUIL6q%2FbBkDV7FQS%2BljI%3D&reserved=0
>
> On v7.0-rc1 the test failure of filter_exclude/test is gone.
> It also keeps working when applying your patch. Some other tests are
> broken, but it looks that is due to missing dependencies on Debian.
> So maybe it is time to resubmit your patch.
>
> In any case, I don't really want to entangle my series with the switch
> to AUDIT_ARCH_COMPAT_GENERIC. My proposed cleanup does not make the code
> worse and if both patches are applied the conflict will be trivial to
> resolve.
I didn't mean to interfere with your patch, it is just that your patch
reminded me that tentative.
Thanks for testing, I will consider re-posting my patch based on your test.
Christophe
^ permalink raw reply [flat|nested] 16+ messages in thread