Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp1166457lqs; Wed, 6 Mar 2024 08:06:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV7e7+qU2AnQ+SPn8UHKT8bl+x37kaZI6eiQvCXb0u9t9TsFS5CCj9UWJ2tJPwd3wHwe+7SRlfeEqIWdI30fcgu5FYloossAmkQN9VyKg== X-Google-Smtp-Source: AGHT+IF1+qFyKe3bkeL1q14VYh+jh+rjJazqpjZ4pa1otQcHXbHo1+84dl/BJv/yydS3LAqPrqvY X-Received: by 2002:a17:906:35cd:b0:a44:dc35:df19 with SMTP id p13-20020a17090635cd00b00a44dc35df19mr8536539ejb.67.1709741170234; Wed, 06 Mar 2024 08:06:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709741170; cv=pass; d=google.com; s=arc-20160816; b=PQihYfY0F/mnj/3kThYENkMwLaRyYV38UOQMyGcu9u2Dqe2AuDJPqLGuJNzIV3NmKh 52V+QFEA9ZPi2SFIOVOvrqow0IJEPlkqu77VYWLc1T8sbXta3H8a72tQZPQIcHZfvTKh gXPg0Joi9E6DSrIdLJRNjJIgCkb83XsmnIyNsmkVAU1Iv+jhR9pqlrH3hBaj77XESlqf AxF8NJYSiMkEdSxXky/dFeJztbIaAIMXxCTPmfLwRB18BapYiUUF/rcsGaNklGMKjRxr 7l5xjIXgIkZD9AGWWjwa/XgZZSiiMHh6Wvyvypi5Bx2t8KgFziKQZbypYbP/MLQutahs UWCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=782EDnoVXxNpmneTGmzQIIAJtH2DCiZGVikVKjFfgfo=; fh=IxXvO/KiRGgSEOJ7btGLhBkWW7UT8sMIrtHE6VnDvJE=; b=FOQTMSsCzPMekgvYzgvpxpiwty/GX4U49VYOAZ1T8AKkRLdyn0TC1jWWEPsIyD6moR T0BPpZlRSTak1xrrbIx0A+ZiUHiTvhwM9FwGP7M3gngKUFGpTu2PhDg6OSN0scU5PLX+ QnhmYSxp4DUTgS8MZA1HMsyiF42u/bTLMDXxponX3yQqTOBe8lV2+zHu5oYmwrGIUJdm 1qnlw76wPKR0/QaKvo0G9lgm2y400/TlzXkMMxpYXt16URWy41HmDh+pDiapYiTaQe6D f4PqER4EeAr9cwAreflr94+nJYp1YHxTPwcVS+jWn98b8u+v6cdJeYIIaqTydgMnXYnF iKDw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U8xe60q1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-94223-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94223-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n4-20020a170906088400b00a451e906d93si3391795eje.965.2024.03.06.08.06.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 08:06:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94223-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U8xe60q1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-94223-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94223-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9D89F1F235F1 for ; Wed, 6 Mar 2024 16:05:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9AC2E13A888; Wed, 6 Mar 2024 16:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U8xe60q1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFCDC137904; Wed, 6 Mar 2024 16:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709740970; cv=none; b=oasRNsGNkT+H1D7ehUTapwJGAhI2txZ4TrMa7zSMsEMiDPmEPLvyTPmoUahG3paR2jYFxbNZ0RwuPzOHeO61sCVvRux89xuoUaphtHktUSxaRvM+LH3gvWJzmG5t9oVGYl6sAGg3Iyy69WfNNYi0LsXEj0duywXDx7UFqLv+SXk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709740970; c=relaxed/simple; bh=IG8ko0VxIq5wqmccJeKPMEw+wW9fETH2/U5QZozNYlA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=J0JtDgeVlbpx/H+X+VkurTltPk5RIl8b3Qo97dUiwbAPr23F7Ei6X9/k9W5YjIJ65YbzRhvVaLvge0EEwQy6NKFJCT8dqW8wwjCmL4Gbjs2gFIM9jMP4UWHyWQDnLgbDj4fjNn8fHhRz4Rtab1LCd/LuV1bk78EJ1tmHGnE4478= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=U8xe60q1; arc=none smtp.client-ip=10.30.226.201 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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