public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* arch/um/os-Linux/start_up.c:309:39: sparse: sparse: Using plain integer as NULL pointer
@ 2025-06-07  4:33 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-06-07  4:33 UTC (permalink / raw)
  To: Benjamin Berg; +Cc: oe-kbuild-all, linux-kernel, Johannes Berg

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   119b1e61a769aa98e68599f44721661a4d8c55f3
commit: beddc9fb1cb161e1bf779b180750b648ff9690c7 um: Add SECCOMP support detection and initialization
date:   5 days ago
config: um-randconfig-r112-20250607 (https://download.01.org/0day-ci/archive/20250607/202506071247.JCFuvo4j-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250607/202506071247.JCFuvo4j-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506071247.JCFuvo4j-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   arch/um/os-Linux/start_up.c: note: in included file (through include/linux/compiler_types.h, arch/um/include/shared/init.h):
   include/linux/compiler_attributes.h:55:9: sparse: sparse: preprocessor token __always_inline redefined
   arch/um/os-Linux/start_up.c: note: in included file (through /usr/include/features.h, /usr/include/sys/types.h, arch/um/include/shared/user.h, builtin):
   /usr/include/sys/cdefs.h:426:10: sparse: this was the original definition
>> arch/um/os-Linux/start_up.c:309:39: sparse: sparse: Using plain integer as NULL pointer

vim +309 arch/um/os-Linux/start_up.c

   287	
   288	static bool __init init_seccomp(void)
   289	{
   290		int pid;
   291		int status;
   292		int n;
   293		unsigned long sp;
   294	
   295		/* doesn't work on 32-bit right now */
   296		if (!IS_ENABLED(CONFIG_64BIT))
   297			return false;
   298	
   299		/*
   300		 * We check that we can install a seccomp filter and then exit(0)
   301		 * from a trapped syscall.
   302		 *
   303		 * Note that we cannot verify that no seccomp filter already exists
   304		 * for a syscall that results in the process/thread to be killed.
   305		 */
   306	
   307		os_info("Checking that seccomp filters can be installed...");
   308	
 > 309		seccomp_test_stub_data = mmap(0, sizeof(*seccomp_test_stub_data),
   310					      PROT_READ | PROT_WRITE,
   311					      MAP_SHARED | MAP_ANON, 0, 0);
   312	
   313		/* Use the syscall data area as stack, we just need something */
   314		sp = (unsigned long)&seccomp_test_stub_data->syscall_data +
   315		     sizeof(seccomp_test_stub_data->syscall_data) -
   316		     sizeof(void *);
   317		pid = clone(seccomp_helper, (void *)sp, CLONE_VFORK | CLONE_VM, NULL);
   318	
   319		if (pid < 0)
   320			fatal_perror("check_seccomp : clone failed");
   321	
   322		CATCH_EINTR(n = waitpid(pid, &status, __WCLONE));
   323		if (n < 0)
   324			fatal_perror("check_seccomp : waitpid failed");
   325	
   326		if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
   327			struct uml_pt_regs *regs;
   328			unsigned long fp_size;
   329			int r;
   330	
   331			/* Fill in the host_fp_size from the mcontext. */
   332			regs = calloc(1, sizeof(struct uml_pt_regs));
   333			get_stub_state(regs, seccomp_test_stub_data, &fp_size);
   334			host_fp_size = fp_size;
   335			free(regs);
   336	
   337			/* Repeat with the correct size */
   338			regs = calloc(1, sizeof(struct uml_pt_regs) + host_fp_size);
   339			r = get_stub_state(regs, seccomp_test_stub_data, NULL);
   340	
   341			/* Store as the default startup registers */
   342			exec_fp_regs = malloc(host_fp_size);
   343			memcpy(exec_regs, regs->gp, sizeof(exec_regs));
   344			memcpy(exec_fp_regs, regs->fp, host_fp_size);
   345	
   346			munmap(seccomp_test_stub_data, sizeof(*seccomp_test_stub_data));
   347	
   348			free(regs);
   349	
   350			if (r) {
   351				os_info("failed to fetch registers: %d\n", r);
   352				return false;
   353			}
   354	
   355			os_info("OK\n");
   356			return true;
   357		}
   358	
   359		if (WIFEXITED(status) && WEXITSTATUS(status) == 2)
   360			os_info("missing\n");
   361		else
   362			os_info("error\n");
   363	
   364		munmap(seccomp_test_stub_data, sizeof(*seccomp_test_stub_data));
   365		return false;
   366	}
   367	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* arch/um/os-Linux/start_up.c:309:39: sparse: sparse: Using plain integer as NULL pointer
@ 2025-12-15 19:45 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-12-15 19:45 UTC (permalink / raw)
  To: Benjamin Berg; +Cc: oe-kbuild-all, linux-kernel, Johannes Berg

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8f0b4cce4481fb22653697cced8d0d04027cb1e8
commit: beddc9fb1cb161e1bf779b180750b648ff9690c7 um: Add SECCOMP support detection and initialization
date:   7 months ago
config: um-randconfig-r123-20251214 (https://download.01.org/0day-ci/archive/20251216/202512160342.z3BTz6kZ-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251216/202512160342.z3BTz6kZ-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512160342.z3BTz6kZ-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   arch/um/os-Linux/start_up.c: note: in included file (through include/linux/compiler_types.h, arch/um/include/shared/init.h):
   include/linux/compiler_attributes.h:55:9: sparse: sparse: preprocessor token __always_inline redefined
   arch/um/os-Linux/start_up.c: note: in included file (through /usr/include/features.h, /usr/include/sys/types.h, arch/um/include/shared/user.h, builtin):
   /usr/include/sys/cdefs.h:595:10: sparse: this was the original definition
   arch/um/os-Linux/start_up.c: note: in included file (through arch/um/include/shared/init.h):
   include/linux/compiler_types.h:348:10: sparse: sparse: preprocessor token __counted_by redefined
   arch/um/os-Linux/start_up.c: note: in included file (through /usr/include/linux/posix_types.h, /usr/include/linux/types.h, /usr/include/bits/sched.h, /usr/include/sched.h):
   /usr/include/linux/stddef.h:62:9: sparse: this was the original definition
   arch/um/os-Linux/start_up.c: note: in included file (through arch/um/include/shared/init.h):
   include/linux/compiler_types.h:367:9: sparse: sparse: preprocessor token __counted_by_le redefined
   arch/um/os-Linux/start_up.c: note: in included file (through /usr/include/linux/posix_types.h, /usr/include/linux/types.h, /usr/include/bits/sched.h, /usr/include/sched.h):
   /usr/include/linux/stddef.h:66:9: sparse: this was the original definition
   arch/um/os-Linux/start_up.c: note: in included file (through arch/um/include/shared/init.h):
   include/linux/compiler_types.h:368:9: sparse: sparse: preprocessor token __counted_by_be redefined
   arch/um/os-Linux/start_up.c: note: in included file (through /usr/include/linux/posix_types.h, /usr/include/linux/types.h, /usr/include/bits/sched.h, /usr/include/sched.h):
   /usr/include/linux/stddef.h:70:9: sparse: this was the original definition
>> arch/um/os-Linux/start_up.c:309:39: sparse: sparse: Using plain integer as NULL pointer

vim +309 arch/um/os-Linux/start_up.c

   287	
   288	static bool __init init_seccomp(void)
   289	{
   290		int pid;
   291		int status;
   292		int n;
   293		unsigned long sp;
   294	
   295		/* doesn't work on 32-bit right now */
   296		if (!IS_ENABLED(CONFIG_64BIT))
   297			return false;
   298	
   299		/*
   300		 * We check that we can install a seccomp filter and then exit(0)
   301		 * from a trapped syscall.
   302		 *
   303		 * Note that we cannot verify that no seccomp filter already exists
   304		 * for a syscall that results in the process/thread to be killed.
   305		 */
   306	
   307		os_info("Checking that seccomp filters can be installed...");
   308	
 > 309		seccomp_test_stub_data = mmap(0, sizeof(*seccomp_test_stub_data),
   310					      PROT_READ | PROT_WRITE,
   311					      MAP_SHARED | MAP_ANON, 0, 0);
   312	
   313		/* Use the syscall data area as stack, we just need something */
   314		sp = (unsigned long)&seccomp_test_stub_data->syscall_data +
   315		     sizeof(seccomp_test_stub_data->syscall_data) -
   316		     sizeof(void *);
   317		pid = clone(seccomp_helper, (void *)sp, CLONE_VFORK | CLONE_VM, NULL);
   318	
   319		if (pid < 0)
   320			fatal_perror("check_seccomp : clone failed");
   321	
   322		CATCH_EINTR(n = waitpid(pid, &status, __WCLONE));
   323		if (n < 0)
   324			fatal_perror("check_seccomp : waitpid failed");
   325	
   326		if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
   327			struct uml_pt_regs *regs;
   328			unsigned long fp_size;
   329			int r;
   330	
   331			/* Fill in the host_fp_size from the mcontext. */
   332			regs = calloc(1, sizeof(struct uml_pt_regs));
   333			get_stub_state(regs, seccomp_test_stub_data, &fp_size);
   334			host_fp_size = fp_size;
   335			free(regs);
   336	
   337			/* Repeat with the correct size */
   338			regs = calloc(1, sizeof(struct uml_pt_regs) + host_fp_size);
   339			r = get_stub_state(regs, seccomp_test_stub_data, NULL);
   340	
   341			/* Store as the default startup registers */
   342			exec_fp_regs = malloc(host_fp_size);
   343			memcpy(exec_regs, regs->gp, sizeof(exec_regs));
   344			memcpy(exec_fp_regs, regs->fp, host_fp_size);
   345	
   346			munmap(seccomp_test_stub_data, sizeof(*seccomp_test_stub_data));
   347	
   348			free(regs);
   349	
   350			if (r) {
   351				os_info("failed to fetch registers: %d\n", r);
   352				return false;
   353			}
   354	
   355			os_info("OK\n");
   356			return true;
   357		}
   358	
   359		if (WIFEXITED(status) && WEXITSTATUS(status) == 2)
   360			os_info("missing\n");
   361		else
   362			os_info("error\n");
   363	
   364		munmap(seccomp_test_stub_data, sizeof(*seccomp_test_stub_data));
   365		return false;
   366	}
   367	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* arch/um/os-Linux/start_up.c:309:39: sparse: sparse: Using plain integer as NULL pointer
@ 2026-05-04  2:02 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-05-04  2:02 UTC (permalink / raw)
  To: Benjamin Berg; +Cc: oe-kbuild-all, linux-kernel, Johannes Berg

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6d35786de28116ecf78797a62b84e6bf3c45aa5a
commit: beddc9fb1cb161e1bf779b180750b648ff9690c7 um: Add SECCOMP support detection and initialization
date:   11 months ago
config: um-randconfig-r111-20260504 (https://download.01.org/0day-ci/archive/20260504/202605040946.zwDQc3lb-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260504/202605040946.zwDQc3lb-lkp@intel.com/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
| Fixes: beddc9fb1cb1 ("um: Add SECCOMP support detection and initialization")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605040946.zwDQc3lb-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   arch/um/os-Linux/start_up.c: note: in included file (through include/linux/compiler_types.h, arch/um/include/shared/init.h):
   include/linux/compiler_attributes.h:55:9: sparse: sparse: preprocessor token __always_inline redefined
   arch/um/os-Linux/start_up.c: note: in included file (through /usr/include/features.h, /usr/include/sys/types.h, arch/um/include/shared/user.h, builtin):
   /usr/include/sys/cdefs.h:595:10: sparse: this was the original definition
   arch/um/os-Linux/start_up.c: note: in included file (through arch/um/include/shared/init.h):
   include/linux/compiler_types.h:346:10: sparse: sparse: preprocessor token __counted_by redefined
   arch/um/os-Linux/start_up.c: note: in included file (through /usr/include/linux/posix_types.h, /usr/include/linux/types.h, /usr/include/bits/sched.h, /usr/include/sched.h):
   /usr/include/linux/stddef.h:62:9: sparse: this was the original definition
   arch/um/os-Linux/start_up.c: note: in included file (through arch/um/include/shared/init.h):
   include/linux/compiler_types.h:367:9: sparse: sparse: preprocessor token __counted_by_le redefined
   arch/um/os-Linux/start_up.c: note: in included file (through /usr/include/linux/posix_types.h, /usr/include/linux/types.h, /usr/include/bits/sched.h, /usr/include/sched.h):
   /usr/include/linux/stddef.h:66:9: sparse: this was the original definition
   arch/um/os-Linux/start_up.c: note: in included file (through arch/um/include/shared/init.h):
   include/linux/compiler_types.h:368:9: sparse: sparse: preprocessor token __counted_by_be redefined
   arch/um/os-Linux/start_up.c: note: in included file (through /usr/include/linux/posix_types.h, /usr/include/linux/types.h, /usr/include/bits/sched.h, /usr/include/sched.h):
   /usr/include/linux/stddef.h:70:9: sparse: this was the original definition
>> arch/um/os-Linux/start_up.c:309:39: sparse: sparse: Using plain integer as NULL pointer

vim +309 arch/um/os-Linux/start_up.c

   287	
   288	static bool __init init_seccomp(void)
   289	{
   290		int pid;
   291		int status;
   292		int n;
   293		unsigned long sp;
   294	
   295		/* doesn't work on 32-bit right now */
   296		if (!IS_ENABLED(CONFIG_64BIT))
   297			return false;
   298	
   299		/*
   300		 * We check that we can install a seccomp filter and then exit(0)
   301		 * from a trapped syscall.
   302		 *
   303		 * Note that we cannot verify that no seccomp filter already exists
   304		 * for a syscall that results in the process/thread to be killed.
   305		 */
   306	
   307		os_info("Checking that seccomp filters can be installed...");
   308	
 > 309		seccomp_test_stub_data = mmap(0, sizeof(*seccomp_test_stub_data),
   310					      PROT_READ | PROT_WRITE,
   311					      MAP_SHARED | MAP_ANON, 0, 0);
   312	
   313		/* Use the syscall data area as stack, we just need something */
   314		sp = (unsigned long)&seccomp_test_stub_data->syscall_data +
   315		     sizeof(seccomp_test_stub_data->syscall_data) -
   316		     sizeof(void *);
   317		pid = clone(seccomp_helper, (void *)sp, CLONE_VFORK | CLONE_VM, NULL);
   318	
   319		if (pid < 0)
   320			fatal_perror("check_seccomp : clone failed");
   321	
   322		CATCH_EINTR(n = waitpid(pid, &status, __WCLONE));
   323		if (n < 0)
   324			fatal_perror("check_seccomp : waitpid failed");
   325	
   326		if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
   327			struct uml_pt_regs *regs;
   328			unsigned long fp_size;
   329			int r;
   330	
   331			/* Fill in the host_fp_size from the mcontext. */
   332			regs = calloc(1, sizeof(struct uml_pt_regs));
   333			get_stub_state(regs, seccomp_test_stub_data, &fp_size);
   334			host_fp_size = fp_size;
   335			free(regs);
   336	
   337			/* Repeat with the correct size */
   338			regs = calloc(1, sizeof(struct uml_pt_regs) + host_fp_size);
   339			r = get_stub_state(regs, seccomp_test_stub_data, NULL);
   340	
   341			/* Store as the default startup registers */
   342			exec_fp_regs = malloc(host_fp_size);
   343			memcpy(exec_regs, regs->gp, sizeof(exec_regs));
   344			memcpy(exec_fp_regs, regs->fp, host_fp_size);
   345	
   346			munmap(seccomp_test_stub_data, sizeof(*seccomp_test_stub_data));
   347	
   348			free(regs);
   349	
   350			if (r) {
   351				os_info("failed to fetch registers: %d\n", r);
   352				return false;
   353			}
   354	
   355			os_info("OK\n");
   356			return true;
   357		}
   358	
   359		if (WIFEXITED(status) && WEXITSTATUS(status) == 2)
   360			os_info("missing\n");
   361		else
   362			os_info("error\n");
   363	
   364		munmap(seccomp_test_stub_data, sizeof(*seccomp_test_stub_data));
   365		return false;
   366	}
   367	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-04  2:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04  2:02 arch/um/os-Linux/start_up.c:309:39: sparse: sparse: Using plain integer as NULL pointer kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2025-12-15 19:45 kernel test robot
2025-06-07  4:33 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox