arch/powerpc/kernel/compat_audit.c | 3 +-- arch/s390/Makefile | 3 +-- arch/sparc/vdso/Makefile | 3 +++ arch/x86/entry/vdso/vdso32/Makefile | 4 ++++ include/asm-generic/bitsperlong.h | 9 +++++++++ 5 files changed, 18 insertions(+), 4 deletions(-)
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
- Move check to kernel headers instead of UAPI ones
- Use KBUILD_CPPFLAGS = -m64 on s390 instead,
the previous include trimming turned out to require changes to many more files
- Rebase on v7.0-rc1
- Link to v1: https://lore.kernel.org/r/20260116-vdso-compat-checkflags-v1-0-4a83b4fbb0d3@linutronix.de
---
Thomas Weißschuh (5):
x86/vdso: Use 32-bit CHECKFLAGS for compat vDSO
sparc64: vdso: Use 32-bit CHECKFLAGS for compat vDSO
s390: Add -m64 to KBUILD_CPPFLAGS
powerpc/audit: directly include unistd_32.h from compat_audit.c
asm-generic/bitsperlong.h: Add sanity checks for __BITS_PER_LONG
arch/powerpc/kernel/compat_audit.c | 3 +--
arch/s390/Makefile | 3 +--
arch/sparc/vdso/Makefile | 3 +++
arch/x86/entry/vdso/vdso32/Makefile | 4 ++++
include/asm-generic/bitsperlong.h | 9 +++++++++
5 files changed, 18 insertions(+), 4 deletions(-)
---
base-commit: 740f1913cfa0d48222760eaa438c509ca9fc3710
change-id: 20251107-vdso-compat-checkflags-5db75b3b4bac
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@linutronix.de>
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
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
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
© 2016 - 2026 Red Hat, Inc.