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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81685C43458 for ; Mon, 29 Jun 2026 13:08:51 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4gpmmJ4K9Qz2yh4; Mon, 29 Jun 2026 23:08:00 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=113.46.200.227 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1782738480; cv=none; b=Z10CPu0sxobA1WbPM2BZ6ae7q1qM85mB+67GHRnCdsyTnOWDP23gJj6CNWtqJU5gX4OpeOUjUMNPeq8YZbq5aTe74hLo5FAxEtZhdp8rviVkDZ/2cplx9UZgLpYRQEo1+tlRpuaRRK54f+rVVlwANTw7Y4gsY08g2Ar3sn4WLFKd9/0SKNgaDbGDwY46gEx+nLkLx9JnxIBaVFG2NYlKVhFmnGgSwEf4NTDsdlfqU9BvBtUqaDFg8a+JXESqEJIyQg0FAoGvdOXk83pZ+WC0gGIMgABKeW/FSvgtFZbv8iNhoEUPF5NVWoYC1QvGbOhiimM8iXifzZ3qPABznt36NA== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1782738480; c=relaxed/relaxed; bh=nXlEqg7p36Jks1c4yuaOXWFRq7Kp2sLsUwczenqjsfU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SCVvFQAi/yli7C9mNDQszW5zK0+OzQeGc1KM4F2zNADvTQYaQZ05wjasBkmrue8bPRz9QWEXe2fqqj6MYUQcCIghwqs+jFmn/0TJGyp1qe6Ey9NQHPzv8L6jKkvI3l2KcIQVOUDQIebS4Ni5lgsICxibQS8+0/0Ey6y5gpDbZk+SVfvrInuq0XGSTj2uekfTdky9gd7+xSmoSsxOUQ0hyU9Vlr5KCTMr3FTF6ynWsCknyE6kz52gmO4fmPnp8OQ1AMOOfm/izE5ojB+8CKW0jXrT1ehPVSO9d4oAsB+9vGs2ykSTSZ3tLtkct8qV1+i8TlWPGZ4JmTuMNaaAM/ub8w== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; dkim=pass (1024-bit key; unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=n8efmFXZ; dkim-atps=neutral; spf=pass (client-ip=113.46.200.227; helo=canpmsgout12.his.huawei.com; envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org) smtp.mailfrom=huawei.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=n8efmFXZ; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=113.46.200.227; helo=canpmsgout12.his.huawei.com; envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org) Received: from canpmsgout12.his.huawei.com (canpmsgout12.his.huawei.com [113.46.200.227]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4gpmmH4WZXz2yFc for ; Mon, 29 Jun 2026 23:07:59 +1000 (AEST) dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=nXlEqg7p36Jks1c4yuaOXWFRq7Kp2sLsUwczenqjsfU=; b=n8efmFXZdzG/h0lZ6Y0o4MsHme01XM8L7okaKbD/TR5W3fhAEUiS3084Q2F4FbdJWy9onNHJn NoyvX82wTsDRv9G5PxGTgVIRQ7Jcm5Hx10ZCpPXtHg6aMkk03hx8R8iCitsSqg5zLYEjQwsADbU ewPWK6UfSGus42FOPWCcAkU= Received: from mail.maildlp.com (unknown [172.19.163.163]) by canpmsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4gpmZ82YsKznTbW; Mon, 29 Jun 2026 20:59:12 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 5D6CF40588; Mon, 29 Jun 2026 21:07:53 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 29 Jun 2026 21:07:49 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v16 18/18] arm64: vdso: Expose sigreturn address on vdso to the kernel Date: Mon, 29 Jun 2026 21:06:16 +0800 Message-ID: <20260629130616.642022-19-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260629130616.642022-1-ruanjinjie@huawei.com> References: <20260629130616.642022-1-ruanjinjie@huawei.com> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To dggpemf500011.china.huawei.com (7.185.36.131) Syscall User Dispatch (SUD) requires the signal trampoline code to not be intercepted. This is necessary to support returning with a locked selector while avoiding infinite recursion back into the signal handler. Implement arch_syscall_is_vdso_sigreturn() for arm64 to support this exclusion mechanism. For native 64-bit tasks, it checks whether the current PC matches the 'svc #0' instruction inside the vDSO sigreturn trampoline. SYM_CODE_START(__kernel_rt_sigreturn) mov x8, #__NR_rt_sigreturn svc #0 SYM_CODE_END(__kernel_rt_sigreturn) For COMPAT tasks, it verifies if the instruction falls within the architecture's 'sigpage' range, allowing the kernel to safely bypass dispatching syscalls originating from these areas back to userspace. Suggested-by: Kevin Brodsky Suggested-by: kemal Signed-off-by: Jinjie Ruan --- arch/arm64/include/asm/elf.h | 1 + arch/arm64/kernel/vdso.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index d2779d604c7b..f43d4dea916a 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -185,6 +185,7 @@ do { \ struct linux_binprm; extern int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp); +extern bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs); /* 1GB of VA */ #ifdef CONFIG_COMPAT diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 592dd8668de4..5a0314a3c26e 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -343,3 +343,19 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) return ret; } + +bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs) +{ + unsigned long sigtramp; + +#ifdef CONFIG_COMPAT + if (is_compat_task()) { + unsigned long sigpage = (unsigned long)current->mm->context.sigpage; + + return regs->pc >= sigpage && regs->pc < (sigpage + PAGE_SIZE); + } +#endif + sigtramp = (unsigned long)VDSO_SYMBOL(current->mm->context.vdso, sigtramp); + + return regs->pc == (sigtramp + 8); +} -- 2.34.1