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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D5EFC54E68 for ; Thu, 21 Mar 2024 11:24:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DAF4F6B0089; Thu, 21 Mar 2024 07:24:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D5E526B008A; Thu, 21 Mar 2024 07:24:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFFE46B008C; Thu, 21 Mar 2024 07:24:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id ADCE16B0089 for ; Thu, 21 Mar 2024 07:24:34 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5EF8E1215BA for ; Thu, 21 Mar 2024 11:24:34 +0000 (UTC) X-FDA: 81920813268.22.B17EB0A Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) by imf15.hostedemail.com (Postfix) with ESMTP id 1D3CFA0019 for ; Thu, 21 Mar 2024 11:24:31 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=armlinux.org.uk header.s=pandora-2019 header.b=W99tkOqB; dmarc=pass (policy=none) header.from=armlinux.org.uk; spf=none (imf15.hostedemail.com: domain of "linux+linux-mm=kvack.org@armlinux.org.uk" has no SPF policy when checking 78.32.30.218) smtp.mailfrom="linux+linux-mm=kvack.org@armlinux.org.uk" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711020272; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/68CR4f0azvzcAmAfC291AOl4wS99r8FrcRejyLq6xM=; b=KoR9ZwEAApGORW3pZP+FudtC+pP39OrKDrO+/Is51DuT37M3Bied2E44WJ2byrKxAvvEZu Ty1fAwdhZZ7XTctgMPmda3ClRZ2uQWfNqli8M+1E9DCVSWvx/0PyrW27tD+xZpBhM0AnZM jOYFCE+lamMEx1b/2HGbvstROJ8jhA4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=armlinux.org.uk header.s=pandora-2019 header.b=W99tkOqB; dmarc=pass (policy=none) header.from=armlinux.org.uk; spf=none (imf15.hostedemail.com: domain of "linux+linux-mm=kvack.org@armlinux.org.uk" has no SPF policy when checking 78.32.30.218) smtp.mailfrom="linux+linux-mm=kvack.org@armlinux.org.uk" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711020272; a=rsa-sha256; cv=none; b=q/xUV7eeL9MVLYiVQL1+bqD0WPvsp0+GCJ9BRRHLdnYoQVLSLFfoNGXeZQJAqhm9ZYWKg+ Yepya8L2uBrdyx3w0OH5GKZjN1e2vue44d41/UAFwb5OAxAWuoLCoYaCAIWhKRDjmP/eak 1b5ECGQEmc/Du3m7IsaSEByXRU37jog= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: 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-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/68CR4f0azvzcAmAfC291AOl4wS99r8FrcRejyLq6xM=; b=W99tkOqBejY893YpC1mtzh9mSp gSa43/zdRcQpaebucrIyVrHxRsSIDRvVgZnItXAPDixGHUB5u4//H27eDTOTj5newSQixHC6+jynm r5qETHV1Ogr4iSiXWxS3zADgqkER/fq/MSBqvSy/GOvGWWlzeV+SY1pG5MjPt9mOY5lligJmN3UIf yDp2jMybyFbaLB866k7EJlMFVUhcd0byz9JSyy+ds6mo4HUA1IBkeXoaAVNobNqzOepGc56fHbhct zKUDDEkpK0iAbRYRuCslUcOC/6KBZycr2Okkdz1t+aI3TOKfG5SePHOuDK5s5Tw7nf21CYpdbDkyk AQVn5l7g==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:46498) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rnGWd-0007UH-2y; Thu, 21 Mar 2024 11:24:01 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rnGWW-0003bL-0S; Thu, 21 Mar 2024 11:23:52 +0000 Date: Thu, 21 Mar 2024 11:23:51 +0000 From: "Russell King (Oracle)" To: David Laight , Ard Biesheuvel Cc: 'Jiangfeng Xiao' , "arnd@arndb.de" , "keescook@chromium.org" , "haibo.li@mediatek.com" , "angelogioacchino.delregno@collabora.com" , "amergnat@baylibre.com" , "akpm@linux-foundation.org" , "dave.hansen@linux.intel.com" , "douzhaolei@huawei.com" , "gustavoars@kernel.org" , "jpoimboe@kernel.org" , "kepler.chenxin@huawei.com" , "kirill.shutemov@linux.intel.com" , "linux-hardening@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "linux-arm-kernel@lists.infradead.org" , "nixiaoming@huawei.com" , "peterz@infradead.org" , "wangbing6@huawei.com" , "wangfangpeng1@huawei.com" , "jannh@google.com" , "willy@infradead.org" Subject: Re: [PATCH v2] ARM: unwind: improve unwinders for noreturn case Message-ID: References: <1709516385-7778-1-git-send-email-xiaojiangfeng@huawei.com> <1710906278-23851-1-git-send-email-xiaojiangfeng@huawei.com> <84a57ca8-8963-ca24-8bd1-ddc5c33bf4da@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 1D3CFA0019 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: nd8417anwbukkfmthypbmwtibm1jszq6 X-HE-Tag: 1711020271-404606 X-HE-Meta: U2FsdGVkX18wuA84zFbrHMWufpcFobSXm7FSHEk0HjNW6oSt1TgTKtUSxQdcRznDlKTG+8QQsrMvKRuaiZeTSHrj5IcYEiGyn2ggy12BQu0YDw2eRHebthK6XSY0V5+myjzMKUzarrj9q4QCFMchQTMyjgD37o9DA7WKtUnFiHpUvfC/fm9PsbwTxDr02ux2SWNfQF6+44jB29qYj0TNYXLLZUxuRwVp1ZtU44zCDXKHatQx+xVwKvrUMnS9S6ZEOjovLcYrS98OWg8OVpA3d2HrgGJfaUcI8vL4gcGkS6PKpnfoWEnfXs/2lJGk3tAAvIPQkTM+Nie4uiVg4EcELTVkMg4VNAp3kgg+eQp6bCyE4+NV+tzIHwZWX2sDJ1N/jCcS5ajX4lMGsu0jCi40eExbc89Rey29togI4XWJJLJy7sxDBG9RahkCzkwWNzfI7YgIh8XKwktWE4BkmFdCAOGK1TO8R2my1GK1vI16qd2hihhYxmiOdJA2rGACtIZo914sMvqcwlpJZqFzsTa24K3Fo2emXrnKbJJ0uMk+8lyTdaRxKoL1EMjUFUgE+Wis1Wp8Ozlcb3ak2xWJCQ5/8V0hMOZNTMzbg+6mhngQSE45h9KeTPngThrstYge79yYub2GhlPoC9BzO7HJ42zPq7TOFa8rRIjbIqsWt243ZHSozi0ll6V3I0knbmH2SMlINOjt1oL2AfRecK1H6E9CCwPqrCTD8biZ5Vs0TM9vP1uYttstaspm4qL0npq1TGEpGLInSoKBq2ecUq+f4EhK1mCwitIV6jdy5d2nA2alSqAZSdfGsItsVkZKpHyUrF+JOckCmg4OxwXn+jCAViYvjOQHCEoNAi32tdLZdKzKTki9HDvHLsGdLtTrV71YSnlyIhySAsJFzv91eQa8Kyh5DxXcZNTtAeladt3gl7LpO8C8J6cu2Ga8AC81NpJoaPbYRC8AzNxGMiK24+i9JGf 5H1y/Mwn /eSGn/G3tXZqC9Uwz0rLS5V2mE34km3Dqm2AfK6/jg83C/jLe4pslO9hZt815dgpk6/dqZgx05etRrxXGbke99ngg8Bg19w9PxGDE5v8aw3AOdiQ/Y0Lkb4n+J3antQNsLKy4zbfiD0+PBjvjkF1YjfA8ikpfV6xwWKsA2qRIh8u4i2y5FWIHX8AOETvTlGJ/A5Zy75Gv/UvJ3C7jYMyyow835vsoIuX0RjxeGcmSNbmrWkAPm0BJQUxJhsnye3MIy65GLIiWgsoKIFfgfqT3689aa2GiykBZ70SFeznukb4lNBlKWJlrat9v+GULi84Zk1riC3qjiRUoK8Sje+K+dBEsPq1dV0phgtlj0QvV6vl8UzcI4IQZhB90eb2jU+kLBr4XJHrwPWUzlvrTn8AOxkzmlYTYihoWAh5vYkD/71qO0srZ9yyK4MDTmqc2kd8jMjlq6E6ImlLXRPGT3fqHaen8vw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.001228, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Mar 21, 2024 at 10:22:30AM +0000, David Laight wrote: > How aggressively does the compiler optimise 'noreturn' functions? I've seen cases where the compiler emits a BL instruction as the very last thing in the function, and nothing after it. This is where the problem lies - because the link register value created by the BL instruction will point to the instruction after the BL which will _not_ part of the function that invoked the BL. That will probably cause issues for the ELF unwinder, which means this issue probably goes beyond _just_ printing the function name. I have vague memories that Ard has been involved in the unwinder, maybe he could comment on this problem? Maybe we need the unwinder itself to do the correction? I also wonder whether we should only do the correction if we detect that we're pointing at the first instruction of a function, and the previous instruction in the text segment was a BL. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!