[Top][All Lists]

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

[bug #49730] /proc/PID/environ returns I/O errors on read attempts

From: Brent Baccala
Subject: [bug #49730] /proc/PID/environ returns I/O errors on read attempts
Date: Tue, 29 Nov 2016 07:42:03 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0


                 Summary: /proc/PID/environ returns I/O errors on read
                 Project: The GNU Hurd
            Submitted by: baccala
            Submitted on: Tue 29 Nov 2016 07:42:00 AM GMT
                Category: Hurd Servers
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Reproducibility: None
              Size (loc): None
         Planned Release: None
                  Effort: 0.00
Wiki-like text discussion box: 



I'm having problems retrieving process environment from /proc.  Something like
"cat /proc/936/environ" often (but not always) returns an I/O error, while
"msgport --getenv -p 936" works fine.  I'm not sure exactly which processes
suffer from this, but translators seem particularly vulnerable.

Studying the problem with rpctrace, it seems that there are two different ways
to obtain a process's environment.  The proc server hold a pointer to the
environment array (in the process's address space, not its own), and then
vm_read's it to answer proc_procgetenv RPCs.  This is how procfs does it, and
this is what isn't working.

I've written a short program (attached) to fetch the argument locations and
print them.  Comparing this output to /proc/PID/maps shows that on the
affected processes, the addresses appear sane, but do not correspond to mapped
memory locations, thus the I/O errors.

The other way to get a process's environment is to fetch the process's msg
port and query it using a msg_get_environment RPC.  The msgport program does
this, and is able to successfully retrieve environment information.

Related: Do we need two different ways to retrieve a process's environment?


File Attachments:

Date: Tue 29 Nov 2016 07:42:00 AM GMT  Name: get_arg_locations.c  Size: 380B  
By: baccala



Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]