All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Günther Noack" <gnoack@google.com>
To: kernel test robot <lkp@intel.com>
Cc: "Mickaël Salaün" <mic@digikod.net>, oe-kbuild-all@lists.linux.dev
Subject: Re: [linux-next:master 9036/10560] security/landlock/cap.c:108 hook_mmap_addr() warn: always true condition '(addr >= 0) => (0-u32max >= 0)'
Date: Tue, 24 Nov 2026 13:10:37 +0100	[thread overview]
Message-ID: <awV-vbDGqKjknlyj@google.com> (raw)
In-Reply-To: <20261121123703.ufHSg06x-lkp@intel.com>

On Sat, Nov 21, 2026 at 12:42:12PM +0100, kernel test robot wrote:
> 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

False positive


dac_mmap_min_addr is defined as

    unsigned long dac_mmap_min_addr = CONFIG_DEFAULT_MMAP_MIN_ADDR;

so it is just your specific kernel configuration where that condition
is unconditionally true.

—Günther

      reply	other threads:[~2026-11-24 12:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awV-vbDGqKjknlyj@google.com \
    --to=gnoack@google.com \
    --cc=lkp@intel.com \
    --cc=mic@digikod.net \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.