Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1221446 > unrolled thread
| Started by | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| First post | 2015-09-09 15:30 +0200 |
| Last post | 2015-09-18 00:20 +0200 |
| Articles | 18 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v12 00/21] Compile-time stack metadata validation Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-09 15:30 +0200
[PATCH v12 16/21] x86/asm/crypto: Create stack frames in clmul_ghash_mul/update() Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-09 15:40 +0200
[PATCH v12 21/21] x86/asm/power: Create stack frames in hibernate_asm_64.S Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-09 15:40 +0200
[PATCH v12 15/21] x86/asm/crypto: Move jump_table to .rodata section Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-09 15:40 +0200
[PATCH v12 17/21] x86/asm/entry: Create stack frames in thunk functions Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-09 15:40 +0200
[PATCH v12 05/21] x86/stacktool: Add file and directory ignores Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-09 15:40 +0200
[PATCH v12 19/21] x86/asm: Create stack frames in rwsem functions Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-09 15:40 +0200
[PATCH v12 18/21] x86/asm/acpi: Create a stack frame in do_suspend_lowlevel() Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-09 15:40 +0200
[PATCH v12 20/21] x86/asm/efi: Create a stack frame in efi_call() Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-09 15:40 +0200
Re: [PATCH v12 00/21] Compile-time stack metadata validation Chris J Arges <chris.j.arges@canonical.com> - 2015-09-15 19:00 +0200
Re: [PATCH v12 00/21] Compile-time stack metadata validation Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-15 20:20 +0200
[PATCH 3/3] kprobes/x86: stacktool: ignore kretprobe_trampoline_holder Chris J Arges <chris.j.arges@canonical.com> - 2015-09-18 00:20 +0200
Re: [PATCH 3/3] kprobes/x86: stacktool: ignore kretprobe_trampoline_holder Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-18 16:10 +0200
[PATCH 2/3] x86/stacktool: Ignore head_$(BITS) files. Chris J Arges <chris.j.arges@canonical.com> - 2015-09-18 00:20 +0200
Re: [PATCH 2/3] x86/stacktool: Ignore head_$(BITS) files. Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-18 16:00 +0200
[PATCH 1/3] x86/uaccess: Add stack frame output operand in get_user inline asm Chris J Arges <chris.j.arges@canonical.com> - 2015-09-18 00:20 +0200
Re: [PATCH 1/3] x86/uaccess: Add stack frame output operand in get_user inline asm Josh Poimboeuf <jpoimboe@redhat.com> - 2015-09-18 16:00 +0200
[PATCH 0/3] A few stacktool warning fixes. Chris J Arges <chris.j.arges@canonical.com> - 2015-09-18 00:20 +0200
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-09 15:30 +0200 |
| Subject | [PATCH v12 00/21] Compile-time stack metadata validation |
| Message-ID | <q6NBL-4jS-3@gated-at.bofh.it> |
This is v12 of the compile-time stack metadata validation patch set, along with proposed fixes for many of the warnings it found. It's based on the tip/master branch. Biggest changes since v11: - Moved the tool from scripts/ to tools/ so it can be a standalone program for use by non-kernel code bases. - Renamed from "stackvalidate" to "stacktool" (for lack of a better name). "stackvalidate" is too limiting because eventually it will do more than just validation -- it will also have the ability to modify the object file when CFI generation support gets added. v11 can be found here: https://lkml.kernel.org/r/cover.1440423732.git.jpoimboe@redhat.com For more information about the motivation behind this patch set, and more details about what it does, see the patch 4 changelog and tools/stacktool/Documentation/stack-validation.txt. Patch 1 fixes the formatting for the "make -C tools" help message. Patches 2-6 add stacktool and some related macros. Patches 7-21 are some proposed fixes for several of the warnings reported by stacktool. They've been compile-tested and boot-tested in a VM, but I haven't attempted any meaningful testing for many of them. v12: - rename "stackvalidate" -> "stacktool" - move from scripts/ to tools/: - makefile rework - make a copy of the x86 insn code (and warn if the code diverges) - use tools/include/linux/list.h - move warning macros to a new warn.h file - change wording: "stack validation" -> "stack metadata validation" v11: - attempt to answer the "why" question better in the documentation and commit message - s/FP_SAVE/FRAME_BEGIN/ in documentation v10: - add scripts/mod to directory ignores - remove circular dependencies for ignored objects which are built before stackvalidate - fix CONFIG_MODVERSIONS incompatibility v9: - rename FRAME/ENDFRAME -> FRAME_BEGIN/FRAME_END - fix jump table issue for when the original instruction is a jump - drop paravirt thunk alignment patch - add maintainers to CC for proposed warning fixes v8: - add proposed fixes for warnings - fix all memory leaks - process ignores earlier and add more ignore checks - always assume POPCNT alternative is enabled - drop hweight inline asm fix - drop __schedule() ignore patch - change .Ltemp_\@ to .Lstackvalidate_ignore_\@ in asm macro - fix CONFIG_* checks in asm macros - add C versions of ignore macros and frame macros - change ";" to "\n" in C macros - add ifdef CONFIG_STACK_VALIDATION checks in C ignore macros - use numbered label in C ignore macro - add missing break in switch case statement in arch-x86.c v7: - sibling call support - document proposed solution for inline asm() frame pointer issues - say "kernel entry/exit" instead of "context switch" - clarify the checking of switch statement jump tables - discard __stackvalidate_ignore_* sections in linker script - use .Ltemp_\@ to get a unique label instead of static 3-digit number - change STACKVALIDATE_IGNORE_FUNC variable to a static - move STACKVALIDATE_IGNORE_INSN to arch-specific .h file v6: - rename asmvalidate -> stackvalidate (again) - gcc-generated object file support - recursive branch state analysis - external jump support - fixup/exception table support - jump label support - switch statement jump table support - added documentation - detection of "noreturn" dead end functions - added a Kbuild mechanism for skipping files and dirs - moved frame pointer macros to arch/x86/include/asm/frame.h - moved ignore macros to include/linux/stackvalidate.h v5: - stackvalidate -> asmvalidate - frame pointers only required for non-leaf functions - check for the use of the FP_SAVE/RESTORE macros instead of manually analyzing code to detect frame pointer usage - additional checks to ensure each function doesn't leave its boundaries - make the macros simpler and more flexible - support for analyzing ALTERNATIVE macros - simplified the arch interfaces in scripts/asmvalidate/arch.h - fixed some asmvalidate warnings - rebased onto latest tip asm cleanups - many more small changes v4: - Changed the default to CONFIG_STACK_VALIDATION=n, until all the asm code can get cleaned up. - Fixed a stackvalidate error path exit code issue found by Michal Marek. v3: - Added a patch to make the push/pop CFI macros arch-independent, as suggested by H. Peter Anvin v2: - Fixed memory leaks reported by Petr Mladek Cc: linux-kernel@vger.kernel.org Cc: live-patching@vger.kernel.org Cc: Michal Marek <mmarek@suse.cz> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: Pedro Alves <palves@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at> Cc: "Chris J Arges" <chris.j.arges@canonical.com> Cc: Andrew Morton <akpm@linux-foundation.org> Josh Poimboeuf (21): tools: Fix formatting of the "make -C tools" help message x86/asm: Frame pointer macro cleanup x86/asm: Add C versions of frame pointer macros x86/stacktool: Compile-time stack metadata validation x86/stacktool: Add file and directory ignores x86/stacktool: Add ignore macros x86/xen: Add stack frame dependency to hypercall inline asm calls x86/paravirt: Add stack frame dependency to PVOP inline asm calls x86/paravirt: Create a stack frame in PV_CALLEE_SAVE_REGS_THUNK x86/amd: Set ELF function type for vide() x86/reboot: Add ljmp instructions to stacktool whitelist x86/xen: Add xen_cpuid() and xen_setup_gdt() to stacktool whitelists x86/asm/crypto: Create stack frames in aesni-intel_asm.S x86/asm/crypto: Move .Lbswap_mask data to .rodata section x86/asm/crypto: Move jump_table to .rodata section x86/asm/crypto: Create stack frames in clmul_ghash_mul/update() x86/asm/entry: Create stack frames in thunk functions x86/asm/acpi: Create a stack frame in do_suspend_lowlevel() x86/asm: Create stack frames in rwsem functions x86/asm/efi: Create a stack frame in efi_call() x86/asm/power: Create stack frames in hibernate_asm_64.S MAINTAINERS | 7 + Makefile | 5 +- arch/Kconfig | 6 + arch/x86/Kconfig | 1 + arch/x86/boot/Makefile | 3 +- arch/x86/boot/compressed/Makefile | 3 +- arch/x86/crypto/aesni-intel_asm.S | 21 + arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 8 +- arch/x86/crypto/ghash-clmulni-intel_asm.S | 5 + arch/x86/entry/thunk_64.S | 4 + arch/x86/entry/vdso/Makefile | 5 +- arch/x86/include/asm/frame.h | 51 +- arch/x86/include/asm/paravirt.h | 9 +- arch/x86/include/asm/paravirt_types.h | 18 +- arch/x86/include/asm/stacktool.h | 45 + arch/x86/include/asm/xen/hypercall.h | 5 +- arch/x86/kernel/acpi/wakeup_64.S | 3 + arch/x86/kernel/cpu/amd.c | 5 +- arch/x86/kernel/reboot.c | 7 +- arch/x86/kernel/vmlinux.lds.S | 5 +- arch/x86/lib/rwsem.S | 11 +- arch/x86/platform/efi/efi_stub_64.S | 3 + arch/x86/power/hibernate_asm_64.S | 7 + arch/x86/purgatory/Makefile | 2 + arch/x86/realmode/Makefile | 4 +- arch/x86/realmode/rm/Makefile | 3 +- arch/x86/xen/enlighten.c | 4 +- drivers/firmware/efi/libstub/Makefile | 1 + include/linux/stacktool.h | 29 + lib/Kconfig.debug | 12 + scripts/Makefile.build | 37 +- scripts/mod/Makefile | 2 + tools/Makefile | 43 +- tools/stacktool/.gitignore | 1 + tools/stacktool/Build | 4 + tools/stacktool/Documentation/stack-validation.txt | 336 +++++++ tools/stacktool/Makefile | 51 ++ tools/stacktool/arch.h | 44 + tools/stacktool/arch/x86/Build | 12 + tools/stacktool/arch/x86/decode.c | 163 ++++ .../stacktool/arch/x86/insn/gen-insn-attr-x86.awk | 387 ++++++++ tools/stacktool/arch/x86/insn/inat.c | 97 ++ tools/stacktool/arch/x86/insn/inat.h | 221 +++++ tools/stacktool/arch/x86/insn/inat_types.h | 29 + tools/stacktool/arch/x86/insn/insn.c | 594 +++++++++++++ tools/stacktool/arch/x86/insn/insn.h | 201 +++++ tools/stacktool/arch/x86/insn/x86-opcode-map.txt | 984 +++++++++++++++++++++ tools/stacktool/elf.c | 403 +++++++++ tools/stacktool/elf.h | 79 ++ tools/stacktool/special.c | 199 +++++ tools/stacktool/special.h | 42 + tools/stacktool/stacktool.c | 980 ++++++++++++++++++++ tools/stacktool/warn.h | 60 ++ 53 files changed, 5192 insertions(+), 69 deletions(-) create mode 100644 arch/x86/include/asm/stacktool.h create mode 100644 include/linux/stacktool.h create mode 100644 tools/stacktool/.gitignore create mode 100644 tools/stacktool/Build create mode 100644 tools/stacktool/Documentation/stack-validation.txt create mode 100644 tools/stacktool/Makefile create mode 100644 tools/stacktool/arch.h create mode 100644 tools/stacktool/arch/x86/Build create mode 100644 tools/stacktool/arch/x86/decode.c create mode 100644 tools/stacktool/arch/x86/insn/gen-insn-attr-x86.awk create mode 100644 tools/stacktool/arch/x86/insn/inat.c create mode 100644 tools/stacktool/arch/x86/insn/inat.h create mode 100644 tools/stacktool/arch/x86/insn/inat_types.h create mode 100644 tools/stacktool/arch/x86/insn/insn.c create mode 100644 tools/stacktool/arch/x86/insn/insn.h create mode 100644 tools/stacktool/arch/x86/insn/x86-opcode-map.txt create mode 100644 tools/stacktool/elf.c create mode 100644 tools/stacktool/elf.h create mode 100644 tools/stacktool/special.c create mode 100644 tools/stacktool/special.h create mode 100644 tools/stacktool/stacktool.c create mode 100644 tools/stacktool/warn.h -- 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/
[toc] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-09 15:40 +0200 |
| Subject | [PATCH v12 16/21] x86/asm/crypto: Create stack frames in clmul_ghash_mul/update() |
| Message-ID | <q6NLs-4vi-3@gated-at.bofh.it> |
| In reply to | #1221446 |
clmul_ghash_mul() and clmul_ghash_update() are 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> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: "David S. Miller" <davem@davemloft.net> --- arch/x86/crypto/ghash-clmulni-intel_asm.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/crypto/ghash-clmulni-intel_asm.S b/arch/x86/crypto/ghash-clmulni-intel_asm.S index 5d1e007..eed55c8 100644 --- a/arch/x86/crypto/ghash-clmulni-intel_asm.S +++ b/arch/x86/crypto/ghash-clmulni-intel_asm.S @@ -18,6 +18,7 @@ #include <linux/linkage.h> #include <asm/inst.h> +#include <asm/frame.h> .data @@ -94,6 +95,7 @@ ENDPROC(__clmul_gf128mul_ble) /* void clmul_ghash_mul(char *dst, const u128 *shash) */ ENTRY(clmul_ghash_mul) + FRAME_BEGIN movups (%rdi), DATA movups (%rsi), SHASH movaps .Lbswap_mask, BSWAP @@ -101,6 +103,7 @@ ENTRY(clmul_ghash_mul) call __clmul_gf128mul_ble PSHUFB_XMM BSWAP DATA movups DATA, (%rdi) + FRAME_END ret ENDPROC(clmul_ghash_mul) @@ -109,6 +112,7 @@ ENDPROC(clmul_ghash_mul) * const u128 *shash); */ ENTRY(clmul_ghash_update) + FRAME_BEGIN cmp $16, %rdx jb .Lupdate_just_ret # check length movaps .Lbswap_mask, BSWAP @@ -128,5 +132,6 @@ ENTRY(clmul_ghash_update) PSHUFB_XMM BSWAP DATA movups DATA, (%rdi) .Lupdate_just_ret: + FRAME_END ret ENDPROC(clmul_ghash_update) -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-09 15:40 +0200 |
| Subject | [PATCH v12 21/21] x86/asm/power: Create stack frames in hibernate_asm_64.S |
| Message-ID | <q6NLs-4vi-9@gated-at.bofh.it> |
| In reply to | #1221446 |
swsusp_arch_suspend() and restore_registers() are callable non-leaf functions which don't honor CONFIG_FRAME_POINTER, which can result in bad stack traces. Also they aren't annotated as ELF callable functions which can confuse tooling. Create a stack frame for them when CONFIG_FRAME_POINTER is enabled and give them proper ELF function annotations. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Acked-by: Pavel Machek <pavel@ucw.cz> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> --- arch/x86/power/hibernate_asm_64.S | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/power/hibernate_asm_64.S b/arch/x86/power/hibernate_asm_64.S index e2386cb..4400a43 100644 --- a/arch/x86/power/hibernate_asm_64.S +++ b/arch/x86/power/hibernate_asm_64.S @@ -21,8 +21,10 @@ #include <asm/page_types.h> #include <asm/asm-offsets.h> #include <asm/processor-flags.h> +#include <asm/frame.h> ENTRY(swsusp_arch_suspend) + FRAME_BEGIN movq $saved_context, %rax movq %rsp, pt_regs_sp(%rax) movq %rbp, pt_regs_bp(%rax) @@ -50,7 +52,9 @@ ENTRY(swsusp_arch_suspend) movq %rax, restore_cr3(%rip) call swsusp_save + FRAME_END ret +ENDPROC(swsusp_arch_suspend) ENTRY(restore_image) /* switch to temporary page tables */ @@ -107,6 +111,7 @@ ENTRY(core_restore_code) */ ENTRY(restore_registers) + FRAME_BEGIN /* go back to the original page tables */ movq %rbx, %cr3 @@ -147,4 +152,6 @@ ENTRY(restore_registers) /* tell the hibernation core that we've just restored the memory */ movq %rax, in_suspend(%rip) + FRAME_END ret +ENDPROC(restore_registers) -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-09 15:40 +0200 |
| Subject | [PATCH v12 15/21] x86/asm/crypto: Move jump_table to .rodata section |
| Message-ID | <q6NLt-4vi-17@gated-at.bofh.it> |
| In reply to | #1221446 |
stacktool reports the following warning:
stacktool: arch/x86/crypto/crc32c-pcl-intel-asm_64.o: crc_pcl()+0x11dd: can't decode instruction
It gets confused when trying to decode jump_table data. Move jump_table
to the .rodata section which is a more appropriate home for read-only
data.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
---
arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
index 225be06..dc05f01 100644
--- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
+++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
@@ -170,8 +170,8 @@ continue_block:
## branch into array
lea jump_table(%rip), bufp
movzxw (bufp, %rax, 2), len
- offset=crc_array-jump_table
- lea offset(bufp, len, 1), bufp
+ lea crc_array(%rip), bufp
+ lea (bufp, len, 1), bufp
jmp *bufp
################################################################
@@ -310,7 +310,9 @@ do_return:
popq %rdi
popq %rbx
ret
+ENDPROC(crc_pcl)
+.section .rodata, "a", %progbits
################################################################
## jump table Table is 129 entries x 2 bytes each
################################################################
@@ -324,13 +326,11 @@ JMPTBL_ENTRY %i
i=i+1
.endr
-ENDPROC(crc_pcl)
################################################################
## PCLMULQDQ tables
## Table is 128 entries x 2 words (8 bytes) each
################################################################
-.section .rotata, "a", %progbits
.align 8
K_table:
.long 0x493c7d27, 0x00000001
--
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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-09 15:40 +0200 |
| Subject | [PATCH v12 17/21] x86/asm/entry: Create stack frames in thunk functions |
| Message-ID | <q6NLt-4vi-21@gated-at.bofh.it> |
| In reply to | #1221446 |
Thunk functions are callable non-leaf functions that don't honor CONFIG_FRAME_POINTER, which can result in bad stack traces. Also they aren't annotated as ELF callable functions which can confuse tooling. Create stack frames for them when CONFIG_FRAME_POINTER is enabled and add the ELF function type. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> --- arch/x86/entry/thunk_64.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/entry/thunk_64.S b/arch/x86/entry/thunk_64.S index efb2b93..98df1fa 100644 --- a/arch/x86/entry/thunk_64.S +++ b/arch/x86/entry/thunk_64.S @@ -8,11 +8,14 @@ #include <linux/linkage.h> #include "calling.h" #include <asm/asm.h> +#include <asm/frame.h> /* rdi: arg1 ... normal C conventions. rax is saved/restored. */ .macro THUNK name, func, put_ret_addr_in_rdi=0 .globl \name + .type \name, @function \name: + FRAME_BEGIN /* this one pushes 9 elems, the next one would be %rIP */ pushq %rdi @@ -62,6 +65,7 @@ restore: popq %rdx popq %rsi popq %rdi + FRAME_END ret _ASM_NOKPROBE(restore) #endif -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-09 15:40 +0200 |
| Subject | [PATCH v12 05/21] x86/stacktool: Add file and directory ignores |
| Message-ID | <q6NLt-4vi-41@gated-at.bofh.it> |
| In reply to | #1221446 |
Tell stacktool to skip validation of the following code: - boot image - vdso image - kexec purgatory - realmode - efi libstub - scripts/mod They all run outside the kernel's normal mode of operation and they don't affect runtime kernel stack traces, so they're free to skirt the stacktool rules. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> --- arch/x86/boot/Makefile | 3 ++- arch/x86/boot/compressed/Makefile | 3 ++- arch/x86/entry/vdso/Makefile | 5 ++++- arch/x86/purgatory/Makefile | 2 ++ arch/x86/realmode/Makefile | 4 +++- arch/x86/realmode/rm/Makefile | 3 ++- drivers/firmware/efi/libstub/Makefile | 1 + scripts/mod/Makefile | 2 ++ 8 files changed, 18 insertions(+), 5 deletions(-) diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index 0d553e5..fe96b2f 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -14,7 +14,8 @@ # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode. # The number is the same as you would ordinarily press at bootup. -KASAN_SANITIZE := n +KASAN_SANITIZE := n +STACKTOOL := n SVGA_MODE := -DSVGA_MODE=NORMAL_VGA diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 0a291cd..8cea814 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -16,7 +16,8 @@ # (see scripts/Makefile.lib size_append) # compressed vmlinux.bin.all + u32 size of vmlinux.bin.all -KASAN_SANITIZE := n +KASAN_SANITIZE := n +STACKTOOL := n targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4 diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index a3d0767..8095694 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -3,7 +3,9 @@ # KBUILD_CFLAGS += $(DISABLE_LTO) -KASAN_SANITIZE := n + +KASAN_SANITIZE := n +STACKTOOL := n VDSO64-$(CONFIG_X86_64) := y VDSOX32-$(CONFIG_X86_X32_ABI) := y @@ -15,6 +17,7 @@ vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o # files to link into kernel obj-y += vma.o +STACKTOOL_vma.o := y # vDSO images to build vdso_img-$(VDSO64-y) += 64 diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index 2c835e3..30d7d58 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -1,3 +1,5 @@ +STACKTOOL := n + purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string.o targets += $(purgatory-y) diff --git a/arch/x86/realmode/Makefile b/arch/x86/realmode/Makefile index e02c2c6..0c24689 100644 --- a/arch/x86/realmode/Makefile +++ b/arch/x86/realmode/Makefile @@ -6,7 +6,9 @@ # for more details. # # -KASAN_SANITIZE := n +KASAN_SANITIZE := n +STACKTOOL := n + subdir- := rm obj-y += init.o diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile index 2730d77..1da2e5b 100644 --- a/arch/x86/realmode/rm/Makefile +++ b/arch/x86/realmode/rm/Makefile @@ -6,7 +6,8 @@ # for more details. # # -KASAN_SANITIZE := n +KASAN_SANITIZE := n +STACKTOOL := n always := realmode.bin realmode.relocs diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index 816dbe9..a612cdb 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -20,6 +20,7 @@ KBUILD_CFLAGS := $(cflags-y) \ GCOV_PROFILE := n KASAN_SANITIZE := n +STACKTOOL := n lib-y := efi-stub-helper.o lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index c11212f..496184d 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile @@ -1,3 +1,5 @@ +STACKTOOL := n + hostprogs-y := modpost mk_elfconfig always := $(hostprogs-y) empty.o -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-09 15:40 +0200 |
| Subject | [PATCH v12 19/21] x86/asm: Create stack frames in rwsem functions |
| Message-ID | <q6NLu-4vi-47@gated-at.bofh.it> |
| In reply to | #1221446 |
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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-09 15:40 +0200 |
| Subject | [PATCH v12 18/21] x86/asm/acpi: Create a stack frame in do_suspend_lowlevel() |
| Message-ID | <q6NLu-4vi-49@gated-at.bofh.it> |
| In reply to | #1221446 |
do_suspend_lowlevel() is a callable non-leaf function which doesn't honor CONFIG_FRAME_POINTER, which can result in bad stack traces. Create a stack frame for it when CONFIG_FRAME_POINTER is enabled. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Acked-by: Pavel Machek <pavel@ucw.cz> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Len Brown <len.brown@intel.com> --- arch/x86/kernel/acpi/wakeup_64.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S index 8c35df4..169963f 100644 --- a/arch/x86/kernel/acpi/wakeup_64.S +++ b/arch/x86/kernel/acpi/wakeup_64.S @@ -5,6 +5,7 @@ #include <asm/page_types.h> #include <asm/msr.h> #include <asm/asm-offsets.h> +#include <asm/frame.h> # Copyright 2003 Pavel Machek <pavel@suse.cz>, distribute under GPLv2 @@ -39,6 +40,7 @@ bogus_64_magic: jmp bogus_64_magic ENTRY(do_suspend_lowlevel) + FRAME_BEGIN subq $8, %rsp xorl %eax, %eax call save_processor_state @@ -109,6 +111,7 @@ ENTRY(do_suspend_lowlevel) xorl %eax, %eax addq $8, %rsp + FRAME_END jmp restore_processor_state ENDPROC(do_suspend_lowlevel) -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-09 15:40 +0200 |
| Subject | [PATCH v12 20/21] x86/asm/efi: Create a stack frame in efi_call() |
| Message-ID | <q6NLv-4vi-57@gated-at.bofh.it> |
| In reply to | #1221446 |
efi_call() is a callable non-leaf function which doesn't honor CONFIG_FRAME_POINTER, which can result in bad stack traces. Create a stack frame for it when CONFIG_FRAME_POINTER is enabled. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Reviewed-by: Matt Fleming <matt.fleming@intel.com> --- arch/x86/platform/efi/efi_stub_64.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/platform/efi/efi_stub_64.S b/arch/x86/platform/efi/efi_stub_64.S index 86d0f9e..0df2dcc 100644 --- a/arch/x86/platform/efi/efi_stub_64.S +++ b/arch/x86/platform/efi/efi_stub_64.S @@ -11,6 +11,7 @@ #include <asm/msr.h> #include <asm/processor-flags.h> #include <asm/page_types.h> +#include <asm/frame.h> #define SAVE_XMM \ mov %rsp, %rax; \ @@ -74,6 +75,7 @@ .endm ENTRY(efi_call) + FRAME_BEGIN SAVE_XMM mov (%rsp), %rax mov 8(%rax), %rax @@ -88,6 +90,7 @@ ENTRY(efi_call) RESTORE_PGT addq $48, %rsp RESTORE_XMM + FRAME_END ret ENDPROC(efi_call) -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Chris J Arges <chris.j.arges@canonical.com> |
|---|---|
| Date | 2015-09-15 19:00 +0200 |
| Message-ID | <q91Ki-2gb-1@gated-at.bofh.it> |
| In reply to | #1221446 |
I got the following compiler error when building v12 of this patchset: DESCEND stacktool CC stacktool.o CC elf.o CC special.o CC arch/x86/decode.o LD arch/x86/stacktool-in.o LD stacktool-in.o Warning: stacktool: x86 instruction decoder differs from kernel LINK stacktool stacktool-in.o: In function `elf_close': (.text+0xe7c): undefined reference to `elf_end' stacktool-in.o: In function `elf_open': (.text+0xec7): undefined reference to `elf_version' stacktool-in.o: In function `elf_open': (.text+0xf29): undefined reference to `elf_begin' stacktool-in.o: In function `elf_open': (.text+0xf42): undefined reference to `gelf_getehdr' stacktool-in.o: In function `elf_open': (.text+0xf59): undefined reference to `elf_getshdrnum' stacktool-in.o: In function `elf_open': (.text+0xf6f): undefined reference to `elf_getshdrstrndx' stacktool-in.o: In function `elf_open': (.text+0xfc9): undefined reference to `elf_getscn' stacktool-in.o: In function `elf_open': (.text+0xfdd): undefined reference to `elf_ndxscn' stacktool-in.o: In function `elf_open': (.text+0xff2): undefined reference to `gelf_getshdr' stacktool-in.o: In function `elf_open': (.text+0x100e): undefined reference to `elf_strptr' stacktool-in.o: In function `elf_open': (.text+0x1029): undefined reference to `elf_getdata' stacktool-in.o: In function `elf_open': (.text+0x1101): undefined reference to `elf_nextscn' stacktool-in.o: In function `elf_open': (.text+0x119e): undefined reference to `gelf_getsym' stacktool-in.o: In function `elf_open': (.text+0x11b8): undefined reference to `elf_strptr' stacktool-in.o: In function `elf_open': (.text+0x13d4): undefined reference to `gelf_getrela' collect2: error: ld returned 1 exit status Makefile:33: recipe for target 'stacktool' failed make[2]: *** [stacktool] Error 1 Makefile:53: recipe for target 'stacktool' failed make[1]: *** [stacktool] Error 2 Makefile:1502: recipe for target 'tools/stacktool' failed make: *** [tools/stacktool] Error 2 The patch below addresses this issue for me. -- From 9ec5827aa726300394c0155657820f2595008116 Mon Sep 17 00:00:00 2001 From: Chris J Arges <chris.j.arges@canonical.com> Date: Tue, 15 Sep 2015 16:45:27 +0000 Subject: [PATCH] x86/stacktool: Fix LDFLAGS order in Makefile When building tools/stacktool I get a compiler error which causes libelf to not properly link. This patch adjusts the LDFLAG after the object file, which allows gcc to properly link. Signed-off-by: Chris J Arges <chris.j.arges@canonical.com> --- tools/stacktool/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/stacktool/Makefile b/tools/stacktool/Makefile index 87a3ee0..9f5d2f9 100644 --- a/tools/stacktool/Makefile +++ b/tools/stacktool/Makefile @@ -39,7 +39,7 @@ $(STACKTOOL): $(STACKTOOL_IN) diff -I'^#include' arch/x86/insn/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \ diff -I'^#include' arch/x86/insn/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \ || echo "Warning: stacktool: x86 instruction decoder differs from kernel" >&2 )) || true - $(QUIET_LINK)$(CC) $(LDFLAGS) $(STACKTOOL_IN) -o $@ + $(QUIET_LINK)$(CC) $(STACKTOOL_IN) $(LDFLAGS) -o $@ clean: $(call QUIET_CLEAN, stacktool) $(RM) $(STACKTOOL) -- 2.5.0 -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-15 20:20 +0200 |
| Message-ID | <q92ZJ-4cN-31@gated-at.bofh.it> |
| In reply to | #1225425 |
On Tue, Sep 15, 2015 at 11:57:00AM -0500, Chris J Arges wrote: > I got the following compiler error when building v12 of this patchset: > > DESCEND stacktool > CC stacktool.o > CC elf.o > CC special.o > CC arch/x86/decode.o > LD arch/x86/stacktool-in.o > LD stacktool-in.o > Warning: stacktool: x86 instruction decoder differs from kernel > LINK stacktool > stacktool-in.o: In function `elf_close': > (.text+0xe7c): undefined reference to `elf_end' > stacktool-in.o: In function `elf_open': > (.text+0xec7): undefined reference to `elf_version' > stacktool-in.o: In function `elf_open': > (.text+0xf29): undefined reference to `elf_begin' > stacktool-in.o: In function `elf_open': > (.text+0xf42): undefined reference to `gelf_getehdr' > stacktool-in.o: In function `elf_open': > (.text+0xf59): undefined reference to `elf_getshdrnum' > stacktool-in.o: In function `elf_open': > (.text+0xf6f): undefined reference to `elf_getshdrstrndx' > stacktool-in.o: In function `elf_open': > (.text+0xfc9): undefined reference to `elf_getscn' > stacktool-in.o: In function `elf_open': > (.text+0xfdd): undefined reference to `elf_ndxscn' > stacktool-in.o: In function `elf_open': > (.text+0xff2): undefined reference to `gelf_getshdr' > stacktool-in.o: In function `elf_open': > (.text+0x100e): undefined reference to `elf_strptr' > stacktool-in.o: In function `elf_open': > (.text+0x1029): undefined reference to `elf_getdata' > stacktool-in.o: In function `elf_open': > (.text+0x1101): undefined reference to `elf_nextscn' > stacktool-in.o: In function `elf_open': > (.text+0x119e): undefined reference to `gelf_getsym' > stacktool-in.o: In function `elf_open': > (.text+0x11b8): undefined reference to `elf_strptr' > stacktool-in.o: In function `elf_open': > (.text+0x13d4): undefined reference to `gelf_getrela' > collect2: error: ld returned 1 exit status > Makefile:33: recipe for target 'stacktool' failed > make[2]: *** [stacktool] Error 1 > Makefile:53: recipe for target 'stacktool' failed > make[1]: *** [stacktool] Error 2 > Makefile:1502: recipe for target 'tools/stacktool' failed > make: *** [tools/stacktool] Error 2 > > The patch below addresses this issue for me. > > -- > > From 9ec5827aa726300394c0155657820f2595008116 Mon Sep 17 00:00:00 2001 > From: Chris J Arges <chris.j.arges@canonical.com> > Date: Tue, 15 Sep 2015 16:45:27 +0000 > Subject: [PATCH] x86/stacktool: Fix LDFLAGS order in Makefile > > When building tools/stacktool I get a compiler error which causes libelf to not > properly link. This patch adjusts the LDFLAG after the object file, which > allows gcc to properly link. > > Signed-off-by: Chris J Arges <chris.j.arges@canonical.com> Makes sense (after reading the part in the ld man page about how the order matters for '-l' arguments). Not sure yet why it works for me without the patch. To avoid breaking bisection, this patch should be folded into patch 4 of the series (which I will do, if a v13 is necessary). Thanks! -- Josh -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Chris J Arges <chris.j.arges@canonical.com> |
|---|---|
| Date | 2015-09-18 00:20 +0200 |
| Subject | [PATCH 3/3] kprobes/x86: stacktool: ignore kretprobe_trampoline_holder |
| Message-ID | <q9PH3-g0-1@gated-at.bofh.it> |
| In reply to | #1221446 |
The function kretprobe_trampoline_holder isn't called explicility and therefore should be ignored by stacktool. Signed-off-by: Chris J Arges <chris.j.arges@canonical.com> --- arch/x86/kernel/kprobes/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 1deffe6..3ade909 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c @@ -49,6 +49,7 @@ #include <linux/kdebug.h> #include <linux/kallsyms.h> #include <linux/ftrace.h> +#include <linux/stacktool.h> #include <asm/cacheflush.h> #include <asm/desc.h> @@ -704,6 +705,7 @@ static void __used kretprobe_trampoline_holder(void) } NOKPROBE_SYMBOL(kretprobe_trampoline_holder); NOKPROBE_SYMBOL(kretprobe_trampoline); +STACKTOOL_IGNORE_FUNC(kretprobe_trampoline_holder); /* * Called from kretprobe_trampoline -- 1.9.1 -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-18 16:10 +0200 |
| Subject | Re: [PATCH 3/3] kprobes/x86: stacktool: ignore kretprobe_trampoline_holder |
| Message-ID | <qa4wq-4P4-25@gated-at.bofh.it> |
| In reply to | #1227441 |
On Thu, Sep 17, 2015 at 05:14:37PM -0500, Chris J Arges wrote: > The function kretprobe_trampoline_holder isn't called explicility and therefore > should be ignored by stacktool. > > Signed-off-by: Chris J Arges <chris.j.arges@canonical.com> > --- > arch/x86/kernel/kprobes/core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c > index 1deffe6..3ade909 100644 > --- a/arch/x86/kernel/kprobes/core.c > +++ b/arch/x86/kernel/kprobes/core.c > @@ -49,6 +49,7 @@ > #include <linux/kdebug.h> > #include <linux/kallsyms.h> > #include <linux/ftrace.h> > +#include <linux/stacktool.h> > > #include <asm/cacheflush.h> > #include <asm/desc.h> > @@ -704,6 +705,7 @@ static void __used kretprobe_trampoline_holder(void) > } > NOKPROBE_SYMBOL(kretprobe_trampoline_holder); > NOKPROBE_SYMBOL(kretprobe_trampoline); > +STACKTOOL_IGNORE_FUNC(kretprobe_trampoline_holder); > > /* > * Called from kretprobe_trampoline > -- > 1.9.1 The kretprobe trampoline isn't called directly but it can still be executed at runtime. I think we should make sure it does the "right thing" with respect to frame pointers and CFI before telling stacktool to ignore it. -- Josh -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Chris J Arges <chris.j.arges@canonical.com> |
|---|---|
| Date | 2015-09-18 00:20 +0200 |
| Subject | [PATCH 2/3] x86/stacktool: Ignore head_$(BITS) files. |
| Message-ID | <q9PH3-g0-5@gated-at.bofh.it> |
| In reply to | #1221446 |
Tell stacktool to skip validation of head_64, head_32 as they don't affect runtime kernel stack traces. Signed-off-by: Chris J Arges <chris.j.arges@canonical.com> --- arch/x86/kernel/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index b1b78ff..f331fef 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -19,6 +19,7 @@ endif KASAN_SANITIZE_head$(BITS).o := n KASAN_SANITIZE_dumpstack.o := n KASAN_SANITIZE_dumpstack_$(BITS).o := n +STACKTOOL_head_$(BITS).o := n CFLAGS_irq.o := -I$(src)/../include/asm/trace -- 1.9.1 -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-18 16:00 +0200 |
| Subject | Re: [PATCH 2/3] x86/stacktool: Ignore head_$(BITS) files. |
| Message-ID | <qa4mK-4oE-25@gated-at.bofh.it> |
| In reply to | #1227442 |
On Thu, Sep 17, 2015 at 05:14:36PM -0500, Chris J Arges wrote: > Tell stacktool to skip validation of head_64, head_32 as they don't affect > runtime kernel stack traces. > > Signed-off-by: Chris J Arges <chris.j.arges@canonical.com> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com> > --- > arch/x86/kernel/Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile > index b1b78ff..f331fef 100644 > --- a/arch/x86/kernel/Makefile > +++ b/arch/x86/kernel/Makefile > @@ -19,6 +19,7 @@ endif > KASAN_SANITIZE_head$(BITS).o := n > KASAN_SANITIZE_dumpstack.o := n > KASAN_SANITIZE_dumpstack_$(BITS).o := n > +STACKTOOL_head_$(BITS).o := n > > CFLAGS_irq.o := -I$(src)/../include/asm/trace > > -- > 1.9.1 > -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Chris J Arges <chris.j.arges@canonical.com> |
|---|---|
| Date | 2015-09-18 00:20 +0200 |
| Subject | [PATCH 1/3] x86/uaccess: Add stack frame output operand in get_user inline asm |
| Message-ID | <q9PH4-g0-25@gated-at.bofh.it> |
| In reply to | #1221446 |
Numerous 'call without frame pointer save/setup' warnings are introduced by
stacktool because of functions using the get_user macro. Bad stack traces could
occur due to lack of or misplacement of stack frame setup code.
This patch forces a stack frame to be created before the inline asm code if
CONFIG_FRAME_POINTER is enabled by listing the stack pointer as an output
operand for the get_user inline assembly statement.
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
arch/x86/include/asm/uaccess.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index a8df874..55b8db5 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -176,10 +176,11 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
({ \
int __ret_gu; \
register __inttype(*(ptr)) __val_gu asm("%"_ASM_DX); \
+ register void *__sp asm(_ASM_SP); \
__chk_user_ptr(ptr); \
might_fault(); \
- asm volatile("call __get_user_%P3" \
- : "=a" (__ret_gu), "=r" (__val_gu) \
+ asm volatile("call __get_user_%P4" \
+ : "=a" (__ret_gu), "=r" (__val_gu), "+r" (__sp) \
: "0" (ptr), "i" (sizeof(*(ptr)))); \
(x) = (__force __typeof__(*(ptr))) __val_gu; \
__ret_gu; \
--
1.9.1
--
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/
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2015-09-18 16:00 +0200 |
| Subject | Re: [PATCH 1/3] x86/uaccess: Add stack frame output operand in get_user inline asm |
| Message-ID | <qa4mL-4oE-31@gated-at.bofh.it> |
| In reply to | #1227450 |
On Thu, Sep 17, 2015 at 05:14:35PM -0500, Chris J Arges wrote:
> Numerous 'call without frame pointer save/setup' warnings are introduced by
> stacktool because of functions using the get_user macro. Bad stack traces could
> occur due to lack of or misplacement of stack frame setup code.
>
> This patch forces a stack frame to be created before the inline asm code if
> CONFIG_FRAME_POINTER is enabled by listing the stack pointer as an output
> operand for the get_user inline assembly statement.
>
> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
> arch/x86/include/asm/uaccess.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
> index a8df874..55b8db5 100644
> --- a/arch/x86/include/asm/uaccess.h
> +++ b/arch/x86/include/asm/uaccess.h
> @@ -176,10 +176,11 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
> ({ \
> int __ret_gu; \
> register __inttype(*(ptr)) __val_gu asm("%"_ASM_DX); \
> + register void *__sp asm(_ASM_SP); \
> __chk_user_ptr(ptr); \
> might_fault(); \
> - asm volatile("call __get_user_%P3" \
> - : "=a" (__ret_gu), "=r" (__val_gu) \
> + asm volatile("call __get_user_%P4" \
> + : "=a" (__ret_gu), "=r" (__val_gu), "+r" (__sp) \
> : "0" (ptr), "i" (sizeof(*(ptr)))); \
> (x) = (__force __typeof__(*(ptr))) __val_gu; \
> __ret_gu; \
> --
> 1.9.1
>
--
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/
[toc] | [prev] | [next] | [standalone]
| From | Chris J Arges <chris.j.arges@canonical.com> |
|---|---|
| Date | 2015-09-18 00:20 +0200 |
| Subject | [PATCH 0/3] A few stacktool warning fixes. |
| Message-ID | <q9PH3-g0-3@gated-at.bofh.it> |
| In reply to | #1221446 |
Included here are a few patches to fix various stacktool warnings I've found. This patchset requires the stack validation patchset. Chris J Arges (3): x86/uaccess: Add stack frame output operand in get_user inline asm x86/stacktool: Ignore head_$(BITS) files. kprobes/x86: stacktool: ignore kretprobe_trampoline_holder arch/x86/include/asm/uaccess.h | 5 +++-- arch/x86/kernel/Makefile | 1 + arch/x86/kernel/kprobes/core.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) -- 1.9.1 -- 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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web