lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190211205938.GE20493@dastard>
Date:   Tue, 12 Feb 2019 07:59:38 +1100
From:   Dave Chinner <david@...morbit.com>
To:     Tavian Barnes <tavianator@...ianator.com>
Cc:     linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: d_type and bind mounts

On Mon, Feb 11, 2019 at 02:59:29PM -0500, Tavian Barnes wrote:
> It seems that readdir()/getdents() fill d_type from the underlying
> filesystem, not respecting bind mounts of non-directories:
> 
> $ touch mount_point
> $ sudo mount --bind /dev/null mount_point
> $ find -name mount_point -type c
> $ find -name mount_point -type f
> ./mount_point
> 
> (Requires a fairly recent GNU findutils to reproduce, older ones
> always call stat().)  I've seen similar discussions about d_ino being
> for the underlying file, not the mount point, which people have said

Find is using readdir to look up the directory entry, so what it
finds is the underlying filesystem dirent that is completely unaware
that the dentry cache has an overlayed mountpoint above the
filesystem.  d_type is stored in the underlying directory, so it is
reported from the on-disk information in the underlying filesystem,
not the dentry cache that is aware of the mount point at that
location.

> is technically a POSIX violation but also unlikely to be fixed.  Is
> the same true of d_type?  And is there some workaround a program could
> use to get the actual type without the overhead of a whole stat()
> call? For example, a way to tell whether a directory entry is a mount
> point?

Not that I know of, but that doesn't mean there isn't one. In
general, though, if you are looking for something overlaid on the
underlying dirent (like a mount point) then you have to trigger a
path walk to find whatever is overlaid on that location.

Cheers,

Dave.
-- 
Dave Chinner
david@...morbit.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ