Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp731320ybz; Sat, 25 Apr 2020 03:06:09 -0700 (PDT) X-Google-Smtp-Source: APiQypLPOkU5wbmWT8vu356vMB9vGmTS6X2VprYVkOTo4lzisHWxmHanI1bCzFGCcAuFPOQBNkhJ X-Received: by 2002:a17:906:fcaf:: with SMTP id qw15mr10989663ejb.236.1587809169368; Sat, 25 Apr 2020 03:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587809169; cv=none; d=google.com; s=arc-20160816; b=yzk+z04oPBykjwvrAnA9BrZg53zEI5u9gwO6KahkIcUHRGicdqtnXwaqazlDCmYKYV ZwzFFQQqbOZJWZLmWbRPdSkSaKcTaLFa+yI0qYvIUix2NKUazAaDlPIPkEQU2Ef2c++r Xa2qaF/fL4oytfLj05Z/JhPARSf7Uvrv+1smyTPKu81pws8JYE3FipLIR+K5l1Hijlb2 p3MdXGDAPYuobbBDbF42p03sPoxaDfGNOs/yZr4EAbHOdemuZ9e5Jn2I3Qa+px0gs6H/ cypE+JIYXfSVKgpuMcemMgH74C2zjp/6TII52nXT6tOgczxdXopIas/0gGiEx+s4yzm8 EU8w== 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=98wxm4LxWtuh6/aQQPAtxpzRp5BkuEHL2r32GVcm3CA=; b=KoLBEo175ZHBYAvZb0cUyPGuf0FBT3yM3tjmzMvGl5PGYi/4y9SVFZhqC58SKAmArc AuE0caeDRKP9qauRNS5WAP9TFQSaWfhoqsSkTu6HDiH53a8kJz7QJECVnIB3gAaOyKFx k8wMWj0tGgCUwJgjR3kuDLwHP0smNHS+/2V0gyov65P8AVRhnvG7gG5oq0mLhHUdwRbn /0k2YkyzMnv2TEhdl4IyXF06MdCdkayN2LTxTJOjV1EbTeQJOstEfKLvAlHpAFijrFjR pKl1yzmMXtuW3/4PQAULfsIkodNBZ+hZWl0TfepGHwVGfsxDTSEGC4oJ2mTBRmW57udj WgNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QR+JOTpe; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si5238184ejc.247.2020.04.25.03.05.46; Sat, 25 Apr 2020 03:06:09 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QR+JOTpe; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726224AbgDYKDr (ORCPT + 99 others); Sat, 25 Apr 2020 06:03:47 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:51839 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726159AbgDYKDj (ORCPT ); Sat, 25 Apr 2020 06:03:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587809018; 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=98wxm4LxWtuh6/aQQPAtxpzRp5BkuEHL2r32GVcm3CA=; b=QR+JOTpeu4HaFq9GPdIKIqnW3DEIxue98TitbU5oBqlJ5WbeqO57ulCv9oNPNLmB4rhCn0 3KgABjkA3msYtfkN4cds9doaNP5xNk2OG1cPlUPbQtqw3bhu1in8qUkbWumdRS2i2OOnvS Bfb/Lb1xrq3IjlyB40xC16U16HCrXiE= 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-151-xGBhV-sTPt-C629FmLqGtg-1; Sat, 25 Apr 2020 06:03:33 -0400 X-MC-Unique: xGBhV-sTPt-C629FmLqGtg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E6A08015CF; Sat, 25 Apr 2020 10:03:32 +0000 (UTC) Received: from treble.redhat.com (ovpn-114-29.rdu2.redhat.com [10.10.114.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4A5D60623; Sat, 25 Apr 2020 10:03:30 +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 , Thomas Gleixner Subject: [PATCH v2 09/11] x86/unwind/orc: Prevent unwinding before ORC initialization Date: Sat, 25 Apr 2020 05:03:08 -0500 Message-Id: <069d1499ad606d85532eb32ce39b2441679667d5.1587808742.git.jpoimboe@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 Reviewed-by: Miroslav Benes --- 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