Added empty sys_ememz
Subsystems (6)
PATCH 1/1 Added empty sys_ememz
--- arch/x86/entry/syscalls/syscall_32.tbl | 1 + arch/x86/entry/syscalls/syscall_64.tbl | 1 + include/linux/syscalls.h | 1 + include/uapi/asm-generic/unistd.h | 5 ++++- kernel/sys_ni.c | 3 +++ mm/Kconfig | 7 +++++++ mm/ememz.c | 18 ++++++++++++++++++ 7 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 mm/ememz.c
arch/x86/entry/syscalls/syscall_32.tbl +1 -0
@@ -457,3 +457,4 @@ 450 i386 set_mempolicy_home_node sys_set_mempolicy_home_node 451 i386 cachestat sys_cachestat 452 i386 fchmodat2 sys_fchmodat2 +453 i386 ememz sys_ememz
arch/x86/entry/syscalls/syscall_64.tbl +1 -0
@@ -375,6 +375,7 @@ 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 453 64 map_shadow_stack sys_map_shadow_stack +454 common ememz sys_ememz # # Due to a historical design error, certain syscalls are numbered differently
include/linux/syscalls.h +1 -0
@@ -940,6 +940,7 @@ asmlinkage long sys_cachestat(unsigned int fd,struct cachestat_range __user *cstat_range, struct cachestat __user *cstat, unsigned int flags);asmlinkage long sys_map_shadow_stack (unsigned long addr,unsigned long size,unsigned int flags); +asmlinkage long sys_ememz (int flags);/* * Architecture-specific system calls
include/uapi/asm-generic/unistd.h +4 -1
@@ -823,8 +823,11 @@ __SYSCALL(__NR_cachestat, sys_cachestat)#define __NR_fchmodat2 452 __SYSCALL(__NR_fchmodat2, sys_fchmodat2) +#define __NR_ememz 453 +__SYSCALL(__NR_ememz, sys_ememz) +#undef __NR_syscalls -#define __NR_syscalls 453 +#define __NR_syscalls 454/* * 32 bit systems traditionally used different
kernel/sys_ni.c +3 -0
@@ -253,6 +253,9 @@ COND_SYSCALL(pkey_free);/* memfd_secret */ COND_SYSCALL (memfd_secret); +/* ememz */ +COND_SYSCALL (ememz); +/* * Architecture specific weak syscall entries. */
mm/Kconfig +7 -0
@@ -1260,4 +1260,11 @@ config LOCK_MM_AND_FIND_VMA source "mm/damon/Kconfig" +config EMEMZ_SYSCALL + bool "Ememz syscall" if EXPERT + default y + help + sys_ememz is a system call to flag a process' memory to be filled + with zeros on exit. + endmenu
mm/ememz.c new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <linux/syscalls.h> + +#ifdef CONFIG_EMEMZ_SYSCALL +/* +* Set task_struct flag to fill any memory associated with process on +* exit to zero. +*/ +SYSCALL_DEFINE1(ememz, int, flags) +{ +if (flags & ~(0 )) +return -EINVAL ; + +// Set flag atomically +return 0 ; +} +#endif
Signature · 11 lines
2.34.1 Hi, I am looking for a more fine grained alternative with less system overhead to CONFIG_INIT_ON_FREE_DEFAULT_ON. My idea was to add a system call (ememz) to set a flag in the task_struct that causes initialization of all a process' pages on exit. Are there already any other alternatives I should consider and is this the proper way to go on with it? Any suggestions are welcome. Signed-off-by: York Jasper Niebuhr <[email protected]>
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi York,
kernel test robot noticed the following build warnings:
[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on tip/x86/asm linus/master v6.6-rc7] [cannot apply to arnd-asm-generic/master next-20231027]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/York-Jasper-Niebuhr/Added-empty-sys_ememz/20231029-044215 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20231028204046.11258-1-yjnworkstation%40gmail.com patch subject: [PATCH] Added empty sys_ememz config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231029/[email protected]/config) compiler: m68k-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231029/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> <stdin>:1573:2: warning: #warning syscall ememz not implemented [-Wcpp] -- >> <stdin>:1573:2: warning: #warning syscall ememz not implemented [-Wcpp]
--
scripts/genksyms/parse.y: warning: 9 shift/reduce conflicts [-Wconflicts-sr] scripts/genksyms/parse.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr] scripts/genksyms/parse.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
>> <stdin>:1573:2: warning: #warning syscall ememz not implemented [-Wcpp]
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki