Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1294780

[PATCH v15 21/25] x86/asm: Create stack frames in rwsem functions

From Josh Poimboeuf <jpoimboe@redhat.com>
Newsgroups linux.kernel
Subject [PATCH v15 21/25] x86/asm: Create stack frames in rwsem functions
Date 2015-12-18 13:50 +0100
Message-ID <qH2DW-5IP-53@gated-at.bofh.it> (permalink)
References <qH2DT-5IP-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


rwsem.S has several callable non-leaf functions which don't honor
CONFIG_FRAME_POINTER, which can result in bad stack traces.

Create stack frames for them when CONFIG_FRAME_POINTER is enabled.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 arch/x86/lib/rwsem.S | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x86/lib/rwsem.S b/arch/x86/lib/rwsem.S
index 40027db..be110ef 100644
--- a/arch/x86/lib/rwsem.S
+++ b/arch/x86/lib/rwsem.S
@@ -15,6 +15,7 @@
 
 #include <linux/linkage.h>
 #include <asm/alternative-asm.h>
+#include <asm/frame.h>
 
 #define __ASM_HALF_REG(reg)	__ASM_SEL(reg, e##reg)
 #define __ASM_HALF_SIZE(inst)	__ASM_SEL(inst##w, inst##l)
@@ -84,24 +85,29 @@
 
 /* Fix up special calling conventions */
 ENTRY(call_rwsem_down_read_failed)
+	FRAME_BEGIN
 	save_common_regs
 	__ASM_SIZE(push,) %__ASM_REG(dx)
 	movq %rax,%rdi
 	call rwsem_down_read_failed
 	__ASM_SIZE(pop,) %__ASM_REG(dx)
 	restore_common_regs
+	FRAME_END
 	ret
 ENDPROC(call_rwsem_down_read_failed)
 
 ENTRY(call_rwsem_down_write_failed)
+	FRAME_BEGIN
 	save_common_regs
 	movq %rax,%rdi
 	call rwsem_down_write_failed
 	restore_common_regs
+	FRAME_END
 	ret
 ENDPROC(call_rwsem_down_write_failed)
 
 ENTRY(call_rwsem_wake)
+	FRAME_BEGIN
 	/* do nothing if still outstanding active readers */
 	__ASM_HALF_SIZE(dec) %__ASM_HALF_REG(dx)
 	jnz 1f
@@ -109,15 +115,18 @@ ENTRY(call_rwsem_wake)
 	movq %rax,%rdi
 	call rwsem_wake
 	restore_common_regs
-1:	ret
+1:	FRAME_END
+	ret
 ENDPROC(call_rwsem_wake)
 
 ENTRY(call_rwsem_downgrade_wake)
+	FRAME_BEGIN
 	save_common_regs
 	__ASM_SIZE(push,) %__ASM_REG(dx)
 	movq %rax,%rdi
 	call rwsem_downgrade_wake
 	__ASM_SIZE(pop,) %__ASM_REG(dx)
 	restore_common_regs
+	FRAME_END
 	ret
 ENDPROC(call_rwsem_downgrade_wake)
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v15 00/25] Compile-time stack metadata validation Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-18 13:50 +0100
  [PATCH v15 10/25] x86/paravirt: Add stack frame dependency to PVOP inline asm calls Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-18 13:50 +0100
  [PATCH v15 12/25] x86/amd: Set ELF function type for vide() Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-18 13:50 +0100
  [PATCH v15 17/25] x86/asm/crypto: Move jump_table to .rodata section Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-18 13:50 +0100
  [PATCH v15 25/25] x86/stacktool: Ignore head_$(BITS) files. Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-18 13:50 +0100
  [PATCH v15 05/25] x86/asm: Add C versions of frame pointer macros Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-18 13:50 +0100
  [PATCH v15 21/25] x86/asm: Create stack frames in rwsem functions Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-18 13:50 +0100
  [PATCH v15 22/25] x86/asm/efi: Create a stack frame in efi_call() Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-18 13:50 +0100
  [PATCH v15 24/25] x86/uaccess: Add stack frame output operand in get_user inline asm Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-18 13:50 +0100
  [PATCH v15 08/25] x86/stacktool: Add ignore macros Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-18 13:50 +0100
  [PATCH v15 02/25] tools: Make list.h self-sufficient Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-18 13:50 +0100

csiph-web