lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date: Sun, 12 May 2024 07:55:28 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org,
	Vincenzo Frascino <vincenzo.frascino@....com>,
	Andy Lutomirski <luto@...nel.org>
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@...il.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;
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ