Skip to contentSkip to conversation

x86/entry: Fixlets after the big entry series

PATCH New Andy Lutomirski 2 participants 7 messages Oct 13, 2015 – Oct 14, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover x86/entry: Fixlets after the big entry series

Patch 1 fixes some style problems that Borislav noticed. Patch 2 deletes unused macros at Ingo's request. Patch 3 fixes the UML build. (I haven't confirmed that UML *works*, but that should be easy to check.)

Andy Lutomirski (3):
selftests/x86: Style fixes for unwind_vdso x86/asm: Remove the xyz_cfi macros from dwarf2.h
um: Fix build after x86 syscall changes

 arch/x86/include/asm/dwarf2.h             | 93 -------------------------------
 arch/x86/um/asm/syscall.h                 |  4 ++
 tools/testing/selftests/x86/unwind_vdso.c |  6 +-
 3 files changed, 8 insertions(+), 95 deletions(-)
Signature · 1 line
2.4.3
#1 lore raw

PATCH 1/3 selftests/x86: Style fixes for unwind_vdso

checkpatch is really quite bad for user code like this, but it caught two legit style issues.

---
 tools/testing/selftests/x86/unwind_vdso.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/testing/selftests/x86/unwind_vdso.c +4 -2
index 5992ff24ab83..00a26a82fa98 100644
@@ -134,7 +134,7 @@ _Unwind_Reason_Code trace_fn(struct _Unwind_Context * ctx, void *opaque)
 
 static void sigtrap(int sig, siginfo_t *info, void *ctx_void)
 {
-	ucontext_t *ctx = (ucontext_t*)ctx_void;
+	ucontext_t *ctx = (ucontext_t *)ctx_void;
 	struct unwind_state state;
 	unsigned long ip = ctx->uc_mcontext.gregs[REG_EIP];
 
@@ -192,7 +192,9 @@ int main()
 		 * affected by libc/19006 (https://sourceware.org/PR19006).
 		 */
 		printf("[WARN]\tsyscall(2) didn't enter AT_SYSINFO\n");
-	} if (get_eflags() & X86_EFLAGS_TF) {
+	}
+
+	if (get_eflags() & X86_EFLAGS_TF) {
 		printf("[FAIL]\tTF is still set\n");
 		nerrs++;
 	}
Signature · 1 line
2.4.3
#5 lore raw

PATCH 3/3 um: Fix build after x86 syscall changes

In reply to Andy Lutomirski

I didn't realize that um didn't include x86's asm/syscall.h. Re-add a missing typedef.

Fixes 034042cc1e28 ("x86/entry/syscalls: Move syscall table declarations into asm/syscalls.h")
---
 arch/x86/um/asm/syscall.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/um/asm/syscall.h +4 -0
index 9fe77b7b5a0e..81d6562ce01d 100644
@@ -3,6 +3,10 @@
 
 #include <uapi/linux/audit.h>
 
+typedef asmlinkage long (*sys_call_ptr_t)(unsigned long, unsigned long,
+					  unsigned long, unsigned long,
+					  unsigned long, unsigned long);
+
 static inline int syscall_get_arch(void)
 {
 #ifdef CONFIG_X86_32
Signature · 1 line
2.4.3
#3 lore raw

PATCH 2/3 x86/asm: Remove the xyz_cfi macros from dwarf2.h

In reply to Andy Lutomirski

They are currently unused, and I don't think that anyone was ever particularly happy with them. They had the unfortunate property that they made it easy to CFI-annotate things without thinking about them -- when pushing, do you want to just update the CFA offset, or do you also want to update the saved location of the register being pushed?

---
 arch/x86/include/asm/dwarf2.h | 93 -------------------------------------------
 1 file changed, 93 deletions(-)
arch/x86/include/asm/dwarf2.h +0 -93
index 09133ba032b3..b7a1ab865d68 100644
@@ -81,97 +81,4 @@
 
 #endif
 
-/*
- * An attempt to make CFI annotations more or less
- * correct and shorter. It is implied that you know
- * what you're doing if you use them.
- */
-#ifdef __ASSEMBLY__
-#ifdef CONFIG_X86_64
-	.macro pushq_cfi reg
-	pushq \reg
-	CFI_ADJUST_CFA_OFFSET 8
-	.endm
-
-	.macro pushq_cfi_reg reg
-	pushq %\reg
-	CFI_ADJUST_CFA_OFFSET 8
-	CFI_REL_OFFSET \reg, 0
-	.endm
-
-	.macro popq_cfi reg
-	popq \reg
-	CFI_ADJUST_CFA_OFFSET -8
-	.endm
-
-	.macro popq_cfi_reg reg
-	popq %\reg
-	CFI_ADJUST_CFA_OFFSET -8
-	CFI_RESTORE \reg
-	.endm
-
-	.macro pushfq_cfi
-	pushfq
-	CFI_ADJUST_CFA_OFFSET 8
-	.endm
-
-	.macro popfq_cfi
-	popfq
-	CFI_ADJUST_CFA_OFFSET -8
-	.endm
-
-	.macro movq_cfi reg offset=0
-	movq %\reg, \offset(%rsp)
-	CFI_REL_OFFSET \reg, \offset
-	.endm
-
-	.macro movq_cfi_restore offset reg
-	movq \offset(%rsp), %\reg
-	CFI_RESTORE \reg
-	.endm
-#else /*!CONFIG_X86_64*/
-	.macro pushl_cfi reg
-	pushl \reg
-	CFI_ADJUST_CFA_OFFSET 4
-	.endm
-
-	.macro pushl_cfi_reg reg
-	pushl %\reg
-	CFI_ADJUST_CFA_OFFSET 4
-	CFI_REL_OFFSET \reg, 0
-	.endm
-
-	.macro popl_cfi reg
-	popl \reg
-	CFI_ADJUST_CFA_OFFSET -4
-	.endm
-
-	.macro popl_cfi_reg reg
-	popl %\reg
-	CFI_ADJUST_CFA_OFFSET -4
-	CFI_RESTORE \reg
-	.endm
-
-	.macro pushfl_cfi
-	pushfl
-	CFI_ADJUST_CFA_OFFSET 4
-	.endm
-
-	.macro popfl_cfi
-	popfl
-	CFI_ADJUST_CFA_OFFSET -4
-	.endm
-
-	.macro movl_cfi reg offset=0
-	movl %\reg, \offset(%esp)
-	CFI_REL_OFFSET \reg, \offset
-	.endm
-
-	.macro movl_cfi_restore offset reg
-	movl \offset(%esp), %\reg
-	CFI_RESTORE \reg
-	.endm
-#endif /*!CONFIG_X86_64*/
-#endif /*__ASSEMBLY__*/
-
 #endif /* _ASM_X86_DWARF2_H */
Signature · 1 line
2.4.3
#2 lore raw

[tip:x86/asm] selftests/x86: Style fixes for the 'unwind_vdso' test

In reply to Andy Lutomirski
selftests/x86: Style fixes for the 'unwind_vdso' test
Commit-ID:  893a3ec27e1dae62a904f78d53244001979748a6
Gitweb:     http://git.kernel.org/tip/893a3ec27e1dae62a904f78d53244001979748a6
Author:     Andy Lutomirski <[email protected]>
AuthorDate: Mon, 12 Oct 2015 17:32:12 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 14 Oct 2015 16:56:28 +0200

selftests/x86: Style fixes for the 'unwind_vdso' test

Checkpatch is really quite bad for user code like this, but it caught two legit style issues.

---
 tools/testing/selftests/x86/unwind_vdso.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/testing/selftests/x86/unwind_vdso.c +4 -2
index 5992ff2..00a26a8 100644
@@ -134,7 +134,7 @@ _Unwind_Reason_Code trace_fn(struct _Unwind_Context * ctx, void *opaque)
 
 static void sigtrap(int sig, siginfo_t *info, void *ctx_void)
 {
-	ucontext_t *ctx = (ucontext_t*)ctx_void;
+	ucontext_t *ctx = (ucontext_t *)ctx_void;
 	struct unwind_state state;
 	unsigned long ip = ctx->uc_mcontext.gregs[REG_EIP];
 
@@ -192,7 +192,9 @@ int main()
 		 * affected by libc/19006 (https://sourceware.org/PR19006).
 		 */
 		printf("[WARN]\tsyscall(2) didn't enter AT_SYSINFO\n");
-	} if (get_eflags() & X86_EFLAGS_TF) {
+	}
+
+	if (get_eflags() & X86_EFLAGS_TF) {
 		printf("[FAIL]\tTF is still set\n");
 		nerrs++;
 	}
#4 lore raw

[tip:x86/asm] x86/asm: Remove the xyz_cfi macros from dwarf2.h

In reply to Andy Lutomirski
x86/asm: Remove the xyz_cfi macros from dwarf2.h
Commit-ID:  af22aa7c766d50712b9afeca53e9e4208ce6284c
Gitweb:     http://git.kernel.org/tip/af22aa7c766d50712b9afeca53e9e4208ce6284c
Author:     Andy Lutomirski <[email protected]>
AuthorDate: Mon, 12 Oct 2015 17:32:13 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 14 Oct 2015 16:56:28 +0200

x86/asm: Remove the xyz_cfi macros from dwarf2.h

They are currently unused, and I don't think that anyone was ever particularly happy with them. They had the unfortunate property that they made it easy to CFI-annotate things without thinking about them -- when pushing, do you want to just update the CFA offset, or do you also want to update the saved location of the register being pushed?

---
 arch/x86/include/asm/dwarf2.h | 93 -------------------------------------------
 1 file changed, 93 deletions(-)
arch/x86/include/asm/dwarf2.h +0 -93
index 09133ba..b7a1ab8 100644
@@ -81,97 +81,4 @@
 
 #endif
 
-/*
- * An attempt to make CFI annotations more or less
- * correct and shorter. It is implied that you know
- * what you're doing if you use them.
- */
-#ifdef __ASSEMBLY__
-#ifdef CONFIG_X86_64
-	.macro pushq_cfi reg
-	pushq \reg
-	CFI_ADJUST_CFA_OFFSET 8
-	.endm
-
-	.macro pushq_cfi_reg reg
-	pushq %\reg
-	CFI_ADJUST_CFA_OFFSET 8
-	CFI_REL_OFFSET \reg, 0
-	.endm
-
-	.macro popq_cfi reg
-	popq \reg
-	CFI_ADJUST_CFA_OFFSET -8
-	.endm
-
-	.macro popq_cfi_reg reg
-	popq %\reg
-	CFI_ADJUST_CFA_OFFSET -8
-	CFI_RESTORE \reg
-	.endm
-
-	.macro pushfq_cfi
-	pushfq
-	CFI_ADJUST_CFA_OFFSET 8
-	.endm
-
-	.macro popfq_cfi
-	popfq
-	CFI_ADJUST_CFA_OFFSET -8
-	.endm
-
-	.macro movq_cfi reg offset=0
-	movq %\reg, \offset(%rsp)
-	CFI_REL_OFFSET \reg, \offset
-	.endm
-
-	.macro movq_cfi_restore offset reg
-	movq \offset(%rsp), %\reg
-	CFI_RESTORE \reg
-	.endm
-#else /*!CONFIG_X86_64*/
-	.macro pushl_cfi reg
-	pushl \reg
-	CFI_ADJUST_CFA_OFFSET 4
-	.endm
-
-	.macro pushl_cfi_reg reg
-	pushl %\reg
-	CFI_ADJUST_CFA_OFFSET 4
-	CFI_REL_OFFSET \reg, 0
-	.endm
-
-	.macro popl_cfi reg
-	popl \reg
-	CFI_ADJUST_CFA_OFFSET -4
-	.endm
-
-	.macro popl_cfi_reg reg
-	popl %\reg
-	CFI_ADJUST_CFA_OFFSET -4
-	CFI_RESTORE \reg
-	.endm
-
-	.macro pushfl_cfi
-	pushfl
-	CFI_ADJUST_CFA_OFFSET 4
-	.endm
-
-	.macro popfl_cfi
-	popfl
-	CFI_ADJUST_CFA_OFFSET -4
-	.endm
-
-	.macro movl_cfi reg offset=0
-	movl %\reg, \offset(%esp)
-	CFI_REL_OFFSET \reg, \offset
-	.endm
-
-	.macro movl_cfi_restore offset reg
-	movl \offset(%esp), %\reg
-	CFI_RESTORE \reg
-	.endm
-#endif /*!CONFIG_X86_64*/
-#endif /*__ASSEMBLY__*/
-
 #endif /* _ASM_X86_DWARF2_H */
#6 lore raw

[tip:x86/asm] um/x86: Fix build after x86 syscall changes

In reply to Andy Lutomirski
um/x86: Fix build after x86 syscall changes
Commit-ID:  612bece654ff6cd43160e201985be826e96b8bcb
Gitweb:     http://git.kernel.org/tip/612bece654ff6cd43160e201985be826e96b8bcb
Author:     Andy Lutomirski <[email protected]>
AuthorDate: Mon, 12 Oct 2015 17:32:14 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 14 Oct 2015 16:56:28 +0200

um/x86: Fix build after x86 syscall changes

I didn't realize that um didn't include x86's asm/syscall.h. Re-add a missing typedef.

Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes 034042cc1e28 ("x86/entry/syscalls: Move syscall table declarations into asm/syscalls.h")
---
 arch/x86/um/asm/syscall.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/um/asm/syscall.h +4 -0
index 9fe77b7..81d6562 100644
@@ -3,6 +3,10 @@
 
 #include <uapi/linux/audit.h>
 
+typedef asmlinkage long (*sys_call_ptr_t)(unsigned long, unsigned long,
+					  unsigned long, unsigned long,
+					  unsigned long, unsigned long);
+
 static inline int syscall_get_arch(void)
 {
 #ifdef CONFIG_X86_32