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 C4EE1CF9C6F for ; Tue, 24 Sep 2024 11:28:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A26B6B0082; Tue, 24 Sep 2024 07:28:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32A5F6B0083; Tue, 24 Sep 2024 07:28:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F2096B0085; Tue, 24 Sep 2024 07:28:09 -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 010466B0082 for ; Tue, 24 Sep 2024 07:28:08 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 77C4516163F for ; Tue, 24 Sep 2024 11:28:08 +0000 (UTC) X-FDA: 82599407856.01.991B19B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf14.hostedemail.com (Postfix) with ESMTP id 7078D10000F for ; Tue, 24 Sep 2024 11:28:06 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727177226; a=rsa-sha256; cv=none; b=ZKea6AejkmoOLmKrDt9O6lubLWw0QwnPG8ZI7dkwSfe7NbVotHZWghisWPNiYMyXys3dJQ bOvb9lknalpm2KjRHa/7bLhI7GnYXztX3f/5oxNDwyb6sUqEvuYMkf1ZqFrim0stvYecQl WRHlBwQEGXTBPKaX8U64sd7h3BY8t7M= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727177226; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ng/ShEdaF4U+7lZmzaK6jJFWkWXLGdUo2c/kKpuw1es=; b=AYMXZrNCCvrb1d04UqTaCNAZaSh0syTPqiMJkT61HisOlktd9Yp3Icvps7/Vb3NlV7cw/w 5+wmhelErRfKNvtJsZ5jH7MUqdIPBH2tsLOhHFZPBq/4F5rsfRf/HZyOjM7KguCigdcqde I9MXjNXsHJ2NskcxHnboC3Z0HzXsQE4= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EADECDA7; Tue, 24 Sep 2024 04:28:34 -0700 (PDT) Received: from [10.57.76.149] (unknown [10.57.76.149]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 452493F528; Tue, 24 Sep 2024 04:28:00 -0700 (PDT) Message-ID: <47e1537f-5b60-4541-aed1-a20e804c137d@arm.com> Date: Tue, 24 Sep 2024 13:27:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 19/30] arm64: add POE signal support To: Joey Gouly , linux-arm-kernel@lists.infradead.org Cc: 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, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org References: <20240822151113.1479789-1-joey.gouly@arm.com> <20240822151113.1479789-20-joey.gouly@arm.com> Content-Language: en-GB From: Kevin Brodsky In-Reply-To: <20240822151113.1479789-20-joey.gouly@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: 3anh6x1rnbg19w4kk4u6yh5i6nie1ee7 X-Rspamd-Queue-Id: 7078D10000F X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1727177286-752608 X-HE-Meta: U2FsdGVkX19mi1T0oy6IxTMsoj/T7hY74k92wzattV0YWYUwUKeVSV9ZEawIf0DkvO0/WpnP8s4ERU24dozQqYZm4VUKgwvvO9RFkErhWUeaYmA5B6HwGr5oddTs+IxCchcR/uzobVFhcuLe3tJ7E4pvefPekMDcAIwpZ5JOQSbrUhMC7Iznoj3oH+daXZtIdacUCY8Eklhsriu2Xx+U3f+C46p3/SGydN/p7S0F2dmJh+sQNzmodV0FeHCKux0AKRR7jEK4FK1TRxCDrRipPT2YjyGvTJt6p2pC6nyjWzzmHtpMJvyWujCMo+hXP8PJQCT9F/Y0InGYypPNZrx8RPjEd3YZ4xePEpg4W/jaDK6KANvuNocAfvDeAWr7OnXrwxewin+Nrl6vMz9vWuH4D+9cVFRPerEakd3NdmmYzmD0qGuE+shKNriso5L0psxImtW90ADR+4/cnC/S96HtaEbECmmlJjlXd4Y3WUhpr6QVR+ziiH+Ke54JGywCgZ7/8kJog2tUgEOoTB6qGiUhh5vzkByCIYNxZw6KH0Ml2vthjWRGobDmx5G6lHtbEbeSkn0KPyT3MGp6qu9bq6/5hcDgJoiAbwbH9ycobErto8ovZVDrNEnlS3Yy4EEofjluqlTmWsu74+cvGzxw3u8qe6cLL37SYvZJ6hEnxAeOYkqqZ4W3UrGEruN2r7QXdIHgUkgMvPWBrAU8w1dDE5ETI+/G5WBQZbHQNZlNQNfaT3tOYect8ik0H2vMqGDcT3dANXzxmTer9dNIFrcV7z3EQc24qtAJt9MR56ZGFgBV0EYW5gkG+dZAraRUhZDhGM9diBGueBnHK/x20aTA/DwVXN85ohjY44Canb5Uy944CDY5aNfjjYCeBNoPTv5tE8JwqXzb59sK+gkyK55ehKRQjOvDnmIG4kQ+CXH5Ddxl/PE+UnKTFqvN3+6ELmx3eF27e/MF/v+kxcjrnUCB839 0O9bxxxY 5Ep52gXs0mDN4lHR1oGxEKN4m1O1vf4sZ+gWhos0BlVAAef00yKp6RWLbN2dcbZAr7/oU5nknyXB+xCG9HICU3ZGP8AehOTdFTJZPFYgMPbOKkBf7mH9QHOlL2Ml9aqjNLvvbF7bHTYAnZTif3eRFmi9W1e6Eb/UpDKgf6yxEC4Tb2/S56uElJ0AidxSWoZ0MXZaq 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 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). Kevin [1] https://lore.kernel.org/lkml/20240802061318.2140081-2-aruna.ramakrishna@oracle.com/ > + > if (ka->sa.sa_flags & SA_RESTORER) > sigtramp = ka->sa.sa_restorer; > else