From patchwork Mon Aug 26 12:04:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777710 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 C3FA3C5321E for ; Mon, 26 Aug 2024 12:05:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C44B6B0145; Mon, 26 Aug 2024 08:05:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54D266B014C; Mon, 26 Aug 2024 08:05:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3ED3E6B040A; Mon, 26 Aug 2024 08:05:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1DD576B0145 for ; Mon, 26 Aug 2024 08:05:58 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9ED4EC0FC6 for ; Mon, 26 Aug 2024 12:05:57 +0000 (UTC) X-FDA: 82494267954.07.C06B718 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf01.hostedemail.com (Postfix) with ESMTP id 2C80440020 for ; Mon, 26 Aug 2024 12:05:54 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724673936; 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=6AxgHKGi1srXNKz9QnA8kiIxDib+N0ydNrButpCH8Gc=; b=6PvKmLQTBnE6trSC1Vgwdpomi6yz8f4jFgx2CiE8VtJfm3F+Hlo8Axx4eaU8kJ2KUE4hYG vD/gJ0mf+Pq/s7uZgm3rkly3akEGi6n2NnOAEvsGqFRBZ7FvVyuHvNtPH074kwODha73Hs Z0MYsjek5//8Fyj2bqJ+qzJApuutLNk= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724673936; a=rsa-sha256; cv=none; b=dPZGRsAtWXQ3qVGKs4VBoZmxjBor9kI3qEJM8/Re6QRk1p29ABKlPF/L/y3tL/+5uc2KAT iwiZS1yjY1li12Np8+oIAkJAENkliU/fSP8Ear6NsGo9cZHrChOoWMlrsuNmq/vhnov0MB Iua9hVyq+/s1xRMQsrDiNTm0ahtXA9M= Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Wsq5C2dFqzQqhb; Mon, 26 Aug 2024 20:01:03 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id F1B301800D0; Mon, 26 Aug 2024 20:05:50 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:48 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 13/15] x86: vdso: move the sysctl into its own file Date: Mon, 26 Aug 2024 20:04:47 +0800 Message-ID: <20240826120449.1666461-14-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspam-User: X-Stat-Signature: ohzpxyk4xt9qqa8acu184paxqrxyrzys X-Rspamd-Queue-Id: 2C80440020 X-Rspamd-Server: rspam11 X-HE-Tag: 1724673954-756657 X-HE-Meta: U2FsdGVkX1/c04uWJg1iqIP9zT4o/csXqbuSaZ6ySQNwk5HzFAxA9N8V46+dhaxiry8+60Je2FD/WeXzFHYBuJyfV9aaDBY98WOQt2stP1vUzGGZZk3NaNrZG4F97dUcdJ7IsFmrJRUsykG87eoaRpYvq/jOAl57VEj9gZDRvAiawYYeGcU0SgdAw4j4XKkQAA98XPNs9f7I9z0T2c8a5DkULtLGJll7OUs+3bsulp1C6FGw7z8vxIV4YteWPYMw5pxZSGxN9M6LwGlXkJtbrPmAOZ9jyHV7xI3eaJHBFhl2hTlnYlFx2uB3rDrJt6wC/HYbyxb+zT60ofLXRAjkZOhFI3skg5spLgJCm4bcHUNOA6692l6LkesDVwY6yEivpZ6f3bcXFu5ne/bsHRnvIaBaW/guIcjnZonoW8r+6/BL5UfXbaB36ZnLIduki15nWCC79TrHQ56oQYczYaziOgBOsdW2WPqEiy2gG5WypmYo6oxxtc6IoyGwBEWgPb1GdvJbI8ybMYs87xpCovgshpV1ubEiR9acxXncw++rdsKwKMIWnrZRUMvorjVV9Kj0kyF+Lb1pqJn3DTk5YThfh0eGJd+rGjlKAca4/lLjuzzHVcJgZsJI1H51Kb/yZuTKhXlHDPUEEgfJtNDyX2OGDp4dVe1c+NYtezo/80xx7HrowAcrMU1F9lpkk6jMy4x9VfAtPkpKIo19bBwkZ3XuPIVe3p9Jp/z+lpaCQj39BlOV/VFgQkTciPYAOdcm7GfaIPb1pU3oxan2heSJouj0bkbQcNqcO5XqKQ7mMto7Yq6OC4JWeR6cDwNL/5elygaWeWhZEg/SVj/UN+GFTZfnD9I/Ok9g94fef3C+lhz57Q/qTRgQtpWzwg1VbhWVyhD4fXR/QBSYa8wc4INBufXBne+Rlq67bYRbaD9eej2/6iEi8VEq8EQueunqlNE42VqlJIARZEiTOZmlPb+2NWW GWCF8CEq +zyVlv88zcczR4ywafw45mAcGM6e+Wl8bA26ihpW8aP2/Ab53JOSXJ1iSI4P8zysF6/cFbnAjCJRzYWHbVYOEtJuSie1hbDlL6rulKHJf/glQA/FtVO2qLpy38YzJs1MqmavK4hxb0noLE6dd2051rRfCsQ== 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: 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 --- 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..5a6886a006ab 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 -static struct ctl_table abi_table2[] = { +static struct ctl_table vdso_table[] = { { +#ifdef CONFIG_X86_64 .procname = "vsyscall32", +#elif (defined(CONFIG_X86_32) && !defined(CONFIG_UML)) + .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)) + register_sysctl_init("vm", vdso_table); +#endif return 0; } __initcall(ia32_binfmt_init); #endif /* CONFIG_SYSCTL */ -#endif /* CONFIG_X86_64 */ diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 6f03fc749794..24617be93119 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2023,17 +2023,11 @@ static struct ctl_table kern_table[] = { }; static struct ctl_table vm_table[] = { -#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ - (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) +#if defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL) { .procname = "vdso_enabled", -#ifdef CONFIG_X86_32 - .data = &vdso32_enabled, - .maxlen = sizeof(vdso32_enabled), -#else .data = &vdso_enabled, .maxlen = sizeof(vdso_enabled), -#endif .mode = 0644, .proc_handler = proc_dointvec, .extra1 = SYSCTL_ZERO,