[PATCH 5.15 36/89] x86/vsyscall_emu/64: Dont use RET in vsyscall emulation

From: Greg Kroah-Hartman
Date: Fri Jul 22 2022 - 05:21:54 EST


From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>

commit 15583e514eb16744b80be85dea0774ece153177d upstream.

This is userspace code and doesn't play by the normal kernel rules.

Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Signed-off-by: Borislav Petkov <bp@xxxxxxx>
Reviewed-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Signed-off-by: Borislav Petkov <bp@xxxxxxx>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
arch/x86/entry/vsyscall/vsyscall_emu_64.S | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

--- a/arch/x86/entry/vsyscall/vsyscall_emu_64.S
+++ b/arch/x86/entry/vsyscall/vsyscall_emu_64.S
@@ -19,17 +19,20 @@ __vsyscall_page:

mov $__NR_gettimeofday, %rax
syscall
- RET
+ ret
+ int3

.balign 1024, 0xcc
mov $__NR_time, %rax
syscall
- RET
+ ret
+ int3

.balign 1024, 0xcc
mov $__NR_getcpu, %rax
syscall
- RET
+ ret
+ int3

.balign 4096, 0xcc