Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp846109ybk; Wed, 13 May 2020 14:54:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWZl49YSoxV2cy2upqR/5PtD5eUe6AB/eMIzwnb5NIcEIgTDqz5qpLU/9p0fiOR7kkTj9R X-Received: by 2002:a17:906:a44f:: with SMTP id cb15mr982728ejb.219.1589406854418; Wed, 13 May 2020 14:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589406854; cv=none; d=google.com; s=arc-20160816; b=C/XWnQwBy5tAYNaeGH0X4hMnjac48Y9ZiQmyhTvV/vQOkKdEiXYGDwao18UiS2kwgT Gjy20BQy0vLLJ9hk+nZEwqkAOeJQqCr9f/Uckr0Qo1xy3UJxnC5tVV/c/gf0QkdBk5vC gFQBxuc6QbQ1b65vYPuc/IT13nQYbukBMGXpaIBBVdsV+3ODp3qNLMWnRi9X5eE5ol+2 ek0Ub6lZ3d2rh+SJp36tMADdlCpWuK/+UlIs4i2hDmwQLhhFmz4r5adSWUOwvfhBIyy3 TYlEAAnVcNpRHhWUtCcGX7ZMTIrFnFiSJtrdGSsymWd/rk/YuSX6itqfc6V+FnPEySj1 OphQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=3zmt9gdhJqJ4ZjqD5oEUUsbqOZwxDxGKnNTbAER7Fmg=; b=h6EUVZYjTDX8qm4p5hAa2q+sQNX/hxvUAp5g/+LHEbkPOpmfyos1uQyFjhvrcOZEue t2sTOQPuEvCvzy31ZhFoGsOXUC7De3IIAvUJQOrx3xKbSMHJx6UqfAQWGO4WRAhC+w/Y hVdFsk0ROsoicOf0LoNizo4gDvgcdWeogRK5MLniEG2orrVClZJ8VJrs+wQMCvFvDfqE 7g/2ULAQ4MyuSzpHk3Ap3nGdrZ2G7QAVUUqB4ATgXhG2yzi124L30/emZBdpjxHPPQGi 671Y4bkfjlVOmYKj8A7JkTnMk2sPDjEcvPbUXK2EEsaCKvCg5gJ6KnZ8LeU/ShxuT303 lR2g== 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 a12si542760edx.283.2020.05.13.14.53.51; Wed, 13 May 2020 14:54: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; 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 S1729948AbgEMVwN (ORCPT + 99 others); Wed, 13 May 2020 17:52:13 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:55624 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729487AbgEMVwM (ORCPT ); Wed, 13 May 2020 17:52:12 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 342A21C0285; Wed, 13 May 2020 23:52:11 +0200 (CEST) Date: Wed, 13 May 2020 23:52:10 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Miroslav Benes , Josh Poimboeuf , Ingo Molnar , Andy Lutomirski , Dave Jones , Jann Horn , Peter Zijlstra , Thomas Gleixner , Vince Weaver Subject: Re: [PATCH 4.19 41/48] x86/unwind/orc: Prevent unwinding before ORC initialization Message-ID: <20200513215210.GB27858@amd> References: <20200513094351.100352960@linuxfoundation.org> <20200513094402.645961403@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7ZAtKRhVyVSsbBD2" Content-Disposition: inline In-Reply-To: <20200513094402.645961403@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --7ZAtKRhVyVSsbBD2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Josh Poimboeuf >=20 > commit 98d0c8ebf77e0ba7c54a9ae05ea588f0e9e3f46e upstream. >=20 > 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. >=20 > Move the 'orc_init' check from orc_find() to __unwind_init(), so that it > doesn't even try to unwind from an uninitialized state. > @@ -563,6 +560,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 As this returns the *state to the caller, should the "goto done" move below the memset? Otherwise we are returning partialy-initialized struct, which is ... weird. Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --7ZAtKRhVyVSsbBD2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl68bAoACgkQMOfwapXb+vIO/wCfeBz+IYxkM6JcitMdJYsM+hlL nbMAn1Tq0iWjnwpbT7Xhq4LpYViSDVSd =vaev -----END PGP SIGNATURE----- --7ZAtKRhVyVSsbBD2--