I'm trying to read two specific files, namely status
and smaps_rollup
for all the processes under /proc
. All process directories have dr-xr-xr-x
permission and I'm able to enter every one of these directories.
For all the processes the permissions for both of these files are -r--r--r--
.
Here's the bizarre behavior. Let's say I try to read both the files for PID 1. I can read status
file, but not smaps_rollup
. See below:
$ cd /proc/1
$ ls -l status smaps_rollup
-r--r--r-- 1 root root 0 Apr 5 18:34 smaps_rollup
-r--r--r-- 1 root root 0 Mar 21 12:18 status
$ grep "Swap:" status
VmSwap: 1072 kB
$ grep "Swap:" smaps_rollup
grep: smaps_rollup: Permission denied
$ cat smaps_rollup
cat: smaps_rollup: Permission denied
I looked for related questions and came across some of them[1][2][3][4]. None of them has the same problem. The solutions to these other problems had to do with fixing the missing executable permission on the directory. That's not the case here.
Here is mount info for proc:
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
I'm running Arch Linux with kernel 6.2.7-arch1-1 provided by Arch Linux.
I'm looking for a correct explanation of this bizarre behavior. And is there something I can do to fix this problem, besides using sudo as a workaround?