|
16 | 16 | #include <linux/linkage.h>
|
17 | 17 | #include <linux/err.h>
|
18 | 18 |
|
19 |
| -/* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ |
20 |
| -#include <linux/elf-em.h> |
21 |
| -#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) |
22 |
| -#define __AUDIT_ARCH_LE 0x40000000 |
23 |
| - |
24 |
| -#ifndef CONFIG_AUDITSYSCALL |
25 |
| -# define sysexit_audit ia32_ret_from_sys_call_irqs_off |
26 |
| -# define sysretl_audit ia32_ret_from_sys_call_irqs_off |
27 |
| -#endif |
28 |
| - |
29 | 19 | .section .entry.text, "ax"
|
30 | 20 |
|
31 | 21 | #ifdef CONFIG_PARAVIRT
|
@@ -148,7 +138,7 @@ sysenter_dispatch:
|
148 | 138 | DISABLE_INTERRUPTS(CLBR_NONE)
|
149 | 139 | TRACE_IRQS_OFF
|
150 | 140 | testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
|
151 |
| - jnz sysexit_audit |
| 141 | + jnz ia32_ret_from_sys_call_irqs_off |
152 | 142 | sysexit_from_sys_call:
|
153 | 143 | /*
|
154 | 144 | * NB: SYSEXIT is not obviously safe for 64-bit kernels -- an
|
@@ -200,81 +190,12 @@ sysexit_from_sys_call:
|
200 | 190 | */
|
201 | 191 | USERGS_SYSRET32
|
202 | 192 |
|
203 |
| -#ifdef CONFIG_AUDITSYSCALL |
204 |
| - .macro auditsys_entry_common |
205 |
| - /* |
206 |
| - * At this point, registers hold syscall args in the 32-bit syscall ABI: |
207 |
| - * EAX is syscall number, the 6 args are in EBX,ECX,EDX,ESI,EDI,EBP. |
208 |
| - * |
209 |
| - * We want to pass them to __audit_syscall_entry(), which is a 64-bit |
210 |
| - * C function with 5 parameters, so shuffle them to match what |
211 |
| - * the function expects: RDI,RSI,RDX,RCX,R8. |
212 |
| - */ |
213 |
| - movl %esi, %r8d /* arg5 (R8 ) <= 4th syscall arg (ESI) */ |
214 |
| - xchg %ecx, %edx /* arg4 (RCX) <= 3rd syscall arg (EDX) */ |
215 |
| - /* arg3 (RDX) <= 2nd syscall arg (ECX) */ |
216 |
| - movl %ebx, %esi /* arg2 (RSI) <= 1st syscall arg (EBX) */ |
217 |
| - movl %eax, %edi /* arg1 (RDI) <= syscall number (EAX) */ |
218 |
| - call __audit_syscall_entry |
219 |
| - |
220 |
| - /* |
221 |
| - * We are going to jump back to the syscall dispatch code. |
222 |
| - * Prepare syscall args as required by the 64-bit C ABI. |
223 |
| - * Registers clobbered by __audit_syscall_entry() are |
224 |
| - * loaded from pt_regs on stack: |
225 |
| - */ |
226 |
| - movl ORIG_RAX(%rsp), %eax /* syscall number */ |
227 |
| - movl %ebx, %edi /* arg1 */ |
228 |
| - movl RCX(%rsp), %esi /* arg2 */ |
229 |
| - movl RDX(%rsp), %edx /* arg3 */ |
230 |
| - movl RSI(%rsp), %ecx /* arg4 */ |
231 |
| - movl RDI(%rsp), %r8d /* arg5 */ |
232 |
| - .endm |
233 |
| - |
234 |
| - .macro auditsys_exit exit |
235 |
| - TRACE_IRQS_ON |
236 |
| - ENABLE_INTERRUPTS(CLBR_NONE) |
237 |
| - testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
238 |
| - jnz ia32_ret_from_sys_call |
239 |
| - movl %eax, %esi /* second arg, syscall return value */ |
240 |
| - cmpl $-MAX_ERRNO, %eax /* is it an error ? */ |
241 |
| - jbe 1f |
242 |
| - movslq %eax, %rsi /* if error sign extend to 64 bits */ |
243 |
| -1: setbe %al /* 1 if error, 0 if not */ |
244 |
| - movzbl %al, %edi /* zero-extend that into %edi */ |
245 |
| - call __audit_syscall_exit |
246 |
| - movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %edi |
247 |
| - DISABLE_INTERRUPTS(CLBR_NONE) |
248 |
| - TRACE_IRQS_OFF |
249 |
| - testl %edi, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
250 |
| - jz \exit |
251 |
| - xorl %eax, %eax /* Do not leak kernel information */ |
252 |
| - movq %rax, R11(%rsp) |
253 |
| - movq %rax, R10(%rsp) |
254 |
| - movq %rax, R9(%rsp) |
255 |
| - movq %rax, R8(%rsp) |
256 |
| - jmp int_ret_from_sys_call_irqs_off |
257 |
| - .endm |
258 |
| - |
259 |
| -sysenter_auditsys: |
260 |
| - auditsys_entry_common |
261 |
| - movl %ebp, %r9d /* reload 6th syscall arg */ |
262 |
| - jmp sysenter_dispatch |
263 |
| - |
264 |
| -sysexit_audit: |
265 |
| - auditsys_exit sysexit_from_sys_call |
266 |
| -#endif |
267 |
| - |
268 | 193 | sysenter_fix_flags:
|
269 | 194 | pushq $X86_EFLAGS_FIXED
|
270 | 195 | popfq
|
271 | 196 | jmp sysenter_flags_fixed
|
272 | 197 |
|
273 | 198 | sysenter_tracesys:
|
274 |
| -#ifdef CONFIG_AUDITSYSCALL |
275 |
| - testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
276 |
| - jz sysenter_auditsys |
277 |
| -#endif |
278 | 199 | SAVE_EXTRA_REGS
|
279 | 200 | xorl %eax, %eax /* Do not leak kernel information */
|
280 | 201 | movq %rax, R11(%rsp)
|
@@ -389,7 +310,7 @@ cstar_dispatch:
|
389 | 310 | DISABLE_INTERRUPTS(CLBR_NONE)
|
390 | 311 | TRACE_IRQS_OFF
|
391 | 312 | testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
|
392 |
| - jnz sysretl_audit |
| 313 | + jnz ia32_ret_from_sys_call_irqs_off |
393 | 314 |
|
394 | 315 | sysretl_from_sys_call:
|
395 | 316 | andl $~TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS)
|
@@ -420,22 +341,7 @@ sysretl_from_sys_call:
|
420 | 341 | */
|
421 | 342 | USERGS_SYSRET32
|
422 | 343 |
|
423 |
| -#ifdef CONFIG_AUDITSYSCALL |
424 |
| -cstar_auditsys: |
425 |
| - movl %r9d, R9(%rsp) /* register to be clobbered by call */ |
426 |
| - auditsys_entry_common |
427 |
| - movl R9(%rsp), %r9d /* reload 6th syscall arg */ |
428 |
| - jmp cstar_dispatch |
429 |
| - |
430 |
| -sysretl_audit: |
431 |
| - auditsys_exit sysretl_from_sys_call |
432 |
| -#endif |
433 |
| - |
434 | 344 | cstar_tracesys:
|
435 |
| -#ifdef CONFIG_AUDITSYSCALL |
436 |
| - testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
437 |
| - jz cstar_auditsys |
438 |
| -#endif |
439 | 345 | xchgl %r9d, %ebp
|
440 | 346 | SAVE_EXTRA_REGS
|
441 | 347 | xorl %eax, %eax /* Do not leak kernel information */
|
|
0 commit comments