* [PATCH] x86/vdso: add rcx clobber in syscall gettimeofday fallback
@ 2024-05-12 4:55 Alexey Dobriyan
0 siblings, 0 replies; only message in thread
From: Alexey Dobriyan @ 2024-05-12 4:55 UTC (permalink / raw
To: Thomas Gleixner; +Cc: linux-kernel, Vincenzo Frascino, Andy Lutomirski
syscall instruction in fallback code is missing "rcx" and "r11" clobbers.
It doesn't seem to cause any problems because the C code looks like:
if (do_hres(&vd[CS_HRES_COARSE], CLOCK_REALTIME, &ts))
return gettimeofday_fallback(tv, tz);
and assembly looks like
__vdso_gettimeofday:
0: lea r9, [rip]
7: test rdi,rdi
a: je b7
10: mov r8d, [r9]
13: test r8b, 1
17: jne bf
1d: cmp [rip], 1
24: jne c6
2a: rdtsc
c6: mov eax, 96
cb: syscall
====> cd: ret <====
rcx and r11 are caller-saved and nothing seems to use those registers
after syscall and before returning from vDSO.
Fixes: 7ac870747988 ("x86/vdso: Switch to generic vDSO implementation")
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
arch/x86/include/asm/vdso/gettimeofday.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/x86/include/asm/vdso/gettimeofday.h
+++ b/arch/x86/include/asm/vdso/gettimeofday.h
@@ -86,7 +86,7 @@ long gettimeofday_fallback(struct __kernel_old_timeval *_tv,
long ret;
asm("syscall" : "=a" (ret) :
- "0" (__NR_gettimeofday), "D" (_tv), "S" (_tz) : "memory");
+ "0" (__NR_gettimeofday), "D" (_tv), "S" (_tz) : "rcx", "r11", "memory");
return ret;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-12 4:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-12 4:55 [PATCH] x86/vdso: add rcx clobber in syscall gettimeofday fallback Alexey Dobriyan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).