Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1604705ybz; Sun, 26 Apr 2020 00:01:51 -0700 (PDT) X-Google-Smtp-Source: APiQypIBuPVw6G+C2FFF/SyMhHOmfApdB6D7crwL0hWh8dXQRYgf5rStgkJOr3YUjSd7zP4C6TJD X-Received: by 2002:a50:9d42:: with SMTP id j2mr13952064edk.249.1587884511644; Sun, 26 Apr 2020 00:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587884511; cv=none; d=google.com; s=arc-20160816; b=N8X2m3iXztXHVVlF1sJisGDYM1soB+dkRdIkDud44nSMKDf4RWkB1jJUwRjGJ6aK2Q fhxDWoC3KGmXtegritnRX3lnLvdFZVjQfL/0P8zmHLsGk6b2Z9s81ojMUgy8yJOnFVrY tYJ0IRqy+xIhI1M8CXFRk0MIytlyhEGL946G7j/wp3V0DLHs88VBzmMdUpY1LuWEXj0z sj2SO37zH0sptmIIH6KI6yNI3k0w8xDK/mbJTRj8n0EqV9oYPHlqK4JUn9z/WMQL0qN8 ETPka70Fn/HS5+7M05xwqI0a+bfb55ac0+QjeD7+KCd6G+V13um1I9gpfvYFBl+lsBtK XWzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=7BrRmQ0pm56JY9+HcvtPyy0FsXp7eYUGITh42YA8gZc=; b=vn7ejRzqsui+6JNHgJXMbmPfY4S0TKw4s53fMsQZvhdPZlVQ/KOKKEq20JhO9uBCah ur/AkaWFhvprNR0AeKxVQTSrkPYyQLLG/GRng5XLwxKcGD/H/34+FcRI+/fr4wLOxMHi f+eG85vrSSqm0RmCrJybgUe0vbI0bNpbzJ5aCdXsbJjGQsm9PK5ArHpwCwd4GPMMuyjP /OfCl7IMkXXJePu+koXXXRytgHgq4JpVw/I/0ahpB4CeMpeAE1CfSElRv9Gpa0ghVNFJ 5Iw5cohPvvxJ6BKHcRD5yOAcLHcPqCquBbw2JGx9HdnlO+FBhluVlTg0JhORBHEIP5v9 6i5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn10si7741918ejc.357.2020.04.26.00.01.28; Sun, 26 Apr 2020 00:01:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726284AbgDZGrx (ORCPT + 99 others); Sun, 26 Apr 2020 02:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726253AbgDZGrx (ORCPT ); Sun, 26 Apr 2020 02:47:53 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1997BC09B04F; Sat, 25 Apr 2020 23:47:53 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jSb4m-0008Qv-Py; Sun, 26 Apr 2020 08:47:40 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 64CB31C0334; Sun, 26 Apr 2020 08:47:40 +0200 (CEST) Date: Sun, 26 Apr 2020 06:47:40 -0000 From: "tip-bot2 for Josh Poimboeuf" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/unwind/orc: Prevent unwinding before ORC initialization Cc: Miroslav Benes , Josh Poimboeuf , Ingo Molnar , Andy Lutomirski , Dave Jones , Jann Horn , Peter Zijlstra , Thomas Gleixner , Vince Weaver , x86 , LKML In-Reply-To: <069d1499ad606d85532eb32ce39b2441679667d5.1587808742.git.jpoimboe@redhat.com> References: <069d1499ad606d85532eb32ce39b2441679667d5.1587808742.git.jpoimboe@redhat.com> MIME-Version: 1.0 Message-ID: <158788366000.28353.11850032447179748567.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 AuthorDate: Sat, 25 Apr 2020 05:03:08 -05:00 Committer: Ingo Molnar 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 Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Cc: Andy Lutomirski Cc: Dave Jones Cc: Jann Horn Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Vince Weaver 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;