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 BC7C8D18131 for ; Mon, 14 Oct 2024 17:10:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F1A46B007B; Mon, 14 Oct 2024 13:10:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A1EF6B0083; Mon, 14 Oct 2024 13:10:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EABB16B0085; Mon, 14 Oct 2024 13:10: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 CE5CB6B007B for ; Mon, 14 Oct 2024 13:10:34 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5D5B4121135 for ; Mon, 14 Oct 2024 17:10:27 +0000 (UTC) X-FDA: 82672846578.27.4219580 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id 0030014000D for ; Mon, 14 Oct 2024 17:10:27 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fZuGXBvf; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of will@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=will@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728925786; a=rsa-sha256; cv=none; b=OZgchoYOMTTmlBnA41gFadnpZr2XYCBasiy2nFlS1RQMpJw4bIqh7xAMN5VEu22zGHT7mB bVyS0LmuATOieg2gtU731yogKCzGeDd53v2wI6bhF1j4ADONxYcJLaJLHGnVZapAZOkZep d9R79mTr78xWZFYLxKFyi5Q1I7z/TZo= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fZuGXBvf; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of will@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=will@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728925786; 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=3HFDu+RgBC8QB7MBej0VOt4wFOEq6q2+8KySSKiShFg=; b=mWTszzS4mvn5arvn1gXLz+Gwf5CuRRVDpzwzaGi3mDEkFelqq9emqEcrViRnCyOHcStF58 FkgHqb2qubUhE338yq5GlhQEnUxNgICreAMkpcyFeGUYr6WL3Mm6jrgU98VcrT8e1tT6LS /BcZsT9eWl4wB3YQu4E18ZN0qT+1dY0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4934D5C4C1B; Mon, 14 Oct 2024 17:10:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 932D4C4CEC3; Mon, 14 Oct 2024 17:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728925831; bh=iLl0lXkXeALAMr5KDjF+8vkYFyZnHpji9UAQw4I8NLM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fZuGXBvfqai+/3NsOa9W9cD3IlOY9aT3U0WbINyOpuWErGCK6ZB6IOUBzMOrcOcny pu72RD2Q/eOijBUJKudsa5AgJol2pWXeoLojf4MNniYLbSJgH2kEtVhDGVb6Gm14Df 9EGatG41Z1BUkjfjmG1t0dtC3E9OVP/UsR4ZXtN7/cC9OYFti03Mmwc+YQYgMcx9FF id1TyF5286pt2Y3czQbj/ZxkcUQEN2KJW1lxao1NLV3WYoMqD/KKpW+g9w8uWA2Aqn /L7Px0nG8PKBofrF7r6MreT7d1B0i8Jz1iBY6w6RO2ZAzUeeOvYCehz+aQLkdHLfpI KopOxy2RDs1Dw== Date: Mon, 14 Oct 2024 18:10:23 +0100 From: Will Deacon To: Kevin Brodsky Cc: Joey Gouly , linux-arm-kernel@lists.infradead.org, nd@arm.com, akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, anshuman.khandual@arm.com, bp@alien8.de, broonie@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, dave.hansen@linux.intel.com, hpa@zytor.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, npiggin@gmail.com, oliver.upton@linux.dev, shuah@kernel.org, skhan@linuxfoundation.org, szabolcs.nagy@arm.com, tglx@linutronix.de, x86@kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v5 19/30] arm64: add POE signal support Message-ID: <20241014171023.GA18295@willie-the-truck> References: <20240822151113.1479789-1-joey.gouly@arm.com> <20240822151113.1479789-20-joey.gouly@arm.com> <47e1537f-5b60-4541-aed1-a20e804c137d@arm.com> <20241009144301.GA12453@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241009144301.GA12453@willie-the-truck> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspam-User: X-Rspamd-Queue-Id: 0030014000D X-Rspamd-Server: rspam01 X-Stat-Signature: stasdyz7o11etpioi3wjbjbyasy5goxu X-HE-Tag: 1728925827-935384 X-HE-Meta: U2FsdGVkX184n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M/aQ69aLke4gNIaWMcIscDnFW9pbifUgvjpclq2WU0dieB/Ksfw2MyXT/sp+KWviuyd9cD61Yd+eJFZanFtcCeHtMc7p9rwG8wNGMHVSI0QqU007 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: Kevin, Joey, On Wed, Oct 09, 2024 at 03:43:01PM +0100, Will Deacon wrote: > On Tue, Sep 24, 2024 at 01:27:58PM +0200, Kevin Brodsky wrote: > > On 22/08/2024 17:11, Joey Gouly wrote: > > > @@ -1178,6 +1237,9 @@ static void setup_return(struct pt_regs *regs, struct k_sigaction *ka, > > > sme_smstop(); > > > } > > > > > > + if (system_supports_poe()) > > > + write_sysreg_s(POR_EL0_INIT, SYS_POR_EL0); > > > > At the point where setup_return() is called, the signal frame has > > already been written to the user stack. In other words, we write to the > > user stack first, and then reset POR_EL0. This may be problematic, > > especially if we are using the alternate signal stack, which the > > interrupted POR_EL0 may not grant access to. In that situation uaccess > > will fail and we'll end up with a SIGSEGV. > > > > This issue has already been discussed on the x86 side, and as it happens > > patches to reset PKRU early [1] have just landed. I don't think this is > > a blocker for getting this series landed, but we should try and align > > with x86. If there's no objection, I'm planning to work on a counterpart > > to the x86 series (resetting POR_EL0 early during signal delivery). > > Did you get a chance to work on that? It would be great to land the > fixes for 6.12, if possible, so that the first kernel release with POE > support doesn't land with known issues. Looking a little more at this, I think we have quite a weird behaviour on arm64 as it stands. It looks like we rely on the signal frame to hold the original POR_EL0 so, if for some reason we fail to allocate space for the POR context, I think we'll return back from the signal with POR_EL0_INIT. That seems bad? Will