[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202506071247.JCFuvo4j-lkp@intel.com>
Date: Sat, 7 Jun 2025 12:33:41 +0800
From: kernel test robot <lkp@...el.com>
To: Benjamin Berg <benjamin@...solutions.net>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Johannes Berg <johannes.berg@...el.com>
Subject: arch/um/os-Linux/start_up.c:309:39: sparse: sparse: Using plain
integer as NULL pointer
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@...el.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
Powered by blists - more mailing lists