[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1433857975-8656-2-git-send-email-dvlasenk@redhat.com>
Date: Tue, 9 Jun 2015 15:52:55 +0200
From: Denys Vlasenko <dvlasenk@...hat.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: Denys Vlasenko <dvlasenk@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Steven Rostedt <rostedt@...dmis.org>,
Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...capital.net>,
Oleg Nesterov <oleg@...hat.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Alexei Starovoitov <ast@...mgrid.com>,
Will Drewry <wad@...omium.org>,
Kees Cook <keescook@...omium.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] x86/asm/entry/32: Shorten __audit_syscall_entry args preparation
We use three MOVs to swap edx and ecx. We can use one XCHG instead.
Expand the comments. It's difficult to keep track which arg# every register
corresponds to, so spell it out.
Signed-off-by: Denys Vlasenko <dvlasenk@...hat.com>
CC: Linus Torvalds <torvalds@...ux-foundation.org>
CC: Steven Rostedt <rostedt@...dmis.org>
CC: Ingo Molnar <mingo@...nel.org>
CC: Borislav Petkov <bp@...en8.de>
CC: "H. Peter Anvin" <hpa@...or.com>
CC: Andy Lutomirski <luto@...capital.net>
CC: Oleg Nesterov <oleg@...hat.com>
CC: Frederic Weisbecker <fweisbec@...il.com>
CC: Alexei Starovoitov <ast@...mgrid.com>
CC: Will Drewry <wad@...omium.org>
CC: Kees Cook <keescook@...omium.org>
CC: x86@...nel.org
CC: linux-kernel@...r.kernel.org
---
arch/x86/entry/entry_64_compat.S | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
index 411407a..d0b6494 100644
--- a/arch/x86/entry/entry_64_compat.S
+++ b/arch/x86/entry/entry_64_compat.S
@@ -178,12 +178,16 @@ sysexit_from_sys_call:
#ifdef CONFIG_AUDITSYSCALL
.macro auditsys_entry_common
- movl %esi, %r8d /* 5th arg: 4th syscall arg */
- movl %ecx, %r9d /* swap with edx */
- movl %edx, %ecx /* 4th arg: 3rd syscall arg */
- movl %r9d, %edx /* 3rd arg: 2nd syscall arg */
- movl %ebx, %esi /* 2nd arg: 1st syscall arg */
- movl %eax, %edi /* 1st arg: syscall number */
+ /*
+ * At this point, registers hold syscall args in 32-bit ABI:
+ * eax is syscall#, args are in ebx,ecx,edx,esi,edi,ebp.
+ * Shuffle them to match what __audit_syscall_entry() wants.
+ */
+ movl %esi, %r8d /* arg5 (r8): 4th syscall arg */
+ xchg %ecx, %edx /* arg4 (rcx): 3rd syscall arg (edx) */
+ /* arg3 (rdx): 2nd syscall arg (ecx) */
+ movl %ebx, %esi /* arg2 (rsi): 1st syscall arg */
+ movl %eax, %edi /* arg1 (rdi): syscall number */
call __audit_syscall_entry
/*
* We are going to jump back to syscall dispatch.
--
1.8.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists