Thread (30 messages) 30 messages, 5 authors, 2025-01-09

Re: [PATCH v4 -next 14/15] sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c

From: yukaixiong <hidden>
Date: 2025-01-09 02:33:16
Also in: linux-fsdevel, linux-mm, linux-nfs, linux-security-module, linux-sh, lkml


On 2025/1/3 19:11, Geert Uytterhoeven wrote:
quoted hunk ↗ jump to hunk
Hi Kaixiong,

On Sat, Dec 28, 2024 at 4:07 PM Kaixiong Yu [off-list ref] wrote:
quoted
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. After this patch is applied,
all sysctls of vm_table would be moved. So, delete vm_table.

Signed-off-by: Kaixiong Yu <redacted>
Reviewed-by: Kees Cook <kees@kernel.org>
---
v4:
  - const qualify struct ctl_table vdso_table
Thanks for your patch!

I gave this a try on landisk, and /proc/sys/vm/vdso_enabled
disappeared.
quoted
--- a/arch/sh/kernel/vsyscall/vsyscall.c
+++ b/arch/sh/kernel/vsyscall/vsyscall.c
@@ -55,6 +67,8 @@ int __init vsyscall_init(void)
                &vsyscall_trapa_start,
                &vsyscall_trapa_end - &vsyscall_trapa_start);

+       register_sysctl_init("vm", vdso_table);
     "failed when register_sysctl_sz vdso_table to vm"

Adding some debug prints shows that kzalloc() in
__register_sysctl_table() fails, presumably because it is called too
early in the boot process.
quoted
+
         return 0;
  }
Moving the call to register_sysctl_init() into its own fs_initcall(),
like the gmail-whitespace-damaged patch below, fixes that.
--- a/arch/sh/kernel/vsyscall/vsyscall.c
+++ b/arch/sh/kernel/vsyscall/vsyscall.c
@@ -67,11 +67,17 @@ int __init vsyscall_init(void)
                &vsyscall_trapa_start,
                &vsyscall_trapa_end - &vsyscall_trapa_start);

-       register_sysctl_init("vm", vdso_table);
+       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)
  {
Gr{oetje,eeting}s,

                         Geert
Thank you so much for your test and fix patch !

I will fix it in patches series v5.

Best ...

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help