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 3C394C54E41 for ; Wed, 6 Mar 2024 16:02:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1AAD6B0088; Wed, 6 Mar 2024 11:02:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BCA866B0089; Wed, 6 Mar 2024 11:02:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ABA016B008A; Wed, 6 Mar 2024 11:02:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9B8F66B0088 for ; Wed, 6 Mar 2024 11:02:57 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0E7C440C67 for ; Wed, 6 Mar 2024 16:02:57 +0000 (UTC) X-FDA: 81867082794.30.D1540DD Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf12.hostedemail.com (Postfix) with ESMTP id 5811D40005 for ; Wed, 6 Mar 2024 16:02:53 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=U8xe60q1; spf=pass (imf12.hostedemail.com: domain of jpoimboe@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=jpoimboe@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709740974; a=rsa-sha256; cv=none; b=Cl2VNuy+qgV2MJNEEiRT6zm5ZapVZdqZQn7ihc+pVH/hKNdi5x7FEQ5mM28FWq1Ln9btuu AYNJTbIVP/wJZvXvVtZ5tQJ6+r9vYnHO9DuFF+kCD+qiSpAS32HNBQoZ8URJH4fVYA8bAD Y/BYjgPe90S1S56E7kTHcoeNZ9t/O9o= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=U8xe60q1; spf=pass (imf12.hostedemail.com: domain of jpoimboe@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=jpoimboe@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709740974; h=from:from: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=782EDnoVXxNpmneTGmzQIIAJtH2DCiZGVikVKjFfgfo=; b=6iXyCuCtAHPKTvoGzItYD528R+FOPgdicj/yy2FoznOErb/OOR+3zlAT2MylGsSJtub6Bi Uj8Slmq/3xDaYQf7keZjkMIfJK9kep6qH19cbvDKNElwBQNN9bh8EkrMCp1FQ0Z9Zi0/1j JMlInk1numR23pqvc589dIJSeKR0NlA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 15AA9CE1F62; Wed, 6 Mar 2024 16:02:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7C5AC43390; Wed, 6 Mar 2024 16:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709740970; bh=IG8ko0VxIq5wqmccJeKPMEw+wW9fETH2/U5QZozNYlA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=U8xe60q1U4UDSVgM19Kfn8IQ3KbWk/TOY6ykEVfiCuow4FBb811BhgFZHXYqTw+YA sYRIZuRtcj6NbVqPUlHFiDW4wcm4FrxATY1DCxlQWv7zhalsJcuLYAn6zFyZiG3aMx 23TSIPOGxLIwvRCHaJg1R5Zepuiz0rkQ65Y6O/0AwpAnzxV1HdwX9CbeEzcNWhQYlw lgoZdmkHPO3vIcOjRwzV7va+8B7wjJe30bs3PwYULC788JvXpIvY+NW56Yjk4U/aDI S8Vqit6socqN0kKKV2ILZlfOyWLcmpj3r6uG4v9Oy+YOVWB0FjnOdKC6sJKxTDW3TQ ubsCZETCragQQ== Date: Wed, 6 Mar 2024 08:02:48 -0800 From: Josh Poimboeuf To: "Russell King (Oracle)" Cc: Jiangfeng Xiao , Kees Cook , Jann Horn , gustavoars@kernel.org, akpm@linux-foundation.org, peterz@infradead.org, dave.hansen@linux.intel.com, kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-mm@kvack.org, nixiaoming@huawei.com, kepler.chenxin@huawei.com, wangbing6@huawei.com, wangfangpeng1@huawei.com, douzhaolei@huawei.com, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: Re: [PATCH] usercopy: delete __noreturn from usercopy_abort Message-ID: <20240306160248.oxeblpwa5zvplmgw@treble> References: <1709516385-7778-1-git-send-email-xiaojiangfeng@huawei.com> <202403040938.D770633@keescook> <77bb0d81-f496-7726-9495-57088a4c0bfc@huawei.com> <202403050129.5B72ACAA0D@keescook> <20240305175846.qnyiru7uaa7itqba@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 5811D40005 X-Stat-Signature: izwnmqmsgg16ao1m7m1z5ekkykubmnbh X-Rspam-User: X-HE-Tag: 1709740973-844167 X-HE-Meta: U2FsdGVkX1+o0gEmB3k9O6DzzGIDBJiBuJ8cFTLJIv1C6jw3RMbcJqwG67kkE+LRoDapAZXl3JkMSo9ZBSG1D9iOYpz0aGeuJ+hgJPtWQkV2Qvpw2MreozNd+UNwqVc9dvlp51J+hzDLsss+mW1nGm/CsZtCPfWNTzdUVJATNIauGNO6o/hYYuEcmwcZDMv/jZf7r4ZwS7lDDKY4eA7306R4VgGS++BzSLUKzqfNXptHN/YPqSDk4nRVAfwIgb1L+uC27ebZEvoSScPk2H+evtBkUxUqkMToFYhkzGprOdrSfLKC9G3vbYd98+Ifh12+wUr5lxdlKcaVz3Bx1AYyVz+A58jrcIYkBMOfyrzYx/OQZBPjNQsqwnVVz5y/TL0/0XgpcCS1YO4Oaw/2girJ9K/22lL1e7UDHu1rx1O+VkI9HbhPfLn+g5BQ8iGJZ7bCLulJKc+b83r8wQ/iJxnXlZeuHwkrY3pFO5XSKeS38jPrWS8HL9q6G+ToizTnNXDdBSHvfh+DjOkPfTV4Tqu+bZRxnSjBVLnsvYMCXslFKk5j2YQJWynnw8dFao1mfMHNxUGsZY2SMorW8KTWq+K9/DxBrGFHo+aCZ4Boy5Jd4SjbJfGAtXtxoat+37olUXLuZnG3TEDgvyaDwYzPV9RBAdWFlnhobyH1GH50a/EZiqRJnXP6vRqD7mfhZVe9jrIkY+LsHE5oaPxrSkN6l06fzgFA7ZgEi4mIHRSCbTmETDbRorhZcMXXfWSQcYyLw9XWxRkEPeHnIPmCluPbcUG6ye3pUjtAZjhp6A7QBxnS+ZmiJBkA9eRn2+Q7h+0fYKjWF7jf7KbLNx7yh3AKO5VFD80TSh2nRt5vz42amvcxfH8o6UkesDDeAiKKX7mErTj8mQ0LWct8Ul30ttyTzNuxUls1Gp3XglKmd9alRB83b+5PbMsb0jKnGw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, 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 Wed, Mar 06, 2024 at 09:52:01AM +0000, Russell King (Oracle) wrote: > On Tue, Mar 05, 2024 at 09:58:46AM -0800, Josh Poimboeuf wrote: > > This is an off-by-one bug which is common in unwinders, due to the fact > > that the address on the stack points to the return address rather than > > the call address. > > > > So, for example, when the last instruction of a function is a function > > call (e.g., to a noreturn function), it can cause the unwinder to > > incorrectly try to unwind from the function *after* the callee. > > I suppose this can only happen in __noreturn functions because that > can be: > > foo: > ... > bl bar > ... end of function and thus next function ... > > which results in LR pointing into the next function. > > Would it make better sense to lookup the LR value winding it back by > one instruction like ORC on x86 does (as you mention) rather than > the patch you proposed which looks rather large and complicated? That patch *is* an attempt to make it match ORC's behavior. What specifically looks complicated about it? -- Josh