]> git.itanic.dy.fi Git - linux-stable/commitdiff
x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list
authorAmmar Faizi <ammarfaizi2@gnuweeb.org>
Fri, 23 Dec 2022 17:23:38 +0000 (00:23 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 15:44:10 +0000 (16:44 +0100)
[ Upstream commit 5541992e512de8c9133110809f767bd1b54ee10d ]

The 'syscall' instruction clobbers '%rcx' and '%r11', but they are not
listed in the inline Assembly that performs the syscall instruction.

No real bug is found. It wasn't buggy by luck because '%rcx' and '%r11'
are caller-saved registers, and not used in the functions, and the
functions are never inlined.

Add them to the clobber list for code correctness.

Fixes: f1c2bb8b9964ed31de988910f8b1cfb586d30091 ("um: implement a x86_64 vDSO")
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/um/vdso/um_vdso.c

index 891868756a51fed9f22c7f3ddfdc38c8ef4503d4..6d5269093f7cef4d17bc205e65c205321f4ce641 100644 (file)
@@ -17,8 +17,10 @@ int __vdso_clock_gettime(clockid_t clock, struct timespec *ts)
 {
        long ret;
 
-       asm("syscall" : "=a" (ret) :
-               "0" (__NR_clock_gettime), "D" (clock), "S" (ts) : "memory");
+       asm("syscall"
+               : "=a" (ret)
+               : "0" (__NR_clock_gettime), "D" (clock), "S" (ts)
+               : "rcx", "r11", "memory");
 
        return ret;
 }
@@ -29,8 +31,10 @@ int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
 {
        long ret;
 
-       asm("syscall" : "=a" (ret) :
-               "0" (__NR_gettimeofday), "D" (tv), "S" (tz) : "memory");
+       asm("syscall"
+               : "=a" (ret)
+               : "0" (__NR_gettimeofday), "D" (tv), "S" (tz)
+               : "rcx", "r11", "memory");
 
        return ret;
 }