hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/arch/x86/entry/common.c
....@@ -40,6 +40,15 @@
4040 {
4141 nr = syscall_enter_from_user_mode(regs, nr);
4242
43
+ if (dovetailing()) {
44
+ if (nr == EXIT_SYSCALL_OOB) {
45
+ hard_local_irq_disable();
46
+ return;
47
+ }
48
+ if (nr == EXIT_SYSCALL_TAIL)
49
+ goto done;
50
+ }
51
+
4352 instrumentation_begin();
4453 if (likely(nr < NR_syscalls)) {
4554 nr = array_index_nospec(nr, NR_syscalls);
....@@ -53,6 +62,7 @@
5362 #endif
5463 }
5564 instrumentation_end();
65
+done:
5666 syscall_exit_to_user_mode(regs);
5767 }
5868 #endif
....@@ -89,11 +99,22 @@
8999 * or may not be necessary, but it matches the old asm behavior.
90100 */
91101 nr = (unsigned int)syscall_enter_from_user_mode(regs, nr);
102
+
103
+ if (dovetailing()) {
104
+ if (nr == EXIT_SYSCALL_OOB) {
105
+ hard_local_irq_disable();
106
+ return;
107
+ }
108
+ if (nr == EXIT_SYSCALL_TAIL)
109
+ goto done;
110
+ }
111
+
92112 instrumentation_begin();
93113
94114 do_syscall_32_irqs_on(regs, nr);
95115
96116 instrumentation_end();
117
+done:
97118 syscall_exit_to_user_mode(regs);
98119 }
99120
....@@ -136,9 +157,20 @@
136157 /* The case truncates any ptrace induced syscall nr > 2^32 -1 */
137158 nr = (unsigned int)syscall_enter_from_user_mode_work(regs, nr);
138159
160
+ if (dovetailing()) {
161
+ if (nr == EXIT_SYSCALL_OOB) {
162
+ instrumentation_end();
163
+ hard_local_irq_disable();
164
+ return true;
165
+ }
166
+ if (nr == EXIT_SYSCALL_TAIL)
167
+ goto done;
168
+ }
169
+
139170 /* Now this is just like a normal syscall. */
140171 do_syscall_32_irqs_on(regs, nr);
141172
173
+done:
142174 instrumentation_end();
143175 syscall_exit_to_user_mode(regs);
144176 return true;