[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b7530d9-a593-4365-718f-afdd46bdcb31@huawei.com>
Date: Mon, 30 Dec 2024 11:02:38 +0800
From: yukaixiong <yukaixiong@...wei.com>
To: Brian Gerst <brgerst@...il.com>
CC: <akpm@...ux-foundation.org>, <mcgrof@...nel.org>,
<ysato@...rs.sourceforge.jp>, <dalias@...c.org>,
<glaubitz@...sik.fu-berlin.de>, <luto@...nel.org>, <tglx@...utronix.de>,
<mingo@...hat.com>, <bp@...en8.de>, <dave.hansen@...ux.intel.com>,
<hpa@...or.com>, <viro@...iv.linux.org.uk>, <brauner@...nel.org>,
<jack@...e.cz>, <kees@...nel.org>, <j.granados@...sung.com>,
<willy@...radead.org>, <Liam.Howlett@...cle.com>, <vbabka@...e.cz>,
<lorenzo.stoakes@...cle.com>, <trondmy@...nel.org>, <anna@...nel.org>,
<chuck.lever@...cle.com>, <jlayton@...nel.org>, <neilb@...e.de>,
<okorniev@...hat.com>, <Dai.Ngo@...cle.com>, <tom@...pey.com>,
<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <paul@...l-moore.com>, <jmorris@...ei.org>,
<linux-sh@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-fsdevel@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-nfs@...r.kernel.org>, <netdev@...r.kernel.org>,
<linux-security-module@...r.kernel.org>, <dhowells@...hat.com>,
<haifeng.xu@...pee.com>, <baolin.wang@...ux.alibaba.com>,
<shikemeng@...weicloud.com>, <dchinner@...hat.com>, <bfoster@...hat.com>,
<souravpanda@...gle.com>, <hannes@...xchg.org>, <rientjes@...gle.com>,
<pasha.tatashin@...een.com>, <david@...hat.com>, <ryan.roberts@....com>,
<ying.huang@...el.com>, <yang@...amperecomputing.com>,
<zev@...ilderbeest.net>, <serge@...lyn.com>, <vegard.nossum@...cle.com>,
<wangkefeng.wang@...wei.com>
Subject: Re: [PATCH v4 -next 13/15] x86: vdso: move the sysctl to
arch/x86/entry/vdso/vdso32-setup.c
On 2024/12/30 7:05, Brian Gerst wrote:
> On Sat, Dec 28, 2024 at 10:17 AM Kaixiong Yu <yukaixiong@...wei.com> wrote:
>> When CONFIG_X86_32 is defined and CONFIG_UML is not defined,
>> vdso_enabled belongs to arch/x86/entry/vdso/vdso32-setup.c.
>> So, move it into its own file.
>>
>> Before this patch, vdso_enabled was allowed to be set to
>> a value exceeding 1 on x86_32 architecture. After this patch is
>> applied, vdso_enabled is not permitted to set the value more than 1.
>> It does not matter, because according to the function load_vdso32(),
>> only vdso_enabled is set to 1, VDSO would be enabled. Other values
>> all mean "disabled". The same limitation could be seen in the
>> function vdso32_setup().
>>
>> Signed-off-by: Kaixiong Yu <yukaixiong@...wei.com>
>> Reviewed-by: Kees Cook <kees@...nel.org>
>> ---
>> v4:
>> - const qualify struct ctl_table vdso_table
>> ---
>> ---
>> arch/x86/entry/vdso/vdso32-setup.c | 16 +++++++++++-----
>> kernel/sysctl.c | 8 +-------
>> 2 files changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/arch/x86/entry/vdso/vdso32-setup.c b/arch/x86/entry/vdso/vdso32-setup.c
>> index 76e4e74f35b5..f71625f99bf9 100644
>> --- a/arch/x86/entry/vdso/vdso32-setup.c
>> +++ b/arch/x86/entry/vdso/vdso32-setup.c
>> @@ -51,15 +51,17 @@ __setup("vdso32=", vdso32_setup);
>> __setup_param("vdso=", vdso_setup, vdso32_setup, 0);
>> #endif
>>
>> -#ifdef CONFIG_X86_64
>>
>> #ifdef CONFIG_SYSCTL
>> -/* Register vsyscall32 into the ABI table */
>> #include <linux/sysctl.h>
>>
>> -static struct ctl_table abi_table2[] = {
>> +static const struct ctl_table vdso_table[] = {
>> {
>> +#ifdef CONFIG_X86_64
>> .procname = "vsyscall32",
>> +#elif (defined(CONFIG_X86_32) && !defined(CONFIG_UML))
> vdso32-setup,.c is not used when building UML, so this can be reduced
> to "#else".
I will take your advice.
Thanks.
>> + .procname = "vdso_enabled",
>> +#endif
>> .data = &vdso32_enabled,
>> .maxlen = sizeof(int),
>> .mode = 0644,
>> @@ -71,10 +73,14 @@ static struct ctl_table abi_table2[] = {
>>
>> static __init int ia32_binfmt_init(void)
>> {
>> - register_sysctl("abi", abi_table2);
>> +#ifdef CONFIG_X86_64
>> + /* Register vsyscall32 into the ABI table */
>> + register_sysctl("abi", vdso_table);
>> +#elif (defined(CONFIG_X86_32) && !defined(CONFIG_UML))
> Same as above.
>
>
I will take your advice.
Thanks.
>> + register_sysctl_init("vm", vdso_table);
>> +#endif
>> return 0;
>> }
>> __initcall(ia32_binfmt_init);
>> #endif /* CONFIG_SYSCTL */
>>
>> -#endif /* CONFIG_X86_64 */
>
> Brian Gerst
> .
>
Powered by blists - more mailing lists