Bug 272775 - procfs "file" entry pointing to nothing?
Summary: procfs "file" entry pointing to nothing?
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.2-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-28 13:14 UTC by Peter Eriksson
Modified: 2023-08-03 11:04 UTC (History)
0 users

See Also:


Attachments
Script checking that /proc/<pid>/file symlink can be read (343 bytes, application/x-shellscript)
2023-08-03 11:04 UTC, Peter Eriksson
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Eriksson 2023-07-28 13:14:20 UTC
I just noticed that one entry of /proc/<pid>/file which usually looks like a symlink pointing to the real path of the process didn't point to anything?

# ps auxww|egrep win
root      3236    0.0  0.0   97940  104424  -  Ss   22:22       0:02.58 /liu/sbin/winbindd --daemon --configfile=/liu/etc/samba/smb.conf
...

# cat /var/samba/run/winbindd.pid 
3236

# ls /proc/3236/
cmdline	etype	fpregs	mem	notepg	regs	status
dbregs	file	map	note	osrel	rlimit

# /proc/3236/file -V
/proc/3236/file: Command not found.

# ls -l /proc/3236
total 0
-r--r--r--  1 root  wheel  0 Jul 28 15:00 cmdline
-rw-------  1 root  wheel  0 Jul 28 15:00 dbregs
-r--r--r--  1 root  wheel  0 Jul 28 15:00 etype

ls: /proc/3236/file: No such file or directory
lr--r--r--  1 root  wheel  0 Jul 28 15:00 file
-rw-------  1 root  wheel  0 Jul 28 15:00 fpregs
-r--r--r--  1 root  wheel  0 Jul 28 15:00 map
-rw-------  1 root  wheel  0 Jul 28 15:00 mem
--w-------  1 root  wheel  0 Jul 28 15:00 note
--w-------  1 root  wheel  0 Jul 28 15:00 notepg
-rw-------  1 root  wheel  0 Jul 28 15:00 osrel
-rw-------  1 root  wheel  0 Jul 28 15:00 regs
-r--r--r--  1 root  wheel  0 Jul 28 15:00 rlimit
-r--r--r--  1 root  wheel  0 Jul 28 15:00 status

Of all the processes listed in /proc, this was the only one displaying this behavious. When I restarted winbindd the problem went away.

Is this the same/similar problem as with the fdescfs filesystem we've discussed in issue 272127 regarding filesystem vnode cache?
Comment 1 Peter Eriksson 2023-08-03 11:04:14 UTC
Created attachment 243821 [details]
Script checking that /proc/<pid>/file symlink can be read

Attached a sample test script that can be run from crontab (for example) to check for unreadable /proc/<pid>/file symlinks.
Here's an example of it's output from one of my servers right now:

> # bin/check_procfs
> 34687: Unable to get exec path
> USER       PID %CPU %MEM   VSZ   RSS TT  STAT STARTED    TIME COMMAND
> peter    34687  0.0  0.0 21444 11040  -  S    00:40   0:00.24 sshd: peter@pts/3 (sshd)
> 47882: Unable to get exec path
> USER       PID %CPU %MEM   VSZ   RSS TT  STAT STARTED    TIME COMMAND
> peter    47882  0.0  0.0 21444 10952  -  I    Mon11   0:00.82 sshd: peter@pts/0 (sshd)

> # ls -l /proc/34687/
> total 0
> -r--r--r--  1 peter  admins  0 Aug  3 12:57 cmdline
> -r--r--r--  1 peter  admins  0 Aug  3 12:57 etype
> 
> ls: /proc/34687//file: No such file or directory
> lr--r--r--  1 peter  admins  0 Aug  3 12:57 file
> -r--r--r--  1 peter  admins  0 Aug  3 12:57 map
> -r--r--r--  1 peter  admins  0 Aug  3 12:57 rlimit
> -r--r--r--  1 peter  admins  0 Aug  3 12:57 status