]> Git Repo - linux.git/commitdiff
x86/asm/entry/32: Open-code CLEAR_RREGS
authorDenys Vlasenko <[email protected]>
Tue, 2 Jun 2015 19:04:01 +0000 (21:04 +0200)
committerIngo Molnar <[email protected]>
Fri, 5 Jun 2015 11:22:22 +0000 (13:22 +0200)
This macro is small, has only four callsites, and one of them is
slightly different using a conditional parameter.

A few saved lines aren't worth the resulting obfuscation.

Generated machine code is identical.

Signed-off-by: Denys Vlasenko <[email protected]>
[ Added comments. ]
Cc: Alexei Starovoitov <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Will Drewry <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/entry/ia32entry.S

index f00a409dc403047c2dc8045fc67eae0356bd3107..8a45d2cd2beffe57ae7b0617a7a2d32a052ca4a8 100644 (file)
 
        .section .entry.text, "ax"
 
-       /* clobbers %rax */
-       .macro  CLEAR_RREGS _r9=rax
-       xorl    %eax,%eax
-       movq    %rax,R11(%rsp)
-       movq    %rax,R10(%rsp)
-       movq    %\_r9,R9(%rsp)
-       movq    %rax,R8(%rsp)
-       .endm
-
        /*
         * Reload arg registers from stack in case ptrace changed them.
         * We don't reload %eax because syscall_trace_enter() returned
@@ -243,7 +234,11 @@ sysexit_from_sys_call:
        TRACE_IRQS_OFF
        testl %edi, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
        jz \exit
-       CLEAR_RREGS
+       xorl    %eax, %eax      /* do not leak kernel information */
+       movq    %rax, R11(%rsp)
+       movq    %rax, R10(%rsp)
+       movq    %rax, R9(%rsp)
+       movq    %rax, R8(%rsp)
        jmp int_with_check
        .endm
 
@@ -267,7 +262,11 @@ sysenter_tracesys:
        jz      sysenter_auditsys
 #endif
        SAVE_EXTRA_REGS
-       CLEAR_RREGS
+       xorl    %eax, %eax      /* do not leak kernel information */
+       movq    %rax, R11(%rsp)
+       movq    %rax, R10(%rsp)
+       movq    %rax, R9(%rsp)
+       movq    %rax, R8(%rsp)
        movq    %rsp,%rdi        /* &pt_regs -> arg1 */
        call    syscall_trace_enter
        LOAD_ARGS32  /* reload args from stack in case ptrace changed it */
@@ -407,7 +406,11 @@ cstar_tracesys:
 #endif
        xchgl %r9d,%ebp
        SAVE_EXTRA_REGS
-       CLEAR_RREGS r9
+       xorl    %eax, %eax      /* do not leak kernel information */
+       movq    %rax, R11(%rsp)
+       movq    %rax, R10(%rsp)
+       movq    %r9,  R9(%rsp)
+       movq    %rax, R8(%rsp)
        movq %rsp,%rdi        /* &pt_regs -> arg1 */
        call syscall_trace_enter
        LOAD_ARGS32 1   /* reload args from stack in case ptrace changed it */
@@ -422,7 +425,11 @@ ia32_badarg:
        jmp ia32_sysret
 
 ia32_ret_from_sys_call:
-       CLEAR_RREGS
+       xorl    %eax, %eax      /* do not leak kernel information */
+       movq    %rax, R11(%rsp)
+       movq    %rax, R10(%rsp)
+       movq    %rax, R9(%rsp)
+       movq    %rax, R8(%rsp)
        jmp int_ret_from_sys_call
 
 /*
This page took 0.055794 seconds and 4 git commands to generate.