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,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 9AA8FC433B4 for ; Tue, 4 May 2021 15:53:23 +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 CE94360241 for ; Tue, 4 May 2021 15:53:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE94360241 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=iETkkgJlunaXAqpE5vlRoaY6KeczNK2Pv0Xa1QtpuUY=; b=eupD9uKQe8Y7rDHU1SDk1FmMq hIHIC/gQQPqo0fIHopmtCPjJJPMOFqE6GGK5/Z8SLLESMAYLPTffjp5V/isugqDRiaLLLblj2nJMn 9QxU6qkQ1rINPswHumf3BUY43WDlnYhCCkR6YjJVp7KLSKFvF+9xzvphrfIcoMJqxl/s7TZ9yUgjH un9XCn8usslB8hUu2Ydev0qRzYFOR0I1G14VYeyMzFaI+HJUUf70qHtddiXjTALQM+dhWuiqquwHJ OWduljJJ7qsOhVKCM5kUND5m6NgYxzL5FLHjdeB2kQse0aRnZXcIIpOT7cJgwk9nTvOjfObSZGJLE OwfpMGIrw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ldxKk-00GTll-9Y; Tue, 04 May 2021 15:51:38 +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 1ldxKh-00GTkv-Hw for linux-arm-kernel@desiato.infradead.org; Tue, 04 May 2021 15:51:35 +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=odliDw0vm09Ab5doyqRvjL8+LsNzbO61AW9v/xsAUb4=; b=OJgX7al04TbDP3A5jcRV995jMo p8vhAxhLCoKs+rZ/4brqb0+K29f95E4ynACAp4GS+LKbMGJXGUHT4MAp+f5/v1tnrrlg/tup5wp+s w+7YhbQWrgvz1VL/lWtOeCraYR5clIKM5KwR33KNWVro6kUrmDVmh7EiJ/MYAMMclL93AUfJYqn4e qDc0cc57TjbcTnhguOB37VDRTzOpTiqmiEHghhWHzs7yZxYtwqytXvWI5+z8AWBNcVPf/BGFlk2Yk Li0tohv2WmxF9SzykWXhyRax2Z6amS5LlE/xFoJZtT/CvIBIgJE/ToEBs8URJrwVFHOvmImRW9Eke mo3260Kw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldxKe-00457T-U2 for linux-arm-kernel@lists.infradead.org; Tue, 04 May 2021 15:51:34 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 754DC60241; Tue, 4 May 2021 15:51:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620143492; bh=aukY94x5Rgz0iCTvcCLt9B4f7kXhPjoCjGzh7WJdghw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JE2OAUkhXOovXZtN4sAm+cPBFOv1RsnF8+qVnMm4eNA8VunFltvMm6dSKuOAEz+ez ZZ4PuKss9vfUkEaMIziWTo47roem0AxFoPKehijBm8GxV4Jnn2eZOaYFMsc8XiefxR jv90RVpkYK2jL6p2tE441LiAw4rSpAG87KhmUbmZo2HkILlNmBTL0igKIE7uNtVLN8 jTg4/OY73P2FPRnhDmC+u4RrhTuVCbe90U80KUZe5gncs7YyG6mX4kvD7aM2Ohx+fU CoNGwokhmi6ANpzoRRLkVDQj7RhqhM5aQHjapPyZM4SvPTUXgovEf7R6QgolhITgXX lJU8xBvLbxZQQ== Date: Tue, 4 May 2021 16:50:56 +0100 From: Mark Brown To: madvenka@linux.microsoft.com 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 1/4] arm64: Introduce stack trace reliability checks in the unwinder Message-ID: <20210504155056.GB7094@sirena.org.uk> References: <65cf4dfbc439b010b50a0c46ec500432acde86d6> <20210503173615.21576-1-madvenka@linux.microsoft.com> <20210503173615.21576-2-madvenka@linux.microsoft.com> MIME-Version: 1.0 In-Reply-To: <20210503173615.21576-2-madvenka@linux.microsoft.com> X-Cookie: MY income is ALL disposable! 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-20210504_085133_035402_363B2E7D X-CRM114-Status: GOOD ( 17.88 ) 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="===============7826822484931626393==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============7826822484931626393== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="TRYliJ5NKNqkz5bu" Content-Disposition: inline --TRYliJ5NKNqkz5bu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, May 03, 2021 at 12:36:12PM -0500, madvenka@linux.microsoft.com wrote: > + /* > + * First, make sure that the return address is a proper kernel text > + * address. A NULL or invalid return address probably means there's > + * some generated code which __kernel_text_address() doesn't know > + * about. Mark the stack trace as not reliable. > + */ > + if (!__kernel_text_address(frame->pc)) { > + frame->reliable = false; > + return 0; > + } Do we want the return here? It means that... > + > #ifdef CONFIG_FUNCTION_GRAPH_TRACER > if (tsk->ret_stack && > - (ptrauth_strip_insn_pac(frame->pc) == (unsigned long)return_to_handler)) { > + frame->pc == (unsigned long)return_to_handler) { > struct ftrace_ret_stack *ret_stack; > /* > * This is a case where function graph tracer has > @@ -103,11 +117,10 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) > if (WARN_ON_ONCE(!ret_stack)) > return -EINVAL; > frame->pc = ret_stack->ret; > + frame->pc = ptrauth_strip_insn_pac(frame->pc); > } ...we skip this handling in the case where we're not in kernel code. I don't know off hand if that's a case that can happen right now but it seems more robust to run through this and anything else we add later, even if it's not relevant now changes either in the unwinder itself or resulting from some future work elsewhere may mean it later becomes important. Skipping futher reliability checks is obviously fine if we've already decided things aren't reliable but this is more than just a reliability check. --TRYliJ5NKNqkz5bu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmCRbV8ACgkQJNaLcl1U h9DdXgf/btSEJgzLNnEf1rt/RIYhN5+o/eGdvZZ6fKKC2TbncPHuJBcr1vXjf4Dk ygF68CwbtZ/VL7SdEBUCPc+fhy9wA8ezBxFAMGRdRktr7ppAxzPCfrqlr2wSTLIT TvYv2lZO/jiY5DXqkDqvg8RscX6LMsw6AlNT0Z6eQQ090+pf2Fd9LG0tPwDnNAb0 0QJEvYSAJmG1PxANCeH9qcZ8tRuTiJH4pvG6sHs49ssiUIJcU1jtp0RyanuEzlEW 2dJqpPRDkLcPekGBv2eMH3fpd0ygmXrtsiirShtPooS0c2vTxpLc/XYWaMgID3v6 N7S+2iAcKA588sUxQh83GbO1W4Ai5Q== =2xNV -----END PGP SIGNATURE----- --TRYliJ5NKNqkz5bu-- --===============7826822484931626393== 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 --===============7826822484931626393==--