From: "Mickaël Salaün" <mic@digikod.net>
To: "Günther Noack" <gnoack@google.com>
Cc: linux-security-module@vger.kernel.org, Tingmao Wang <m@maowtm.org>
Subject: Re: [PATCH v1] landlock: Remove warning in collect_domain_accesses()
Date: Tue, 1 Jul 2025 22:03:12 +0200 [thread overview]
Message-ID: <20250701.Thaey9eej8oo@digikod.net> (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>
This patch hides an edge cases that I though wasn't supposed to happen.
I'll drop it in favor of this other patch which fixes the underlying
issue:
https://lore.kernel.org/all/20250701183812.3201231-1-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
>
>
prev parent reply other threads:[~2025-07-01 20:10 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
2025-07-01 20:03 ` Mickaël Salaün [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=20250701.Thaey9eej8oo@digikod.net \
--to=mic@digikod.net \
--cc=gnoack@google.com \
--cc=linux-security-module@vger.kernel.org \
--cc=m@maowtm.org \
/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.