[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#896576: marked as done (Reading from /proc/[pid]/environ returns garbage)



Your message dated Mon, 23 Apr 2018 01:25:07 +0100
with message-id <8ed98d8803a1903560b03caa3626c93d713256b0.camel@decadent.org.uk>
and subject line Re: Bug#896576: Reading from /proc/[pid]/environ returns garbage
has caused the Debian Bug report #896576,
regarding Reading from /proc/[pid]/environ returns garbage
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
896576: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=896576
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
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.|

--- End Message ---
--- Begin Message ---
On Sun, 2018-04-22 at 16:11 +0200, Guillaume wrote:
> 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.
[...]

The kernel only knows where it stored the environment for a process
when it started.  If the process manipulates its environment after
that, the kernel doesn't know about it.  This means that the "environ"
file is not reliable, and this can't be fixed.  Sorry.

Ben.

-- 
Ben Hutchings
Theory and practice are closer in theory than in practice - John Levine

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---

Reply to: