1 From 906230051aedc4af1dce033db79e56eb61af2b73 Mon Sep 17 00:00:00 2001
2 From: Josh Poimboeuf <jpoimboe@redhat.com>
3 Date: Mon, 24 Jul 2017 18:36:57 -0500
4 Subject: [PATCH 035/233] x86/unwind: Add the ORC unwinder
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Add the new ORC unwinder which is enabled by CONFIG_ORC_UNWINDER=y.
12 It plugs into the existing x86 unwinder framework.
14 It relies on objtool to generate the needed .orc_unwind and
15 .orc_unwind_ip sections.
17 For more details on why ORC is used instead of DWARF, see
18 Documentation/x86/orc-unwinder.txt - but the short version is
19 that it's a simplified, fundamentally more robust debugninfo
20 data structure, which also allows up to two orders of magnitude
21 faster lookups than the DWARF unwinder - which matters to
22 profiling workloads like perf.
24 Thanks to Andy Lutomirski for the performance improvement ideas:
25 splitting the ORC unwind table into two parallel arrays and creating a
26 fast lookup table to search a subset of the unwind table.
28 Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
29 Cc: Andy Lutomirski <luto@kernel.org>
30 Cc: Borislav Petkov <bp@alien8.de>
31 Cc: Brian Gerst <brgerst@gmail.com>
32 Cc: Denys Vlasenko <dvlasenk@redhat.com>
33 Cc: H. Peter Anvin <hpa@zytor.com>
34 Cc: Jiri Slaby <jslaby@suse.cz>
35 Cc: Linus Torvalds <torvalds@linux-foundation.org>
36 Cc: Mike Galbraith <efault@gmx.de>
37 Cc: Peter Zijlstra <peterz@infradead.org>
38 Cc: Thomas Gleixner <tglx@linutronix.de>
39 Cc: live-patching@vger.kernel.org
40 Link: http://lkml.kernel.org/r/0a6cbfb40f8da99b7a45a1a8302dc6aef16ec812.1500938583.git.jpoimboe@redhat.com
41 [ Extended the changelog. ]
42 Signed-off-by: Ingo Molnar <mingo@kernel.org>
43 (cherry picked from commit ee9f8fce99640811b2b8e79d0d1dbe8bab69ba67)
44 Signed-off-by: Andy Whitcroft <apw@canonical.com>
45 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
46 (cherry picked from commit dccbf63d7a6cc431af23a86e28275a74904545cd)
47 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
49 Documentation/x86/orc-unwinder.txt | 179 ++++++++++++
50 arch/x86/kernel/Makefile | 8 +-
51 scripts/Makefile.build | 14 +-
52 arch/um/include/asm/unwind.h | 8 +
53 arch/x86/include/asm/module.h | 9 +
54 arch/x86/include/asm/orc_lookup.h | 46 +++
55 arch/x86/include/asm/orc_types.h | 2 +-
56 arch/x86/include/asm/unwind.h | 76 +++--
57 include/asm-generic/vmlinux.lds.h | 27 +-
58 arch/x86/kernel/module.c | 11 +-
59 arch/x86/kernel/setup.c | 3 +
60 arch/x86/kernel/unwind_frame.c | 39 +--
61 arch/x86/kernel/unwind_guess.c | 5 +
62 arch/x86/kernel/unwind_orc.c | 582 +++++++++++++++++++++++++++++++++++++
63 arch/x86/Kconfig | 1 +
64 arch/x86/Kconfig.debug | 25 ++
65 arch/x86/kernel/vmlinux.lds.S | 3 +
66 lib/Kconfig.debug | 3 +
67 18 files changed, 977 insertions(+), 64 deletions(-)
68 create mode 100644 Documentation/x86/orc-unwinder.txt
69 create mode 100644 arch/um/include/asm/unwind.h
70 create mode 100644 arch/x86/include/asm/orc_lookup.h
71 create mode 100644 arch/x86/kernel/unwind_orc.c
73 diff --git a/Documentation/x86/orc-unwinder.txt b/Documentation/x86/orc-unwinder.txt
75 index 000000000000..af0c9a4c65a6
77 +++ b/Documentation/x86/orc-unwinder.txt
85 +The kernel CONFIG_ORC_UNWINDER option enables the ORC unwinder, which is
86 +similar in concept to a DWARF unwinder. The difference is that the
87 +format of the ORC data is much simpler than DWARF, which in turn allows
88 +the ORC unwinder to be much simpler and faster.
90 +The ORC data consists of unwind tables which are generated by objtool.
91 +They contain out-of-band data which is used by the in-kernel ORC
92 +unwinder. Objtool generates the ORC data by first doing compile-time
93 +stack metadata validation (CONFIG_STACK_VALIDATION). After analyzing
94 +all the code paths of a .o file, it determines information about the
95 +stack state at each instruction address in the file and outputs that
96 +information to the .orc_unwind and .orc_unwind_ip sections.
98 +The per-object ORC sections are combined at link time and are sorted and
99 +post-processed at boot time. The unwinder uses the resulting data to
100 +correlate instruction addresses with their stack states at run time.
103 +ORC vs frame pointers
104 +---------------------
106 +With frame pointers enabled, GCC adds instrumentation code to every
107 +function in the kernel. The kernel's .text size increases by about
108 +3.2%, resulting in a broad kernel-wide slowdown. Measurements by Mel
109 +Gorman [1] have shown a slowdown of 5-10% for some workloads.
111 +In contrast, the ORC unwinder has no effect on text size or runtime
112 +performance, because the debuginfo is out of band. So if you disable
113 +frame pointers and enable the ORC unwinder, you get a nice performance
114 +improvement across the board, and still have reliable stack traces.
118 + "Note that it's not just a performance improvement, but also an
119 + instruction cache locality improvement: 3.2% .text savings almost
120 + directly transform into a similarly sized reduction in cache
121 + footprint. That can transform to even higher speedups for workloads
122 + whose cache locality is borderline."
124 +Another benefit of ORC compared to frame pointers is that it can
125 +reliably unwind across interrupts and exceptions. Frame pointer based
126 +unwinds can sometimes skip the caller of the interrupted function, if it
127 +was a leaf function or if the interrupt hit before the frame pointer was
130 +The main disadvantage of the ORC unwinder compared to frame pointers is
131 +that it needs more memory to store the ORC unwind tables: roughly 2-4MB
132 +depending on the kernel config.
138 +ORC debuginfo's advantage over DWARF itself is that it's much simpler.
139 +It gets rid of the complex DWARF CFI state machine and also gets rid of
140 +the tracking of unnecessary registers. This allows the unwinder to be
141 +much simpler, meaning fewer bugs, which is especially important for
142 +mission critical oops code.
144 +The simpler debuginfo format also enables the unwinder to be much faster
145 +than DWARF, which is important for perf and lockdep. In a basic
146 +performance test by Jiri Slaby [2], the ORC unwinder was about 20x
147 +faster than an out-of-tree DWARF unwinder. (Note: That measurement was
148 +taken before some performance tweaks were added, which doubled
149 +performance, so the speedup over DWARF may be closer to 40x.)
151 +The ORC data format does have a few downsides compared to DWARF. ORC
152 +unwind tables take up ~50% more RAM (+1.3MB on an x86 defconfig kernel)
153 +than DWARF-based eh_frame tables.
155 +Another potential downside is that, as GCC evolves, it's conceivable
156 +that the ORC data may end up being *too* simple to describe the state of
157 +the stack for certain optimizations. But IMO this is unlikely because
158 +GCC saves the frame pointer for any unusual stack adjustments it does,
159 +so I suspect we'll really only ever need to keep track of the stack
160 +pointer and the frame pointer between call frames. But even if we do
161 +end up having to track all the registers DWARF tracks, at least we will
162 +still be able to control the format, e.g. no complex state machines.
165 +ORC unwind table generation
166 +---------------------------
168 +The ORC data is generated by objtool. With the existing compile-time
169 +stack metadata validation feature, objtool already follows all code
170 +paths, and so it already has all the information it needs to be able to
171 +generate ORC data from scratch. So it's an easy step to go from stack
172 +validation to ORC data generation.
174 +It should be possible to instead generate the ORC data with a simple
175 +tool which converts DWARF to ORC data. However, such a solution would
176 +be incomplete due to the kernel's extensive use of asm, inline asm, and
177 +special sections like exception tables.
179 +That could be rectified by manually annotating those special code paths
180 +using GNU assembler .cfi annotations in .S files, and homegrown
181 +annotations for inline asm in .c files. But asm annotations were tried
182 +in the past and were found to be unmaintainable. They were often
183 +incorrect/incomplete and made the code harder to read and keep updated.
184 +And based on looking at glibc code, annotating inline asm in .c files
185 +might be even worse.
187 +Objtool still needs a few annotations, but only in code which does
188 +unusual things to the stack like entry code. And even then, far fewer
189 +annotations are needed than what DWARF would need, so they're much more
190 +maintainable than DWARF CFI annotations.
192 +So the advantages of using objtool to generate ORC data are that it
193 +gives more accurate debuginfo, with very few annotations. It also
194 +insulates the kernel from toolchain bugs which can be very painful to
195 +deal with in the kernel since we often have to workaround issues in
196 +older versions of the toolchain for years.
198 +The downside is that the unwinder now becomes dependent on objtool's
199 +ability to reverse engineer GCC code flow. If GCC optimizations become
200 +too complicated for objtool to follow, the ORC data generation might
201 +stop working or become incomplete. (It's worth noting that livepatch
202 +already has such a dependency on objtool's ability to follow GCC code
205 +If newer versions of GCC come up with some optimizations which break
206 +objtool, we may need to revisit the current implementation. Some
207 +possible solutions would be asking GCC to make the optimizations more
208 +palatable, or having objtool use DWARF as an additional input, or
209 +creating a GCC plugin to assist objtool with its analysis. But for now,
210 +objtool follows GCC code quite well.
213 +Unwinder implementation details
214 +-------------------------------
216 +Objtool generates the ORC data by integrating with the compile-time
217 +stack metadata validation feature, which is described in detail in
218 +tools/objtool/Documentation/stack-validation.txt. After analyzing all
219 +the code paths of a .o file, it creates an array of orc_entry structs,
220 +and a parallel array of instruction addresses associated with those
221 +structs, and writes them to the .orc_unwind and .orc_unwind_ip sections
224 +The ORC data is split into the two arrays for performance reasons, to
225 +make the searchable part of the data (.orc_unwind_ip) more compact. The
226 +arrays are sorted in parallel at boot time.
228 +Performance is further improved by the use of a fast lookup table which
229 +is created at runtime. The fast lookup table associates a given address
230 +with a range of indices for the .orc_unwind table, so that only a small
231 +subset of the table needs to be searched.
237 +Orcs, fearsome creatures of medieval folklore, are the Dwarves' natural
238 +enemies. Similarly, the ORC unwinder was created in opposition to the
239 +complexity and slowness of DWARF.
241 +"Although Orcs rarely consider multiple solutions to a problem, they do
242 +excel at getting things done because they are creatures of action, not
243 +thought." [3] Similarly, unlike the esoteric DWARF unwinder, the
244 +veracious ORC unwinder wastes no time or siloconic effort decoding
245 +variable-length zero-extended unsigned-integer byte-coded
246 +state-machine-based debug information entries.
248 +Similar to how Orcs frequently unravel the well-intentioned plans of
249 +their adversaries, the ORC unwinder frequently unravels stacks with
250 +brutal, unyielding efficiency.
252 +ORC stands for Oops Rewind Capability.
255 +[1] https://lkml.kernel.org/r/20170602104048.jkkzssljsompjdwy@suse.de
256 +[2] https://lkml.kernel.org/r/d2ca5435-6386-29b8-db87-7f227c2b713a@suse.cz
257 +[3] http://dustin.wikidot.com/half-orcs-and-orcs
258 diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
259 index a01892bdd61a..287eac7d207f 100644
260 --- a/arch/x86/kernel/Makefile
261 +++ b/arch/x86/kernel/Makefile
262 @@ -126,11 +126,9 @@ obj-$(CONFIG_PERF_EVENTS) += perf_regs.o
263 obj-$(CONFIG_TRACING) += tracepoint.o
264 obj-$(CONFIG_SCHED_MC_PRIO) += itmt.o
266 -ifdef CONFIG_FRAME_POINTER
267 -obj-y += unwind_frame.o
269 -obj-y += unwind_guess.o
271 +obj-$(CONFIG_ORC_UNWINDER) += unwind_orc.o
272 +obj-$(CONFIG_FRAME_POINTER_UNWINDER) += unwind_frame.o
273 +obj-$(CONFIG_GUESS_UNWINDER) += unwind_guess.o
276 # 64 bit specific files
277 diff --git a/scripts/Makefile.build b/scripts/Makefile.build
278 index 273bc2228307..ab2c8ef43cdb 100644
279 --- a/scripts/Makefile.build
280 +++ b/scripts/Makefile.build
281 @@ -258,7 +258,8 @@ ifneq ($(SKIP_STACK_VALIDATION),1)
283 __objtool_obj := $(objtree)/tools/objtool/objtool
285 -objtool_args = check
286 +objtool_args = $(if $(CONFIG_ORC_UNWINDER),orc generate,check)
288 ifndef CONFIG_FRAME_POINTER
289 objtool_args += --no-fp
291 @@ -276,6 +277,11 @@ objtool_obj = $(if $(patsubst y%,, \
292 endif # SKIP_STACK_VALIDATION
293 endif # CONFIG_STACK_VALIDATION
295 +# Rebuild all objects when objtool changes, or is enabled/disabled.
296 +objtool_dep = $(objtool_obj) \
297 + $(wildcard include/config/orc/unwinder.h \
298 + include/config/stack/validation.h)
301 $(call echo-cmd,checksrc) $(cmd_checksrc) \
302 $(call cmd_and_fixdep,cc_o_c) \
303 @@ -298,14 +304,14 @@ cmd_undef_syms = echo
306 # Built-in and composite module parts
307 -$(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_obj) FORCE
308 +$(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE
309 $(call cmd,force_checksrc)
310 $(call cmd,force_check_kmsg)
311 $(call if_changed_rule,cc_o_c)
313 # Single-part modules are special since we need to mark them in $(MODVERDIR)
315 -$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_obj) FORCE
316 +$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE
317 $(call cmd,force_checksrc)
318 $(call cmd,force_check_kmsg)
319 $(call if_changed_rule,cc_o_c)
320 @@ -401,7 +407,7 @@ cmd_modversions_S = \
324 -$(obj)/%.o: $(src)/%.S $(objtool_obj) FORCE
325 +$(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
326 $(call if_changed_rule,as_o_S)
328 targets += $(real-objs-y) $(real-objs-m) $(lib-y)
329 diff --git a/arch/um/include/asm/unwind.h b/arch/um/include/asm/unwind.h
331 index 000000000000..7ffa5437b761
333 +++ b/arch/um/include/asm/unwind.h
335 +#ifndef _ASM_UML_UNWIND_H
336 +#define _ASM_UML_UNWIND_H
339 +unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
340 + void *orc, size_t orc_size) {}
342 +#endif /* _ASM_UML_UNWIND_H */
343 diff --git a/arch/x86/include/asm/module.h b/arch/x86/include/asm/module.h
344 index e3b7819caeef..9eb7c718aaf8 100644
345 --- a/arch/x86/include/asm/module.h
346 +++ b/arch/x86/include/asm/module.h
348 #define _ASM_X86_MODULE_H
350 #include <asm-generic/module.h>
351 +#include <asm/orc_types.h>
353 +struct mod_arch_specific {
354 +#ifdef CONFIG_ORC_UNWINDER
355 + unsigned int num_orcs;
356 + int *orc_unwind_ip;
357 + struct orc_entry *orc_unwind;
362 /* X86_64 does not define MODULE_PROC_FAMILY */
363 diff --git a/arch/x86/include/asm/orc_lookup.h b/arch/x86/include/asm/orc_lookup.h
365 index 000000000000..91c8d868424d
367 +++ b/arch/x86/include/asm/orc_lookup.h
370 + * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
372 + * This program is free software; you can redistribute it and/or
373 + * modify it under the terms of the GNU General Public License
374 + * as published by the Free Software Foundation; either version 2
375 + * of the License, or (at your option) any later version.
377 + * This program is distributed in the hope that it will be useful,
378 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
379 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
380 + * GNU General Public License for more details.
382 + * You should have received a copy of the GNU General Public License
383 + * along with this program; if not, see <http://www.gnu.org/licenses/>.
385 +#ifndef _ORC_LOOKUP_H
386 +#define _ORC_LOOKUP_H
389 + * This is a lookup table for speeding up access to the .orc_unwind table.
390 + * Given an input address offset, the corresponding lookup table entry
391 + * specifies a subset of the .orc_unwind table to search.
393 + * Each block represents the end of the previous range and the start of the
394 + * next range. An extra block is added to give the last range an end.
396 + * The block size should be a power of 2 to avoid a costly 'div' instruction.
398 + * A block size of 256 was chosen because it roughly doubles unwinder
399 + * performance while only adding ~5% to the ORC data footprint.
401 +#define LOOKUP_BLOCK_ORDER 8
402 +#define LOOKUP_BLOCK_SIZE (1 << LOOKUP_BLOCK_ORDER)
404 +#ifndef LINKER_SCRIPT
406 +extern unsigned int orc_lookup[];
407 +extern unsigned int orc_lookup_end[];
409 +#define LOOKUP_START_IP (unsigned long)_stext
410 +#define LOOKUP_STOP_IP (unsigned long)_etext
412 +#endif /* LINKER_SCRIPT */
414 +#endif /* _ORC_LOOKUP_H */
415 diff --git a/arch/x86/include/asm/orc_types.h b/arch/x86/include/asm/orc_types.h
416 index 7dc777a6cb40..9c9dc579bd7d 100644
417 --- a/arch/x86/include/asm/orc_types.h
418 +++ b/arch/x86/include/asm/orc_types.h
419 @@ -88,7 +88,7 @@ struct orc_entry {
427 * This struct is used by asm and inline asm code to manually annotate the
428 diff --git a/arch/x86/include/asm/unwind.h b/arch/x86/include/asm/unwind.h
429 index e6676495b125..25b8d31a007d 100644
430 --- a/arch/x86/include/asm/unwind.h
431 +++ b/arch/x86/include/asm/unwind.h
432 @@ -12,11 +12,14 @@ struct unwind_state {
433 struct task_struct *task;
436 -#ifdef CONFIG_FRAME_POINTER
437 +#if defined(CONFIG_ORC_UNWINDER)
438 + bool signal, full_regs;
439 + unsigned long sp, bp, ip;
440 + struct pt_regs *regs;
441 +#elif defined(CONFIG_FRAME_POINTER)
443 - unsigned long *bp, *orig_sp;
444 + unsigned long *bp, *orig_sp, ip;
445 struct pt_regs *regs;
450 @@ -24,41 +27,30 @@ struct unwind_state {
452 void __unwind_start(struct unwind_state *state, struct task_struct *task,
453 struct pt_regs *regs, unsigned long *first_frame);
455 bool unwind_next_frame(struct unwind_state *state);
457 unsigned long unwind_get_return_address(struct unwind_state *state);
458 +unsigned long *unwind_get_return_address_ptr(struct unwind_state *state);
460 static inline bool unwind_done(struct unwind_state *state)
462 return state->stack_info.type == STACK_TYPE_UNKNOWN;
466 -void unwind_start(struct unwind_state *state, struct task_struct *task,
467 - struct pt_regs *regs, unsigned long *first_frame)
469 - first_frame = first_frame ? : get_stack_pointer(task, regs);
471 - __unwind_start(state, task, regs, first_frame);
474 static inline bool unwind_error(struct unwind_state *state)
479 -#ifdef CONFIG_FRAME_POINTER
482 -unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
483 +void unwind_start(struct unwind_state *state, struct task_struct *task,
484 + struct pt_regs *regs, unsigned long *first_frame)
486 - if (unwind_done(state))
488 + first_frame = first_frame ? : get_stack_pointer(task, regs);
490 - return state->regs ? &state->regs->ip : state->bp + 1;
491 + __unwind_start(state, task, regs, first_frame);
494 +#if defined(CONFIG_ORC_UNWINDER) || defined(CONFIG_FRAME_POINTER)
495 static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
497 if (unwind_done(state))
498 @@ -66,20 +58,46 @@ static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
503 -#else /* !CONFIG_FRAME_POINTER */
506 -unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
508 +static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
514 -static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
515 +#ifdef CONFIG_ORC_UNWINDER
516 +void unwind_init(void);
517 +void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
518 + void *orc, size_t orc_size);
520 +static inline void unwind_init(void) {}
522 +void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
523 + void *orc, size_t orc_size) {}
527 + * This disables KASAN checking when reading a value from another task's stack,
528 + * since the other task could be running on another CPU and could have poisoned
529 + * the stack in the meantime.
531 +#define READ_ONCE_TASK_STACK(task, x) \
533 + unsigned long val; \
534 + if (task == current) \
535 + val = READ_ONCE(x); \
537 + val = READ_ONCE_NOCHECK(x); \
541 +static inline bool task_on_another_cpu(struct task_struct *task)
545 + return task != current && task->on_cpu;
551 -#endif /* CONFIG_FRAME_POINTER */
553 #endif /* _ASM_X86_UNWIND_H */
554 diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
555 index e7e955d4ab9e..9fdb54a95976 100644
556 --- a/include/asm-generic/vmlinux.lds.h
557 +++ b/include/asm-generic/vmlinux.lds.h
562 +#ifdef CONFIG_ORC_UNWINDER
563 +#define ORC_UNWIND_TABLE \
565 + .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \
566 + VMLINUX_SYMBOL(__start_orc_unwind_ip) = .; \
567 + KEEP(*(.orc_unwind_ip)) \
568 + VMLINUX_SYMBOL(__stop_orc_unwind_ip) = .; \
571 + .orc_unwind : AT(ADDR(.orc_unwind) - LOAD_OFFSET) { \
572 + VMLINUX_SYMBOL(__start_orc_unwind) = .; \
573 + KEEP(*(.orc_unwind)) \
574 + VMLINUX_SYMBOL(__stop_orc_unwind) = .; \
577 + .orc_lookup : AT(ADDR(.orc_lookup) - LOAD_OFFSET) { \
578 + VMLINUX_SYMBOL(orc_lookup) = .; \
579 + . += (((SIZEOF(.text) + LOOKUP_BLOCK_SIZE - 1) / \
580 + LOOKUP_BLOCK_SIZE) + 1) * 4; \
581 + VMLINUX_SYMBOL(orc_lookup_end) = .; \
584 +#define ORC_UNWIND_TABLE
587 #ifdef CONFIG_PM_TRACE
597 #define INIT_TEXT_SECTION(inittext_align) \
598 . = ALIGN(inittext_align); \
599 diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
600 index f67bd3205df7..62e7d70aadd5 100644
601 --- a/arch/x86/kernel/module.c
602 +++ b/arch/x86/kernel/module.c
604 #include <asm/page.h>
605 #include <asm/pgtable.h>
606 #include <asm/setup.h>
607 +#include <asm/unwind.h>
610 #define DEBUGP(fmt, ...) \
611 @@ -213,7 +214,7 @@ int module_finalize(const Elf_Ehdr *hdr,
614 const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL,
616 + *para = NULL, *orc = NULL, *orc_ip = NULL;
617 char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
619 for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
620 @@ -225,6 +226,10 @@ int module_finalize(const Elf_Ehdr *hdr,
622 if (!strcmp(".parainstructions", secstrings + s->sh_name))
624 + if (!strcmp(".orc_unwind", secstrings + s->sh_name))
626 + if (!strcmp(".orc_unwind_ip", secstrings + s->sh_name))
631 @@ -248,6 +253,10 @@ int module_finalize(const Elf_Ehdr *hdr,
632 /* make jump label nops */
633 jump_label_apply_nops(me);
636 + unwind_module_init(me, (void *)orc_ip->sh_addr, orc_ip->sh_size,
637 + (void *)orc->sh_addr, orc->sh_size);
642 diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
643 index f964bfddfefd..dd6e8707e969 100644
644 --- a/arch/x86/kernel/setup.c
645 +++ b/arch/x86/kernel/setup.c
647 #include <asm/microcode.h>
648 #include <asm/mmu_context.h>
649 #include <asm/kaslr.h>
650 +#include <asm/unwind.h>
653 * max_low_pfn_mapped: highest direct mapped pfn under 4GB
654 @@ -1325,6 +1326,8 @@ void __init setup_arch(char **cmdline_p)
655 if (efi_enabled(EFI_BOOT))
656 efi_apply_memmap_quirks();
663 diff --git a/arch/x86/kernel/unwind_frame.c b/arch/x86/kernel/unwind_frame.c
664 index c29e5bc7e9c9..d145a0b1f529 100644
665 --- a/arch/x86/kernel/unwind_frame.c
666 +++ b/arch/x86/kernel/unwind_frame.c
669 #define FRAME_HEADER_SIZE (sizeof(long) * 2)
672 - * This disables KASAN checking when reading a value from another task's stack,
673 - * since the other task could be running on another CPU and could have poisoned
674 - * the stack in the meantime.
676 -#define READ_ONCE_TASK_STACK(task, x) \
678 - unsigned long val; \
679 - if (task == current) \
680 - val = READ_ONCE(x); \
682 - val = READ_ONCE_NOCHECK(x); \
685 +unsigned long unwind_get_return_address(struct unwind_state *state)
687 + if (unwind_done(state))
690 + return __kernel_text_address(state->ip) ? state->ip : 0;
692 +EXPORT_SYMBOL_GPL(unwind_get_return_address);
694 +unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
696 + if (unwind_done(state))
699 + return state->regs ? &state->regs->ip : state->bp + 1;
702 static void unwind_dump(struct unwind_state *state)
704 @@ -66,15 +68,6 @@ static void unwind_dump(struct unwind_state *state)
708 -unsigned long unwind_get_return_address(struct unwind_state *state)
710 - if (unwind_done(state))
713 - return __kernel_text_address(state->ip) ? state->ip : 0;
715 -EXPORT_SYMBOL_GPL(unwind_get_return_address);
717 static size_t regs_size(struct pt_regs *regs)
719 /* x86_32 regs from kernel mode are two words shorter: */
720 diff --git a/arch/x86/kernel/unwind_guess.c b/arch/x86/kernel/unwind_guess.c
721 index 039f36738e49..4f0e17b90463 100644
722 --- a/arch/x86/kernel/unwind_guess.c
723 +++ b/arch/x86/kernel/unwind_guess.c
724 @@ -19,6 +19,11 @@ unsigned long unwind_get_return_address(struct unwind_state *state)
726 EXPORT_SYMBOL_GPL(unwind_get_return_address);
728 +unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
733 bool unwind_next_frame(struct unwind_state *state)
735 struct stack_info *info = &state->stack_info;
736 diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
738 index 000000000000..570b70d3f604
740 +++ b/arch/x86/kernel/unwind_orc.c
742 +#include <linux/module.h>
743 +#include <linux/sort.h>
744 +#include <asm/ptrace.h>
745 +#include <asm/stacktrace.h>
746 +#include <asm/unwind.h>
747 +#include <asm/orc_types.h>
748 +#include <asm/orc_lookup.h>
749 +#include <asm/sections.h>
751 +#define orc_warn(fmt, ...) \
752 + printk_deferred_once(KERN_WARNING pr_fmt("WARNING: " fmt), ##__VA_ARGS__)
754 +extern int __start_orc_unwind_ip[];
755 +extern int __stop_orc_unwind_ip[];
756 +extern struct orc_entry __start_orc_unwind[];
757 +extern struct orc_entry __stop_orc_unwind[];
759 +static DEFINE_MUTEX(sort_mutex);
760 +int *cur_orc_ip_table = __start_orc_unwind_ip;
761 +struct orc_entry *cur_orc_table = __start_orc_unwind;
763 +unsigned int lookup_num_blocks;
766 +static inline unsigned long orc_ip(const int *ip)
768 + return (unsigned long)ip + *ip;
771 +static struct orc_entry *__orc_find(int *ip_table, struct orc_entry *u_table,
772 + unsigned int num_entries, unsigned long ip)
774 + int *first = ip_table;
775 + int *last = ip_table + num_entries - 1;
776 + int *mid = first, *found = first;
782 + * Do a binary range search to find the rightmost duplicate of a given
783 + * starting address. Some entries are section terminators which are
784 + * "weak" entries for ensuring there are no gaps. They should be
785 + * ignored when they conflict with a real entry.
787 + while (first <= last) {
788 + mid = first + ((last - first) / 2);
790 + if (orc_ip(mid) <= ip) {
797 + return u_table + (found - ip_table);
800 +#ifdef CONFIG_MODULES
801 +static struct orc_entry *orc_module_find(unsigned long ip)
803 + struct module *mod;
805 + mod = __module_address(ip);
806 + if (!mod || !mod->arch.orc_unwind || !mod->arch.orc_unwind_ip)
808 + return __orc_find(mod->arch.orc_unwind_ip, mod->arch.orc_unwind,
809 + mod->arch.num_orcs, ip);
812 +static struct orc_entry *orc_module_find(unsigned long ip)
818 +static struct orc_entry *orc_find(unsigned long ip)
823 + /* For non-init vmlinux addresses, use the fast lookup table: */
824 + if (ip >= LOOKUP_START_IP && ip < LOOKUP_STOP_IP) {
825 + unsigned int idx, start, stop;
827 + idx = (ip - LOOKUP_START_IP) / LOOKUP_BLOCK_SIZE;
829 + if (unlikely((idx >= lookup_num_blocks-1))) {
830 + orc_warn("WARNING: bad lookup idx: idx=%u num=%u ip=%lx\n",
831 + idx, lookup_num_blocks, ip);
835 + start = orc_lookup[idx];
836 + stop = orc_lookup[idx + 1] + 1;
838 + if (unlikely((__start_orc_unwind + start >= __stop_orc_unwind) ||
839 + (__start_orc_unwind + stop > __stop_orc_unwind))) {
840 + orc_warn("WARNING: bad lookup value: idx=%u num=%u start=%u stop=%u ip=%lx\n",
841 + idx, lookup_num_blocks, start, stop, ip);
845 + return __orc_find(__start_orc_unwind_ip + start,
846 + __start_orc_unwind + start, stop - start, ip);
849 + /* vmlinux .init slow lookup: */
850 + if (ip >= (unsigned long)_sinittext && ip < (unsigned long)_einittext)
851 + return __orc_find(__start_orc_unwind_ip, __start_orc_unwind,
852 + __stop_orc_unwind_ip - __start_orc_unwind_ip, ip);
854 + /* Module lookup: */
855 + return orc_module_find(ip);
858 +static void orc_sort_swap(void *_a, void *_b, int size)
860 + struct orc_entry *orc_a, *orc_b;
861 + struct orc_entry orc_tmp;
862 + int *a = _a, *b = _b, tmp;
863 + int delta = _b - _a;
865 + /* Swap the .orc_unwind_ip entries: */
870 + /* Swap the corresponding .orc_unwind entries: */
871 + orc_a = cur_orc_table + (a - cur_orc_ip_table);
872 + orc_b = cur_orc_table + (b - cur_orc_ip_table);
878 +static int orc_sort_cmp(const void *_a, const void *_b)
880 + struct orc_entry *orc_a;
881 + const int *a = _a, *b = _b;
882 + unsigned long a_val = orc_ip(a);
883 + unsigned long b_val = orc_ip(b);
891 + * The "weak" section terminator entries need to always be on the left
892 + * to ensure the lookup code skips them in favor of real entries.
893 + * These terminator entries exist to handle any gaps created by
894 + * whitelisted .o files which didn't get objtool generation.
896 + orc_a = cur_orc_table + (a - cur_orc_ip_table);
897 + return orc_a->sp_reg == ORC_REG_UNDEFINED ? -1 : 1;
900 +#ifdef CONFIG_MODULES
901 +void unwind_module_init(struct module *mod, void *_orc_ip, size_t orc_ip_size,
902 + void *_orc, size_t orc_size)
904 + int *orc_ip = _orc_ip;
905 + struct orc_entry *orc = _orc;
906 + unsigned int num_entries = orc_ip_size / sizeof(int);
908 + WARN_ON_ONCE(orc_ip_size % sizeof(int) != 0 ||
909 + orc_size % sizeof(*orc) != 0 ||
910 + num_entries != orc_size / sizeof(*orc));
913 + * The 'cur_orc_*' globals allow the orc_sort_swap() callback to
914 + * associate an .orc_unwind_ip table entry with its corresponding
915 + * .orc_unwind entry so they can both be swapped.
917 + mutex_lock(&sort_mutex);
918 + cur_orc_ip_table = orc_ip;
919 + cur_orc_table = orc;
920 + sort(orc_ip, num_entries, sizeof(int), orc_sort_cmp, orc_sort_swap);
921 + mutex_unlock(&sort_mutex);
923 + mod->arch.orc_unwind_ip = orc_ip;
924 + mod->arch.orc_unwind = orc;
925 + mod->arch.num_orcs = num_entries;
929 +void __init unwind_init(void)
931 + size_t orc_ip_size = (void *)__stop_orc_unwind_ip - (void *)__start_orc_unwind_ip;
932 + size_t orc_size = (void *)__stop_orc_unwind - (void *)__start_orc_unwind;
933 + size_t num_entries = orc_ip_size / sizeof(int);
934 + struct orc_entry *orc;
937 + if (!num_entries || orc_ip_size % sizeof(int) != 0 ||
938 + orc_size % sizeof(struct orc_entry) != 0 ||
939 + num_entries != orc_size / sizeof(struct orc_entry)) {
940 + orc_warn("WARNING: Bad or missing .orc_unwind table. Disabling unwinder.\n");
944 + /* Sort the .orc_unwind and .orc_unwind_ip tables: */
945 + sort(__start_orc_unwind_ip, num_entries, sizeof(int), orc_sort_cmp,
948 + /* Initialize the fast lookup table: */
949 + lookup_num_blocks = orc_lookup_end - orc_lookup;
950 + for (i = 0; i < lookup_num_blocks-1; i++) {
951 + orc = __orc_find(__start_orc_unwind_ip, __start_orc_unwind,
953 + LOOKUP_START_IP + (LOOKUP_BLOCK_SIZE * i));
955 + orc_warn("WARNING: Corrupt .orc_unwind table. Disabling unwinder.\n");
959 + orc_lookup[i] = orc - __start_orc_unwind;
962 + /* Initialize the ending block: */
963 + orc = __orc_find(__start_orc_unwind_ip, __start_orc_unwind, num_entries,
966 + orc_warn("WARNING: Corrupt .orc_unwind table. Disabling unwinder.\n");
969 + orc_lookup[lookup_num_blocks-1] = orc - __start_orc_unwind;
974 +unsigned long unwind_get_return_address(struct unwind_state *state)
976 + if (unwind_done(state))
979 + return __kernel_text_address(state->ip) ? state->ip : 0;
981 +EXPORT_SYMBOL_GPL(unwind_get_return_address);
983 +unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
985 + if (unwind_done(state))
989 + return &state->regs->ip;
992 + return (unsigned long *)state->sp - 1;
997 +static bool stack_access_ok(struct unwind_state *state, unsigned long addr,
1000 + struct stack_info *info = &state->stack_info;
1003 + * If the address isn't on the current stack, switch to the next one.
1005 + * We may have to traverse multiple stacks to deal with the possibility
1006 + * that info->next_sp could point to an empty stack and the address
1007 + * could be on a subsequent stack.
1009 + while (!on_stack(info, (void *)addr, len))
1010 + if (get_stack_info(info->next_sp, state->task, info,
1011 + &state->stack_mask))
1017 +static bool deref_stack_reg(struct unwind_state *state, unsigned long addr,
1018 + unsigned long *val)
1020 + if (!stack_access_ok(state, addr, sizeof(long)))
1023 + *val = READ_ONCE_TASK_STACK(state->task, *(unsigned long *)addr);
1027 +#define REGS_SIZE (sizeof(struct pt_regs))
1028 +#define SP_OFFSET (offsetof(struct pt_regs, sp))
1029 +#define IRET_REGS_SIZE (REGS_SIZE - offsetof(struct pt_regs, ip))
1030 +#define IRET_SP_OFFSET (SP_OFFSET - offsetof(struct pt_regs, ip))
1032 +static bool deref_stack_regs(struct unwind_state *state, unsigned long addr,
1033 + unsigned long *ip, unsigned long *sp, bool full)
1035 + size_t regs_size = full ? REGS_SIZE : IRET_REGS_SIZE;
1036 + size_t sp_offset = full ? SP_OFFSET : IRET_SP_OFFSET;
1037 + struct pt_regs *regs = (struct pt_regs *)(addr + regs_size - REGS_SIZE);
1039 + if (IS_ENABLED(CONFIG_X86_64)) {
1040 + if (!stack_access_ok(state, addr, regs_size))
1049 + if (!stack_access_ok(state, addr, sp_offset))
1054 + if (user_mode(regs)) {
1055 + if (!stack_access_ok(state, addr + sp_offset,
1056 + REGS_SIZE - SP_OFFSET))
1061 + *sp = (unsigned long)®s->sp;
1066 +bool unwind_next_frame(struct unwind_state *state)
1068 + unsigned long ip_p, sp, orig_ip, prev_sp = state->sp;
1069 + enum stack_type prev_type = state->stack_info.type;
1070 + struct orc_entry *orc;
1071 + struct pt_regs *ptregs;
1072 + bool indirect = false;
1074 + if (unwind_done(state))
1077 + /* Don't let modules unload while we're reading their ORC data. */
1078 + preempt_disable();
1080 + /* Have we reached the end? */
1081 + if (state->regs && user_mode(state->regs))
1085 + * Find the orc_entry associated with the text address.
1087 + * Decrement call return addresses by one so they work for sibling
1088 + * calls and calls to noreturn functions.
1090 + orc = orc_find(state->signal ? state->ip : state->ip - 1);
1091 + if (!orc || orc->sp_reg == ORC_REG_UNDEFINED)
1093 + orig_ip = state->ip;
1095 + /* Find the previous frame's stack: */
1096 + switch (orc->sp_reg) {
1098 + sp = state->sp + orc->sp_offset;
1102 + sp = state->bp + orc->sp_offset;
1105 + case ORC_REG_SP_INDIRECT:
1106 + sp = state->sp + orc->sp_offset;
1110 + case ORC_REG_BP_INDIRECT:
1111 + sp = state->bp + orc->sp_offset;
1116 + if (!state->regs || !state->full_regs) {
1117 + orc_warn("missing regs for base reg R10 at ip %p\n",
1118 + (void *)state->ip);
1121 + sp = state->regs->r10;
1125 + if (!state->regs || !state->full_regs) {
1126 + orc_warn("missing regs for base reg R13 at ip %p\n",
1127 + (void *)state->ip);
1130 + sp = state->regs->r13;
1134 + if (!state->regs || !state->full_regs) {
1135 + orc_warn("missing regs for base reg DI at ip %p\n",
1136 + (void *)state->ip);
1139 + sp = state->regs->di;
1143 + if (!state->regs || !state->full_regs) {
1144 + orc_warn("missing regs for base reg DX at ip %p\n",
1145 + (void *)state->ip);
1148 + sp = state->regs->dx;
1152 + orc_warn("unknown SP base reg %d for ip %p\n",
1153 + orc->sp_reg, (void *)state->ip);
1158 + if (!deref_stack_reg(state, sp, &sp))
1162 + /* Find IP, SP and possibly regs: */
1163 + switch (orc->type) {
1164 + case ORC_TYPE_CALL:
1165 + ip_p = sp - sizeof(long);
1167 + if (!deref_stack_reg(state, ip_p, &state->ip))
1170 + state->ip = ftrace_graph_ret_addr(state->task, &state->graph_idx,
1171 + state->ip, (void *)ip_p);
1174 + state->regs = NULL;
1175 + state->signal = false;
1178 + case ORC_TYPE_REGS:
1179 + if (!deref_stack_regs(state, sp, &state->ip, &state->sp, true)) {
1180 + orc_warn("can't dereference registers at %p for ip %p\n",
1181 + (void *)sp, (void *)orig_ip);
1185 + state->regs = (struct pt_regs *)sp;
1186 + state->full_regs = true;
1187 + state->signal = true;
1190 + case ORC_TYPE_REGS_IRET:
1191 + if (!deref_stack_regs(state, sp, &state->ip, &state->sp, false)) {
1192 + orc_warn("can't dereference iret registers at %p for ip %p\n",
1193 + (void *)sp, (void *)orig_ip);
1197 + ptregs = container_of((void *)sp, struct pt_regs, ip);
1198 + if ((unsigned long)ptregs >= prev_sp &&
1199 + on_stack(&state->stack_info, ptregs, REGS_SIZE)) {
1200 + state->regs = ptregs;
1201 + state->full_regs = false;
1203 + state->regs = NULL;
1205 + state->signal = true;
1209 + orc_warn("unknown .orc_unwind entry type %d\n", orc->type);
1214 + switch (orc->bp_reg) {
1215 + case ORC_REG_UNDEFINED:
1216 + if (state->regs && state->full_regs)
1217 + state->bp = state->regs->bp;
1220 + case ORC_REG_PREV_SP:
1221 + if (!deref_stack_reg(state, sp + orc->bp_offset, &state->bp))
1226 + if (!deref_stack_reg(state, state->bp + orc->bp_offset, &state->bp))
1231 + orc_warn("unknown BP base reg %d for ip %p\n",
1232 + orc->bp_reg, (void *)orig_ip);
1236 + /* Prevent a recursive loop due to bad ORC data: */
1237 + if (state->stack_info.type == prev_type &&
1238 + on_stack(&state->stack_info, (void *)state->sp, sizeof(long)) &&
1239 + state->sp <= prev_sp) {
1240 + orc_warn("stack going in the wrong direction? ip=%p\n",
1250 + state->stack_info.type = STACK_TYPE_UNKNOWN;
1253 +EXPORT_SYMBOL_GPL(unwind_next_frame);
1255 +void __unwind_start(struct unwind_state *state, struct task_struct *task,
1256 + struct pt_regs *regs, unsigned long *first_frame)
1258 + memset(state, 0, sizeof(*state));
1259 + state->task = task;
1262 + * Refuse to unwind the stack of a task while it's executing on another
1263 + * CPU. This check is racy, but that's ok: the unwinder has other
1264 + * checks to prevent it from going off the rails.
1266 + if (task_on_another_cpu(task))
1270 + if (user_mode(regs))
1273 + state->ip = regs->ip;
1274 + state->sp = kernel_stack_pointer(regs);
1275 + state->bp = regs->bp;
1276 + state->regs = regs;
1277 + state->full_regs = true;
1278 + state->signal = true;
1280 + } else if (task == current) {
1281 + asm volatile("lea (%%rip), %0\n\t"
1282 + "mov %%rsp, %1\n\t"
1283 + "mov %%rbp, %2\n\t"
1284 + : "=r" (state->ip), "=r" (state->sp),
1285 + "=r" (state->bp));
1288 + struct inactive_task_frame *frame = (void *)task->thread.sp;
1290 + state->sp = task->thread.sp;
1291 + state->bp = READ_ONCE_NOCHECK(frame->bp);
1292 + state->ip = READ_ONCE_NOCHECK(frame->ret_addr);
1295 + if (get_stack_info((unsigned long *)state->sp, state->task,
1296 + &state->stack_info, &state->stack_mask))
1300 + * The caller can provide the address of the first frame directly
1301 + * (first_frame) or indirectly (regs->sp) to indicate which stack frame
1302 + * to start unwinding at. Skip ahead until we reach it.
1305 + /* When starting from regs, skip the regs frame: */
1307 + unwind_next_frame(state);
1311 + /* Otherwise, skip ahead to the user-specified starting frame: */
1312 + while (!unwind_done(state) &&
1313 + (!on_stack(&state->stack_info, first_frame, sizeof(long)) ||
1314 + state->sp <= (unsigned long)first_frame))
1315 + unwind_next_frame(state);
1320 + state->stack_info.type = STACK_TYPE_UNKNOWN;
1323 +EXPORT_SYMBOL_GPL(__unwind_start);
1324 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
1325 index 658fcf67862c..d6f45f6d1054 100644
1326 --- a/arch/x86/Kconfig
1327 +++ b/arch/x86/Kconfig
1328 @@ -158,6 +158,7 @@ config X86
1329 select HAVE_MEMBLOCK
1330 select HAVE_MEMBLOCK_NODE_MAP
1331 select HAVE_MIXED_BREAKPOINTS_REGS
1332 + select HAVE_MOD_ARCH_SPECIFIC
1334 select HAVE_OPROFILE
1335 select HAVE_OPTPROBES
1336 diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
1337 index 1fc519f3c49e..d5bca2ec8a74 100644
1338 --- a/arch/x86/Kconfig.debug
1339 +++ b/arch/x86/Kconfig.debug
1340 @@ -356,4 +356,29 @@ config PUNIT_ATOM_DEBUG
1341 The current power state can be read from
1342 /sys/kernel/debug/punit_atom/dev_power_state
1344 +config ORC_UNWINDER
1345 + bool "ORC unwinder"
1347 + select STACK_VALIDATION
1349 + This option enables the ORC (Oops Rewind Capability) unwinder for
1350 + unwinding kernel stack traces. It uses a custom data format which is
1351 + a simplified version of the DWARF Call Frame Information standard.
1353 + This unwinder is more accurate across interrupt entry frames than the
1354 + frame pointer unwinder. It can also enable a 5-10% performance
1355 + improvement across the entire kernel if CONFIG_FRAME_POINTER is
1358 + Enabling this option will increase the kernel's runtime memory usage
1359 + by roughly 2-4MB, depending on your kernel config.
1361 +config FRAME_POINTER_UNWINDER
1363 + depends on !ORC_UNWINDER && FRAME_POINTER
1365 +config GUESS_UNWINDER
1367 + depends on !ORC_UNWINDER && !FRAME_POINTER
1370 diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
1371 index c8a3b61be0aa..f05f00acac89 100644
1372 --- a/arch/x86/kernel/vmlinux.lds.S
1373 +++ b/arch/x86/kernel/vmlinux.lds.S
1375 #include <asm/asm-offsets.h>
1376 #include <asm/thread_info.h>
1377 #include <asm/page_types.h>
1378 +#include <asm/orc_lookup.h>
1379 #include <asm/cache.h>
1380 #include <asm/boot.h>
1382 @@ -148,6 +149,8 @@ SECTIONS
1388 . = ALIGN(PAGE_SIZE);
1391 diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
1392 index c617b9d1d6cb..0b4d1b3880b0 100644
1393 --- a/lib/Kconfig.debug
1394 +++ b/lib/Kconfig.debug
1395 @@ -374,6 +374,9 @@ config STACK_VALIDATION
1396 pointers (if CONFIG_FRAME_POINTER is enabled). This helps ensure
1397 that runtime stack traces are more reliable.
1399 + This is also a prerequisite for generation of ORC unwind data, which
1400 + is needed for CONFIG_ORC_UNWINDER.
1402 For more information, see
1403 tools/objtool/Documentation/stack-validation.txt.