Skip to contentSkip to conversation

kernel/pid_sysctl.h: Add missing definitions for specific config

PATCH In review SeongJae Park 2 participants 2 messages Dec 16, 2022 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/pid_sysctl.h: Add missing definitions for specific config

Commit bdb6231e88a3 ("mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC") on mm-unstable when CONFIG_SYSCTL or CONFIG_MEMFD_CRETE not defined, as below, because initialize_memfd_noexec_scope() and register_pid_ns_sysctl_table_vm(), which defined by the commit, is not defined for the config case.

ERROR:root:/kernel/pid_namespace.c: In function ‘create_pid_namespace’:
/kernel/pid_namespace.c:114:2: error: implicit declaration of function ‘initialize_memfd_noexec_scope’; did you mean ‘set_memfd_noexec_scope’? [-Werror=implicit-function-declaration]
114 | initialize_memfd_noexec_scope(ns);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| set_memfd_noexec_scope
/kernel/pid_namespace.c: In function ‘pid_namespaces_init’:
/kernel/pid_namespace.c:462:2: error: implicit declaration of function ‘register_pid_ns_sysctl_table_vm’; did you mean ‘register_pid_ns_ctl_table_vm’? [-Werror=implicit-function-declaration]
462 | register_pid_ns_sysctl_table_vm();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| register_pid_ns_ctl_table_vm
cc1: some warnings being treated as errors
make[3]: *** [/scripts/Makefile.build:250: kernel/pid_namespace.o] Error 1

Fix the commit by defining the functions for the configuration.

Fixes bdb6231e88a3 ("mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC") on mm-unstable
---
 kernel/pid_sysctl.h | 2 ++
 1 file changed, 2 insertions(+)
kernel/pid_sysctl.h +2 -0
index 90a93161a122..770c060a0d33 100644
@@ -52,8 +52,10 @@ static inline void register_pid_ns_sysctl_table_vm(void)
 	register_sysctl_paths(vm_path, pid_ns_ctl_table_vm);
 }
 #else
+static inline void initialize_memfd_noexec_scope(struct pid_namespace *ns) {}
 static inline void set_memfd_noexec_scope(struct pid_namespace *ns) {}
 static inline void register_pid_ns_ctl_table_vm(void) {}
+static inline void register_pid_ns_sysctl_table_vm(void) {}
 #endif
 
 #endif /* LINUX_PID_SYSCTL_H */
Signature · 1 line
2.25.1
#1 lore raw

Hi SeongJae
Thank you for fixing this.
Do I need to send v9 of the original patch ?

Quoted 33 lines · SeongJae Park

Commit bdb6231e88a3 ("mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC") on mm-unstable when CONFIG_SYSCTL or CONFIG_MEMFD_CRETE not defined, as below, because initialize_memfd_noexec_scope() and register_pid_ns_sysctl_table_vm(), which defined by the commit, is not defined for the config case.

ERROR:root:/kernel/pid_namespace.c: In function ‘create_pid_namespace’:
/kernel/pid_namespace.c:114:2: error: implicit declaration of function ‘initialize_memfd_noexec_scope’; did you mean ‘set_memfd_noexec_scope’? [-Werror=implicit-function-declaration]
114 | initialize_memfd_noexec_scope(ns);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| set_memfd_noexec_scope
/kernel/pid_namespace.c: In function ‘pid_namespaces_init’:
/kernel/pid_namespace.c:462:2: error: implicit declaration of function ‘register_pid_ns_sysctl_table_vm’; did you mean ‘register_pid_ns_ctl_table_vm’? [-Werror=implicit-function-declaration]
462 | register_pid_ns_sysctl_table_vm();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| register_pid_ns_ctl_table_vm
cc1: some warnings being treated as errors
make[3]: *** [/scripts/Makefile.build:250: kernel/pid_namespace.o] Error 1

Fix the commit by defining the functions for the configuration.

Fixes bdb6231e88a3 ("mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC") on mm-unstable
---
 kernel/pid_sysctl.h | 2 ++
 1 file changed, 2 insertions(+)
kernel/pid_sysctl.h +0 -0
index 90a93161a122..770c060a0d33 100644

kernel/pid_sysctl.h static inline void register_pid_ns_sysctl_table_vm(void) · line 57

Quoted 6 lines
kernel/pid_sysctl.h +1 -0
@@ -52,8 +52,10 @@ static inline void register_pid_ns_sysctl_table_vm(void)
        register_sysctl_paths(vm_path, pid_ns_ctl_table_vm);
 }
 #else
+static inline void initialize_memfd_noexec_scope(struct pid_namespace *ns) {}
 static inline void set_memfd_noexec_scope(struct pid_namespace *ns) {}
 static inline void register_pid_ns_ctl_table_vm(void) {}

register_pid_ns_ctl_table_vm can be removed.

Thanks
Jeff

+static inline void register_pid_ns_sysctl_table_vm(void) {}

Quoted 6 lines
kernel/pid_sysctl.h +0 -1
 #endif
 
 #endif /* LINUX_PID_SYSCTL_H */
--

2.25.1