URL: <http://savannah.gnu.org/bugs/?49730>
Summary: /proc/PID/environ returns I/O errors on read attempts 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: _______________________________________________________ Details: 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 <http://savannah.gnu.org/bugs/download.php?file_id=39096> _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?49730> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/