Bug#896576: Reading from /proc/[pid]/environ returns garbage
Package: linux-image-4.9.0-6-amd64
Version: 4.9.82-1+deb9u3
When I attempt to get the environment of a process by reading
/proc/[pid]/environ, it sometimes returns garbage.
The same garbage is seen when reading this magic 'environ' file using
cat, hexdump, or python. So I believe the tool reading it is not at fault.
I am filling this against a linux image package, because my
understanding is that /proc is a virtual file system managed by the
linux kernel.
Reproducing:
In my case I observed this with a couple sshd and dovecot processes, I
suggest you start by looking at theses when reproducing.
# cat /proc/10230/cmdline && echo
dovecot/imap-login
# cat /proc/10230/environ && echo
����������[TRUNCATED]
# hexdump -C /proc/10230/environ
00000000 ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab
|................|
*
000001fd
# cat /proc/7590/cmdline && echo
sshd: guillaume [priv]
# cat /proc/7590/environ && echo
riv]2
# hexdump -C /proc/7590/environ
00000000 72 69 76 5d 00 00 00 00 00 00 00 00 00 00 00 00
|riv]............|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|................|
*
00000730 00 00 00 00 00 00 00 00 00 00 00 32 00 |...........2.|
Reply to: