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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D2D74C54E68 for ; Thu, 21 Mar 2024 14:57:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding: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-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nwTjJbakct/uxDtdmzLMRecUT6iOVIJGjcxgbuVOw2w=; b=vCIjTIIn6kJvyJ JXRWu3re4aeuszBzzCuOOdOAIk0wSHDHgUH3l38HSDc5W8RRVWfG7jMa20z9flsEWxEkpxKTzrPTC Wx3MAc/0yk7+6XyW/Usmhg7A5TlpiNFpwxdidTMrQuH2Jh8HaBAjfzhSYcv0zHKpfHxzoR6+K/gwz c9RgMXt/qcGaM+bfZbnPkSzYIz/mNfJkdio0XqThcN/+NDPh7od94WC5H9B8eo6rXHr/pxoOh5WQT TD7guR7DtlSYbPAsJLKgLMeFGOuG2aipl6+kOG7ObPsoVRKQ6gQJ6VwsDit8jT58xl/L2Wco3pikB M8i1U/JG/T5hd/uDQs9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnJqm-00000003MoG-2KPS; Thu, 21 Mar 2024 14:57:00 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnJqb-00000003Mld-05dq for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 14:56:50 +0000 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=OLw2lU9lpBwjLUSQ/UpfVBslsUspZQKPHPTl4U7tJ60=; b=R9Q7yXVVqgdbeoUTqOfF1D1JUY aVv2jE88tkz8pMKojqD8CZqYgL9NubNF9nWhDccFAIkkV+5AJgfAM1EALCONOzStkFp1CSsMZQbpS IG5l3HeC2csOb9vAD64Ahpjih6SmyKwg3HLHGr6WiStHqNxDoTqA90taj0TBS9XOBjeQiewIjwZfM 3lbNvC82x5qmvxcdFY1EGZ+zdq/ldoh0GIKmTyB2QMViG3lk1lSkqMaBnqW54Lc2t6vFGMImVmiuN +4j6EcjYrvSqHnpkc8ESZ8VCbxohMyaNsOvoXPkEMtyxab20/i4TuP8zdyPkNTVb8vQSweRG8kAjT XWDfLbRA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35816) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rnJq4-0007fb-2f; Thu, 21 Mar 2024 14:56:16 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rnJpx-0003jQ-8t; Thu, 21 Mar 2024 14:56:09 +0000 Date: Thu, 21 Mar 2024 14:56:09 +0000 From: "Russell King (Oracle)" To: David Laight Cc: Ard Biesheuvel , '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: <84a57ca8-8963-ca24-8bd1-ddc5c33bf4da@huawei.com> <0fd55e156195440bb1d815dd8300894b@AcuMS.aculab.com> <9d6057b110034c04b6b590522c8c69cc@AcuMS.aculab.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9d6057b110034c04b6b590522c8c69cc@AcuMS.aculab.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_075649_086593_0DE362E0 X-CRM114-Status: GOOD ( 23.16 ) 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: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Mar 21, 2024 at 02:37:28PM +0000, David Laight wrote: > From: Russell King > > Sent: 21 March 2024 13:08 > > > > On Thu, Mar 21, 2024 at 12:57:07PM +0000, David Laight wrote: > > > From: Russell King > > > > Sent: 21 March 2024 12:23 > > > ... > > > > > That might mean you can get the BL in the middle of a function > > > > > but where the following instruction is for the 'no stack frame' > > > > > side of the branch. > > > > > That is very likely to break any stack offset calculations. > > > > > > > > No it can't. At any one point in the function, the stack has to be in > > > > a well defined state, so that access to local variables can work, and > > > > also the stack can be correctly unwound. If there exists a point in > > > > the function body which can be reached where the stack could be in two > > > > different states, then the stack can't be restored to the parent > > > > context. > > > > > > Actually you can get there with a function that has a lot of args. > > > So you can have: > > > if (...) { > > > push x > > > bl func > > > add %sp, #8 > > > } > > > code; > > > which is fine. > > > > No you can't.... and that isn't even Arm code. Arm doesn't use %sp. > > Moreover, that "bl" will stomp over the link register, meaning this > > function can not return. > > With 9+ arguments they spill to see https://godbolt.org/z/Yj3ovd8bY > > Where the compiler generates: > f9: > cmp w0, 0 > ble .L2 > sub sp, sp, #32 > mov w7, w0 > mov w6, w0 > mov w5, w0 > mov w4, w0 > mov w3, w0 > stp x29, x30, [sp, 16] > add x29, sp, 16 > mov w2, w0 > mov w1, w0 > str w0, [sp] > bl f > .L2: > ret Don't show me Arm64 assembly when we're discussing Arm32. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel