[WTF][landlock] d_is_negative(fd_file(f)->f_path.dentry) ???
Al Viro
viro at zeniv.linux.org.uk
Thu Apr 24 22:00:11 UTC 2025
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.
More information about the Linux-security-module-archive
mailing list