From mboxrd@z Thu Jan 1 00:00:00 1970 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 C94EA2FA62F; Tue, 17 Jun 2025 16:59:15 +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=1750179556; cv=none; b=g1ArYyUKrqsNdimviwCuRX67ARS+qawGf8Z6AS2w+bvcwG83w7YH7b67Bfe1RgiHdR2RiO15+yZhc1vVVfPdnFHVhuM7Lmkwc02Lf2IU1jVlMwFCS6HRJLVFXcnm9DlTNL9BDAgw6CFz1uP3j+T+cPoRsLp+4gFNYHoBNcnJTo4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750179556; c=relaxed/simple; bh=RF8uh+fODg9oQeENzeBpepOzoTeP1tUAuGzCW0pJ+uA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hJfYcCZy2pe1dWkuCuYrfKv82yCrfiFsbdk8znZlU3QmJT19oxeZpdK7IfVSyvaKlkEFN7UCpnRBn58ZXVDiigStEQilR9lGXNdUkGFY/nhX3Tg5HzPAKn/heLuxcCwnQlqedp2aXYS58q2fFvUaNQ3pm3olKDe5By7cyio3l48= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wDPPMZm/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wDPPMZm/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF349C4CEE3; Tue, 17 Jun 2025 16:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750179555; bh=RF8uh+fODg9oQeENzeBpepOzoTeP1tUAuGzCW0pJ+uA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wDPPMZm/ZnfmGZXxPX3i6m+Kz1188o9UM3C1qNZkSJXpV1iXnPmJobod9qWR0Iisv UNc2SZM8STf02YvoQAHTv98+rqysN14PBDJ2hTVEXGMiaKZWyaE/AKsKogsxwrcQ82 iEcXH8kby7EvHvfHANkWVQWidZ6XAZ3Yc8hCez9I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Stefano Stabellini , Juergen Gross Subject: [PATCH 6.15 770/780] xen/arm: call uaccess_ttbr0_enable for dm_op hypercall Date: Tue, 17 Jun 2025 17:27:58 +0200 Message-ID: <20250617152522.871933865@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617152451.485330293@linuxfoundation.org> References: <20250617152451.485330293@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefano Stabellini commit 7f9bbc1140ff8796230bc2634055763e271fd692 upstream. dm_op hypercalls might come from userspace and pass memory addresses as parameters. The memory addresses typically correspond to buffers allocated in userspace to hold extra hypercall parameters. On ARM, when CONFIG_ARM64_SW_TTBR0_PAN is enabled, they might not be accessible by Xen, as a result ioreq hypercalls might fail. See the existing comment in arch/arm64/xen/hypercall.S regarding privcmd_call for reference. For privcmd_call, Linux calls uaccess_ttbr0_enable before issuing the hypercall thanks to commit 9cf09d68b89a. We need to do the same for dm_op. This resolves the problem. Cc: stable@kernel.org Fixes: 9cf09d68b89a ("arm64: xen: Enable user access before a privcmd hvc call") Signed-off-by: Stefano Stabellini Reviewed-by: Juergen Gross Message-ID: Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- arch/arm64/xen/hypercall.S | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) --- a/arch/arm64/xen/hypercall.S +++ b/arch/arm64/xen/hypercall.S @@ -83,7 +83,26 @@ HYPERCALL3(vcpu_op); HYPERCALL1(platform_op_raw); HYPERCALL2(multicall); HYPERCALL2(vm_assist); -HYPERCALL3(dm_op); + +SYM_FUNC_START(HYPERVISOR_dm_op) + mov x16, #__HYPERVISOR_dm_op; \ + /* + * dm_op hypercalls are issued by the userspace. The kernel needs to + * enable access to TTBR0_EL1 as the hypervisor would issue stage 1 + * translations to user memory via AT instructions. Since AT + * instructions are not affected by the PAN bit (ARMv8.1), we only + * need the explicit uaccess_enable/disable if the TTBR0 PAN emulation + * is enabled (it implies that hardware UAO and PAN disabled). + */ + uaccess_ttbr0_enable x6, x7, x8 + hvc XEN_IMM + + /* + * Disable userspace access from kernel once the hyp call completed. + */ + uaccess_ttbr0_disable x6, x7 + ret +SYM_FUNC_END(HYPERVISOR_dm_op); SYM_FUNC_START(privcmd_call) mov x16, x0