From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0662AC433DF for ; Wed, 13 May 2020 21:52:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F3BA320727 for ; Wed, 13 May 2020 21:52:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729992AbgEMVwN (ORCPT ); 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--