Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1375592pxy; Thu, 6 May 2021 06:50:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFb/NUJWaQCnjkzaHcQdfzzM1Sn2g72SsbxhO+nbJ/aEOsCEjWsFZRZ+FKGDid1at5CUeE X-Received: by 2002:a17:907:62a7:: with SMTP id nd39mr4539195ejc.502.1620309056376; Thu, 06 May 2021 06:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620309056; cv=none; d=google.com; s=arc-20160816; b=D6bZHOZH7lXUP2mxv4EHaVAmq8X68JzO9AAf5ZEgt+HbW2c5SWgNqs3t7cjjXRdgMZ dIk85/V0gK1yBJ7XkkQUagZmUi66ovXpYGzAjAOv7fLR762dnXxV5dkv9uVWnZPNn6Js 2CR9jraIdg9W0bA8xMPxnoAgaF0w+BrhH9H9ki//60b+9vMRdHOnp+JuWeljBqO+nILI YKyfYLhAvlqHxgUKTdcV6DcT8lGFj/K0bvyKg79EAnBmC+54IWYPedAppzIDwPMj5Tcl Kc0HLSmGjPxdNZtMpcrc3DllfR4ce080rny308lapqgVAcYFMaUko8SMz2b3yJ8iV9ca AoYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=qdoQd7krsEUymeuQLhQCt1CjoNS05e0B2jZiFOnSCRo=; b=giJa/k2yYBy8wlVmT2CHHWyE5KOaC7D8lkbfXGOKAwRjYGJHTNpdr1kq0+ZIcYQ+6C PdfN1ytVk0VIACeTQdK5wDyPgijVdRowJvQIRwrj3JyXsZ0OkZfzn0zz+9QWB7bVk1rx HsxWHNedq1jH00rfPvHOE1hBHCC0Q0Yr8d8thbZLWZyYD605b8TcuvclKF4/vVg1FaYP xm+nagkDLKjDe6Ag9eZuhYKnxwCHjumnlLBBNRynoCtx5kM7DaCbVsjiGDnI3OxHClh9 JRDwq8Yvl8lrHykBBBjHzTfMDcRaSYPeE39qLEi6shyU0PvLmua6AD4u768n99sVtMBc pdAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BP76V0dt; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si2348437ejd.204.2021.05.06.06.50.32; Thu, 06 May 2021 06:50:56 -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=@kernel.org header.s=k20201202 header.b=BP76V0dt; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234267AbhEFNrS (ORCPT + 99 others); Thu, 6 May 2021 09:47:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:52362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233918AbhEFNrR (ORCPT ); Thu, 6 May 2021 09:47:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0F48B61027; Thu, 6 May 2021 13:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620308779; bh=DIhfGeaxAF5Hk1en/OO3GvL7gcgjS1Hb4ylbBzg5nFg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BP76V0dtuhX8xo3/WhwVAhFBvwQw/u0q/Bm4dNSZ7G+jWlXSGETVAWYMiWpc5FLLR JjrJ/ZmrdDfvr1yhrf0ckiraPrWFWODcxxdZGfyhxMDDS285T8WE563w85ZMv8oLxQ nbema7O1knM88idtTdkEuQ+dvPt95isyfmZR5UTHGpMeZt9ViZmIN6RxdzbqGfumbQ UzVj0LqXPvK+hbOGLlIGcicWuKbxuU62UVD0K4U5lqnC9z/7ZEHphFreZGpS3a6osC lXhqEng1JWhFws3MTGbSY2ha2AMZGG84+LTtq4QlkIA/ezLpwiItqYgG0QumEUOIZV 8TuYmpLSNjF1g== Date: Thu, 6 May 2021 14:45:42 +0100 From: Mark Brown To: "Madhavan T. Venkataraman" Cc: jpoimboe@redhat.com, mark.rutland@arm.com, jthierry@redhat.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, pasha.tatashin@soleen.com, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v3 2/4] arm64: Check the return PC against unreliable code sections Message-ID: <20210506134542.GD4642@sirena.org.uk> References: <65cf4dfbc439b010b50a0c46ec500432acde86d6> <20210503173615.21576-1-madvenka@linux.microsoft.com> <20210503173615.21576-3-madvenka@linux.microsoft.com> <20210504160508.GC7094@sirena.org.uk> <1bd2b177-509a-21d9-e349-9b2388db45eb@linux.microsoft.com> <0f72c4cb-25ef-ee23-49e4-986542be8673@linux.microsoft.com> <20210505164648.GC4541@sirena.org.uk> <9781011e-2d99-7f46-592c-621c66ea66c3@linux.microsoft.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="OaZoDhBhXzo6bW1J" Content-Disposition: inline In-Reply-To: <9781011e-2d99-7f46-592c-621c66ea66c3@linux.microsoft.com> X-Cookie: If it ain't baroque, don't phiques it. User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --OaZoDhBhXzo6bW1J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 05, 2021 at 01:48:21PM -0500, Madhavan T. Venkataraman wrote: > On 5/5/21 11:46 AM, Mark Brown wrote: > > I think that works even if it's hard to love the goto, might want some > > defensiveness to ensure we can't somehow end up in an infinite loop with > > a sufficiently badly formed stack. > I could do something like this: > unwind_frame() > { > int i; > ... >=20 > for (i =3D 0; i < MAX_CHECKS; i++) { > if (!check_frame(tsk, frame)) > break; > } I think that could work, yes. Have to see the actual code (and other people's opinions!). > If this is acceptable, then the only question is - what should be the val= ue of > MAX_CHECKS (I will rename it to something more appropriate)? I'd expect something like 10 to be way more than we'd ever need, or we could define it down to the 2 checks we expect to be possible ATM to be conservative. I'm tempted to be permissive if we have sufficient other checks but I'm not 100% sure on that. --OaZoDhBhXzo6bW1J Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmCT8wYACgkQJNaLcl1U h9A5/Qf5AQzIK1iGk05+Ew7d4dR1Bd1YEuSiIlmDHZ+9WIWaZ0SR0GNG5mtqwX1B pJhBkSXH7XsChPi1INElGPgOomaF8H2V2Z7C/QUI/KW1PqyQHmlFOQahHNPaRn6/ kxuuG1prGKfuPZ2+wFCdJZXHk1FWm/VpjVpiweX/E0kzx+V8NHNbKFwMuBSNCEH6 Jo8VMKsTSMghThbfpVAuYxPCaJB/kCaYU1KQL2Ktzq+n0CXsOdyHXolOE9D/0N8A KgLCewUwIOpFXU+8gJspoxYXd1VIEzRG+lgKwCYuv6XBCZIOK2cXLvtPMU4xw9wj mVA3fT2D8o0uPAQF+2Zy24K/f6wbgA== =eeY2 -----END PGP SIGNATURE----- --OaZoDhBhXzo6bW1J--