All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Josh Poimboeuf" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Miroslav Benes <mbenes@suse.cz>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Ingo Molnar <mingo@kernel.org>, Andy Lutomirski <luto@kernel.org>,
	Dave Jones <dsj@fb.com>, Jann Horn <jannh@google.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Vince Weaver <vincent.weaver@maine.edu>, x86 <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [tip: x86/urgent] x86/unwind/orc: Prevent unwinding before ORC initialization
Date: Sun, 26 Apr 2020 06:47:40 -0000	[thread overview]
Message-ID: <158788366000.28353.11850032447179748567.tip-bot2@tip-bot2> (raw)
In-Reply-To: <069d1499ad606d85532eb32ce39b2441679667d5.1587808742.git.jpoimboe@redhat.com>

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     98d0c8ebf77e0ba7c54a9ae05ea588f0e9e3f46e
Gitweb:        https://git.kernel.org/tip/98d0c8ebf77e0ba7c54a9ae05ea588f0e9e3f46e
Author:        Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate:    Sat, 25 Apr 2020 05:03:08 -05:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Sat, 25 Apr 2020 12:22:29 +02:00

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: ee9f8fce9964 ("x86/unwind: Add the ORC unwinder")
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Dave Jones <dsj@fb.com>
Cc: Jann Horn <jannh@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: https://lore.kernel.org/r/069d1499ad606d85532eb32ce39b2441679667d5.1587808742.git.jpoimboe@redhat.com
---
 arch/x86/kernel/unwind_orc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index e9f5a20..cb11567 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -148,9 +148,6 @@ static struct orc_entry *orc_find(unsigned long ip)
 {
 	static struct orc_entry *orc;
 
-	if (!orc_init)
-		return NULL;
-
 	if (ip == 0)
 		return &null_orc_entry;
 
@@ -591,6 +588,9 @@ EXPORT_SYMBOL_GPL(unwind_next_frame);
 void __unwind_start(struct unwind_state *state, struct task_struct *task,
 		    struct pt_regs *regs, unsigned long *first_frame)
 {
+	if (!orc_init)
+		goto done;
+
 	memset(state, 0, sizeof(*state));
 	state->task = task;
 

  parent reply	other threads:[~2020-04-26  6:48 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25 10:02 [PATCH v2 00/11] ORC fixes Josh Poimboeuf
2020-04-25 10:03 ` [PATCH v2 01/11] objtool: Fix stack offset tracking for indirect CFAs Josh Poimboeuf
2020-04-26  6:47   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2020-04-25 10:03 ` [PATCH v2 02/11] x86/entry/64: Fix unwind hints in register clearing code Josh Poimboeuf
2020-04-26  6:47   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2020-04-25 10:03 ` [PATCH v2 03/11] x86/entry/64: Fix unwind hints in kernel exit path Josh Poimboeuf
2020-04-26  6:47   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2020-04-25 10:03 ` [PATCH v2 04/11] x86/entry/64: Fix unwind hints in __switch_to_asm() Josh Poimboeuf
2020-04-26  6:47   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2020-04-25 10:03 ` [PATCH v2 05/11] x86/entry/64: Fix unwind hints in rewind_stack_do_exit() Josh Poimboeuf
2020-04-26  6:47   ` [tip: x86/urgent] " tip-bot2 for Jann Horn
2020-04-25 10:03 ` [PATCH v2 06/11] x86/unwind/orc: Convert global variables to static Josh Poimboeuf
2020-04-26  6:47   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2024-02-28 23:35   ` [PATCH v2 06/11] " Steven Rostedt
2024-02-29  0:03     ` Josh Poimboeuf
2024-02-29  0:14       ` Steven Rostedt
2024-02-29  0:42         ` Josh Poimboeuf
2024-02-29 23:40           ` Steven Rostedt
2024-03-18 15:58           ` Steven Rostedt
2020-04-25 10:03 ` [PATCH v2 07/11] x86/unwind: Prevent false warnings for non-current tasks Josh Poimboeuf
2020-04-26  6:47   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2020-04-25 10:03 ` [PATCH v2 08/11] x86/unwind/orc: Don't skip the first frame for inactive tasks Josh Poimboeuf
2020-04-26  6:47   ` [tip: x86/urgent] " tip-bot2 for Miroslav Benes
2020-04-25 10:03 ` [PATCH v2 09/11] x86/unwind/orc: Prevent unwinding before ORC initialization Josh Poimboeuf
2020-04-25 10:12   ` Josh Poimboeuf
2020-04-26  6:47   ` tip-bot2 for Josh Poimboeuf [this message]
2020-04-25 10:06 ` [PATCH v2 10/11] x86/unwind/orc: Fix error path for bad ORC entry type Josh Poimboeuf
2020-04-26  6:47   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2020-04-25 10:06 ` [PATCH v2 11/11] x86/unwind/orc: Fix premature unwind stoppage due to IRET frames Josh Poimboeuf
2020-04-26  6:47   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2020-04-25 10:25 ` [PATCH v2 00/11] ORC fixes Ingo Molnar
2020-04-25 10:41   ` Josh Poimboeuf
2020-04-26  7:26     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=158788366000.28353.11850032447179748567.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=dsj@fb.com \
    --cc=jannh@google.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.weaver@maine.edu \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.