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 26B60C44501 for ; Thu, 9 Jul 2026 08:15:34 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4gwnpD4rzdz3c9w; Thu, 09 Jul 2026 18:15:32 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=113.46.200.218 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1783584932; cv=none; b=F9xPsWl81fiSjvte1soWTjOKClg1PWnDM7T6pK0UPkL+0quWi6cpiyOs0TuEktsy/KICAE8wlh+nM4GcI5rwIvReuXnNkIL7bAPDj7aofNLdsfIbIYp8o2nRvYnLoXzgLy8izylXitYvsVHjrcj9crcShOfC00GO+fDCk8QvbmijL9POJfJcOZfZa23lRPawI1pDudXjYozED8fK01WLF2hDn6iJgqGuOtzw5BSifolTiTeUTIZnUBk7JmizoPCFahhP5EnAmGkJ5br0Jntg0m4eMbkpi8uVjrU9R0m6SwEi4NZ8GKD3Tl2hfJkc19rTQE5DtPgXqi2Pnfr+SVSWTg== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1783584932; c=relaxed/relaxed; bh=48+51s385OsDhp5N7LQ5qHC6FAjEEUm6ed4fMfXeBFY=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=PRFRQ3NIDXSojrBSPU4N6VvzRC2Mg3ct7fxYka9lZ5QkWYKi6HK4STS5GqM51Wc6jXh+2QuFfeybgvAbbX5lICH0epa10gLXksHK/Asogc3L/OaA/Oq2V/9hKiAkZMoOmRNXg59Jt0ASVEG6Rv9zHWoGZJshu24usu631AeTLx2lcJ4YP9cZ7js47vj7svuvLFtyUyO0nqHRSINKfKk5BgImN3vMzmPWsSIn5QPbYjgphL2OCLQWDYhRGsYKV9ycab2i8bkCmFqQHboJ4qGXzEgwo4sGBA6HLY1SO8JJ+lzK65wmdE1RHji4JcKOq0nzropfsvgjP+yyPJVo8tmm2A== 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=kCxesqoZ; dkim-atps=neutral; spf=pass (client-ip=113.46.200.218; helo=canpmsgout03.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=kCxesqoZ; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=113.46.200.218; helo=canpmsgout03.his.huawei.com; envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org) Received: from canpmsgout03.his.huawei.com (canpmsgout03.his.huawei.com [113.46.200.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4gwnpB0hKBz3c9k for ; Thu, 09 Jul 2026 18:15:26 +1000 (AEST) dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=48+51s385OsDhp5N7LQ5qHC6FAjEEUm6ed4fMfXeBFY=; b=kCxesqoZlJiDDihnZyAzF5o6+WjRbCD++5bvCV+W0tELEqX7VwTIDS62IobikU82bv7sl8+Y1 2yCD+9ZYiDHYfjsAjS3Zn9Bd2SI2V6mn7KdFbxeGgCuBgK5A7WIPxe6IBYKwyHnFX9K58lcg3UM OCKTRSDGklsZpCIPJLCzdso= Received: from mail.maildlp.com (unknown [172.19.162.223]) by canpmsgout03.his.huawei.com (SkyGuard) with ESMTPS id 4gwnbz733tzpSvY; Thu, 9 Jul 2026 16:06:39 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id CC36D40561; Thu, 9 Jul 2026 16:15:21 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) 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; Thu, 9 Jul 2026 16:15:16 +0800 Message-ID: Date: Thu, 9 Jul 2026 16:15:15 +0800 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v16 18/18] arm64: vdso: Expose sigreturn address on vdso to the kernel To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , References: <20260629130616.642022-1-ruanjinjie@huawei.com> <20260629130616.642022-19-ruanjinjie@huawei.com> <20260630172619-6c78c2e2-c2d3-44be-88e6-6c82de12baf4@linutronix.de> <21875fb4-434b-480d-b68b-e2ffd5fff5ae@huawei.com> <20260709090525-b1e5ae06-1fb4-454e-919c-6503dcf3d073@linutronix.de> From: Jinjie Ruan In-Reply-To: <20260709090525-b1e5ae06-1fb4-454e-919c-6503dcf3d073@linutronix.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.109.254] X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To dggpemf500011.china.huawei.com (7.185.36.131) On 7/9/2026 3:17 PM, Thomas Weißschuh wrote: > On Thu, Jul 09, 2026 at 02:37:05PM +0800, Jinjie Ruan wrote: >> On 6/30/2026 11:32 PM, Thomas Weißschuh wrote: >>> On Mon, Jun 29, 2026 at 09:06:16PM +0800, Jinjie Ruan wrote: > (..) > >>>> 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); >>> >>> Instead of hardcoding 'sigtramp + 8' you could add a new label to the 'svc #0' >>> instruction and use that with VDSO_SYMBOL(). >> >> It seems that the modification of __kernel_rt_sigreturn() is not recommended > > For the changes to the object code of the function this is obvious and > well explained in the comments. > > Such a label however would not change the object code of the function. > In fact it would not change any bit whatsoever in the final vDSO, > save for a new build ID. Yes, and using labels is easier to maintain than hardcoding offsets directly. Similar to the code below? --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -86,6 +86,7 @@ config ARM64 select ARCH_SUPPORTS_SCHED_SMT select ARCH_SUPPORTS_SCHED_CLUSTER select ARCH_SUPPORTS_SCHED_MC + select ARCH_SUPPORTS_SYSCALL_USER_DISPATCH select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT select ARCH_WANT_DEFAULT_BPF_JIT diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index d2779d604c7b..a8b232c5c6d9 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -293,6 +293,7 @@ static inline int arch_check_elf(void *ehdr, bool has_interp, return 0; } +extern bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs); #endif /* !__ASSEMBLER__ */ #endif diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 592dd8668de4..609d7bcd8308 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, sigreturn_landing_pad); + + return regs->pc == sigtramp; +} diff --git a/arch/arm64/kernel/vdso/sigreturn.S b/arch/arm64/kernel/vdso/sigreturn.S index 0e18729abc3b..8d2d413ff45e 100644 --- a/arch/arm64/kernel/vdso/sigreturn.S +++ b/arch/arm64/kernel/vdso/sigreturn.S @@ -73,6 +73,7 @@ SYM_CODE_START(__kernel_rt_sigreturn) mov x8, #__NR_rt_sigreturn // PLEASE DO NOT MODIFY svc #0 + SYM_INNER_LABEL(__sigreturn_landing_pad, SYM_L_GLOBAL) // PLEASE DO NOT MODIFY // .cfi_endproc SYM_CODE_END(__kernel_rt_sigreturn) diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S index 52314be29191..5fee2927e4c5 100644 --- a/arch/arm64/kernel/vdso/vdso.lds.S +++ b/arch/arm64/kernel/vdso/vdso.lds.S @@ -104,6 +104,7 @@ VERSION __kernel_clock_gettime; __kernel_clock_getres; __kernel_getrandom; + __sigreturn_landing_pad; local: *; }; } @@ -112,3 +113,4 @@ VERSION * Make the sigreturn code visible to the kernel. */ VDSO_sigtramp = __kernel_rt_sigreturn; +VDSO_sigreturn_landing_pad = __sigreturn_landing_pad; > > > Thomas >