public inbox for linux-security-module@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: linux-security-module@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Subject: [WTF][landlock] d_is_negative(fd_file(f)->f_path.dentry) ???
Date: Thu, 24 Apr 2025 23:00:11 +0100	[thread overview]
Message-ID: <20250424220011.GJ2023217@ZenIV> (raw)


static int get_path_from_fd(const s32 fd, struct path *const path)
{
...
        if ((fd_file(f)->f_op == &ruleset_fops) ||
            (fd_file(f)->f_path.mnt->mnt_flags & MNT_INTERNAL) ||
            (fd_file(f)->f_path.dentry->d_sb->s_flags & SB_NOUSER) ||
            d_is_negative(fd_file(f)->f_path.dentry) ||
            IS_PRIVATE(d_backing_inode(fd_file(f)->f_path.dentry)))
                return -EBADFD;

	Folks, could somebody explain how exactly can an opened file
come to have a _negative_ dentry?  And if you have found a way for that
to happen, why didn't you report the arseloads of NULL pointer dereference
bugs that would expose, along with assorted memory corruptors, etc.?

	Normally I would just quietly rip the bogus check out, but on
the off-chance that somebody _has_ found a bug that would cause that,
I would prefer to check with those who had added the check in the first
place.

             reply	other threads:[~2025-04-24 22:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 22:00 Al Viro [this message]
2025-04-25  9:38 ` [WTF][landlock] d_is_negative(fd_file(f)->f_path.dentry) ??? 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=20250424220011.GJ2023217@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox