Home Home > GIT Browse > stable-xen
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2017-07-27 07:46:03 +0200
committerJiri Slaby <jslaby@suse.cz>2017-07-27 07:46:03 +0200
commit903e200b45a3b2f5d37d34244aa95feb317c5686 (patch)
treeb0cee7e08112439cb7819a083d11b8d26c4c6ee3
parentb545b8732b541f0c383321cd13736e24c4f00e5a (diff)
- x86/kconfig: Make it easier to switch to the new ORC unwinder
(bnc#1018348). - x86/kconfig: Consolidate unwinders into multiple choice selection (bnc#1018348). - Update config files. - Refresh patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch. - Refresh patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch. - Refresh patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch. Update to version from -tip. ORC is in -tip completely. So make sure we use the upstream version.
-rw-r--r--config/i386/default2
-rw-r--r--config/i386/pae3
-rw-r--r--config/x86_64/default4
-rw-r--r--config/x86_64/syzkaller1
-rw-r--r--patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch24
-rw-r--r--patches.suse/0001-x86-unwind-Add-the-ORC-unwinder.patch (renamed from patches.suse/0009-x86-unwind-add-ORC-unwinder.patch)281
-rw-r--r--patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch30
-rw-r--r--patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch18
-rw-r--r--patches.suse/0002-x86-kconfig-Make-it-easier-to-switch-to-the-new-ORC-.patch99
-rw-r--r--patches.suse/0003-x86-dumpstack-Fix-occasionally-missing-registers.patch (renamed from patches.suse/0003-x86-dumpstack-fix-occasionally-missing-registers.patch)19
-rw-r--r--patches.suse/0003-x86-kconfig-Consolidate-unwinders-into-multiple-choi.patch157
-rw-r--r--patches.suse/0004-x86-dumpstack-Fix-interrupt-and-exception-stack-boun.patch (renamed from patches.suse/0004-x86-dumpstack-fix-interrupt-and-exception-stack-boun.patch)19
-rw-r--r--patches.suse/0005-objtool-Add-ORC-unwind-table-generation.patch (renamed from patches.suse/0005-objtool-add-ORC-unwind-table-generation.patch)25
-rw-r--r--patches.suse/0006-objtool-x86-Add-facility-for-asm-code-to-provide-unw.patch (renamed from patches.suse/0006-objtool-x86-add-facility-for-asm-code-to-provide-unw.patch)31
-rw-r--r--patches.suse/0007-x86-entry-64-Add-unwind-hint-annotations.patch (renamed from patches.suse/0007-x86-entry-64-add-unwind-hint-annotations.patch)79
-rw-r--r--patches.suse/0008-x86-asm-Add-unwind-hint-annotations-to-sync_core.patch (renamed from patches.suse/0008-x86-asm-add-unwind-hint-annotations-to-sync_core.patch)21
-rw-r--r--series.conf29
17 files changed, 645 insertions, 197 deletions
diff --git a/config/i386/default b/config/i386/default
index 4978f10c73..a402e8d980 100644
--- a/config/i386/default
+++ b/config/i386/default
@@ -60,7 +60,6 @@ CONFIG_DRM_I2C_ADV7533=y
# CONFIG_DRM_SIL_SII8620 is not set
# CONFIG_DRM_TI_TFP410 is not set
# CONFIG_DRM_TOSHIBA_TC358767 is not set
-CONFIG_DRM_VBOXVIDEO=m
CONFIG_DTLK=m
CONFIG_EBC_C384_WDT=m
# CONFIG_EISA is not set
@@ -76,6 +75,7 @@ CONFIG_FLATMEM_MANUAL=y
CONFIG_FPGA_BRIDGE=m
# CONFIG_FPGA_MGR_ICE40_SPI is not set
CONFIG_FPGA_REGION=m
+# CONFIG_FRAME_POINTER_UNWINDER is not set
# CONFIG_FSL_EDMA is not set
CONFIG_GPIO_104_DIO_48E=m
CONFIG_GPIO_104_IDIO_16=m
diff --git a/config/i386/pae b/config/i386/pae
index 8a494c6845..6b6aaa0cec 100644
--- a/config/i386/pae
+++ b/config/i386/pae
@@ -7911,8 +7911,6 @@ CONFIG_DEBUG_FS=y
CONFIG_HEADERS_CHECK=y
CONFIG_DEBUG_SECTION_MISMATCH=y
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
-CONFIG_ARCH_WANT_FRAME_POINTERS=y
-# CONFIG_FRAME_POINTER is not set
CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1
@@ -8153,6 +8151,7 @@ CONFIG_OPTIMIZE_INLINING=y
# CONFIG_DEBUG_IMR_SELFTEST is not set
# CONFIG_X86_DEBUG_FPU is not set
# CONFIG_PUNIT_ATOM_DEBUG is not set
+# CONFIG_FRAME_POINTER_UNWINDER is not set
CONFIG_GUESS_UNWINDER=y
#
diff --git a/config/x86_64/default b/config/x86_64/default
index d9de0cd175..0d09e65421 100644
--- a/config/x86_64/default
+++ b/config/x86_64/default
@@ -7917,8 +7917,6 @@ CONFIG_DEBUG_FS=y
CONFIG_HEADERS_CHECK=y
CONFIG_DEBUG_SECTION_MISMATCH=y
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
-CONFIG_ARCH_WANT_FRAME_POINTERS=y
-# CONFIG_FRAME_POINTER is not set
CONFIG_STACK_VALIDATION=y
CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
CONFIG_MAGIC_SYSRQ=y
@@ -8163,7 +8161,9 @@ CONFIG_OPTIMIZE_INLINING=y
# CONFIG_DEBUG_NMI_SELFTEST is not set
# CONFIG_X86_DEBUG_FPU is not set
# CONFIG_PUNIT_ATOM_DEBUG is not set
+# CONFIG_FRAME_POINTER_UNWINDER is not set
CONFIG_ORC_UNWINDER=y
+# CONFIG_GUESS_UNWINDER is not set
#
# Security options
diff --git a/config/x86_64/syzkaller b/config/x86_64/syzkaller
index 72c20547c6..7cc95e17c6 100644
--- a/config/x86_64/syzkaller
+++ b/config/x86_64/syzkaller
@@ -8,7 +8,6 @@ CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_RT_MUTEXES=y
CONFIG_DEBUG_SPINLOCK=y
-CONFIG_FRAME_POINTER=y
CONFIG_GCC_PLUGINS=y
# CONFIG_GCC_PLUGIN_CYC_COMPLEXITY is not set
# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set
diff --git a/patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch b/patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch
index ff2c7b925e..e1ef7db15c 100644
--- a/patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch
+++ b/patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch
@@ -1,5 +1,5 @@
From: Andy Lutomirski <luto@kernel.org>
-Date: Fri, 30 Jun 2017 08:56:32 -0700
+Date: Tue, 11 Jul 2017 10:33:38 -0500
Subject: x86/entry/64: Refactor IRQ stacks and make them NMI-safe
Patch-mainline: Queued in subsystem maintainer repository
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
@@ -16,6 +16,18 @@ Signed-off-by: Andy Lutomirski <luto@kernel.org>
[ Use %r10 instead of %r11 in xen_do_hypervisor_callback to make objtool
and ORC unwinder's lives a little easier. ]
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/b0b2ff5fb97d2da2e1d7e1f380190c92545c8bb5.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/x86/Kconfig.debug | 2 -
@@ -36,7 +48,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
config DEBUG_NMI_SELFTEST
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
-@@ -446,6 +446,59 @@ ENTRY(irq_entries_start)
+@@ -447,6 +447,59 @@ ENTRY(irq_entries_start)
.endr
END(irq_entries_start)
@@ -96,7 +108,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/*
* Interrupt entry/exit.
*
-@@ -484,17 +537,7 @@ END(irq_entries_start)
+@@ -485,17 +538,7 @@ END(irq_entries_start)
CALL_enter_from_user_mode
1:
@@ -115,7 +127,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/* We entered an interrupt context - irqs are off: */
TRACE_IRQS_OFF
-@@ -514,10 +557,8 @@ common_interrupt:
+@@ -515,10 +558,8 @@ common_interrupt:
ret_from_intr:
DISABLE_INTERRUPTS(CLBR_ANY)
TRACE_IRQS_OFF
@@ -127,7 +139,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
testb $3, CS(%rsp)
jz retint_kernel
-@@ -890,12 +931,10 @@ bad_gs:
+@@ -891,12 +932,10 @@ bad_gs:
ENTRY(do_softirq_own_stack)
pushq %rbp
mov %rsp, %rbp
@@ -142,7 +154,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
ret
END(do_softirq_own_stack)
-@@ -922,13 +961,11 @@ ENTRY(xen_do_hypervisor_callback) /* do
+@@ -923,13 +962,11 @@ ENTRY(xen_do_hypervisor_callback) /* do
* see the correct pointer to the pt_regs
*/
movq %rdi, %rsp /* we don't return, adjust the stack frame */
diff --git a/patches.suse/0009-x86-unwind-add-ORC-unwinder.patch b/patches.suse/0001-x86-unwind-Add-the-ORC-unwinder.patch
index adc1444619..33166d42be 100644
--- a/patches.suse/0009-x86-unwind-add-ORC-unwinder.patch
+++ b/patches.suse/0001-x86-unwind-Add-the-ORC-unwinder.patch
@@ -1,67 +1,90 @@
From: Josh Poimboeuf <jpoimboe@redhat.com>
-Date: Wed, 31 May 2017 20:05:20 -0500
-Subject: x86/unwind: add ORC unwinder
-Patch-mainline: submitted Jun 28th 2017
+Date: Mon, 24 Jul 2017 18:36:57 -0500
+Subject: x86/unwind: Add the ORC unwinder
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: ee9f8fce99640811b2b8e79d0d1dbe8bab69ba67
References: bnc#1018348
-Add a new ORC unwinder which is enabled by CONFIG_ORC_UNWINDER. It
-plugs into the existing x86 unwinder framework.
+Add the new ORC unwinder which is enabled by CONFIG_ORC_UNWINDER=y.
+It plugs into the existing x86 unwinder framework.
It relies on objtool to generate the needed .orc_unwind and
.orc_unwind_ip sections.
For more details on why ORC is used instead of DWARF, see
-Documentation/x86/orc-unwinder.txt.
+Documentation/x86/orc-unwinder.txt - but the short version is
+that it's a simplified, fundamentally more robust debugninfo
+data structure, which also allows up to two orders of magnitude
+faster lookups than the DWARF unwinder - which matters to
+profiling workloads like perf.
Thanks to Andy Lutomirski for the performance improvement ideas:
splitting the ORC unwind table into two parallel arrays and creating a
fast lookup table to search a subset of the unwind table.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/0a6cbfb40f8da99b7a45a1a8302dc6aef16ec812.1500938583.git.jpoimboe@redhat.com
+[ Extended the changelog. ]
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
- Documentation/x86/orc-unwinder.txt | 178 +++++++++++
+ Documentation/x86/orc-unwinder.txt | 179 +++++++++++
arch/um/include/asm/unwind.h | 8
arch/x86/Kconfig | 1
arch/x86/Kconfig.debug | 25 +
arch/x86/include/asm/module.h | 9
+ arch/x86/include/asm/orc_lookup.h | 46 ++
+ arch/x86/include/asm/orc_types.h | 2
arch/x86/include/asm/unwind.h | 76 ++--
arch/x86/kernel/Makefile | 8
arch/x86/kernel/module.c | 11
arch/x86/kernel/setup.c | 3
arch/x86/kernel/unwind_frame.c | 39 +-
arch/x86/kernel/unwind_guess.c | 5
- arch/x86/kernel/unwind_orc.c | 590 +++++++++++++++++++++++++++++++++++++
- arch/x86/kernel/vmlinux.lds.S | 2
- include/asm-generic/vmlinux.lds.h | 20 +
+ arch/x86/kernel/unwind_orc.c | 582 +++++++++++++++++++++++++++++++++++++
+ arch/x86/kernel/vmlinux.lds.S | 3
+ include/asm-generic/vmlinux.lds.h | 27 +
lib/Kconfig.debug | 3
scripts/Makefile.build | 14
- 16 files changed, 929 insertions(+), 63 deletions(-)
+ 18 files changed, 977 insertions(+), 64 deletions(-)
create mode 100644 Documentation/x86/orc-unwinder.txt
create mode 100644 arch/um/include/asm/unwind.h
+ create mode 100644 arch/x86/include/asm/orc_lookup.h
create mode 100644 arch/x86/kernel/unwind_orc.c
--- /dev/null
+++ b/Documentation/x86/orc-unwinder.txt
-@@ -0,0 +1,178 @@
+@@ -0,0 +1,179 @@
+ORC unwinder
+============
+
+Overview
+--------
+
-+The kernel CONFIG_ORC_UNWINDER option enables objtool generation of the
-+ORC unwind tables, which contain out-of-band data which is used by the
-+in-kernel ORC unwinder. It's similar in concept to DWARF CFI debuginfo
-+which would be used by a DWARF unwinder. The difference is that the
-+format of the ORC data is simpler than DWARF, which in turn allows the
-+unwinder to be simpler and faster.
++The kernel CONFIG_ORC_UNWINDER 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.
+
-+Objtool generates the ORC data by first doing compile-time stack
-+metadata validation (CONFIG_STACK_VALIDATION). After analyzing all the
-+code paths of a .o file, it determines information about the stack state
-+at each instruction address in the file and outputs that information to
-+the .orc_unwind and .orc_unwind_ip sections.
++The ORC data consists of unwind tables which are generated by objtool.
++They contain out-of-band data which is used by the in-kernel ORC
++unwinder. Objtool generates the ORC data by first doing compile-time
++stack metadata validation (CONFIG_STACK_VALIDATION). After analyzing
++all the code paths of a .o file, it determines information about the
++stack state at each instruction address in the file and outputs that
++information to the .orc_unwind and .orc_unwind_ip sections.
+
+The per-object ORC sections are combined at link time and are sorted and
+post-processed at boot time. The unwinder uses the resulting data to
@@ -116,8 +139,9 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+taken before some performance tweaks were added, which doubled
+performance, so the speedup over DWARF may be closer to 40x.)
+
-+The ORC data format does have a few downsides compared to DWARF. The
-+ORC unwind tables take up ~1MB more memory than DWARF eh_frame tables.
++The ORC data format does have a few downsides compared to DWARF. ORC
++unwind tables take up ~50% more RAM (+1.3MB on an x86 defconfig kernel)
++than DWARF-based eh_frame tables.
+
+Another potential downside is that, as GCC evolves, it's conceivable
+that the ORC data may end up being *too* simple to describe the state of
@@ -235,7 +259,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+#endif /* _ASM_UML_UNWIND_H */
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
-@@ -151,6 +151,7 @@ config X86
+@@ -157,6 +157,7 @@ config X86
select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP
select HAVE_MIXED_BREAKPOINTS_REGS
@@ -245,7 +269,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
select HAVE_OPTPROBES
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
-@@ -355,4 +355,29 @@ config PUNIT_ATOM_DEBUG
+@@ -356,4 +356,29 @@ config PUNIT_ATOM_DEBUG
The current power state can be read from
/sys/kernel/debug/punit_atom/dev_power_state
@@ -254,7 +278,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ depends on X86_64
+ select STACK_VALIDATION
+ ---help---
-+ This option enables the ORC (Oops Rewind Capabilty) unwinder for
++ This option enables the ORC (Oops Rewind Capability) unwinder for
+ unwinding kernel stack traces. It uses a custom data format which is
+ a simplified version of the DWARF Call Frame Information standard.
+
@@ -285,7 +309,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+
+struct mod_arch_specific {
+#ifdef CONFIG_ORC_UNWINDER
-+ unsigned int num_undwarves;
++ unsigned int num_orcs;
+ int *orc_unwind_ip;
+ struct orc_entry *orc_unwind;
+#endif
@@ -293,6 +317,66 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
#ifdef CONFIG_X86_64
/* X86_64 does not define MODULE_PROC_FAMILY */
+--- /dev/null
++++ b/arch/x86/include/asm/orc_lookup.h
+@@ -0,0 +1,46 @@
++/*
++ * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++#ifndef _ORC_LOOKUP_H
++#define _ORC_LOOKUP_H
++
++/*
++ * This is a lookup table for speeding up access to the .orc_unwind table.
++ * Given an input address offset, the corresponding lookup table entry
++ * specifies a subset of the .orc_unwind table to search.
++ *
++ * Each block represents the end of the previous range and the start of the
++ * next range. An extra block is added to give the last range an end.
++ *
++ * The block size should be a power of 2 to avoid a costly 'div' instruction.
++ *
++ * A block size of 256 was chosen because it roughly doubles unwinder
++ * performance while only adding ~5% to the ORC data footprint.
++ */
++#define LOOKUP_BLOCK_ORDER 8
++#define LOOKUP_BLOCK_SIZE (1 << LOOKUP_BLOCK_ORDER)
++
++#ifndef LINKER_SCRIPT
++
++extern unsigned int orc_lookup[];
++extern unsigned int orc_lookup_end[];
++
++#define LOOKUP_START_IP (unsigned long)_stext
++#define LOOKUP_STOP_IP (unsigned long)_etext
++
++#endif /* LINKER_SCRIPT */
++
++#endif /* _ORC_LOOKUP_H */
+--- a/arch/x86/include/asm/orc_types.h
++++ b/arch/x86/include/asm/orc_types.h
+@@ -88,7 +88,7 @@ struct orc_entry {
+ unsigned sp_reg:4;
+ unsigned bp_reg:4;
+ unsigned type:2;
+-};
++} __packed;
+
+ /*
+ * This struct is used by asm and inline asm code to manually annotate the
--- a/arch/x86/include/asm/unwind.h
+++ b/arch/x86/include/asm/unwind.h
@@ -12,11 +12,14 @@ struct unwind_state {
@@ -419,7 +503,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
#endif /* _ASM_X86_UNWIND_H */
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
-@@ -125,11 +125,9 @@ obj-$(CONFIG_PERF_EVENTS) += perf_regs.
+@@ -126,11 +126,9 @@ obj-$(CONFIG_PERF_EVENTS) += perf_regs.
obj-$(CONFIG_TRACING) += tracepoint.o
obj-$(CONFIG_SCHED_MC_PRIO) += itmt.o
@@ -485,7 +569,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/*
* max_low_pfn_mapped: highest direct mapped pfn under 4GB
-@@ -1303,6 +1304,8 @@ void __init setup_arch(char **cmdline_p)
+@@ -1310,6 +1311,8 @@ void __init setup_arch(char **cmdline_p)
if (efi_enabled(EFI_BOOT))
efi_apply_memmap_quirks();
#endif
@@ -565,59 +649,30 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
struct stack_info *info = &state->stack_info;
--- /dev/null
+++ b/arch/x86/kernel/unwind_orc.c
-@@ -0,0 +1,590 @@
+@@ -0,0 +1,582 @@
+#include <linux/module.h>
+#include <linux/sort.h>
+#include <asm/ptrace.h>
+#include <asm/stacktrace.h>
+#include <asm/unwind.h>
+#include <asm/orc_types.h>
++#include <asm/orc_lookup.h>
+#include <asm/sections.h>
+
+#define orc_warn(fmt, ...) \
+ printk_deferred_once(KERN_WARNING pr_fmt("WARNING: " fmt), ##__VA_ARGS__)
+
+extern int __start_orc_unwind_ip[];
-+extern int __stop_orc_ip[];
++extern int __stop_orc_unwind_ip[];
+extern struct orc_entry __start_orc_unwind[];
-+extern struct orc_entry __stop_orc[];
++extern struct orc_entry __stop_orc_unwind[];
+
-+bool orc_init;
+static DEFINE_MUTEX(sort_mutex);
-+
+int *cur_orc_ip_table = __start_orc_unwind_ip;
+struct orc_entry *cur_orc_table = __start_orc_unwind;
+
-+/*
-+ * This is a lookup table for speeding up access to the .orc_unwind table.
-+ * Given an input address offset, the corresponding lookup table entry
-+ * specifies a subset of the .orc_unwind table to search.
-+ *
-+ * Each block represents the end of the previous range and the start of the
-+ * next range. An extra block is added to give the last range an end.
-+ *
-+ * Some measured performance results for different values of LOOKUP_NUM_BLOCKS:
-+ *
-+ * num blocks array size lookup speedup total speedup
-+ * 2k 8k 1.5x 1.5x
-+ * 4k 16k 1.6x 1.6x
-+ * 8k 32k 1.8x 1.7x
-+ * 16k 64k 2.0x 1.8x
-+ * 32k 128k 2.5x 2.0x
-+ * 64k 256k 2.9x 2.2x
-+ * 128k 512k 3.3x 2.4x
-+ *
-+ * Here we go with 32k blocks because it doubles unwinder performance while
-+ * only adding 3.5% to the ORC data footprint.
-+ */
-+#define LOOKUP_NUM_BLOCKS (32 * 1024)
-+static unsigned int orc_fast_lookup[LOOKUP_NUM_BLOCKS + 1] __ro_after_init;
-+
-+#define LOOKUP_START_IP (unsigned long)_stext
-+#define LOOKUP_STOP_IP (unsigned long)_etext
-+#define LOOKUP_BLOCK_SIZE \
-+ (DIV_ROUND_UP(LOOKUP_STOP_IP - LOOKUP_START_IP, LOOKUP_NUM_BLOCKS))
-+
++unsigned int lookup_num_blocks;
++bool orc_init;
+
+static inline unsigned long orc_ip(const int *ip)
+{
@@ -653,10 +708,26 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ return u_table + (found - ip_table);
+}
+
-+static struct orc_entry *orc_find(unsigned long ip)
++#ifdef CONFIG_MODULES
++static struct orc_entry *orc_module_find(unsigned long ip)
+{
+ struct module *mod;
+
++ mod = __module_address(ip);
++ if (!mod || !mod->arch.orc_unwind || !mod->arch.orc_unwind_ip)
++ return NULL;
++ return __orc_find(mod->arch.orc_unwind_ip, mod->arch.orc_unwind,
++ mod->arch.num_orcs, ip);
++}
++#else
++static struct orc_entry *orc_module_find(unsigned long ip)
++{
++ return NULL;
++}
++#endif
++
++static struct orc_entry *orc_find(unsigned long ip)
++{
+ if (!orc_init)
+ return NULL;
+
@@ -666,15 +737,21 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+
+ idx = (ip - LOOKUP_START_IP) / LOOKUP_BLOCK_SIZE;
+
-+ if (WARN_ON_ONCE(idx >= LOOKUP_NUM_BLOCKS))
++ if (unlikely((idx >= lookup_num_blocks-1))) {
++ orc_warn("WARNING: bad lookup idx: idx=%u num=%u ip=%lx\n",
++ idx, lookup_num_blocks, ip);
+ return NULL;
++ }
+
-+ start = orc_fast_lookup[idx];
-+ stop = orc_fast_lookup[idx + 1] + 1;
++ start = orc_lookup[idx];
++ stop = orc_lookup[idx + 1] + 1;
+
-+ if (WARN_ON_ONCE(__start_orc_unwind + start >= __stop_orc) ||
-+ __start_orc_unwind + stop > __stop_orc)
++ if (unlikely((__start_orc_unwind + start >= __stop_orc_unwind) ||
++ (__start_orc_unwind + stop > __stop_orc_unwind))) {
++ orc_warn("WARNING: bad lookup value: idx=%u num=%u start=%u stop=%u ip=%lx\n",
++ idx, lookup_num_blocks, start, stop, ip);
+ return NULL;
++ }
+
+ return __orc_find(__start_orc_unwind_ip + start,
+ __start_orc_unwind + start, stop - start, ip);
@@ -683,14 +760,10 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ /* vmlinux .init slow lookup: */
+ if (ip >= (unsigned long)_sinittext && ip < (unsigned long)_einittext)
+ return __orc_find(__start_orc_unwind_ip, __start_orc_unwind,
-+ __stop_orc - __start_orc_unwind, ip);
++ __stop_orc_unwind_ip - __start_orc_unwind_ip, ip);
+
+ /* Module lookup: */
-+ mod = __module_address(ip);
-+ if (!mod || !mod->arch.orc_unwind || !mod->arch.orc_unwind_ip)
-+ return NULL;
-+ return __orc_find(mod->arch.orc_unwind_ip, mod->arch.orc_unwind,
-+ mod->arch.num_undwarves, ip);
++ return orc_module_find(ip);
+}
+
+static void orc_sort_swap(void *_a, void *_b, int size)
@@ -735,6 +808,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ return orc_a->sp_reg == ORC_REG_UNDEFINED ? -1 : 1;
+}
+
++#ifdef CONFIG_MODULES
+void unwind_module_init(struct module *mod, void *_orc_ip, size_t orc_ip_size,
+ void *_orc, size_t orc_size)
+{
@@ -759,13 +833,14 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+
+ mod->arch.orc_unwind_ip = orc_ip;
+ mod->arch.orc_unwind = orc;
-+ mod->arch.num_undwarves = num_entries;
++ mod->arch.num_orcs = num_entries;
+}
++#endif
+
+void __init unwind_init(void)
+{
-+ size_t orc_ip_size = (void *)__stop_orc_ip - (void *)__start_orc_unwind_ip;
-+ size_t orc_size = (void *)__stop_orc - (void *)__start_orc_unwind;
++ size_t orc_ip_size = (void *)__stop_orc_unwind_ip - (void *)__start_orc_unwind_ip;
++ size_t orc_size = (void *)__stop_orc_unwind - (void *)__start_orc_unwind;
+ size_t num_entries = orc_ip_size / sizeof(int);
+ struct orc_entry *orc;
+ int i;
@@ -773,7 +848,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ if (!num_entries || orc_ip_size % sizeof(int) != 0 ||
+ orc_size % sizeof(struct orc_entry) != 0 ||
+ num_entries != orc_size / sizeof(struct orc_entry)) {
-+ pr_warn("WARNING: Bad or missing .orc_unwind table. Disabling unwinder.\n");
++ orc_warn("WARNING: Bad or missing .orc_unwind table. Disabling unwinder.\n");
+ return;
+ }
+
@@ -782,26 +857,27 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ orc_sort_swap);
+
+ /* Initialize the fast lookup table: */
-+ for (i = 0; i < LOOKUP_NUM_BLOCKS; i++) {
++ lookup_num_blocks = orc_lookup_end - orc_lookup;
++ for (i = 0; i < lookup_num_blocks-1; i++) {
+ orc = __orc_find(__start_orc_unwind_ip, __start_orc_unwind,
+ num_entries,
+ LOOKUP_START_IP + (LOOKUP_BLOCK_SIZE * i));
+ if (!orc) {
-+ pr_warn("WARNING: Corrupt .orc_unwind table. Disabling unwinder.\n");
++ orc_warn("WARNING: Corrupt .orc_unwind table. Disabling unwinder.\n");
+ return;
+ }
+
-+ orc_fast_lookup[i] = orc - __start_orc_unwind;
++ orc_lookup[i] = orc - __start_orc_unwind;
+ }
+
-+ /* Initialize the last 'end' block: */
++ /* Initialize the ending block: */
+ orc = __orc_find(__start_orc_unwind_ip, __start_orc_unwind, num_entries,
+ LOOKUP_STOP_IP);
+ if (!orc) {
-+ pr_warn("WARNING: Corrupt .orc_unwind table. Disabling unwinder.\n");
++ orc_warn("WARNING: Corrupt .orc_unwind table. Disabling unwinder.\n");
+ return;
+ }
-+ orc_fast_lookup[LOOKUP_NUM_BLOCKS] = orc - __start_orc_unwind;
++ orc_lookup[lookup_num_blocks-1] = orc - __start_orc_unwind;
+
+ orc_init = true;
+}
@@ -1122,9 +1198,9 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ } else {
+ struct inactive_task_frame *frame = (void *)task->thread.sp;
+
-+ state->ip = frame->ret_addr;
+ state->sp = task->thread.sp;
-+ state->bp = frame->bp;
++ state->bp = READ_ONCE_NOCHECK(frame->bp);
++ state->ip = READ_ONCE_NOCHECK(frame->ret_addr);
+ }
+
+ if (get_stack_info((unsigned long *)state->sp, state->task,
@@ -1158,7 +1234,15 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+EXPORT_SYMBOL_GPL(__unwind_start);
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
-@@ -148,6 +148,8 @@ SECTIONS
+@@ -24,6 +24,7 @@
+ #include <asm/asm-offsets.h>
+ #include <asm/thread_info.h>
+ #include <asm/page_types.h>
++#include <asm/orc_lookup.h>
+ #include <asm/cache.h>
+ #include <asm/boot.h>
+
+@@ -148,6 +149,8 @@ SECTIONS
BUG_TABLE
@@ -1169,7 +1253,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
-@@ -669,6 +669,24 @@
+@@ -680,6 +680,31 @@
#define BUG_TABLE
#endif
@@ -1179,13 +1263,20 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \
+ VMLINUX_SYMBOL(__start_orc_unwind_ip) = .; \
+ KEEP(*(.orc_unwind_ip)) \
-+ VMLINUX_SYMBOL(__stop_orc_ip) = .; \
++ VMLINUX_SYMBOL(__stop_orc_unwind_ip) = .; \
+ } \
+ . = ALIGN(6); \
+ .orc_unwind : AT(ADDR(.orc_unwind) - LOAD_OFFSET) { \
+ VMLINUX_SYMBOL(__start_orc_unwind) = .; \
+ KEEP(*(.orc_unwind)) \
-+ VMLINUX_SYMBOL(__stop_orc) = .; \
++ VMLINUX_SYMBOL(__stop_orc_unwind) = .; \
++ } \
++ . = ALIGN(4); \
++ .orc_lookup : AT(ADDR(.orc_lookup) - LOAD_OFFSET) { \
++ VMLINUX_SYMBOL(orc_lookup) = .; \
++ . += (((SIZEOF(.text) + LOOKUP_BLOCK_SIZE - 1) / \
++ LOOKUP_BLOCK_SIZE) + 1) * 4; \
++ VMLINUX_SYMBOL(orc_lookup_end) = .; \
+ }
+#else
+#define ORC_UNWIND_TABLE
@@ -1194,7 +1285,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
#ifdef CONFIG_PM_TRACE
#define TRACEDATA \
. = ALIGN(4); \
-@@ -855,7 +873,7 @@
+@@ -866,7 +891,7 @@
DATA_DATA \
CONSTRUCTORS \
} \
diff --git a/patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch b/patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch
index 2c738ca306..1827b52ba3 100644
--- a/patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch
+++ b/patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch
@@ -14,12 +14,12 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
arch/x86/entry/calling.h | 13 +++++++++++++
arch/x86/kernel/vmlinux.lds.S | 2 ++
arch/x86/tools/relocs.c | 1 +
- lib/Kconfig.debug | 16 ++++++++++++++--
- 7 files changed, 38 insertions(+), 3 deletions(-)
+ lib/Kconfig.debug | 12 ++++++++++++
+ 7 files changed, 36 insertions(+), 1 deletion(-)
--- a/Makefile
+++ b/Makefile
-@@ -744,6 +744,11 @@ endif
+@@ -747,6 +747,11 @@ endif
KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)
@@ -33,18 +33,18 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g)
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
-@@ -160,7 +160,7 @@ config X86
+@@ -167,7 +167,7 @@ config X86
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
select HAVE_REGS_AND_STACK_ACCESS_API
-- select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER && STACK_VALIDATION
-+ select HAVE_RELIABLE_STACKTRACE if X86_64 && (FRAME_POINTER || ORC_UNWINDER) && STACK_VALIDATION
+- select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER_UNWINDER && STACK_VALIDATION
++ select HAVE_RELIABLE_STACKTRACE if X86_64 && (FRAME_POINTER_UNWINDER || ORC_UNWINDER) && STACK_VALIDATION
select HAVE_STACK_VALIDATION if X86_64
select HAVE_SYSCALL_TRACEPOINTS
select HAVE_UNSTABLE_SCHED_CLOCK
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
-@@ -213,7 +213,9 @@ KBUILD_CFLAGS += -pipe
+@@ -230,7 +230,9 @@ KBUILD_CFLAGS += -pipe
# Workaround for a gcc prelease that unfortunately was shipped in a suse release
KBUILD_CFLAGS += -Wno-sign-compare
#
@@ -56,7 +56,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
KBUILD_AFLAGS += $(mflags-y)
--- a/arch/x86/entry/calling.h
+++ b/arch/x86/entry/calling.h
-@@ -48,6 +48,19 @@ For 32-bit we have the following convent
+@@ -49,6 +49,19 @@ For 32-bit we have the following convent
*/
@@ -78,7 +78,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/*
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
-@@ -345,7 +345,9 @@ SECTIONS
+@@ -348,7 +348,9 @@ SECTIONS
/* Sections to be discarded */
DISCARDS
/DISCARD/ : {
@@ -117,22 +117,18 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
config BOOT_PRINTK_DELAY
bool "Delay each boot printk message by N milliseconds"
depends on DEBUG_KERNEL && PRINTK && GENERIC_CALIBRATE_DELAY
-@@ -1680,7 +1690,8 @@ config FAULT_INJECTION_STACKTRACE_FILTER
- depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT
+@@ -1544,6 +1554,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER
depends on !X86_64
select STACKTRACE
-- select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !SCORE
-+ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !X86 && !ARM_UNWIND && !ARC && !SCORE
+ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !SCORE && !X86
+ select UNWIND_INFO if X86 && !FRAME_POINTER
help
Provide stacktrace filter for fault-injection capabilities
-@@ -1689,7 +1700,8 @@ config LATENCYTOP
- depends on DEBUG_KERNEL
+@@ -1553,6 +1564,7 @@ config LATENCYTOP
depends on STACKTRACE_SUPPORT
depends on PROC_FS
-- select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC
-+ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !X86 && !ARM_UNWIND && !ARC
+ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !X86
+ select UNWIND_INFO if X86 && !FRAME_POINTER
select KALLSYMS
select KALLSYMS_ALL
diff --git a/patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch b/patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch
index da61df01d0..d5d800ddd1 100644
--- a/patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch
+++ b/patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch
@@ -1,5 +1,5 @@
From: Andy Lutomirski <luto@kernel.org>
-Date: Fri, 30 Jun 2017 08:56:33 -0700
+Date: Tue, 11 Jul 2017 10:33:39 -0500
Subject: x86/entry/64: Initialize the top of the IRQ stack before switching
stacks
Patch-mainline: Queued in subsystem maintainer repository
@@ -19,9 +19,21 @@ irq_stack_ptr_minus_eight (better name welcome). OTOH, there may be
all kinds of odd microarchitectural considerations in play that
affect performance by a few cycles here.
+Reported-by: Mike Galbraith <efault@gmx.de>
Reported-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/aae7e79e49914808440ad5310ace138ced2179ca.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/x86/entry/entry_64.S | 24 +++++++++++++++++++++++-
@@ -29,7 +41,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
-@@ -468,6 +468,7 @@ END(irq_entries_start)
+@@ -469,6 +469,7 @@ END(irq_entries_start)
DEBUG_ENTRY_ASSERT_IRQS_OFF
movq %rsp, \old_rsp
incl PER_CPU_VAR(irq_count)
@@ -37,7 +49,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/*
* Right now, if we just incremented irq_count to zero, we've
-@@ -477,9 +478,30 @@ END(irq_entries_start)
+@@ -478,9 +479,30 @@ END(irq_entries_start)
* it must be *extremely* careful to limit its stack usage. This
* could include kprobes and a hypothetical future IST-less #DB
* handler.
diff --git a/patches.suse/0002-x86-kconfig-Make-it-easier-to-switch-to-the-new-ORC-.patch b/patches.suse/0002-x86-kconfig-Make-it-easier-to-switch-to-the-new-ORC-.patch
new file mode 100644
index 0000000000..0875041a26
--- /dev/null
+++ b/patches.suse/0002-x86-kconfig-Make-it-easier-to-switch-to-the-new-ORC-.patch
@@ -0,0 +1,99 @@
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Mon, 24 Jul 2017 18:36:58 -0500
+Subject: x86/kconfig: Make it easier to switch to the new ORC unwinder
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: a34a766ff96d9e88572e35a45066279e40a85d84
+References: bnc#1018348
+
+A couple of Kconfig changes which make it much easier to switch to the
+new CONFIG_ORC_UNWINDER:
+
+1) Remove x86 dependencies on CONFIG_FRAME_POINTER for lockdep,
+ latencytop, and fault injection. x86 has a 'guess' unwinder which
+ just scans the stack for kernel text addresses. It's not 100%
+ accurate but in many cases it's good enough. This allows those users
+ who don't want the text overhead of the frame pointer or ORC
+ unwinders to still use these features. More importantly, this also
+ makes it much more straightforward to disable frame pointers.
+
+2) Make CONFIG_ORC_UNWINDER depend on !CONFIG_FRAME_POINTER. While it
+ would be possible to have both enabled, it doesn't really make sense
+ to do so. So enforce a sane configuration to prevent the user from
+ making a dumb mistake.
+
+With these changes, when you disable CONFIG_FRAME_POINTER, "make
+oldconfig" will ask if you want to enable CONFIG_ORC_UNWINDER.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/9985fb91ce5005fe33ea5cc2a20f14bd33c61d03.1500938583.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/Kconfig.debug | 7 +++----
+ lib/Kconfig.debug | 6 +++---
+ 2 files changed, 6 insertions(+), 7 deletions(-)
+
+--- a/arch/x86/Kconfig.debug
++++ b/arch/x86/Kconfig.debug
+@@ -358,7 +358,7 @@ config PUNIT_ATOM_DEBUG
+
+ config ORC_UNWINDER
+ bool "ORC unwinder"
+- depends on X86_64
++ depends on X86_64 && !FRAME_POINTER
+ select STACK_VALIDATION
+ ---help---
+ This option enables the ORC (Oops Rewind Capability) unwinder for
+@@ -366,9 +366,8 @@ config ORC_UNWINDER
+ a simplified version of the DWARF Call Frame Information standard.
+
+ This unwinder is more accurate across interrupt entry frames than the
+- frame pointer unwinder. It can also enable a 5-10% performance
+- improvement across the entire kernel if CONFIG_FRAME_POINTER is
+- disabled.
++ frame pointer unwinder. It also enables a 5-10% performance
++ improvement across the entire kernel compared to frame pointers.
+
+ Enabling this option will increase the kernel's runtime memory usage
+ by roughly 2-4MB, depending on your kernel config.
+--- a/lib/Kconfig.debug
++++ b/lib/Kconfig.debug
+@@ -1124,7 +1124,7 @@ config LOCKDEP
+ bool
+ depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
+ select STACKTRACE
+- select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC && !SCORE
++ select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC && !SCORE && !X86
+ select KALLSYMS
+ select KALLSYMS_ALL
+
+@@ -1543,7 +1543,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER
+ depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT
+ depends on !X86_64
+ select STACKTRACE
+- select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !SCORE
++ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !SCORE && !X86
+ help
+ Provide stacktrace filter for fault-injection capabilities
+
+@@ -1552,7 +1552,7 @@ config LATENCYTOP
+ depends on DEBUG_KERNEL
+ depends on STACKTRACE_SUPPORT
+ depends on PROC_FS
+- select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC
++ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !X86
+ select KALLSYMS
+ select KALLSYMS_ALL
+ select STACKTRACE
diff --git a/patches.suse/0003-x86-dumpstack-fix-occasionally-missing-registers.patch b/patches.suse/0003-x86-dumpstack-Fix-occasionally-missing-registers.patch
index 6ff74d7ac9..259a98c043 100644
--- a/patches.suse/0003-x86-dumpstack-fix-occasionally-missing-registers.patch
+++ b/patches.suse/0003-x86-dumpstack-Fix-occasionally-missing-registers.patch
@@ -1,6 +1,6 @@
From: Josh Poimboeuf <jpoimboe@redhat.com>
-Date: Wed, 5 Jul 2017 14:48:48 -0500
-Subject: x86/dumpstack: fix occasionally missing registers
+Date: Tue, 11 Jul 2017 10:33:40 -0500
+Subject: x86/dumpstack: Fix occasionally missing registers
Patch-mainline: Queued in subsystem maintainer repository
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
Git-commit: b0529becebde629ff6abf2afdca6def6824f4fa9
@@ -9,8 +9,21 @@ References: bnc#1018348
If two consecutive stack frames have pt_regs, the oops dump code fails
to print the second frame's registers. Fix that.
-Fixes: 3b3fa11bc700 ("x86/dumpstack: Print any pt_regs found on the stack")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Fixes: 3b3fa11bc700 ("x86/dumpstack: Print any pt_regs found on the stack")
+Link: http://lkml.kernel.org/r/269c5c00c7d45c699f3dcea42a3a594c6cf7a9a3.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/x86/kernel/dumpstack.c | 12 +++++++-----
diff --git a/patches.suse/0003-x86-kconfig-Consolidate-unwinders-into-multiple-choi.patch b/patches.suse/0003-x86-kconfig-Consolidate-unwinders-into-multiple-choi.patch
new file mode 100644
index 0000000000..828a7db061
--- /dev/null
+++ b/patches.suse/0003-x86-kconfig-Consolidate-unwinders-into-multiple-choi.patch
@@ -0,0 +1,157 @@
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Tue, 25 Jul 2017 08:54:24 -0500
+Subject: x86/kconfig: Consolidate unwinders into multiple choice selection
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: 81d387190039c14edac8de2b3ec789beb899afd9
+References: bnc#1018348
+
+There are three mutually exclusive unwinders. Make that more obvious by
+combining them into a multiple-choice selection:
+
+ CONFIG_FRAME_POINTER_UNWINDER
+ CONFIG_ORC_UNWINDER
+ CONFIG_GUESS_UNWINDER (if CONFIG_EXPERT=y)
+
+Frame pointers are still the default (for now).
+
+The old CONFIG_FRAME_POINTER option is still used in some
+arch-independent places, so keep it around, but make it
+invisible to the user on x86 - it's now selected by
+CONFIG_FRAME_POINTER_UNWINDER=y.
+
+Suggested-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/20170725135424.zukjmgpz3plf5pmt@treble
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/Kconfig | 3 --
+ arch/x86/Kconfig.debug | 47 +++++++++++++++++++++++++++++++++++-------
+ arch/x86/configs/tiny.config | 2 +
+ arch/x86/include/asm/unwind.h | 4 +--
+ 4 files changed, 45 insertions(+), 11 deletions(-)
+
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -73,7 +73,6 @@ config X86
+ select ARCH_USE_QUEUED_RWLOCKS
+ select ARCH_USE_QUEUED_SPINLOCKS
+ select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
+- select ARCH_WANT_FRAME_POINTERS
+ select ARCH_WANTS_DYNAMIC_TASK_STRUCT
+ select ARCH_WANTS_THP_SWAP if X86_64
+ select BUILDTIME_EXTABLE_SORT
+@@ -168,7 +167,7 @@ config X86
+ select HAVE_PERF_REGS
+ select HAVE_PERF_USER_STACK_DUMP
+ select HAVE_REGS_AND_STACK_ACCESS_API
+- select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER && STACK_VALIDATION
++ select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER_UNWINDER && STACK_VALIDATION
+ select HAVE_STACK_VALIDATION if X86_64
+ select HAVE_SYSCALL_TRACEPOINTS
+ select HAVE_UNSTABLE_SCHED_CLOCK
+--- a/arch/x86/Kconfig.debug
++++ b/arch/x86/Kconfig.debug
+@@ -356,9 +356,32 @@ config PUNIT_ATOM_DEBUG
+ The current power state can be read from
+ /sys/kernel/debug/punit_atom/dev_power_state
+
++choice
++ prompt "Choose kernel unwinder"
++ default FRAME_POINTER_UNWINDER
++ ---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
++ 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 ORC_UNWINDER
+ bool "ORC unwinder"
+- depends on X86_64 && !FRAME_POINTER
++ depends on X86_64
+ select STACK_VALIDATION
+ ---help---
+ This option enables the ORC (Oops Rewind Capability) unwinder for
+@@ -372,12 +395,22 @@ config ORC_UNWINDER
+ Enabling this option will increase the kernel's runtime memory usage
+ by roughly 2-4MB, depending on your kernel config.
+
+-config FRAME_POINTER_UNWINDER
+- def_bool y
+- depends on !ORC_UNWINDER && FRAME_POINTER
+-
+ config GUESS_UNWINDER
+- def_bool y
+- depends on !ORC_UNWINDER && !FRAME_POINTER
++ bool "Guess unwinder"
++ depends on EXPERT
++ ---help---
++ This option enables the "guess" unwinder for unwinding kernel stack
++ traces. It scans the stack and reports every kernel text address it
++ finds. Some of the addresses it reports may be incorrect.
++
++ While this option often produces false positives, it can still be
++ useful in many cases. Unlike the other unwinders, it has no runtime
++ overhead.
++
++endchoice
++
++config FRAME_POINTER
++ depends on !ORC_UNWINDER && !GUESS_UNWINDER
++ bool
+
+ endmenu
+--- a/arch/x86/configs/tiny.config
++++ b/arch/x86/configs/tiny.config
+@@ -1,3 +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
+--- a/arch/x86/include/asm/unwind.h
++++ b/arch/x86/include/asm/unwind.h
+@@ -16,7 +16,7 @@ struct unwind_state {
+ bool signal, full_regs;
+ unsigned long sp, bp, ip;
+ struct pt_regs *regs;
+-#elif defined(CONFIG_FRAME_POINTER)
++#elif defined(CONFIG_FRAME_POINTER_UNWINDER)
+ bool got_irq;
+ unsigned long *bp, *orig_sp, ip;
+ struct pt_regs *regs;
+@@ -50,7 +50,7 @@ void unwind_start(struct unwind_state *s
+ __unwind_start(state, task, regs, first_frame);
+ }
+
+-#if defined(CONFIG_ORC_UNWINDER) || defined(CONFIG_FRAME_POINTER)
++#if defined(CONFIG_ORC_UNWINDER) || defined(CONFIG_FRAME_POINTER_UNWINDER)
+ static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
+ {
+ if (unwind_done(state))
diff --git a/patches.suse/0004-x86-dumpstack-fix-interrupt-and-exception-stack-boun.patch b/patches.suse/0004-x86-dumpstack-Fix-interrupt-and-exception-stack-boun.patch
index ecdbde63a7..ce24584ba7 100644
--- a/patches.suse/0004-x86-dumpstack-fix-interrupt-and-exception-stack-boun.patch
+++ b/patches.suse/0004-x86-dumpstack-Fix-interrupt-and-exception-stack-boun.patch
@@ -1,6 +1,6 @@
From: Josh Poimboeuf <jpoimboe@redhat.com>
-Date: Wed, 5 Jul 2017 14:54:20 -0500
-Subject: x86/dumpstack: fix interrupt and exception stack boundary checks
+Date: Tue, 11 Jul 2017 10:33:41 -0500
+Subject: x86/dumpstack: Fix interrupt and exception stack boundary checks
Patch-mainline: Queued in subsystem maintainer repository
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
Git-commit: 5a3cf86978a1ac433407704ec280919751aa2699
@@ -16,8 +16,21 @@ Fix this kind of stack border confusion by never considering the
beginning address of an exception or interrupt stack to be part of the
stack.
-Fixes: 5fe599e02e41 ("x86/dumpstack: Add support for unwinding empty IRQ stacks")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Fixes: 5fe599e02e41 ("x86/dumpstack: Add support for unwinding empty IRQ stacks")
+Link: http://lkml.kernel.org/r/bcc142160a5104de5c354c21c394c93a0173943f.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/x86/kernel/dumpstack_32.c | 4 ++--
diff --git a/patches.suse/0005-objtool-add-ORC-unwind-table-generation.patch b/patches.suse/0005-objtool-Add-ORC-unwind-table-generation.patch
index 3e8a30e9c6..2e0b842e44 100644
--- a/patches.suse/0005-objtool-add-ORC-unwind-table-generation.patch
+++ b/patches.suse/0005-objtool-Add-ORC-unwind-table-generation.patch
@@ -1,6 +1,6 @@
From: Josh Poimboeuf <jpoimboe@redhat.com>
-Date: Wed, 31 May 2017 19:38:55 -0500
-Subject: objtool: add ORC unwind table generation
+Date: Tue, 11 Jul 2017 10:33:42 -0500
+Subject: objtool: Add ORC unwind table generation
Patch-mainline: Queued in subsystem maintainer repository
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
Git-commit: 627fce14809ba5610b0cb476cd0186d3fcedecfc
@@ -16,6 +16,19 @@ Documentation/x86/orc-unwinder.txt for a more detailed description of
this new debuginfo format and why it's preferable to DWARF.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/c9b9f01ba6c5ed2bdc9bb0957b78167fdbf9632e.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
tools/objtool/Build | 3
@@ -335,7 +348,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
} else if (state1->drap != state2->drap ||
(state1->drap && state1->drap_reg != state2->drap_reg)) {
WARN_FUNC("stack state mismatch: drap1=%d(%d) drap2=%d(%d)",
-@@ -1604,7 +1640,7 @@ static void cleanup(struct objtool_file
+@@ -1613,7 +1649,7 @@ static void cleanup(struct objtool_file
elf_close(file->elf);
}
@@ -344,7 +357,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
{
struct objtool_file file;
int ret, warnings = 0;
-@@ -1612,7 +1648,7 @@ int check(const char *_objname, bool _no
+@@ -1621,7 +1657,7 @@ int check(const char *_objname, bool _no
objname = _objname;
nofp = _nofp;
@@ -353,7 +366,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
if (!file.elf)
return 1;
-@@ -1645,6 +1681,20 @@ int check(const char *_objname, bool _no
+@@ -1654,6 +1690,20 @@ int check(const char *_objname, bool _no
warnings += ret;
}
@@ -1121,7 +1134,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ return -1;
+ }
+
-+ /* count the number of needed undwarves */
++ /* count the number of needed orcs */
+ idx = 0;
+ for_each_sec(file, sec) {
+ if (!sec->text)
diff --git a/patches.suse/0006-objtool-x86-add-facility-for-asm-code-to-provide-unw.patch b/patches.suse/0006-objtool-x86-Add-facility-for-asm-code-to-provide-unw.patch
index e9fbed0f76..83a12a88b3 100644
--- a/patches.suse/0006-objtool-x86-add-facility-for-asm-code-to-provide-unw.patch
+++ b/patches.suse/0006-objtool-x86-Add-facility-for-asm-code-to-provide-unw.patch
@@ -1,6 +1,6 @@
From: Josh Poimboeuf <jpoimboe@redhat.com>
-Date: Wed, 31 May 2017 19:44:58 -0500
-Subject: objtool, x86: add facility for asm code to provide unwind hints
+Date: Tue, 11 Jul 2017 10:33:43 -0500
+Subject: objtool, x86: Add facility for asm code to provide unwind hints
Patch-mainline: Queued in subsystem maintainer repository
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
Git-commit: 39358a033b2e4432052265c1fa0f36f572d8cfb5
@@ -18,6 +18,19 @@ fill in the blanks by following branches and adjusting the stack pointer
for pushes and pops.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/0f5f3c9104fca559ff4088bece1d14ae3bca52d5.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/x86/include/asm/orc_types.h | 107 ++++++++++++++++++++
@@ -123,7 +136,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ unsigned sp_reg:4;
+ unsigned bp_reg:4;
+ unsigned type:2;
-+} __packed;
++};
+
+/*
+ * This struct is used by asm and inline asm code to manually annotate the
@@ -409,7 +422,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
if (file->c_file && insn->func) {
if (func && func != insn->func) {
WARN("%s() falls through to next function %s()",
-@@ -1408,13 +1501,54 @@ static int validate_branch(struct objtoo
+@@ -1414,13 +1507,54 @@ static int validate_branch(struct objtoo
}
if (insn->visited) {
@@ -466,7 +479,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
insn->visited = true;
-@@ -1488,6 +1622,14 @@ static int validate_branch(struct objtoo
+@@ -1497,6 +1631,14 @@ static int validate_branch(struct objtoo
return 0;
@@ -481,7 +494,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
case INSN_STACK:
if (update_insn_state(insn, &state))
return -1;
-@@ -1501,7 +1643,7 @@ static int validate_branch(struct objtoo
+@@ -1510,7 +1652,7 @@ static int validate_branch(struct objtoo
if (insn->dead_end)
return 0;
@@ -490,7 +503,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
if (!insn) {
WARN("%s: unexpected end of section", sec->name);
return 1;
-@@ -1511,6 +1653,27 @@ static int validate_branch(struct objtoo
+@@ -1520,6 +1662,27 @@ static int validate_branch(struct objtoo
return 0;
}
@@ -518,7 +531,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
static bool is_kasan_insn(struct instruction *insn)
{
return (insn->type == INSN_CALL &&
-@@ -1656,8 +1819,9 @@ int check(const char *_objname, bool _no
+@@ -1665,8 +1828,9 @@ int check(const char *_objname, bool _no
hash_init(file.insn_hash);
file.whitelist = find_section_by_name(file.elf, ".discard.func_stack_frame_non_standard");
file.rodata = find_section_by_name(file.elf, ".rodata");
@@ -529,7 +542,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
arch_initial_func_cfi_state(&initial_func_cfi);
-@@ -1673,6 +1837,11 @@ int check(const char *_objname, bool _no
+@@ -1682,6 +1846,11 @@ int check(const char *_objname, bool _no
if (ret < 0)
goto out;
warnings += ret;
diff --git a/patches.suse/0007-x86-entry-64-add-unwind-hint-annotations.patch b/patches.suse/0007-x86-entry-64-Add-unwind-hint-annotations.patch
index b5f3a616fd..404c7b0e5b 100644
--- a/patches.suse/0007-x86-entry-64-add-unwind-hint-annotations.patch
+++ b/patches.suse/0007-x86-entry-64-Add-unwind-hint-annotations.patch
@@ -1,6 +1,6 @@
From: Josh Poimboeuf <jpoimboe@redhat.com>
-Date: Wed, 31 May 2017 19:48:12 -0500
-Subject: x86/entry/64: add unwind hint annotations
+Date: Tue, 11 Jul 2017 10:33:44 -0500
+Subject: x86/entry/64: Add unwind hint annotations
Patch-mainline: Queued in subsystem maintainer repository
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
Git-commit: 8c1f75587a18ca032da8f6376d1ed882d7095289
@@ -11,6 +11,19 @@ unwinder to unwind through any location in the entry code including
syscalls, interrupts, and exceptions.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/b9f6d478aadf68ba57c739dcfac34ec0dc021c4c.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/x86/entry/Makefile | 1
@@ -114,7 +127,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
USERGS_SYSRET64
1:
-@@ -315,6 +320,7 @@ syscall_return_via_sysret:
+@@ -316,6 +321,7 @@ syscall_return_via_sysret:
/* rcx and r11 are already restored (see code above) */
RESTORE_C_REGS_EXCEPT_RCX_R11
movq RSP(%rsp), %rsp
@@ -122,7 +135,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
USERGS_SYSRET64
opportunistic_sysret_failed:
-@@ -342,6 +348,7 @@ ENTRY(stub_ptregs_64)
+@@ -343,6 +349,7 @@ ENTRY(stub_ptregs_64)
DISABLE_INTERRUPTS(CLBR_ANY)
TRACE_IRQS_OFF
popq %rax
@@ -130,7 +143,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
jmp entry_SYSCALL64_slow_path
1:
-@@ -350,6 +357,7 @@ END(stub_ptregs_64)
+@@ -351,6 +358,7 @@ END(stub_ptregs_64)
.macro ptregs_stub func
ENTRY(ptregs_\func)
@@ -138,7 +151,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
leaq \func(%rip), %rax
jmp stub_ptregs_64
END(ptregs_\func)
-@@ -366,6 +374,7 @@ END(ptregs_\func)
+@@ -367,6 +375,7 @@ END(ptregs_\func)
* %rsi: next task
*/
ENTRY(__switch_to_asm)
@@ -146,7 +159,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/*
* Save callee-saved registers
* This must match the order in inactive_task_frame
-@@ -405,6 +414,7 @@ END(__switch_to_asm)
+@@ -406,6 +415,7 @@ END(__switch_to_asm)
* r12: kernel thread arg
*/
ENTRY(ret_from_fork)
@@ -154,7 +167,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
movq %rax, %rdi
call schedule_tail /* rdi: 'prev' task parameter */
-@@ -412,6 +422,7 @@ ENTRY(ret_from_fork)
+@@ -413,6 +423,7 @@ ENTRY(ret_from_fork)
jnz 1f /* kernel threads are uncommon */
2:
@@ -162,7 +175,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
movq %rsp, %rdi
call syscall_return_slowpath /* returns with IRQs disabled */
TRACE_IRQS_ON /* user mode is traced as IRQS on */
-@@ -439,10 +450,11 @@ END(ret_from_fork)
+@@ -440,10 +451,11 @@ END(ret_from_fork)
ENTRY(irq_entries_start)
vector=FIRST_EXTERNAL_VECTOR
.rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
@@ -175,7 +188,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
.endr
END(irq_entries_start)
-@@ -464,9 +476,14 @@ END(irq_entries_start)
+@@ -465,9 +477,14 @@ END(irq_entries_start)
*
* The invariant is that, if irq_count != -1, then the IRQ stack is in use.
*/
@@ -191,7 +204,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
incl PER_CPU_VAR(irq_count)
jnz .Lirq_stack_push_old_rsp_\@
-@@ -503,16 +520,24 @@ END(irq_entries_start)
+@@ -504,16 +521,24 @@ END(irq_entries_start)
.Lirq_stack_push_old_rsp_\@:
pushq \old_rsp
@@ -217,7 +230,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/*
* As in ENTER_IRQ_STACK, irq_count == 0, we are still claiming
* the irq stack but we're not on it.
-@@ -623,6 +648,7 @@ restore_c_regs_and_iret:
+@@ -624,6 +649,7 @@ restore_c_regs_and_iret:
INTERRUPT_RETURN
ENTRY(native_iret)
@@ -225,7 +238,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/*
* Are we returning to a stack segment from the LDT? Note: in
* 64-bit mode SS:RSP on the exception stack is always valid.
-@@ -695,6 +721,7 @@ native_irq_return_ldt:
+@@ -696,6 +722,7 @@ native_irq_return_ldt:
orq PER_CPU_VAR(espfix_stack), %rax
SWAPGS
movq %rax, %rsp
@@ -233,7 +246,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/*
* At this point, we cannot write to the stack any more, but we can
-@@ -716,6 +743,7 @@ END(common_interrupt)
+@@ -717,6 +744,7 @@ END(common_interrupt)
*/
.macro apicinterrupt3 num sym do_sym
ENTRY(\sym)
@@ -241,7 +254,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
ASM_CLAC
pushq $~(\num)
.Lcommon_\sym:
-@@ -801,6 +829,8 @@ apicinterrupt IRQ_WORK_VECTOR irq_work
+@@ -802,6 +830,8 @@ apicinterrupt IRQ_WORK_VECTOR irq_work
.macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1
ENTRY(\sym)
@@ -250,7 +263,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/* Sanity check */
.if \shift_ist != -1 && \paranoid == 0
.error "using shift_ist requires paranoid=1"
-@@ -824,6 +854,7 @@ ENTRY(\sym)
+@@ -825,6 +855,7 @@ ENTRY(\sym)
.else
call error_entry
.endif
@@ -258,7 +271,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/* returned flag: ebx=0: need swapgs on exit, ebx=1: don't need it */
.if \paranoid
-@@ -921,6 +952,7 @@ idtentry simd_coprocessor_error do_simd
+@@ -922,6 +953,7 @@ idtentry simd_coprocessor_error do_simd
* edi: new selector
*/
ENTRY(native_load_gs_index)
@@ -266,7 +279,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
pushfq
DISABLE_INTERRUPTS(CLBR_ANY & ~CLBR_RDI)
SWAPGS
-@@ -929,8 +961,9 @@ ENTRY(native_load_gs_index)
+@@ -930,8 +962,9 @@ ENTRY(native_load_gs_index)
2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE
SWAPGS
popfq
@@ -277,7 +290,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
EXPORT_SYMBOL(native_load_gs_index)
_ASM_EXTABLE(.Lgs_change, bad_gs)
-@@ -953,12 +986,12 @@ bad_gs:
+@@ -954,12 +987,12 @@ bad_gs:
ENTRY(do_softirq_own_stack)
pushq %rbp
mov %rsp, %rbp
@@ -293,7 +306,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
#ifdef CONFIG_XEN
idtentry xen_hypervisor_callback xen_do_hypervisor_callback has_error_code=0
-@@ -982,7 +1015,9 @@ ENTRY(xen_do_hypervisor_callback) /* do
+@@ -983,7 +1016,9 @@ ENTRY(xen_do_hypervisor_callback) /* do
* Since we don't modify %rdi, evtchn_do_upall(struct *pt_regs) will
* see the correct pointer to the pt_regs
*/
@@ -303,7 +316,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
ENTER_IRQ_STACK old_rsp=%r10
call xen_evtchn_do_upcall
-@@ -1008,6 +1043,7 @@ END(xen_do_hypervisor_callback)
+@@ -1009,6 +1044,7 @@ END(xen_do_hypervisor_callback)
* with its current contents: any discrepancy means we in category 1.
*/
ENTRY(xen_failsafe_callback)
@@ -311,7 +324,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
movl %ds, %ecx
cmpw %cx, 0x10(%rsp)
jne 1f
-@@ -1027,11 +1063,13 @@ ENTRY(xen_failsafe_callback)
+@@ -1028,11 +1064,13 @@ ENTRY(xen_failsafe_callback)
pushq $0 /* RIP */
pushq %r11
pushq %rcx
@@ -325,7 +338,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
pushq $-1 /* orig_ax = -1 => not a system call */
ALLOC_PT_GPREGS_ON_STACK
SAVE_C_REGS
-@@ -1077,6 +1115,7 @@ idtentry machine_check has_error_cod
+@@ -1078,6 +1116,7 @@ idtentry machine_check has_error_cod
* Return: ebx=0: need swapgs on exit, ebx=1: otherwise
*/
ENTRY(paranoid_entry)
@@ -333,7 +346,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
cld
SAVE_C_REGS 8
SAVE_EXTRA_REGS 8
-@@ -1104,6 +1143,7 @@ END(paranoid_entry)
+@@ -1105,6 +1144,7 @@ END(paranoid_entry)
* On entry, ebx is "no swapgs" flag (1: don't need swapgs, 0: need it)
*/
ENTRY(paranoid_exit)
@@ -341,7 +354,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
DISABLE_INTERRUPTS(CLBR_ANY)
TRACE_IRQS_OFF_DEBUG
testl %ebx, %ebx /* swapgs needed? */
-@@ -1125,6 +1165,7 @@ END(paranoid_exit)
+@@ -1126,6 +1166,7 @@ END(paranoid_exit)
* Return: EBX=0: came from user mode; EBX=1: otherwise
*/
ENTRY(error_entry)
@@ -349,7 +362,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
cld
SAVE_C_REGS 8
SAVE_EXTRA_REGS 8
-@@ -1209,6 +1250,7 @@ END(error_entry)
+@@ -1210,6 +1251,7 @@ END(error_entry)
* 0: user gsbase is loaded, we need SWAPGS and standard preparation for return to usermode
*/
ENTRY(error_exit)
@@ -357,7 +370,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
DISABLE_INTERRUPTS(CLBR_ANY)
TRACE_IRQS_OFF
testl %ebx, %ebx
-@@ -1218,6 +1260,7 @@ END(error_exit)
+@@ -1219,6 +1261,7 @@ END(error_exit)
/* Runs on exception stack */
ENTRY(nmi)
@@ -365,7 +378,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/*
* Fix up the exception frame if we're on Xen.
* PARAVIRT_ADJUST_EXCEPTION_FRAME is guaranteed to push at most
-@@ -1289,11 +1332,13 @@ ENTRY(nmi)
+@@ -1290,11 +1333,13 @@ ENTRY(nmi)
cld
movq %rsp, %rdx
movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
@@ -379,7 +392,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
pushq $-1 /* pt_regs->orig_ax */
pushq %rdi /* pt_regs->di */
pushq %rsi /* pt_regs->si */
-@@ -1310,6 +1355,7 @@ ENTRY(nmi)
+@@ -1311,6 +1356,7 @@ ENTRY(nmi)
pushq %r13 /* pt_regs->r13 */
pushq %r14 /* pt_regs->r14 */
pushq %r15 /* pt_regs->r15 */
@@ -387,7 +400,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
ENCODE_FRAME_POINTER
/*
-@@ -1464,6 +1510,7 @@ first_nmi:
+@@ -1465,6 +1511,7 @@ first_nmi:
.rept 5
pushq 11*8(%rsp)
.endr
@@ -395,7 +408,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/* Everything up to here is safe from nested NMIs */
-@@ -1479,6 +1526,7 @@ first_nmi:
+@@ -1480,6 +1527,7 @@ first_nmi:
pushq $__KERNEL_CS /* CS */
pushq $1f /* RIP */
INTERRUPT_RETURN /* continues at repeat_nmi below */
@@ -403,7 +416,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
1:
#endif
-@@ -1528,6 +1576,7 @@ end_repeat_nmi:
+@@ -1529,6 +1577,7 @@ end_repeat_nmi:
* exceptions might do.
*/
call paranoid_entry
@@ -411,7 +424,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
movq %rsp, %rdi
-@@ -1565,17 +1614,19 @@ nmi_restore:
+@@ -1566,17 +1615,19 @@ nmi_restore:
END(nmi)
ENTRY(ignore_sysret)
diff --git a/patches.suse/0008-x86-asm-add-unwind-hint-annotations-to-sync_core.patch b/patches.suse/0008-x86-asm-Add-unwind-hint-annotations-to-sync_core.patch
index a277c44595..31d8f3659c 100644
--- a/patches.suse/0008-x86-asm-add-unwind-hint-annotations-to-sync_core.patch
+++ b/patches.suse/0008-x86-asm-Add-unwind-hint-annotations-to-sync_core.patch
@@ -1,6 +1,6 @@
From: Josh Poimboeuf <jpoimboe@redhat.com>
-Date: Wed, 31 May 2017 20:02:47 -0500
-Subject: x86/asm: add unwind hint annotations to sync_core()
+Date: Tue, 11 Jul 2017 10:33:45 -0500
+Subject: x86/asm: Add unwind hint annotations to sync_core()
Patch-mainline: Queued in subsystem maintainer repository
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
Git-commit: 76846bf3cb09e98881cb4908385a0e899716b01f
@@ -9,6 +9,19 @@ References: bnc#1018348
This enables objtool to grok the iret in the middle of a C function.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/b057be26193c11d2ed3337b2107bc7adcba42c99.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/x86/include/asm/processor.h | 3 +++
@@ -24,7 +37,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
#include <linux/personality.h>
#include <linux/cache.h>
-@@ -676,6 +677,7 @@ static inline void sync_core(void)
+@@ -684,6 +685,7 @@ static inline void sync_core(void)
unsigned int tmp;
asm volatile (
@@ -32,7 +45,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
"mov %%ss, %0\n\t"
"pushq %q0\n\t"
"pushq %%rsp\n\t"
-@@ -685,6 +687,7 @@ static inline void sync_core(void)
+@@ -693,6 +695,7 @@ static inline void sync_core(void)
"pushq %q0\n\t"
"pushq $1f\n\t"
"iretq\n\t"
diff --git a/series.conf b/series.conf
index e7bc437a74..b3b3a1bdf8 100644
--- a/series.conf
+++ b/series.conf
@@ -425,22 +425,27 @@
# Other patches for debugging
########################################################
patches.suse/crasher.patch
-+dwarf patches.suse/0001-linkage-new-macros-for-assembler-symbols.patch
- patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch
-+dwarf patches.suse/0003-DWARF-EH-frame-based-stack-unwinding.patch
-+dwarf patches.suse/stack-unwind-disable-kasan.patch
-
# pending
patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch
patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch
- patches.suse/0003-x86-dumpstack-fix-occasionally-missing-registers.patch
- patches.suse/0004-x86-dumpstack-fix-interrupt-and-exception-stack-boun.patch
- patches.suse/0005-objtool-add-ORC-unwind-table-generation.patch
- patches.suse/0006-objtool-x86-add-facility-for-asm-code-to-provide-unw.patch
- patches.suse/0007-x86-entry-64-add-unwind-hint-annotations.patch
- patches.suse/0008-x86-asm-add-unwind-hint-annotations-to-sync_core.patch
- patches.suse/0009-x86-unwind-add-ORC-unwinder.patch
+
+ patches.suse/0003-x86-dumpstack-Fix-occasionally-missing-registers.patch
+ patches.suse/0004-x86-dumpstack-Fix-interrupt-and-exception-stack-boun.patch
+ patches.suse/0005-objtool-Add-ORC-unwind-table-generation.patch
+ patches.suse/0006-objtool-x86-Add-facility-for-asm-code-to-provide-unw.patch
+ patches.suse/0007-x86-entry-64-Add-unwind-hint-annotations.patch
+ patches.suse/0008-x86-asm-Add-unwind-hint-annotations-to-sync_core.patch
+
+
+ patches.suse/0001-x86-unwind-Add-the-ORC-unwinder.patch
+ patches.suse/0002-x86-kconfig-Make-it-easier-to-switch-to-the-new-ORC-.patch
+ patches.suse/0003-x86-kconfig-Consolidate-unwinders-into-multiple-choi.patch
+
++dwarf patches.suse/0001-linkage-new-macros-for-assembler-symbols.patch
+ patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch
++dwarf patches.suse/0003-DWARF-EH-frame-based-stack-unwinding.patch
++dwarf patches.suse/stack-unwind-disable-kasan.patch
########################################################
# Kdump