Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #60726

Bug#896576: Reading from /proc/[pid]/environ returns garbage

From Guillaume <guillaume@atto.be>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#896576: Reading from /proc/[pid]/environ returns garbage
Date 2018-04-22 16:40 +0200
Message-ID <vHojM-5ib-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


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.|

Back to linux.debian.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Bug#896576: Reading from /proc/[pid]/environ returns garbage Guillaume <guillaume@atto.be> - 2018-04-22 16:40 +0200
  Bug#896576: marked as done (Reading from /proc/[pid]/environ  returns garbage) "Debian Bug Tracking System" <owner@bugs.debian.org> - 2018-04-23 02:30 +0200
  Bug#896576: closed by Ben Hutchings <ben@decadent.org.uk> (Re: Bug#896576: Reading from /proc/[pid]/environ returns garbage) Guillaume <guillaume@atto.be> - 2018-04-23 20:10 +0200

csiph-web