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=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 4F92AC433B4 for ; Wed, 5 May 2021 16:41:49 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D5CDE613E3 for ; Wed, 5 May 2021 16:41:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5CDE613E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uepmYJNa3adJuuCdfjDyFoiqWHukiFbelV3hlMiszTE=; b=XVa9F8H6hapeLpDU95iuCihao B/fGIyw7VwiW2GzJA6ftf6gn+tTx7wwL/s6LQq9ItkzxNyFj39Wg4+ff7GSDO5lR/UlWx+PGssFsq 47J4ynRJZ97GTb1cIl9L6DloQR3be4xnsWBkKrXMp7pU1oWIWOu/xrxswWkEjujIw0MTPtKeR/MdO 72SmZb5cEqHKlz3gcJAEDO4Y/XlcR5SA2NTv0DljaJIg1fd+GVkn4gT79zHJaol1j3XGq6ZqoXipp w9bwF8br0l49bJdjOeR8K/WkffMPue0rLTZbQ7PLJlIvSHn+wGaytV/0hNwMd77RiFgMu0CntehDS IsOlTfPag==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leKZR-001hgd-ES; Wed, 05 May 2021 16:40:21 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leKU2-001fFp-I1 for linux-arm-kernel@desiato.infradead.org; Wed, 05 May 2021 16:34:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=bZ0tATjgz9xq+f4gjLxMlspQGjgZ87VJQ590mhdky4Y=; b=gRQp3bvxblEORDx/CAZQjP97MK yKH7m2nl6+xlKhOF0pWdelo9dGpkcnxayL7No78zD+7P94xEZLkMOu3VGwksjy4mwbTxJk655qsYK wHsvZNzlFIkkYzDobTPGcQ06n9kFs6fTNbFbZChBwhmosWOkASJj4UPLmkfyrDX5vGKyvpEcrAsVa WBAr7uD78rFbOIRRLTEThCtS9u5TUGNhTqZd5tO8CfGU/z3rknmDPu7ZXu5iiv1U4eLPGaYp+fimt Qk9+fDOrSbTA7vtqBBZ7A5zFMG6npNZCCbilH9t5VdlO4iM6aBES5ooTaw7J/K+SSe85aHRP+ViKy sxFdZI4w==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leKTz-004wtu-Sq for linux-arm-kernel@lists.infradead.org; Wed, 05 May 2021 16:34:45 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 512C7616E8; Wed, 5 May 2021 16:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620232482; bh=pN1MfxHin+caU+Dvsh+jFpWBcP0jideP3oH2EhjkwA8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Y1+jTj8Cky74YmZw8Mu0LvGLn8ieXNxZKR7s/9E9nhDzrvitPq5kn9c4GHbTMj0kg P4OKEZ9IcxaAS/OuIZ1zq+zwbyzvgaPmcf8+viprCDqERFju0YO/CwvKM7O7nx81No arI4ZEuztkIgsAiJ+/eLwQV8d0rNfkzJqwSBkZ7681IUcs0EkZzcXa+pvp2iTryZLn Ux0Gie+Ii4gKSLV7JrSuirBIuqQYJHuuS6cJ/Gsrggx4NTNkJW3/50BU3JylQs5fXc JdzPo8Ak/YNeKTdiMFuc8k/SRypyCUG46ekRf9m7CtZec9tugu5WisrGXCgSbn5l33 1Nook+U/Gs/tA== Date: Wed, 5 May 2021 17:34:06 +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: <20210505163406.GB4541@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> MIME-Version: 1.0 In-Reply-To: <1bd2b177-509a-21d9-e349-9b2388db45eb@linux.microsoft.com> X-Cookie: Please ignore previous fortune. User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210505_093444_006886_889D28FD X-CRM114-Status: GOOD ( 27.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============0707164375359897873==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============0707164375359897873== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="OwLcNYc0lM97+oe1" Content-Disposition: inline --OwLcNYc0lM97+oe1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, May 04, 2021 at 02:03:14PM -0500, Madhavan T. Venkataraman wrote: > On 5/4/21 11:05 AM, Mark Brown wrote: > >> @@ -118,9 +160,21 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) > >> return -EINVAL; > >> frame->pc = ret_stack->ret; > >> frame->pc = ptrauth_strip_insn_pac(frame->pc); > >> + return 0; > >> } > > Do we not need to look up the range of the restored pc and validate > > what's being pointed to here? It's not immediately obvious why we do > > the lookup before handling the function graph tracer, especially given > > that we never look at the result and there's now a return added skipping > > further reliability checks. At the very least I think this needs some > > additional comments so the code is more obvious. > I want sym_code_ranges[] to contain both unwindable and non-unwindable ranges. > Unwindable ranges will be special ranges such as the return_to_handler() and > kretprobe_trampoline() functions for which the unwinder has (or will have) > special code to unwind. So, the lookup_range() has to happen before the > function graph code. Please look at the last patch in the series for > the fix for the above function graph code. That sounds reasonable but like I say should probably be called out in the code so it's clear to people working with it. > On the question of "should the original return address be checked against > sym_code_ranges[]?" - I assumed that if there is a function graph trace on a > function, it had to be an ftraceable function. It would not be a part > of sym_code_ranges[]. Is that a wrong assumption on my part? I can't think of any cases where it wouldn't be right now, but it seems easier to just do a redundant check than to have the assumption in the code and have to think about if it's missing. --OwLcNYc0lM97+oe1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmCSyP0ACgkQJNaLcl1U h9AHXwf/dlSkWVc9S8GPIKnOPjZ4hMQvnKRX40iT/k9PrAM7y+5z3ear/Ur46dvD DeVmFutp0xtG9sZZuOVvhvc1Ud8HJejQDzFkC5cuSA5qsfjsB8oSnIzcXXMnFe7W HIC1GuRUZbS8tghRCYKlPAmJ07iIcM8TDiLY/sm54sHa2JPbIA9CeTK5U9VdgWKY ezPNVRXs/mfA2BEEOMr9PCjBrUXTnywTjUDW2UBHn4556xYHfDYGlAuwNkB9S93j yb5q32pFklKStG5NeMdFX31fNxRUpfmINEa+zaElVLChifuf2+BLilpzqf8j8uJQ H+6W3qYdxBAa4XnfSoPDXIbwMXEWzw== =tf0f -----END PGP SIGNATURE----- --OwLcNYc0lM97+oe1-- --===============0707164375359897873== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============0707164375359897873==--