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 53A9AC54E68 for ; Thu, 21 Mar 2024 14:56:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD4936B0083; Thu, 21 Mar 2024 10:56:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D86136B0085; Thu, 21 Mar 2024 10:56:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C25716B0088; Thu, 21 Mar 2024 10:56:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AF91F6B0083 for ; Thu, 21 Mar 2024 10:56:51 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 87BD31A0462 for ; Thu, 21 Mar 2024 14:56:51 +0000 (UTC) X-FDA: 81921348222.01.72C82EE Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) by imf18.hostedemail.com (Postfix) with ESMTP id C05C21C001B for ; Thu, 21 Mar 2024 14:56:48 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=armlinux.org.uk header.s=pandora-2019 header.b=R9Q7yXVV; dmarc=pass (policy=none) header.from=armlinux.org.uk; spf=none (imf18.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=1711033009; 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=OLw2lU9lpBwjLUSQ/UpfVBslsUspZQKPHPTl4U7tJ60=; b=wBXYjWIwrWEOb1yJ/zAWm0ndnYH0ey2FT2YdMbBNQFDVlnq/TqImEnlOFnASgUYPFwnKV7 +aIoWZLQH+N9a9N6lsDARDZQYBwWbdkRlsW3m+Y1AEqjDsU3dNtmCri/xGM4uwS/pDKs3n EcuGhqnK5xLX2p0nhKu73sbItWQQLAc= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=armlinux.org.uk header.s=pandora-2019 header.b=R9Q7yXVV; dmarc=pass (policy=none) header.from=armlinux.org.uk; spf=none (imf18.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=1711033009; a=rsa-sha256; cv=none; b=l6ges6b2Bgb0JZZSINo9DxmLOiRBWurRHOkaJwVlQ+2wj2IQt1eYtZpkvCnOUq7HadEaIV c3rZ0WJIktwNjD1CoIedVTAwiSwf/IQEqYkFWl7bAiKGFBmm+3Eih1QeI1M4X3sjM3vLKd HZp7QWTvuDfHKXFSUl+rrNaPPrMFWo0= 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9d6057b110034c04b6b590522c8c69cc@AcuMS.aculab.com> X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C05C21C001B X-Stat-Signature: 17hji7cgjwt646z8mha8c3x5sx1u8yp1 X-Rspam-User: X-HE-Tag: 1711033008-442195 X-HE-Meta: U2FsdGVkX18Hc3/Ez+wapea1RxBoDuzUX2KLtVlnqrEAr1wIV0HXhIMtJ1UBAbsQJcdrN47y0p6SCdb8JH19U5E+SExpqxyHzkdy1vllXVdTyFAyUNvt6p8Ja4MnYldCspa/zdN2b18pV4zsxjFD8nIrp53bBpXQT/vdSwFOBVp8vqKuz7lHRMAnI4bq7uZneaxVDd4eQ8SM7cMzhxASMpGrWPewvP7l3RvKQH7EDMgGWKKjO8SjYf8OwoOjgJay7K/sfDDoFoMWvWS5DUjl7R7FbN9Z+y5MtJs3qE8q65esYcCXdIZck/7MPg+ty2GrNobolz8o5aS4ZZn4Wu+7jJgnDXOHTm2u0DxWeEHxAe/Na1rZjqgv4xN2WlVzMnw5w9K7lfo5TEQt9aqYvgCvdkRDhQkkNcRLfMtcpt/NFqIZ9SwFWzTu8JFStS7+19LgNkhvU8Uie9f3ERN7vuLKda0aO2m3Tw49B+gURjQhbu1V0T2EUnSN7auFfm4bD63mGkhMcA874JftPLd5CegICsdw1IVOb9otNnfW/ObWome0Q4IruPcHGSIZmYLcdpIiongm4xPnsnElyxM0O0XYilUweW4nNsfUCEpN0V/MhAElogzXomoZrK3GICqL4O8PF+t9WBTohOUqI+x+HZr2S6aqFdZX5crthpAQOKUC5F/6dYQkn1vCX183IZJPYmXEkmLnfggyzzGQY1Da6C4tUmj8NtLtTqFXZteAiIfwVnz3WLGMdMVAmTsrWbVQ1/o5GSfY+pPnV3z5Bxmuo0r195vFsmV62EaisiVzNNgoz9EwZgXqHom0+noT4quIK628waR1YgbXmyFN0JRMwU3dSnL3r0C/wQ6XYATMk9yZOK8HwkhZNCimDJrJVDK/tNInshtC6Q9HzqV0MhCIw3lRj39O6KdgVgW95Cf64X8zhYBoIKpysjKFH+H4+iX3CG2WU0yF2aBKbV+wbL8Gdv4 +wWaQJyd g41o9mgS6EYB689mJjDcDZUYIyZlRrTznWpHaThOS0sCVjSw2jARPq5/9dDgwsietHZRbxqNW04IM0DBGsH/oDPNc7EcggP014FBx7byH4BJrUDOPkLobzA25uBjjil+B0AgVPTp9++wpH0BFng1cZNjK+hKWlznE2gcNLaeP5ls8n1oCVD9mQhjGFCmJSfVB7cIhJlXnU0P25cNOD5KgwIeQDxfKdNCDNes60y9i2QBRFNoGTWb5ZzmDITL1kc2FEGoGGdTRZEal8cxYZr3OEurldloz/vdTo0gfKSgg35zoEbWfcwuo7jLL92mEmUwlkUhoYV1B/C2yGdiiKsqP7zzAWJjMwIy7dM9LLgO5tmg3IMXwi1wk2NrOILGDbcQcgkhkzXBpoeUmGq8ZWkn2bhO0qi1WQspEnbK11LoAvpxYnnhN4NWhzGxyI+QeFHnY0HNOipQNH4gZXqnUcuWfdLPhHOD/dEjCw11K1AdtgI9+SLSJXfsoE8GTkco1GHFk2tJ07Afr1uxVhIMHMHINIiJMJQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000175, 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 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!