From: "Günther Noack" <gnoack@google.com>
To: "Mickaël Salaün" <mic@digikod.net>
Cc: linux-security-module@vger.kernel.org, Tingmao Wang <m@maowtm.org>
Subject: Re: [PATCH v1] landlock: Remove warning in collect_domain_accesses()
Date: Mon, 23 Jun 2025 12:44:54 +0200 [thread overview]
Message-ID: <aFkwFudOCoD0vsjt@google.com> (raw)
In-Reply-To: <20250618134734.1673254-1-mic@digikod.net>
On Wed, Jun 18, 2025 at 03:47:31PM +0200, Mickaël Salaün wrote:
> As in is_access_to_paths_allowed(), it is also possible to reach
> disconnected root directories in collect_domain_accesses().
>
> Remove a wrong WARN_ON_ONCE() canary in collect_domain_accesses() and
> fix comment. Using an unlikely() annotation doesn't seem appropriate
> here. A following patch from Tingmao tests this case [1].
>
> Cc: Günther Noack <gnoack@google.com>
> Reported-by: Tingmao Wang <m@maowtm.org>
> Link: https://lore.kernel.org/r/09b24128f86973a6022e6aa8338945fcfb9a33e4.1749925391.git.m@maowtm.org [1]
> Fixes: b91c3e4ea756 ("landlock: Add support for file reparenting with LANDLOCK_ACCESS_FS_REFER")
> Signed-off-by: Mickaël Salaün <mic@digikod.net>
> ---
> security/landlock/fs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/security/landlock/fs.c b/security/landlock/fs.c
> index 6fee7c20f64d..1d6c4e728f92 100644
> --- a/security/landlock/fs.c
> +++ b/security/landlock/fs.c
> @@ -1061,8 +1061,8 @@ static bool collect_domain_accesses(
> break;
> }
>
> - /* We should not reach a root other than @mnt_root. */
> - if (dir == mnt_root || WARN_ON_ONCE(IS_ROOT(dir)))
> + /* Stops at the mount point or disconnected root directories. */
> + if (dir == mnt_root || IS_ROOT(dir))
> break;
>
> parent_dentry = dget_parent(dir);
> --
> 2.49.0
>
Reviewed-by: Günther Noack <gnoack@google.com>
next prev parent reply other threads:[~2025-06-23 10:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 13:47 [PATCH v1] landlock: Remove warning in collect_domain_accesses() Mickaël Salaün
2025-06-23 10:44 ` Günther Noack [this message]
2025-07-01 20:03 ` Mickaël Salaün
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=aFkwFudOCoD0vsjt@google.com \
--to=gnoack@google.com \
--cc=linux-security-module@vger.kernel.org \
--cc=m@maowtm.org \
--cc=mic@digikod.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).