From a01b5c9f91adaee088a817861603a5dbe14775c2 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Fri, 01 Nov 2024 02:40:28 +0000
Subject: [PATCH] rootfs patch
---
kernel/arch/x86/entry/common.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/kernel/arch/x86/entry/common.c b/kernel/arch/x86/entry/common.c
index 93a3122..9fdc77a 100644
--- a/kernel/arch/x86/entry/common.c
+++ b/kernel/arch/x86/entry/common.c
@@ -40,6 +40,15 @@
{
nr = syscall_enter_from_user_mode(regs, nr);
+ if (dovetailing()) {
+ if (nr == EXIT_SYSCALL_OOB) {
+ hard_local_irq_disable();
+ return;
+ }
+ if (nr == EXIT_SYSCALL_TAIL)
+ goto done;
+ }
+
instrumentation_begin();
if (likely(nr < NR_syscalls)) {
nr = array_index_nospec(nr, NR_syscalls);
@@ -53,6 +62,7 @@
#endif
}
instrumentation_end();
+done:
syscall_exit_to_user_mode(regs);
}
#endif
@@ -89,11 +99,22 @@
* or may not be necessary, but it matches the old asm behavior.
*/
nr = (unsigned int)syscall_enter_from_user_mode(regs, nr);
+
+ if (dovetailing()) {
+ if (nr == EXIT_SYSCALL_OOB) {
+ hard_local_irq_disable();
+ return;
+ }
+ if (nr == EXIT_SYSCALL_TAIL)
+ goto done;
+ }
+
instrumentation_begin();
do_syscall_32_irqs_on(regs, nr);
instrumentation_end();
+done:
syscall_exit_to_user_mode(regs);
}
@@ -136,9 +157,20 @@
/* The case truncates any ptrace induced syscall nr > 2^32 -1 */
nr = (unsigned int)syscall_enter_from_user_mode_work(regs, nr);
+ if (dovetailing()) {
+ if (nr == EXIT_SYSCALL_OOB) {
+ instrumentation_end();
+ hard_local_irq_disable();
+ return true;
+ }
+ if (nr == EXIT_SYSCALL_TAIL)
+ goto done;
+ }
+
/* Now this is just like a normal syscall. */
do_syscall_32_irqs_on(regs, nr);
+done:
instrumentation_end();
syscall_exit_to_user_mode(regs);
return true;
--
Gitblit v1.6.2