]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lsfd: refer to /proc/$pid/map_files if a mapped file is masked
authorMasatake YAMATO <yamato@redhat.com>
Sun, 31 Aug 2025 01:03:03 +0000 (10:03 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Thu, 25 Sep 2025 20:27:20 +0000 (05:27 +0900)
commiteeb42cef6bea9bd5d6f657b8c58e41b4b5371d21
treeba5a3671b4c6bcf2a1ed34919d72c3bfa726d341
parent57d59a5cd5ba6c0b32cae27f5ce48241274f6e6e
lsfd: refer to /proc/$pid/map_files if a mapped file is masked

To extract file information, lsfd called stat(2) on the the file name
found in /proc/$pid/maps. However, lsfd may retrieve information for
the wrong file if the file is bind-mount'ed after the process maps the
file.

To obtain the information about the originally mapped file, this
change makes lsfd call fstat(2) on the corresponding entry under
/proc/$pid/map_files avoiding the bind-mount ambiguity.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
lsfd-cmd/lsfd.c
tests/expected/lsfd/mkfds-mmap-masked-file [new file with mode: 0644]
tests/ts/lsfd/mkfds-mmap-masked-file [new file with mode: 0755]