From: sashiko-bot@kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: Re: [PATCH 2/6] landlock: Mediate CAP_SYS_RAWIO for mappings below mmap_min_addr
Date: Tue, 10 Nov 2026 20:33:50 +0000 [thread overview]
Message-ID: <sashiko-outbox-207713@kernel.org> (raw)
In-Reply-To: <20261110202436.2408244-3-mic@digikod.net>
> Until now, a process in a domain that denies CAP_SYS_RAWIO could still
> map memory below the vm.mmap_min_addr limit if it held this capability.
> cap_mmap_addr() is commoncap's mmap_addr hook, and it checks
> CAP_SYS_RAWIO with cap_capable(), not security_capable(), so the check
> never reaches hook_capable(). Mapping the lowest pages is what this
> limit protects against, because it helps to exploit kernel NULL pointer
> dereferences.
>
> Add a Landlock mmap_addr hook that checks CAP_SYS_RAWIO against the
> domain under the same condition as cap_mmap_addr(). With the same
> vm.mmap_min_addr value, the hook only denies mappings for which
> commoncap required the capability. security_mmap_addr() stops at
> commoncap's error, so processes without the capability get the same
> result as before. This also covers the x86 vm86() syscalls, which use
> the same check for address 0.
>
> Making cap_mmap_addr() call capable() would also fix this, but it would
> send every low mapping through the capable hook of all LSMs (SELinux,
> AppArmor, SafeSetID, BPF LSM programs), adding capability checks that
> their policies never had to handle. For instance, SELinux checks
> mmap_zero in its own mmap_addr hook and keeps it separate from the
> capability on purpose. LSMs with their own policy for low mappings
> implement it in this hook, so Landlock does the same.
>
> Cc: Günther Noack <gnoack@google.com>
> Cc: Paul Moore <paul@paul-moore.com>
> Cc: Serge Hallyn <serge@hallyn.com>
> Reported-by: Ada Smith <adasmithgt@gmail.com>
> Fixes: 97c8386f1d74 ("landlock: Enforce capability restrictions")
> Signed-off-by: Mickaël Salaün <mic@digikod.net>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110202436.2408244-1-mic@digikod.net?part=2
next prev parent reply other threads:[~2026-11-10 20:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 20:24 [PATCH 0/6] Fix Landlock mediation of commoncap's capability checks Mickaël Salaün
2026-11-10 20:24 ` [PATCH 1/6] landlock: Factor out capability denial checks Mickaël Salaün
2026-11-10 20:28 ` sashiko-bot
2026-11-10 20:24 ` [PATCH 2/6] landlock: Mediate CAP_SYS_RAWIO for mappings below mmap_min_addr Mickaël Salaün
2026-11-10 20:33 ` sashiko-bot [this message]
2026-11-10 20:24 ` [PATCH 3/6] landlock: Mediate CAP_SETPCAP for inheritable capabilities Mickaël Salaün
2026-11-10 20:36 ` sashiko-bot
2026-11-10 20:24 ` [PATCH 4/6] landlock: Mediate CAP_SYS_ADMIN for the admin memory reserve Mickaël Salaün
2026-11-10 20:40 ` sashiko-bot
2026-11-10 20:24 ` [PATCH 5/6] selftests/landlock: Test capability checks outside the capable hook Mickaël Salaün
2026-11-10 20:54 ` sashiko-bot
2026-11-10 20:24 ` [PATCH 6/6] landlock: Fix capability restriction documentation Mickaël Salaün
2026-11-10 20:55 ` sashiko-bot
2026-11-11 18:28 ` [PATCH 0/6] Fix Landlock mediation of commoncap's capability checks Serge Hallyn (AMD)
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=sashiko-outbox-207713@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=sashiko-reviews@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.