Yesterday, while writing an answer to [How to get full path names of all opened pdf files (in zathura) - like rofi does](https://unix.stackexchange.com/questions/741457/how-to-get-full-path-names-of-all-opened-pdf-files-in-zathura-like-rofi-does) , I noticed something weird about the ownership of files the /proc/PID/ directory for zathura processes - **most of them are owned by root instead of the user (cas) I ran zathura as**.
For example:
$ cd ~/Manuals
$ zathura X399\ Taichi.pdf &
4055396
$ ls -lF /proc/4055396/fd
ls: cannot open directory '/proc/4055396/fd': Permission denied
$ ls -lFd /proc/4055396/fd
dr-x------ 2 root root 0 Mar 31 13:04 /proc/4055396/fd/
huh? why is that owned by root
? I ran it as cas
.
Most, but not all of the files/dirs in /proc/4055396 are owned by root:
$ ls -lF /proc/4055396
ls: cannot read symbolic link '/proc/4055396/cwd': Permission denied
ls: cannot read symbolic link '/proc/4055396/root': Permission denied
ls: cannot read symbolic link '/proc/4055396/exe': Permission denied
total 0
-r--r--r-- 1 root root 0 Mar 31 13:04 arch_status
dr-xr-xr-x 2 cas cas 0 Mar 31 13:04 attr/
-rw-r--r-- 1 root root 0 Mar 31 13:04 autogroup
-r-------- 1 root root 0 Mar 31 13:04 auxv
-r--r--r-- 1 root root 0 Mar 31 13:04 cgroup
--w------- 1 root root 0 Mar 31 13:04 clear_refs
-r--r--r-- 1 root root 0 Mar 31 13:02 cmdline
-rw-r--r-- 1 root root 0 Mar 31 13:04 comm
-rw-r--r-- 1 root root 0 Mar 31 13:04 coredump_filter
-r--r--r-- 1 root root 0 Mar 31 13:04 cpu_resctrl_groups
-r--r--r-- 1 root root 0 Mar 31 13:04 cpuset
lrwxrwxrwx 1 root root 0 Mar 31 13:04 cwd
-r-------- 1 root root 0 Mar 31 13:04 environ
lrwxrwxrwx 1 root root 0 Mar 31 13:02 exe
dr-x------ 2 root root 0 Mar 31 13:04 fd/
dr-xr-xr-x 2 cas cas 0 Mar 31 13:04 fdinfo/
-rw-r--r-- 1 root root 0 Mar 31 13:04 gid_map
-r-------- 1 root root 0 Mar 31 13:04 io
-r-------- 1 root root 0 Mar 31 13:04 ksm_merging_pages
-r-------- 1 root root 0 Mar 31 13:04 ksm_stat
-r--r--r-- 1 root root 0 Mar 31 13:04 limits
-rw-r--r-- 1 root root 0 Mar 31 13:04 loginuid
dr-x------ 2 root root 0 Mar 31 13:04 map_files/
-r--r--r-- 1 root root 0 Mar 31 13:04 maps
-rw------- 1 root root 0 Mar 31 13:04 mem
-r--r--r-- 1 root root 0 Mar 31 13:04 mountinfo
-r--r--r-- 1 root root 0 Mar 31 13:04 mounts
-r-------- 1 root root 0 Mar 31 13:04 mountstats
dr-xr-xr-x 57 cas cas 0 Mar 31 13:04 net/
dr-x--x--x 2 root root 0 Mar 31 13:04 ns/
-r--r--r-- 1 root root 0 Mar 31 13:04 numa_maps
-rw-r--r-- 1 root root 0 Mar 31 13:04 oom_adj
-r--r--r-- 1 root root 0 Mar 31 13:04 oom_score
-rw-r--r-- 1 root root 0 Mar 31 13:04 oom_score_adj
-r-------- 1 root root 0 Mar 31 13:04 pagemap
-r-------- 1 root root 0 Mar 31 13:04 patch_state
-r-------- 1 root root 0 Mar 31 13:04 personality
-rw-r--r-- 1 root root 0 Mar 31 13:04 projid_map
lrwxrwxrwx 1 root root 0 Mar 31 13:04 root
-rw-r--r-- 1 root root 0 Mar 31 13:04 sched
-r--r--r-- 1 root root 0 Mar 31 13:04 schedstat
-r--r--r-- 1 root root 0 Mar 31 13:04 sessionid
-rw-r--r-- 1 root root 0 Mar 31 13:04 setgroups
-r--r--r-- 1 root root 0 Mar 31 13:04 smaps
-r--r--r-- 1 root root 0 Mar 31 13:04 smaps_rollup
-r-------- 1 root root 0 Mar 31 13:04 stack
-r--r--r-- 1 root root 0 Mar 31 13:02 stat
-r--r--r-- 1 root root 0 Mar 31 13:04 statm
-r--r--r-- 1 root root 0 Mar 31 13:04 status
-r-------- 1 root root 0 Mar 31 13:04 syscall
dr-xr-xr-x 6 cas cas 0 Mar 31 13:04 task/
-rw-r--r-- 1 root root 0 Mar 31 13:04 timens_offsets
-r--r--r-- 1 root root 0 Mar 31 13:04 timers
-rw-rw-rw- 1 root root 0 Mar 31 13:04 timerslack_ns
-rw-r--r-- 1 root root 0 Mar 31 13:04 uid_map
-r--r--r-- 1 root root 0 Mar 31 13:04 wchan
zathura
is NOT setuid root:
$ type -p zathura
/usr/bin/zathura
$ ls -l /usr/bin/zathura
-rwxr-xr-x 1 root root 305456 Nov 28 03:34 /usr/bin/zathura
It is version 0.5.2, and the package was last upgraded on November 28 last year:
$ zathura --version
zathura 0.5.2
girara 0.3.7 (runtime: 0.4.0)
(plugin) cb (0.1.10) (/usr/lib/x86_64-linux-gnu/zathura/libcb.so)
(plugin) pdf-poppler (0.3.1) (/usr/lib/x86_64-linux-gnu/zathura/libpdf-poppler.so)
(plugin) ps (0.2.7) (/usr/lib/x86_64-linux-gnu/zathura/libps.so)
(plugin) djvu (0.2.9) (/usr/lib/x86_64-linux-gnu/zathura/libdjvu.so)
$ dpkg -l zathura
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=============================================
ii zathura 0.5.2-1 amd64 document viewer with a minimalistic interface
$ ls -l /var/cache/apt/archives/zathura_0.5.2-1_amd64.deb
-rw-r--r-- 1 root root 175712 Nov 28 04:41 /var/cache/apt/archives/zathura_0.5.2-1_amd64.deb
If I use qpdfview
, atril
, or okular
instead of zathura
, the permissions are fine:
$ qpdfview X399\ Taichi.pdf
$ pgrep qpdfview
4071588 qpdfview X399 Taichi.pdf
$ ls -lFd /proc/4071588/fd
dr-x------ 2 cas cas 0 Mar 31 13:16 /proc/4071588/fd/
$ atril X399\ Taichi.pdf &
4080297
$ ls -lFd /proc/4080297/fd
dr-x------ 2 cas cas 0 Mar 31 13:20 /proc/4080297/fd/
$ okular X399\ Taichi.pdf &
4081710
$ ls -lFd /proc/4081710/fd
dr-x------ 2 cas cas 0 Mar 31 13:21 /proc/4081710/fd/
All of the above were run from the same instance of bash, same environment, same everything. Not in a VM or container, or anything "unusual".
So, what is up with zathura
? Is it zathura? or is it some weird namespaces related behaviour by systemd or cgroups or something like that?
The system is running Debian sid (updated yesterday), with kernel Linux hex 6.1.0-6-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.15-1 (2023-03-05) x86_64 GNU/Linux
. The last reboot was 14 days ago when I upgraded the kernel, has been running fine since then.
---
NOTE: I vaguely recall that when I was working on my answer yesterday, I saw the same root ownership thing for ONE of the instances of running atril
, but I can't replicate that now. I may have mis-remembered this, it was very late at night (> 3am) and I was tired.
zathura
, however, consistently has root-owned stuff in /proc/PID/ - every time I run it.
Asked by cas
(81932 rep)
Mar 31, 2023, 03:02 AM
Last activity: Mar 31, 2023, 10:22 AM
Last activity: Mar 31, 2023, 10:22 AM