diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2018-08-01 12:30:47 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2018-08-01 12:30:47 -0400 |
commit | e2e63718025e2dca54b066cd7b87d0e29e75a3ab (patch) | |
tree | 1c0d95f3a31017a18fbeb246ed7f549f82aae78f | |
parent | 5b20bfc5a0d3bbbf9353edd4bf722dea97a0ec6a (diff) | |
download | longterm-queue-4.12-e2e63718025e2dca54b066cd7b87d0e29e75a3ab.tar.gz |
drop unwinder/ORC stuff n/a for 4.12.x
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
6 files changed, 0 insertions, 768 deletions
diff --git a/queue/series b/queue/series index e5ce5f4..a678b8e 100644 --- a/queue/series +++ b/queue/series @@ -1,13 +1,8 @@ ACPI-APEI-adjust-a-local-variable-type-in-ghes_iorem.patch -x86-unwinder-Make-CONFIG_UNWINDER_ORC-y-the-default-.patch -x86-unwind-Rename-unwinder-config-options-to-CONFIG_.patch -x86-unwind-Make-CONFIG_UNWINDER_ORC-y-the-default-in.patch x86-platform-UV-Convert-timers-to-use-timer_setup.patch ACPI-APEI-remove-the-unused-dead-code-for-SEA-NMI-no.patch ACPI-APEI-Replace-ioremap_page_range-with-fixmap.patch bpf-fix-build-issues-on-um-due-to-mising-bpf_perf_ev.patch -x86-unwinder-orc-Dont-bail-on-stack-overflow.patch -x86-unwinder-Handle-stack-overflows-more-gracefully.patch optee-fix-invalid-of_node_put-in-optee_driver_init.patch backlight-pwm_bl-Fix-overflow-condition.patch drm-Add-retries-for-lspcon-mode-detection.patch diff --git a/queue/x86-unwind-Make-CONFIG_UNWINDER_ORC-y-the-default-in.patch b/queue/x86-unwind-Make-CONFIG_UNWINDER_ORC-y-the-default-in.patch deleted file mode 100644 index 6c6c6bc..0000000 --- a/queue/x86-unwind-Make-CONFIG_UNWINDER_ORC-y-the-default-in.patch +++ /dev/null @@ -1,79 +0,0 @@ -From fc72ae40e30327aa24eb88a24b9c7058f938bd36 Mon Sep 17 00:00:00 2001 -From: Josh Poimboeuf <jpoimboe@redhat.com> -Date: Fri, 13 Oct 2017 15:02:01 -0500 -Subject: [PATCH] x86/unwind: Make CONFIG_UNWINDER_ORC=y the default in kconfig - for 64-bit - -commit fc72ae40e30327aa24eb88a24b9c7058f938bd36 upstream. - -The ORC unwinder has been stable in testing so far. Give it much wider -testing by making it the default in kconfig for x86_64. It's not yet -supported for 32-bit, so leave frame pointers as the default there. - -Suggested-by: Ingo Molnar <mingo@kernel.org> -Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> -Cc: Linus Torvalds <torvalds@linux-foundation.org> -Cc: Peter Zijlstra <peterz@infradead.org> -Cc: Thomas Gleixner <tglx@linutronix.de> -Link: http://lkml.kernel.org/r/9b1237bbe7244ed9cdf8db2dcb1253e37e1c341e.1507924831.git.jpoimboe@redhat.com -Signed-off-by: Ingo Molnar <mingo@kernel.org> - -diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug -index f274dbb87c26..a4ff214fb760 100644 ---- a/arch/x86/Kconfig.debug -+++ b/arch/x86/Kconfig.debug -@@ -358,27 +358,13 @@ config PUNIT_ATOM_DEBUG - - choice - prompt "Choose kernel unwinder" -- default UNWINDER_FRAME_POINTER -+ default UNWINDER_ORC if X86_64 -+ default UNWINDER_FRAME_POINTER if X86_32 - ---help--- - This determines which method will be used for unwinding kernel stack - traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack, - livepatch, lockdep, and more. - --config UNWINDER_FRAME_POINTER -- bool "Frame pointer unwinder" -- select FRAME_POINTER -- ---help--- -- This option enables the frame pointer unwinder for unwinding kernel -- stack traces. -- -- The unwinder itself is fast and it uses less RAM than the ORC -- unwinder, but the kernel text size will grow by ~3% and the kernel's -- overall performance will degrade by roughly 5-10%. -- -- This option is recommended if you want to use the livepatch -- consistency model, as this is currently the only way to get a -- reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE). -- - config UNWINDER_ORC - bool "ORC unwinder" - depends on X86_64 -@@ -395,6 +381,21 @@ config UNWINDER_ORC - Enabling this option will increase the kernel's runtime memory usage - by roughly 2-4MB, depending on your kernel config. - -+config UNWINDER_FRAME_POINTER -+ bool "Frame pointer unwinder" -+ select FRAME_POINTER -+ ---help--- -+ This option enables the frame pointer unwinder for unwinding kernel -+ stack traces. -+ -+ The unwinder itself is fast and it uses less RAM than the ORC -+ unwinder, but the kernel text size will grow by ~3% and the kernel's -+ overall performance will degrade by roughly 5-10%. -+ -+ This option is recommended if you want to use the livepatch -+ consistency model, as this is currently the only way to get a -+ reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE). -+ - config UNWINDER_GUESS - bool "Guess unwinder" - depends on EXPERT --- -2.15.0 - diff --git a/queue/x86-unwind-Rename-unwinder-config-options-to-CONFIG_.patch b/queue/x86-unwind-Rename-unwinder-config-options-to-CONFIG_.patch deleted file mode 100644 index 25eb213..0000000 --- a/queue/x86-unwind-Rename-unwinder-config-options-to-CONFIG_.patch +++ /dev/null @@ -1,251 +0,0 @@ -From 11af847446ed0d131cf24d16a7ef3d5ea7a49554 Mon Sep 17 00:00:00 2001 -From: Josh Poimboeuf <jpoimboe@redhat.com> -Date: Fri, 13 Oct 2017 15:02:00 -0500 -Subject: [PATCH] x86/unwind: Rename unwinder config options to - 'CONFIG_UNWINDER_*' - -commit 11af847446ed0d131cf24d16a7ef3d5ea7a49554 upstream. - -Rename the unwinder config options from: - - CONFIG_ORC_UNWINDER - CONFIG_FRAME_POINTER_UNWINDER - CONFIG_GUESS_UNWINDER - -to: - - CONFIG_UNWINDER_ORC - CONFIG_UNWINDER_FRAME_POINTER - CONFIG_UNWINDER_GUESS - -... in order to give them a more logical config namespace. - -Suggested-by: Ingo Molnar <mingo@kernel.org> -Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> -Cc: Linus Torvalds <torvalds@linux-foundation.org> -Cc: Peter Zijlstra <peterz@infradead.org> -Cc: Thomas Gleixner <tglx@linutronix.de> -Link: http://lkml.kernel.org/r/73972fc7e2762e91912c6b9584582703d6f1b8cc.1507924831.git.jpoimboe@redhat.com -Signed-off-by: Ingo Molnar <mingo@kernel.org> - -diff --git a/Documentation/x86/orc-unwinder.txt b/Documentation/x86/orc-unwinder.txt -index af0c9a4c65a6..cd4b29be29af 100644 ---- a/Documentation/x86/orc-unwinder.txt -+++ b/Documentation/x86/orc-unwinder.txt -@@ -4,7 +4,7 @@ ORC unwinder - Overview - -------- - --The kernel CONFIG_ORC_UNWINDER option enables the ORC unwinder, which is -+The kernel CONFIG_UNWINDER_ORC option enables the ORC unwinder, which is - similar in concept to a DWARF unwinder. The difference is that the - format of the ORC data is much simpler than DWARF, which in turn allows - the ORC unwinder to be much simpler and faster. -diff --git a/Makefile b/Makefile -index bc5c79e8e3cf..c0f723f81c06 100644 ---- a/Makefile -+++ b/Makefile -@@ -933,8 +933,8 @@ ifdef CONFIG_STACK_VALIDATION - ifeq ($(has_libelf),1) - objtool_target := tools/objtool FORCE - else -- ifdef CONFIG_ORC_UNWINDER -- $(error "Cannot generate ORC metadata for CONFIG_ORC_UNWINDER=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") -+ ifdef CONFIG_UNWINDER_ORC -+ $(error "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") - else - $(warning "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") - endif -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index 971feac13506..6b94ca0aa585 100644 ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -170,7 +170,7 @@ config X86 - select HAVE_PERF_USER_STACK_DUMP - select HAVE_RCU_TABLE_FREE - select HAVE_REGS_AND_STACK_ACCESS_API -- select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER_UNWINDER && STACK_VALIDATION -+ select HAVE_RELIABLE_STACKTRACE if X86_64 && UNWINDER_FRAME_POINTER && STACK_VALIDATION - select HAVE_STACK_VALIDATION if X86_64 - select HAVE_SYSCALL_TRACEPOINTS - select HAVE_UNSTABLE_SCHED_CLOCK -diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug -index 71a48a30fc84..f274dbb87c26 100644 ---- a/arch/x86/Kconfig.debug -+++ b/arch/x86/Kconfig.debug -@@ -358,13 +358,13 @@ config PUNIT_ATOM_DEBUG - - choice - prompt "Choose kernel unwinder" -- default FRAME_POINTER_UNWINDER -+ default UNWINDER_FRAME_POINTER - ---help--- - This determines which method will be used for unwinding kernel stack - traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack, - livepatch, lockdep, and more. - --config FRAME_POINTER_UNWINDER -+config UNWINDER_FRAME_POINTER - bool "Frame pointer unwinder" - select FRAME_POINTER - ---help--- -@@ -379,7 +379,7 @@ config FRAME_POINTER_UNWINDER - consistency model, as this is currently the only way to get a - reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE). - --config ORC_UNWINDER -+config UNWINDER_ORC - bool "ORC unwinder" - depends on X86_64 - select STACK_VALIDATION -@@ -395,7 +395,7 @@ config ORC_UNWINDER - Enabling this option will increase the kernel's runtime memory usage - by roughly 2-4MB, depending on your kernel config. - --config GUESS_UNWINDER -+config UNWINDER_GUESS - bool "Guess unwinder" - depends on EXPERT - ---help--- -@@ -410,7 +410,7 @@ config GUESS_UNWINDER - endchoice - - config FRAME_POINTER -- depends on !ORC_UNWINDER && !GUESS_UNWINDER -+ depends on !UNWINDER_ORC && !UNWINDER_GUESS - bool - - endmenu -diff --git a/arch/x86/configs/tiny.config b/arch/x86/configs/tiny.config -index 550cd5012b73..66c9e2aab16c 100644 ---- a/arch/x86/configs/tiny.config -+++ b/arch/x86/configs/tiny.config -@@ -1,5 +1,5 @@ - CONFIG_NOHIGHMEM=y - # CONFIG_HIGHMEM4G is not set - # CONFIG_HIGHMEM64G is not set --CONFIG_GUESS_UNWINDER=y --# CONFIG_FRAME_POINTER_UNWINDER is not set -+CONFIG_UNWINDER_GUESS=y -+# CONFIG_UNWINDER_FRAME_POINTER is not set -diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig -index eb65c248708d..e32fc1f274d8 100644 ---- a/arch/x86/configs/x86_64_defconfig -+++ b/arch/x86/configs/x86_64_defconfig -@@ -299,7 +299,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y - # CONFIG_DEBUG_RODATA_TEST is not set - CONFIG_DEBUG_BOOT_PARAMS=y - CONFIG_OPTIMIZE_INLINING=y --CONFIG_ORC_UNWINDER=y -+CONFIG_UNWINDER_ORC=y - CONFIG_SECURITY=y - CONFIG_SECURITY_NETWORK=y - CONFIG_SECURITY_SELINUX=y -diff --git a/arch/x86/include/asm/module.h b/arch/x86/include/asm/module.h -index 9eb7c718aaf8..9f05a1002aa9 100644 ---- a/arch/x86/include/asm/module.h -+++ b/arch/x86/include/asm/module.h -@@ -5,7 +5,7 @@ - #include <asm/orc_types.h> - - struct mod_arch_specific { --#ifdef CONFIG_ORC_UNWINDER -+#ifdef CONFIG_UNWINDER_ORC - unsigned int num_orcs; - int *orc_unwind_ip; - struct orc_entry *orc_unwind; -diff --git a/arch/x86/include/asm/unwind.h b/arch/x86/include/asm/unwind.h -index e9f793e2df7a..35d67dc7b69f 100644 ---- a/arch/x86/include/asm/unwind.h -+++ b/arch/x86/include/asm/unwind.h -@@ -12,11 +12,11 @@ struct unwind_state { - struct task_struct *task; - int graph_idx; - bool error; --#if defined(CONFIG_ORC_UNWINDER) -+#if defined(CONFIG_UNWINDER_ORC) - bool signal, full_regs; - unsigned long sp, bp, ip; - struct pt_regs *regs; --#elif defined(CONFIG_FRAME_POINTER_UNWINDER) -+#elif defined(CONFIG_UNWINDER_FRAME_POINTER) - bool got_irq; - unsigned long *bp, *orig_sp, ip; - struct pt_regs *regs; -@@ -50,7 +50,7 @@ void unwind_start(struct unwind_state *state, struct task_struct *task, - __unwind_start(state, task, regs, first_frame); - } - --#if defined(CONFIG_ORC_UNWINDER) || defined(CONFIG_FRAME_POINTER_UNWINDER) -+#if defined(CONFIG_UNWINDER_ORC) || defined(CONFIG_UNWINDER_FRAME_POINTER) - static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state) - { - if (unwind_done(state)) -@@ -65,7 +65,7 @@ static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state) - } - #endif - --#ifdef CONFIG_ORC_UNWINDER -+#ifdef CONFIG_UNWINDER_ORC - void unwind_init(void); - void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size, - void *orc, size_t orc_size); -diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile -index fd0a7895b63f..6209ab6deb50 100644 ---- a/arch/x86/kernel/Makefile -+++ b/arch/x86/kernel/Makefile -@@ -127,9 +127,9 @@ obj-$(CONFIG_PERF_EVENTS) += perf_regs.o - obj-$(CONFIG_TRACING) += tracepoint.o - obj-$(CONFIG_SCHED_MC_PRIO) += itmt.o - --obj-$(CONFIG_ORC_UNWINDER) += unwind_orc.o --obj-$(CONFIG_FRAME_POINTER_UNWINDER) += unwind_frame.o --obj-$(CONFIG_GUESS_UNWINDER) += unwind_guess.o -+obj-$(CONFIG_UNWINDER_ORC) += unwind_orc.o -+obj-$(CONFIG_UNWINDER_FRAME_POINTER) += unwind_frame.o -+obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o - - ### - # 64 bit specific files -diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h -index 8acfc1e099e1..63e56f6c1877 100644 ---- a/include/asm-generic/vmlinux.lds.h -+++ b/include/asm-generic/vmlinux.lds.h -@@ -687,7 +687,7 @@ - #define BUG_TABLE - #endif - --#ifdef CONFIG_ORC_UNWINDER -+#ifdef CONFIG_UNWINDER_ORC - #define ORC_UNWIND_TABLE \ - . = ALIGN(4); \ - .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \ -diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug -index 2689b7c50c52..7566eff22236 100644 ---- a/lib/Kconfig.debug -+++ b/lib/Kconfig.debug -@@ -376,7 +376,7 @@ config STACK_VALIDATION - that runtime stack traces are more reliable. - - This is also a prerequisite for generation of ORC unwind data, which -- is needed for CONFIG_ORC_UNWINDER. -+ is needed for CONFIG_UNWINDER_ORC. - - For more information, see - tools/objtool/Documentation/stack-validation.txt. -diff --git a/scripts/Makefile.build b/scripts/Makefile.build -index 061d0c3a420a..f965f477832e 100644 ---- a/scripts/Makefile.build -+++ b/scripts/Makefile.build -@@ -258,7 +258,7 @@ ifneq ($(SKIP_STACK_VALIDATION),1) - - __objtool_obj := $(objtree)/tools/objtool/objtool - --objtool_args = $(if $(CONFIG_ORC_UNWINDER),orc generate,check) -+objtool_args = $(if $(CONFIG_UNWINDER_ORC),orc generate,check) - - ifndef CONFIG_FRAME_POINTER - objtool_args += --no-fp --- -2.15.0 - diff --git a/queue/x86-unwinder-Handle-stack-overflows-more-gracefully.patch b/queue/x86-unwinder-Handle-stack-overflows-more-gracefully.patch deleted file mode 100644 index 48371db..0000000 --- a/queue/x86-unwinder-Handle-stack-overflows-more-gracefully.patch +++ /dev/null @@ -1,320 +0,0 @@ -From b02fcf9ba1211097754b286043cd87a8b4907e75 Mon Sep 17 00:00:00 2001 -From: Josh Poimboeuf <jpoimboe@redhat.com> -Date: Mon, 4 Dec 2017 15:07:09 +0100 -Subject: [PATCH] x86/unwinder: Handle stack overflows more gracefully - -commit b02fcf9ba1211097754b286043cd87a8b4907e75 upstream. - -There are at least two unwinder bugs hindering the debugging of -stack-overflow crashes: - -- It doesn't deal gracefully with the case where the stack overflows and - the stack pointer itself isn't on a valid stack but the - to-be-dereferenced data *is*. - -- The ORC oops dump code doesn't know how to print partial pt_regs, for the - case where if we get an interrupt/exception in *early* entry code - before the full pt_regs have been saved. - -Fix both issues. - -http://lkml.kernel.org/r/20171126024031.uxi4numpbjm5rlbr@treble - -Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> -Signed-off-by: Thomas Gleixner <tglx@linutronix.de> -Reviewed-by: Borislav Petkov <bpetkov@suse.de> -Cc: Andy Lutomirski <luto@kernel.org> -Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> -Cc: Borislav Petkov <bp@alien8.de> -Cc: Brian Gerst <brgerst@gmail.com> -Cc: Dave Hansen <dave.hansen@intel.com> -Cc: Dave Hansen <dave.hansen@linux.intel.com> -Cc: David Laight <David.Laight@aculab.com> -Cc: Denys Vlasenko <dvlasenk@redhat.com> -Cc: Eduardo Valentin <eduval@amazon.com> -Cc: Greg KH <gregkh@linuxfoundation.org> -Cc: H. Peter Anvin <hpa@zytor.com> -Cc: Juergen Gross <jgross@suse.com> -Cc: Linus Torvalds <torvalds@linux-foundation.org> -Cc: Peter Zijlstra <peterz@infradead.org> -Cc: Rik van Riel <riel@redhat.com> -Cc: Will Deacon <will.deacon@arm.com> -Cc: aliguori@amazon.com -Cc: daniel.gruss@iaik.tugraz.at -Cc: hughd@google.com -Cc: keescook@google.com -Link: https://lkml.kernel.org/r/20171204150605.071425003@linutronix.de -Signed-off-by: Ingo Molnar <mingo@kernel.org> - -diff --git a/arch/x86/include/asm/kdebug.h b/arch/x86/include/asm/kdebug.h -index f86a8caa561e..395c9631e000 100644 ---- a/arch/x86/include/asm/kdebug.h -+++ b/arch/x86/include/asm/kdebug.h -@@ -26,6 +26,7 @@ extern void die(const char *, struct pt_regs *,long); - extern int __must_check __die(const char *, struct pt_regs *, long); - extern void show_stack_regs(struct pt_regs *regs); - extern void __show_regs(struct pt_regs *regs, int all); -+extern void show_iret_regs(struct pt_regs *regs); - extern unsigned long oops_begin(void); - extern void oops_end(unsigned long, struct pt_regs *, int signr); - -diff --git a/arch/x86/include/asm/unwind.h b/arch/x86/include/asm/unwind.h -index e9cc6fe1fc6f..c1688c2d0a12 100644 ---- a/arch/x86/include/asm/unwind.h -+++ b/arch/x86/include/asm/unwind.h -@@ -7,6 +7,9 @@ - #include <asm/ptrace.h> - #include <asm/stacktrace.h> - -+#define IRET_FRAME_OFFSET (offsetof(struct pt_regs, ip)) -+#define IRET_FRAME_SIZE (sizeof(struct pt_regs) - IRET_FRAME_OFFSET) -+ - struct unwind_state { - struct stack_info stack_info; - unsigned long stack_mask; -@@ -52,6 +55,10 @@ void unwind_start(struct unwind_state *state, struct task_struct *task, - } - - #if defined(CONFIG_UNWINDER_ORC) || defined(CONFIG_UNWINDER_FRAME_POINTER) -+/* -+ * WARNING: The entire pt_regs may not be safe to dereference. In some cases, -+ * only the iret frame registers are accessible. Use with caution! -+ */ - static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state) - { - if (unwind_done(state)) -diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c -index f13b4c00a5de..0bc95be5c638 100644 ---- a/arch/x86/kernel/dumpstack.c -+++ b/arch/x86/kernel/dumpstack.c -@@ -50,6 +50,28 @@ static void printk_stack_address(unsigned long address, int reliable, - printk("%s %s%pB\n", log_lvl, reliable ? "" : "? ", (void *)address); - } - -+void show_iret_regs(struct pt_regs *regs) -+{ -+ printk(KERN_DEFAULT "RIP: %04x:%pS\n", (int)regs->cs, (void *)regs->ip); -+ printk(KERN_DEFAULT "RSP: %04x:%016lx EFLAGS: %08lx", (int)regs->ss, -+ regs->sp, regs->flags); -+} -+ -+static void show_regs_safe(struct stack_info *info, struct pt_regs *regs) -+{ -+ if (on_stack(info, regs, sizeof(*regs))) -+ __show_regs(regs, 0); -+ else if (on_stack(info, (void *)regs + IRET_FRAME_OFFSET, -+ IRET_FRAME_SIZE)) { -+ /* -+ * When an interrupt or exception occurs in entry code, the -+ * full pt_regs might not have been saved yet. In that case -+ * just print the iret frame. -+ */ -+ show_iret_regs(regs); -+ } -+} -+ - void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, - unsigned long *stack, char *log_lvl) - { -@@ -94,8 +116,8 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, - if (stack_name) - printk("%s <%s>\n", log_lvl, stack_name); - -- if (regs && on_stack(&stack_info, regs, sizeof(*regs))) -- __show_regs(regs, 0); -+ if (regs) -+ show_regs_safe(&stack_info, regs); - - /* - * Scan the stack, printing any text addresses we find. At the -@@ -119,7 +141,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, - - /* - * Don't print regs->ip again if it was already printed -- * by __show_regs() below. -+ * by show_regs_safe() below. - */ - if (regs && stack == ®s->ip) - goto next; -@@ -155,8 +177,8 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, - - /* if the frame has entry regs, print them */ - regs = unwind_get_entry_regs(&state); -- if (regs && on_stack(&stack_info, regs, sizeof(*regs))) -- __show_regs(regs, 0); -+ if (regs) -+ show_regs_safe(&stack_info, regs); - } - - if (stack_name) -diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c -index eeeb34f85c25..01b119bebb68 100644 ---- a/arch/x86/kernel/process_64.c -+++ b/arch/x86/kernel/process_64.c -@@ -69,9 +69,8 @@ void __show_regs(struct pt_regs *regs, int all) - unsigned int fsindex, gsindex; - unsigned int ds, cs, es; - -- printk(KERN_DEFAULT "RIP: %04lx:%pS\n", regs->cs, (void *)regs->ip); -- printk(KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx", regs->ss, -- regs->sp, regs->flags); -+ show_iret_regs(regs); -+ - if (regs->orig_ax != -1) - pr_cont(" ORIG_RAX: %016lx\n", regs->orig_ax); - else -@@ -88,6 +87,9 @@ void __show_regs(struct pt_regs *regs, int all) - printk(KERN_DEFAULT "R13: %016lx R14: %016lx R15: %016lx\n", - regs->r13, regs->r14, regs->r15); - -+ if (!all) -+ return; -+ - asm("movl %%ds,%0" : "=r" (ds)); - asm("movl %%cs,%0" : "=r" (cs)); - asm("movl %%es,%0" : "=r" (es)); -@@ -98,9 +100,6 @@ void __show_regs(struct pt_regs *regs, int all) - rdmsrl(MSR_GS_BASE, gs); - rdmsrl(MSR_KERNEL_GS_BASE, shadowgs); - -- if (!all) -- return; -- - cr0 = read_cr0(); - cr2 = read_cr2(); - cr3 = __read_cr3(); -diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c -index ff8e1132b2ae..be86a865087a 100644 ---- a/arch/x86/kernel/unwind_orc.c -+++ b/arch/x86/kernel/unwind_orc.c -@@ -253,22 +253,15 @@ unsigned long *unwind_get_return_address_ptr(struct unwind_state *state) - return NULL; - } - --static bool stack_access_ok(struct unwind_state *state, unsigned long addr, -+static bool stack_access_ok(struct unwind_state *state, unsigned long _addr, - size_t len) - { - struct stack_info *info = &state->stack_info; -+ void *addr = (void *)_addr; - -- /* -- * If the address isn't on the current stack, switch to the next one. -- * -- * We may have to traverse multiple stacks to deal with the possibility -- * that info->next_sp could point to an empty stack and the address -- * could be on a subsequent stack. -- */ -- while (!on_stack(info, (void *)addr, len)) -- if (get_stack_info(info->next_sp, state->task, info, -- &state->stack_mask)) -- return false; -+ if (!on_stack(info, addr, len) && -+ (get_stack_info(addr, state->task, info, &state->stack_mask))) -+ return false; - - return true; - } -@@ -283,42 +276,32 @@ static bool deref_stack_reg(struct unwind_state *state, unsigned long addr, - return true; - } - --#define REGS_SIZE (sizeof(struct pt_regs)) --#define SP_OFFSET (offsetof(struct pt_regs, sp)) --#define IRET_REGS_SIZE (REGS_SIZE - offsetof(struct pt_regs, ip)) --#define IRET_SP_OFFSET (SP_OFFSET - offsetof(struct pt_regs, ip)) -- - static bool deref_stack_regs(struct unwind_state *state, unsigned long addr, -- unsigned long *ip, unsigned long *sp, bool full) -+ unsigned long *ip, unsigned long *sp) - { -- size_t regs_size = full ? REGS_SIZE : IRET_REGS_SIZE; -- size_t sp_offset = full ? SP_OFFSET : IRET_SP_OFFSET; -- struct pt_regs *regs = (struct pt_regs *)(addr + regs_size - REGS_SIZE); -- -- if (IS_ENABLED(CONFIG_X86_64)) { -- if (!stack_access_ok(state, addr, regs_size)) -- return false; -- -- *ip = regs->ip; -- *sp = regs->sp; -+ struct pt_regs *regs = (struct pt_regs *)addr; - -- return true; -- } -+ /* x86-32 support will be more complicated due to the ®s->sp hack */ -+ BUILD_BUG_ON(IS_ENABLED(CONFIG_X86_32)); - -- if (!stack_access_ok(state, addr, sp_offset)) -+ if (!stack_access_ok(state, addr, sizeof(struct pt_regs))) - return false; - - *ip = regs->ip; -+ *sp = regs->sp; -+ return true; -+} - -- if (user_mode(regs)) { -- if (!stack_access_ok(state, addr + sp_offset, -- REGS_SIZE - SP_OFFSET)) -- return false; -+static bool deref_stack_iret_regs(struct unwind_state *state, unsigned long addr, -+ unsigned long *ip, unsigned long *sp) -+{ -+ struct pt_regs *regs = (void *)addr - IRET_FRAME_OFFSET; - -- *sp = regs->sp; -- } else -- *sp = (unsigned long)®s->sp; -+ if (!stack_access_ok(state, addr, IRET_FRAME_SIZE)) -+ return false; - -+ *ip = regs->ip; -+ *sp = regs->sp; - return true; - } - -@@ -327,7 +310,6 @@ bool unwind_next_frame(struct unwind_state *state) - unsigned long ip_p, sp, orig_ip, prev_sp = state->sp; - enum stack_type prev_type = state->stack_info.type; - struct orc_entry *orc; -- struct pt_regs *ptregs; - bool indirect = false; - - if (unwind_done(state)) -@@ -435,7 +417,7 @@ bool unwind_next_frame(struct unwind_state *state) - break; - - case ORC_TYPE_REGS: -- if (!deref_stack_regs(state, sp, &state->ip, &state->sp, true)) { -+ if (!deref_stack_regs(state, sp, &state->ip, &state->sp)) { - orc_warn("can't dereference registers at %p for ip %pB\n", - (void *)sp, (void *)orig_ip); - goto done; -@@ -447,20 +429,14 @@ bool unwind_next_frame(struct unwind_state *state) - break; - - case ORC_TYPE_REGS_IRET: -- if (!deref_stack_regs(state, sp, &state->ip, &state->sp, false)) { -+ if (!deref_stack_iret_regs(state, sp, &state->ip, &state->sp)) { - orc_warn("can't dereference iret registers at %p for ip %pB\n", - (void *)sp, (void *)orig_ip); - goto done; - } - -- ptregs = container_of((void *)sp, struct pt_regs, ip); -- if ((unsigned long)ptregs >= prev_sp && -- on_stack(&state->stack_info, ptregs, REGS_SIZE)) { -- state->regs = ptregs; -- state->full_regs = false; -- } else -- state->regs = NULL; -- -+ state->regs = (void *)sp - IRET_FRAME_OFFSET; -+ state->full_regs = false; - state->signal = true; - break; - --- -2.15.0 - diff --git a/queue/x86-unwinder-Make-CONFIG_UNWINDER_ORC-y-the-default-.patch b/queue/x86-unwinder-Make-CONFIG_UNWINDER_ORC-y-the-default-.patch deleted file mode 100644 index d633c7d..0000000 --- a/queue/x86-unwinder-Make-CONFIG_UNWINDER_ORC-y-the-default-.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 1e4078f0bba46ad61b69548abe6a6faf63b89380 Mon Sep 17 00:00:00 2001 -From: Ingo Molnar <mingo@kernel.org> -Date: Thu, 12 Oct 2017 09:24:30 +0200 -Subject: [PATCH] x86/unwinder: Make CONFIG_UNWINDER_ORC=y the default in the - 64-bit defconfig - -commit 1e4078f0bba46ad61b69548abe6a6faf63b89380 upstream. - -Increase testing coverage by turning on the primary x86 unwinder for -the 64-bit defconfig. - -Cc: Josh Poimboeuf <jpoimboe@redhat.com> -Cc: Linus Torvalds <torvalds@linux-foundation.org> -Cc: Peter Zijlstra <peterz@infradead.org> -Cc: Thomas Gleixner <tglx@linutronix.de> -Cc: linux-kernel@vger.kernel.org -Signed-off-by: Ingo Molnar <mingo@kernel.org> - -diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig -index 4a4b16e56d35..eb65c248708d 100644 ---- a/arch/x86/configs/x86_64_defconfig -+++ b/arch/x86/configs/x86_64_defconfig -@@ -299,6 +299,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y - # CONFIG_DEBUG_RODATA_TEST is not set - CONFIG_DEBUG_BOOT_PARAMS=y - CONFIG_OPTIMIZE_INLINING=y -+CONFIG_ORC_UNWINDER=y - CONFIG_SECURITY=y - CONFIG_SECURITY_NETWORK=y - CONFIG_SECURITY_SELINUX=y --- -2.15.0 - diff --git a/queue/x86-unwinder-orc-Dont-bail-on-stack-overflow.patch b/queue/x86-unwinder-orc-Dont-bail-on-stack-overflow.patch deleted file mode 100644 index 1cf4c3b..0000000 --- a/queue/x86-unwinder-orc-Dont-bail-on-stack-overflow.patch +++ /dev/null @@ -1,80 +0,0 @@ -From d3a09104018cf2ad5973dfa8a9c138ef9f5015a3 Mon Sep 17 00:00:00 2001 -From: Andy Lutomirski <luto@kernel.org> -Date: Mon, 4 Dec 2017 15:07:08 +0100 -Subject: [PATCH] x86/unwinder/orc: Dont bail on stack overflow - -commit d3a09104018cf2ad5973dfa8a9c138ef9f5015a3 upstream. - -If the stack overflows into a guard page and the ORC unwinder should work -well: by construction, there can't be any meaningful data in the guard page -because no writes to the guard page will have succeeded. - -But there is a bug that prevents unwinding from working correctly: if the -starting register state has RSP pointing into a stack guard page, the ORC -unwinder bails out immediately. - -Instead of bailing out immediately check whether the next page up is a -valid check page and if so analyze that. As a result the ORC unwinder will -start the unwind. - -Tested by intentionally overflowing the task stack. The result is an -accurate call trace instead of a trace consisting purely of '?' entries. - -There are a few other bugs that are triggered if the unwinder encounters a -stack overflow after the first step, but they are outside the scope of this -fix. - -Signed-off-by: Andy Lutomirski <luto@kernel.org> -Signed-off-by: Thomas Gleixner <tglx@linutronix.de> -Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> -Cc: Borislav Petkov <bp@alien8.de> -Cc: Borislav Petkov <bpetkov@suse.de> -Cc: Brian Gerst <brgerst@gmail.com> -Cc: Dave Hansen <dave.hansen@intel.com> -Cc: Dave Hansen <dave.hansen@linux.intel.com> -Cc: David Laight <David.Laight@aculab.com> -Cc: Denys Vlasenko <dvlasenk@redhat.com> -Cc: Eduardo Valentin <eduval@amazon.com> -Cc: Greg KH <gregkh@linuxfoundation.org> -Cc: H. Peter Anvin <hpa@zytor.com> -Cc: Josh Poimboeuf <jpoimboe@redhat.com> -Cc: Juergen Gross <jgross@suse.com> -Cc: Linus Torvalds <torvalds@linux-foundation.org> -Cc: Peter Zijlstra <peterz@infradead.org> -Cc: Rik van Riel <riel@redhat.com> -Cc: Will Deacon <will.deacon@arm.com> -Cc: aliguori@amazon.com -Cc: daniel.gruss@iaik.tugraz.at -Cc: hughd@google.com -Cc: keescook@google.com -Link: https://lkml.kernel.org/r/20171204150604.991389777@linutronix.de -Signed-off-by: Ingo Molnar <mingo@kernel.org> - -diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c -index a3f973b2c97a..ff8e1132b2ae 100644 ---- a/arch/x86/kernel/unwind_orc.c -+++ b/arch/x86/kernel/unwind_orc.c -@@ -553,8 +553,18 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task, - } - - if (get_stack_info((unsigned long *)state->sp, state->task, -- &state->stack_info, &state->stack_mask)) -- return; -+ &state->stack_info, &state->stack_mask)) { -+ /* -+ * We weren't on a valid stack. It's possible that -+ * we overflowed a valid stack into a guard page. -+ * See if the next page up is valid so that we can -+ * generate some kind of backtrace if this happens. -+ */ -+ void *next_page = (void *)PAGE_ALIGN((unsigned long)state->sp); -+ if (get_stack_info(next_page, state->task, &state->stack_info, -+ &state->stack_mask)) -+ return; -+ } - - /* - * The caller can provide the address of the first frame directly --- -2.15.0 - |