lkml.org 
[lkml]   [2024]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] x86/vdso: add rcx clobber in syscall gettimeofday fallback
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;
}
\
 
 \ /
  Last update: 2024-05-27 18:24    [W:0.044 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site