Package: psmisc
Version: 23.6-1

root filesystem: /dev/sda3 / btrfs rw,relatime,compress=zstd:1,ssd,
                   space_cache=v2,subvolid=256,subvol=/@rootfs 0 0
libc6: 2.36-9+deb12u1
kernel: 6.1.38-4
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE,
                      TAINT_UNSIGNED_MODULE

I believe that fuser(1) should work on libraries, but on this system
it doesn't:

$ fuser /usr/lib/x86_64-linux-gnu/libc.so.6                                    
$ stat -L /usr/lib/x86_64-linux-gnu/libc.so.6                                  
  File: /usr/lib/x86_64-linux-gnu/libc.so.6
  Size: 1922136         Blocks: 3760       IO Block: 4096   regular file
Device: 0,27    Inode: 1834061     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-08-15 11:03:22.556128174 -0400
Modify: 2023-07-13 14:07:47.000000000 -0400
Change: 2023-07-24 23:46:40.235502863 -0400
 Birth: 2023-07-24 23:46:39.943488643 -0400
$ grep -F libc.so /proc/$$/maps
7f6c81da2000-7f6c81dc8000 r--p 00000000 00:19 1834061                    
/usr/lib/x86_64-linux-gnu/libc.so.6
7f6c81dc8000-7f6c81f1d000 r-xp 00026000 00:19 1834061                    
/usr/lib/x86_64-linux-gnu/libc.so.6
7f6c81f1d000-7f6c81f70000 r--p 0017b000 00:19 1834061                    
/usr/lib/x86_64-linux-gnu/libc.so.6
7f6c81f70000-7f6c81f74000 r--p 001ce000 00:19 1834061                    
/usr/lib/x86_64-linux-gnu/libc.so.6
7f6c81f74000-7f6c81f76000 rw-p 001d2000 00:19 1834061                    
/usr/lib/x86_64-linux-gnu/libc.so.6

It looks like there is a disagreement about which device the file's on:
0,27 vs. 00:19 (i.e., 0,25).

If I change the selection criterion in fuser's check_map() to skip the
device check, then I get the sort of results I expect (although of
course it is wrong to do so).

--- src/fuser.c~        Tue Dec 13 00:22:55 2022
+++ src/fuser.c Tue Aug 15 18:47:33 2023
@@ -1760,8 +1760,12 @@ static void check_map(
                 if (dev_tmp->device == tmp_device)
                     add_matched_proc(dev_tmp->name, pid, uid, access);
             for (ino_tmp = ino_head; ino_tmp != NULL; ino_tmp = ino_tmp->next)
-                if (ino_tmp->device == tmp_device
+# if 0
+               if (ino_tmp->device == tmp_device
                     && ino_tmp->inode == tmp_inode)
+# else
+               if (ino_tmp->inode == tmp_inode)
+# endif
                     add_matched_proc(ino_tmp->name, pid, uid, access);
         }
     }

Reply via email to