From patchwork Sat Jan 11 07:07:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935845 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 ADDABE7719A for ; Sat, 11 Jan 2025 07:13:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A2A36B00B6; Sat, 11 Jan 2025 02:13:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 329306B00B8; Sat, 11 Jan 2025 02:13:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A7CA6B00B9; Sat, 11 Jan 2025 02:13:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id EA3BA6B00B6 for ; Sat, 11 Jan 2025 02:13:13 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A179D810E5 for ; Sat, 11 Jan 2025 07:13:13 +0000 (UTC) X-FDA: 82994304666.21.AEBA455 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf18.hostedemail.com (Postfix) with ESMTP id 1B4AA1C000D for ; Sat, 11 Jan 2025 07:13:10 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579591; a=rsa-sha256; cv=none; b=Kzr1Fc4FNq6BGMP2pGMLE7uMcQEQEmH20tX/fu1cHEZQ+OMmGb8TPfxPCl4EMphxFAtMOM ZhZ6LpC0WR4cv0ZRRUdQbyMt62zYPf6baUBch7ntzduqYn0+UigsFTsWh4dSUpr2c+tjf2 hfmN65kT7UMTKbPpozDJlB4+uctr00k= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579591; 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=SsRMZ1Rur2Q+IjAV8lZhGg8xCNmRJFIZDihSahWAAfM=; b=NpMc1NAU/BXxEFlfgzt/hP7HBn3GtnmZKLqBVcY0RiA+Act8Pb6QA9XK7G/ljlny6otyop JwGQpR2trPtO8qIIIR0JGjDl2gadWxh7OLPqTJIWPq5b/sdW0WnWqexhx8DinNkO5vuwCM sLJPBreireaAQ+JXhWWbyp+Sn5XVyjQ= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4YVV9k5jS7z2YPj0; Sat, 11 Jan 2025 15:13:30 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 83882140109; Sat, 11 Jan 2025 15:13:07 +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; Sat, 11 Jan 2025 15:13:03 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 14/16] sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c Date: Sat, 11 Jan 2025 15:07:49 +0800 Message-ID: <20250111070751.2588654-15-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 1B4AA1C000D X-Stat-Signature: e74pq4ytydqzbeewdy9f6fkidhismhdo X-HE-Tag: 1736579590-251082 X-HE-Meta: U2FsdGVkX1+jVythYM1KIG12TZwwYGJ9I/LSdK9dgchDQEeZOwo5+KynkQC6buhF5WgVfUu+9Ueb9VkFELBmIDmeA/FwrIwaiJTADwG0L0mIb7eMDTH01Gm+YVl8lo3RO5zVO0zFKiesDqFdXSPZxeFbk1YEGhRVvprt2zFqzz05kQ4cm0uEU6pejWhaVynQbzSB4/cwM/GrMyPIk+NCWMwCPODDG0Tj3vwZLl4T5UMoKdnI6p2a7ylV6ncIV/DZ3lid0jpVbrkwZiqGI63Wz6bxfANPRuKaS0ZvTboDWbpvElopmpuUJYUdgqPLzJ+oX9cgvHiMAv1wagI7NUlpS4ZAFn36JXFO0vGGCRWnNetIuMxx0/0HbyckIHrJmksSz1jn4USpEE/vrrXbiw1VFcnOflduyktt1K5+yh+eknmkJ1MjHH3R2SuX5O/k33YTBkOLIr4k/4Gq/29zBFgm7WDuj6/ffRBvHXaYJ8KBvmRgcAm/BIGgWJMSjA8yaDBc+JXZ+BGeFbkvXVvhLH5z6T+27fVjJijOtD609Kke8B8B+R0khMUQ8wBvAmG2gGXt6GA9V0d46K9NoGseaQdMdSgXgY6FeBzgiLnCpJ7OhdJ7A7+YjuEnHng5jPMIEEW+/YB+1ZIr0EwzgHKxfBTwzFPgOLXEzn4UALmSAzum1Y2nzeMrzcvzq+0S4/0SIYyMTb/K7dbqUMpfdzngjoYsv+yJ36PmUwyzMiD5apQft8IRg38bGqKihGWmQj4UsYStDsdRMc3fUWYywIH0cHbk2HKwqEp1rEA6irJacYt/dZeMzi7uNoYUxoZ399JchPzD4EpCCiCFK4WtVqPevuLc6KnwNyGHluixWucHRRUqdUt6zAlC48sHdmYrQNJf7Cl0Gxca/7t6jfSQE6YFhNbzINKAVLe13faO1gc1HcOvjcuLj6T0OwyeV2rGJXe6XJ6t00Mi1K5Kd05jmIbM3eF fmT/dMkY Qd1br759y+ychH7016k3Hp9KW6RDOkkALHwQtweLxBoA3uFmW0d/WjFdv3IE5w5WASTiqUgY7uAVc/uYSNDVAiX9/UWR8eLORxHlBJDqNS3k+LaiepmhSqDcJVLrOnxB8fp18kG/UMffARMz/cE2H4vALsQzNr070rQBzFm9GNNOowv0= 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_SUPERH and CONFIG_VSYSCALL are defined, vdso_enabled belongs to arch/sh/kernel/vsyscall/vsyscall.c. So, move it into its own file. To avoid failure when registering the vdso_table, move the call to register_sysctl_init() into its own fs_initcall(). Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook --- v5: - fix the error discovered by Geert Uytterhoeven. Move the call to register_sysctl_init() into its own fs_initcall() as Geert Uytterhoeven's patch does. - take the advice of Joel Granados, separating path14 in V4 into patch14 and patch15 in V5. This patch just moves the vdso_enabled table. The next patch removes the vm_table. - modify the change log v4: - const qualify struct ctl_table vdso_table v3: - change the title --- --- arch/sh/kernel/vsyscall/vsyscall.c | 20 ++++++++++++++++++++ kernel/sysctl.c | 13 +------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c index add35c51e017..d80dd92a483a 100644 --- a/arch/sh/kernel/vsyscall/vsyscall.c +++ b/arch/sh/kernel/vsyscall/vsyscall.c @@ -14,6 +14,7 @@ #include #include #include +#include #include /* @@ -30,6 +31,17 @@ static int __init vdso_setup(char *s) } __setup("vdso=", vdso_setup); +static const struct ctl_table vdso_table[] = { + { + .procname = "vdso_enabled", + .data = &vdso_enabled, + .maxlen = sizeof(vdso_enabled), + .mode = 0644, + .proc_handler = proc_dointvec, + .extra1 = SYSCTL_ZERO, + }, +}; + /* * These symbols are defined by vsyscall.o to mark the bounds * of the ELF DSO images included therein. @@ -58,6 +70,14 @@ int __init vsyscall_init(void) return 0; } +static int __init vm_sysctl_init(void) +{ + register_sysctl_init("vm", vdso_table); + return 0; +} + +fs_initcall(vm_sysctl_init); + /* Setup a VMA at program startup for the vsyscall page */ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) { diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 7ff07b7560b4..21c362768358 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2012,18 +2012,7 @@ static struct ctl_table kern_table[] = { #endif }; -static struct ctl_table vm_table[] = { -#if defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL) - { - .procname = "vdso_enabled", - .data = &vdso_enabled, - .maxlen = sizeof(vdso_enabled), - .mode = 0644, - .proc_handler = proc_dointvec, - .extra1 = SYSCTL_ZERO, - }, -#endif -}; +static struct ctl_table vm_table[] = {}; int __init sysctl_init_bases(void) {