Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp758277ybh; Thu, 12 Mar 2020 10:33:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvg0iEsGmxbHhcvuH0x2AWmOp9E+ACy2cBAQQ8gN3+akrvgeo0l7fAODkO2a4vIBIsmItq4 X-Received: by 2002:a05:6830:22f2:: with SMTP id t18mr7571105otc.165.1584034427179; Thu, 12 Mar 2020 10:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584034427; cv=none; d=google.com; s=arc-20160816; b=BRbn6VcNUICAAn59yAYcL+/Rm8Sv0IjqyDnRo45rpk/wFLz9fL/nXxKsi8a35u7rQt CURYkUlhLlioi9k9nxbzx/034wC+a4dWostces0FB1tO4ZYCGne1fpIHvkZyatiCmT3J XABYFj7MZHhSZTELyF3EEuHou3NbnV54hceemAUKw3+QDyHtQaqsw41e/ym67aENGTNE yCd8l0gZII6y+AQ+MK4Kri4JHZQ1yY6EHcc8NhdaY//3+yec0uvuPvtQlg23djnhx4FX QJ2i8MBxUYG0dyGUsxhQLxlEW0GTB3mokk097krrV5E33yWO5CCvH03+SHXi9O8TwGYV KArQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hDxUNunCB687wAIPkmJJmgGhqlolBxvPaWThLpEgQnk=; b=HYw8CDTsjTohMCp64LYvzMg/e2huVL+2wKCxBSHsoTyuLI0ElovjKm1PA3xi7chkfz 17dx3yEQzAkjk3RhMOptkyeA8d1NXYhGj21MYtFdzV9upPZ9jDQ1zmqhPkNXLk6msT8k RYVfxykxI0KjWrQHbqrYNDC5A+28NLTnMoCm++wDNEfqen7WDmgdTAR/nvEVVN8NzgkX giZYqsUBVsxU1SKzVhd/KDB/etIbRI/YIzRcMVLwMk/Q4iOFI56ItBjy+XdUKzD/QQYk iK3DDvPlaUefbkMmWSU9D+wkMJin1JkZbb+vJE48cfrNbHS2XOoXokfIFE9puQp3F1oy 12qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z8M+Lum9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9si3056791otg.266.2020.03.12.10.33.33; Thu, 12 Mar 2020 10:33:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z8M+Lum9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726725AbgCLRbN (ORCPT + 99 others); Thu, 12 Mar 2020 13:31:13 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:34488 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726637AbgCLRbK (ORCPT ); Thu, 12 Mar 2020 13:31:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584034269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hDxUNunCB687wAIPkmJJmgGhqlolBxvPaWThLpEgQnk=; b=Z8M+Lum9SOT7Erxn5GFFag4J7FwkoxDjyTS46/1RSZOpfPoPf4SdZVDXKFVYcE5L9v8htd kE/k+POnSSBRrArDE8pWMCW+zxAzyxOM/XHMetBVTuayEwKoXMD0VcBPDfLLolqq4CMlm9 HVpUjuUuxSH22uz5P70ex0SwasvNWVs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-2Rrpm0NNPxCKXvu6PLiXNg-1; Thu, 12 Mar 2020 13:31:08 -0400 X-MC-Unique: 2Rrpm0NNPxCKXvu6PLiXNg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1BFED800D48; Thu, 12 Mar 2020 17:31:06 +0000 (UTC) Received: from treble.redhat.com (ovpn-122-137.rdu2.redhat.com [10.10.122.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFCA360BEC; Thu, 12 Mar 2020 17:31:04 +0000 (UTC) From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Vince Weaver , Dave Jones , Jann Horn , Miroslav Benes , Andy Lutomirski , Steven Rostedt , Thomas Gleixner Subject: [PATCH 10/14] x86/unwind/orc: Prevent unwinding before ORC initialization Date: Thu, 12 Mar 2020 12:30:29 -0500 Message-Id: <5b3e0cbab4a5e6cf5e3cab87f18f2ae582ec01d7.1584033751.git.jpoimboe@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") Signed-off-by: Josh Poimboeuf --- 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 e9f5a20c69c6..cb11567361cc 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; =20 - if (!orc_init) - return NULL; - if (ip =3D=3D 0) return &null_orc_entry; =20 @@ -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 =3D task; =20 --=20 2.21.1