[PATCH 2/4] x86/vdso: Use 32-bit CHECKFLAGS for compat vDSO

Thomas Weißschuh posted 4 patches 3 weeks, 3 days ago
[PATCH 2/4] x86/vdso: Use 32-bit CHECKFLAGS for compat vDSO
Posted by Thomas Weißschuh 3 weeks, 3 days ago
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/
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 arch/x86/entry/vdso/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index f247f5f5cb44..ab571ad9b9ac 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -142,7 +142,10 @@ ifneq ($(RETPOLINE_VDSO_CFLAGS),)
 endif
 endif
 
+CHECKFLAGS_32 := $(CHECKFLAGS) -U__x86_64__ -D__i386__ -m32
+
 $(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
+$(obj)/vdso32.so.dbg: CHECKFLAGS = $(CHECKFLAGS_32)
 
 $(obj)/vdso32.so.dbg: $(obj)/vdso32/vdso32.lds $(vobjs32) FORCE
 	$(call if_changed,vdso_and_check)

-- 
2.52.0

Re: [PATCH 2/4] x86/vdso: Use 32-bit CHECKFLAGS for compat vDSO
Posted by Thomas Gleixner 3 weeks, 1 day ago
On Fri, Jan 16 2026 at 08:40, Thomas Weißschuh wrote:
> Manually override the CHECKFLAGS for the compat vDSO with the correct
> 32-bit configuration.

Fun. I just fixed the same thing half an hour ago:

   https://lore.kernel.org/lkml/20260117215542.342638347@kernel.org/

> Reported-by: Sun Jian <sun.jian.kdev@gmail.com>
> Closes: https://lore.kernel.org/lkml/20260114084529.1676356-1-sun.jian.kdev@gmail.com/
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
>  arch/x86/entry/vdso/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
> index f247f5f5cb44..ab571ad9b9ac 100644
> --- a/arch/x86/entry/vdso/Makefile
> +++ b/arch/x86/entry/vdso/Makefile
> @@ -142,7 +142,10 @@ ifneq ($(RETPOLINE_VDSO_CFLAGS),)
>  endif
>  endif
>  
> +CHECKFLAGS_32 := $(CHECKFLAGS) -U__x86_64__ -D__i386__ -m32

Hmm. That keeps -m64. Seems not to matter much, but substituting both
seems to be more correct.

Thanks,

        tglx
Re: [PATCH 2/4] x86/vdso: Use 32-bit CHECKFLAGS for compat vDSO
Posted by Thomas Weißschuh 3 weeks ago
On Sat, Jan 17, 2026 at 11:05:05PM +0100, Thomas Gleixner wrote:
> On Fri, Jan 16 2026 at 08:40, Thomas Weißschuh wrote:
> > Manually override the CHECKFLAGS for the compat vDSO with the correct
> > 32-bit configuration.
> 
> Fun. I just fixed the same thing half an hour ago:
> 
>    https://lore.kernel.org/lkml/20260117215542.342638347@kernel.org/

Assuming you are going to apply your patches bevore, can I respin my
remaining patches on top of tip/x86/entry?

> > Reported-by: Sun Jian <sun.jian.kdev@gmail.com>
> > Closes: https://lore.kernel.org/lkml/20260114084529.1676356-1-sun.jian.kdev@gmail.com/
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > ---
> >  arch/x86/entry/vdso/Makefile | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
> > index f247f5f5cb44..ab571ad9b9ac 100644
> > --- a/arch/x86/entry/vdso/Makefile
> > +++ b/arch/x86/entry/vdso/Makefile
> > @@ -142,7 +142,10 @@ ifneq ($(RETPOLINE_VDSO_CFLAGS),)
> >  endif
> >  endif
> >  
> > +CHECKFLAGS_32 := $(CHECKFLAGS) -U__x86_64__ -D__i386__ -m32
> 
> Hmm. That keeps -m64. Seems not to matter much, but substituting both
> seems to be more correct.

Fair enough.


Thomas
Re: [PATCH 2/4] x86/vdso: Use 32-bit CHECKFLAGS for compat vDSO
Posted by H. Peter Anvin 2 weeks, 6 days ago
On 2026-01-18 23:20, Thomas Weißschuh wrote:
> On Sat, Jan 17, 2026 at 11:05:05PM +0100, Thomas Gleixner wrote:
>> On Fri, Jan 16 2026 at 08:40, Thomas Weißschuh wrote:
>>> Manually override the CHECKFLAGS for the compat vDSO with the correct
>>> 32-bit configuration.
>>
>> Fun. I just fixed the same thing half an hour ago:
>>
>>    https://lore.kernel.org/lkml/20260117215542.342638347@kernel.org/
> 
> Assuming you are going to apply your patches bevore, can I respin my
> remaining patches on top of tip/x86/entry?
> 

Please do.

	-hpa