Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp738652ybz; Sat, 25 Apr 2020 03:15:14 -0700 (PDT) X-Google-Smtp-Source: APiQypKz2VHrtaadFI69CQgMem7EPuq6DsFt4XGmyYoUmc09i3dwObePrHGDYAOnqxL7pr6jzUre X-Received: by 2002:a17:906:d8cf:: with SMTP id re15mr10631178ejb.186.1587809714364; Sat, 25 Apr 2020 03:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587809714; cv=none; d=google.com; s=arc-20160816; b=a2poGC0mDUN5sionFteOvsCJvP5DJW7aa5j55rhqMvQPXOBZGOfMkO1E3QkE8NNtce GtmYUHBu3Y5+lBMv6Yv+06KGbaxXvA2th1aE83ScJc5TJIP7d9qkRsGskIe7Fno//fT5 nnXDxihDrT+9eepnqw34MevV3haEtVVgw7UiJBCKzIqVVANZrCdESjVY2/Cojr6c2Y0R eB2BuavnnEbdtbe3rlRwZGIuHQrEDqAS0w10pjudZpTjGTjHNpxH79NLg7Zye1YF5Q98 QCs+qLKu8VvOroe9mQoSAWlrv9YELh+nddxC7+f1pYxReYcsdkRp/AhZvsyWKOK2anue ZgtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=AOgC2NRGVpcSLKpoq1LxQn9rzNcv8PVJhuPPFwFv8h4=; b=XJ5+oUA/iPFr3ldv23EWLWiFoW1/YA3wvfLfYW3N5WQXQvwMExZKsVXM0IAGOGQCHE rHJuPO9ygCdXUDpC6Ts/H7NEyUrRXn3T6lJ41aOE79HBZHI747AOEYSNzf55/xcr7fiu 8ENlUZQ1Bqm2PhOzGodBbl2FQW690GgUWKvAyKlxOIaSsB1HVYGcYCe1fy31ScSJIsrp 0c9U8W2YNUmSxTYgE9pIIq4M3sh3oXS0Lr/W9NzSQP/pJyZnp1L6p7A8xHt89cftp64m H6t062H1X7h+8L9G/vjln0VbgiEpWU1A2l7AhsXDbmQDBDCTiBlVhQsbmLpXaE12J3au qezw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P4RXn9ge; 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 u5si5012542edx.196.2020.04.25.03.14.50; Sat, 25 Apr 2020 03:15:14 -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=P4RXn9ge; 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 S1726061AbgDYKNV (ORCPT + 99 others); Sat, 25 Apr 2020 06:13:21 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:29547 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726035AbgDYKNU (ORCPT ); Sat, 25 Apr 2020 06:13:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587809599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AOgC2NRGVpcSLKpoq1LxQn9rzNcv8PVJhuPPFwFv8h4=; b=P4RXn9gePko44R6aZNVbrfgUqUDC+pjWKs6HKW+6KW5P+mBZOBpsxVlyZP4w1SSM5lAkAg Z6HVt36rOt/NTsnyBxLm2KwDoPDD26XKpyiHc1Bls6zV4Cmovq5Zdec3PC9LOeOUVmLPb0 +BiVIRVN2nhS5F8VaryTuPe53Vj1urw= 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-217-9cq6eyfXNeWNGJOStwiqDw-1; Sat, 25 Apr 2020 06:12:59 -0400 X-MC-Unique: 9cq6eyfXNeWNGJOStwiqDw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF798107ACCA; Sat, 25 Apr 2020 10:12:57 +0000 (UTC) Received: from treble (ovpn-114-29.rdu2.redhat.com [10.10.114.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF89F5D70C; Sat, 25 Apr 2020 10:12:54 +0000 (UTC) Date: Sat, 25 Apr 2020 05:12:47 -0500 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: Re: [PATCH v2 09/11] x86/unwind/orc: Prevent unwinding before ORC initialization Message-ID: <20200425101247.l2xpp23vmmv7zfuv@treble> References: <069d1499ad606d85532eb32ce39b2441679667d5.1587808742.git.jpoimboe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <069d1499ad606d85532eb32ce39b2441679667d5.1587808742.git.jpoimboe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 25, 2020 at 05:03:08AM -0500, Josh Poimboeuf wrote: > 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 I got a weird error when sending this one: 4.7.1 Error: too much mail from 10.10.114.29 If anybody didn't get it, let me know and I can bounce it. > --- > 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; > > - 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; > > -- > 2.21.1 > -- Josh