* [PATCH] x86/vdso: use calll mnemonic for 32-bit vdso calls
@ 2026-02-15 14:28 Marcel W. Wysocki
2026-02-17 9:08 ` H. Peter Anvin
0 siblings, 1 reply; 2+ messages in thread
From: Marcel W. Wysocki @ 2026-02-15 14:28 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86
Cc: H. Peter Anvin, Nathan Chancellor, linux-kernel, llvm,
Marcel W . Wysocki
The VDSO32 fallback functions use unsuffixed "call" in inline asm
that is compiled in 32-bit mode (-m32). In AT&T syntax, the
unsuffixed "call" is ambiguous -- the assembler must infer the
operand size from context.
While both GNU as and the standard LLVM integrated assembler handle
this correctly in practice, the unsuffixed form is inconsistent with
other 32-bit assembly in the kernel tree (arch/x86/boot/header.S,
arch/x86/boot/copy.S, arch/x86/realmode/rm/wakeup_asm.S) which
already uses the explicit "calll" mnemonic.
More importantly, alternative LLVM-based toolchains (e.g. zig cc)
contain a separate assembler implementation that rejects unsuffixed
"call" in 32-bit inline asm context, preventing VDSO32 compilation
entirely.
Use "calll" -- the canonical AT&T mnemonic for a 32-bit near call
-- to match existing kernel convention and ensure compatibility
with all LLVM-based assemblers.
No object code change: "call" and "calll" produce identical machine
code (opcode E8h with 32-bit relative displacement) on all tested
assemblers (GNU as, LLVM 21, LLVM 20).
Signed-off-by: Marcel W. Wysocki <maci.stgn@gmail.com>
---
arch/x86/include/asm/vdso/gettimeofday.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/include/asm/vdso/gettimeofday.h b/arch/x86/include/asm/vdso/gettimeofday.h
--- a/arch/x86/include/asm/vdso/gettimeofday.h
+++ b/arch/x86/include/asm/vdso/gettimeofday.h
@@ -101,7 +101,7 @@
asm (
"mov %%ebx, %%edx \n"
"mov %[clock], %%ebx \n"
- "call __kernel_vsyscall \n"
+ "calll __kernel_vsyscall \n"
"mov %%edx, %%ebx \n"
: "=a" (ret), "=m" (*_ts)
: "0" (__NR_clock_gettime64), [clock] "g" (_clkid), "c" (_ts)
@@ -118,7 +118,7 @@
asm (
"mov %%ebx, %%edx \n"
"mov %[clock], %%ebx \n"
- "call __kernel_vsyscall \n"
+ "calll __kernel_vsyscall \n"
"mov %%edx, %%ebx \n"
: "=a" (ret), "=m" (*_ts)
: "0" (__NR_clock_gettime), [clock] "g" (_clkid), "c" (_ts)
@@ -136,7 +136,7 @@
asm(
"mov %%ebx, %%edx \n"
"mov %2, %%ebx \n"
- "call __kernel_vsyscall \n"
+ "calll __kernel_vsyscall \n"
"mov %%edx, %%ebx \n"
: "=a" (ret)
: "0" (__NR_gettimeofday), "g" (_tv), "c" (_tz)
@@ -153,7 +153,7 @@
asm (
"mov %%ebx, %%edx \n"
"mov %[clock], %%ebx \n"
- "call __kernel_vsyscall \n"
+ "calll __kernel_vsyscall \n"
"mov %%edx, %%ebx \n"
: "=a" (ret), "=m" (*_ts)
: "0" (__NR_clock_getres_time64), [clock] "g" (_clkid), "c" (_ts)
@@ -170,7 +170,7 @@
asm (
"mov %%ebx, %%edx \n"
"mov %[clock], %%ebx \n"
- "call __kernel_vsyscall \n"
+ "calll __kernel_vsyscall \n"
"mov %%edx, %%ebx \n"
: "=a" (ret), "=m" (*_ts)
: "0" (__NR_clock_getres), [clock] "g" (_clkid), "c" (_ts)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/vdso: use calll mnemonic for 32-bit vdso calls
2026-02-15 14:28 [PATCH] x86/vdso: use calll mnemonic for 32-bit vdso calls Marcel W. Wysocki
@ 2026-02-17 9:08 ` H. Peter Anvin
0 siblings, 0 replies; 2+ messages in thread
From: H. Peter Anvin @ 2026-02-17 9:08 UTC (permalink / raw)
To: Marcel W. Wysocki, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86
Cc: Nathan Chancellor, linux-kernel, llvm, Marcel W . Wysocki
On February 15, 2026 6:28:34 AM PST, "Marcel W. Wysocki" <maci.stgn@gmail.com> wrote:
>The VDSO32 fallback functions use unsuffixed "call" in inline asm
>that is compiled in 32-bit mode (-m32). In AT&T syntax, the
>unsuffixed "call" is ambiguous -- the assembler must infer the
>operand size from context.
>
>While both GNU as and the standard LLVM integrated assembler handle
>this correctly in practice, the unsuffixed form is inconsistent with
>other 32-bit assembly in the kernel tree (arch/x86/boot/header.S,
>arch/x86/boot/copy.S, arch/x86/realmode/rm/wakeup_asm.S) which
>already uses the explicit "calll" mnemonic.
>
>More importantly, alternative LLVM-based toolchains (e.g. zig cc)
>contain a separate assembler implementation that rejects unsuffixed
>"call" in 32-bit inline asm context, preventing VDSO32 compilation
>entirely.
>
>Use "calll" -- the canonical AT&T mnemonic for a 32-bit near call
>-- to match existing kernel convention and ensure compatibility
>with all LLVM-based assemblers.
>
>No object code change: "call" and "calll" produce identical machine
>code (opcode E8h with 32-bit relative displacement) on all tested
>assemblers (GNU as, LLVM 21, LLVM 20).
>
>Signed-off-by: Marcel W. Wysocki <maci.stgn@gmail.com>
>---
> arch/x86/include/asm/vdso/gettimeofday.h | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/arch/x86/include/asm/vdso/gettimeofday.h b/arch/x86/include/asm/vdso/gettimeofday.h
>--- a/arch/x86/include/asm/vdso/gettimeofday.h
>+++ b/arch/x86/include/asm/vdso/gettimeofday.h
>@@ -101,7 +101,7 @@
> asm (
> "mov %%ebx, %%edx \n"
> "mov %[clock], %%ebx \n"
>- "call __kernel_vsyscall \n"
>+ "calll __kernel_vsyscall \n"
> "mov %%edx, %%ebx \n"
> : "=a" (ret), "=m" (*_ts)
> : "0" (__NR_clock_gettime64), [clock] "g" (_clkid), "c" (_ts)
>@@ -118,7 +118,7 @@
> asm (
> "mov %%ebx, %%edx \n"
> "mov %[clock], %%ebx \n"
>- "call __kernel_vsyscall \n"
>+ "calll __kernel_vsyscall \n"
> "mov %%edx, %%ebx \n"
> : "=a" (ret), "=m" (*_ts)
> : "0" (__NR_clock_gettime), [clock] "g" (_clkid), "c" (_ts)
>@@ -136,7 +136,7 @@
> asm(
> "mov %%ebx, %%edx \n"
> "mov %2, %%ebx \n"
>- "call __kernel_vsyscall \n"
>+ "calll __kernel_vsyscall \n"
> "mov %%edx, %%ebx \n"
> : "=a" (ret)
> : "0" (__NR_gettimeofday), "g" (_tv), "c" (_tz)
>@@ -153,7 +153,7 @@
> asm (
> "mov %%ebx, %%edx \n"
> "mov %[clock], %%ebx \n"
>- "call __kernel_vsyscall \n"
>+ "calll __kernel_vsyscall \n"
> "mov %%edx, %%ebx \n"
> : "=a" (ret), "=m" (*_ts)
> : "0" (__NR_clock_getres_time64), [clock] "g" (_clkid), "c" (_ts)
>@@ -170,7 +170,7 @@
> asm (
> "mov %%ebx, %%edx \n"
> "mov %[clock], %%ebx \n"
>- "call __kernel_vsyscall \n"
>+ "calll __kernel_vsyscall \n"
> "mov %%edx, %%ebx \n"
> : "=a" (ret), "=m" (*_ts)
> : "0" (__NR_clock_getres), [clock] "g" (_clkid), "c" (_ts)
The "calll" instances you are pointing at are in *16-bit* code, which therefore need the extra l suffix.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-17 9:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-15 14:28 [PATCH] x86/vdso: use calll mnemonic for 32-bit vdso calls Marcel W. Wysocki
2026-02-17 9:08 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®