All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 9036/10560] security/landlock/cap.c:108 hook_mmap_addr() warn: always true condition '(addr >= 0) => (0-u32max >= 0)'
@ 2026-11-21 11:42 kernel test robot
  2026-11-24 12:10 ` Günther Noack
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-11-21 11:42 UTC (permalink / raw)
  To:  Mickaël Salaün ; +Cc: oe-kbuild-all,  Günther Noack

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   909ef7a9a30fa139e69e555e3606680f5cca7726
commit: 25590e68c40753e28e4713d2dbfde6ba10a7daeb [9036/10560] landlock: Mediate CAP_SYS_RAWIO for mappings below mmap_min_addr
config: m68k-randconfig-2200-20261121 (https://download.01.org/0day-ci/archive/20261121/20261121123703.ufHSg06x-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 8.5.0
smatch: v0.5.0-9187-g5189e3fb

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/20261121123703.ufHSg06x-lkp@intel.com/

New smatch warnings:
security/landlock/cap.c:108 hook_mmap_addr() warn: always true condition '(addr >= 0) => (0-u32max >= 0)'

Old smatch warnings:
arch/m68k/include/asm/io_no.h:50 __cf_internalio() warn: always true condition '(addr <= 3758096384 + 536870912 - 1) => (0-u32max <= u32max)'

vim +108 security/landlock/cap.c

    93	
    94	/**
    95	 * hook_mmap_addr - Restrict mappings below dac_mmap_min_addr
    96	 *
    97	 * @addr: Address of the new mapping.
    98	 *
    99	 * cap_mmap_addr() requires CAP_SYS_RAWIO to map below dac_mmap_min_addr, but
   100	 * calls cap_capable() directly, which skips hook_capable().  Check the same
   101	 * condition against the domain.  commoncap runs first, so this only sees
   102	 * mappings that commoncap allowed.
   103	 *
   104	 * Return: 0 if allowed, -EPERM if CAP_SYS_RAWIO use is denied.
   105	 */
   106	static int hook_mmap_addr(unsigned long addr)
   107	{
 > 108		if (addr >= dac_mmap_min_addr)
   109			return 0;
   110	
   111		return check_cap(current_cred(), CAP_SYS_RAWIO, CAP_OPT_NONE);
   112	}
   113	

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

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

end of thread, other threads:[~2026-11-24 12:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-21 11:42 [linux-next:master 9036/10560] security/landlock/cap.c:108 hook_mmap_addr() warn: always true condition '(addr >= 0) => (0-u32max >= 0)' kernel test robot
2026-11-24 12:10 ` Günther Noack

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.