Skip to content

Commit 98d0c8e

Browse files
jpoimboeIngo Molnar
authored andcommitted
x86/unwind/orc: Prevent unwinding before ORC initialization
If the unwinder is called before the ORC data has been initialized, orc_find() returns NULL, and it tries to fall back to using frame pointers. This can cause some unexpected warnings during boot. Move the 'orc_init' check from orc_find() to __unwind_init(), so that it doesn't even try to unwind from an uninitialized state. Fixes: ee9f8fc ("x86/unwind: Add the ORC unwinder") Reviewed-by: Miroslav Benes <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Dave Jones <[email protected]> Cc: Jann Horn <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Link: https://lore.kernel.org/r/069d1499ad606d85532eb32ce39b2441679667d5.1587808742.git.jpoimboe@redhat.com
1 parent f1d9a2a commit 98d0c8e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/kernel/unwind_orc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ static struct orc_entry *orc_find(unsigned long ip)
148148
{
149149
static struct orc_entry *orc;
150150

151-
if (!orc_init)
152-
return NULL;
153-
154151
if (ip == 0)
155152
return &null_orc_entry;
156153

@@ -591,6 +588,9 @@ EXPORT_SYMBOL_GPL(unwind_next_frame);
591588
void __unwind_start(struct unwind_state *state, struct task_struct *task,
592589
struct pt_regs *regs, unsigned long *first_frame)
593590
{
591+
if (!orc_init)
592+
goto done;
593+
594594
memset(state, 0, sizeof(*state));
595595
state->task = task;
596596

0 commit comments

Comments
 (0)