Bug 1288208 - use of /proc/self/auxv breaks ps when running as a different euid
use of /proc/self/auxv breaks ps when running as a different euid
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: procps (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Ondrej Vasik
Branislav Náter
Petr Bokoc
: Patch
Depends On:
  Show dependency treegraph
Reported: 2015-12-03 15:13 EST by Todd Stansell
Modified: 2016-05-10 20:29 EDT (History)
3 users (show)

See Also:
Fixed In Version: procps-3.2.8-36.el6
Doc Type: Bug Fix
Doc Text:
With the recent fix of crash in the find_elf_note function a new limitation in the usage appeared. The fix was based on a reading of the /proc/self/auxv file instead of reading the notes directly from the memory, but when running with a different euid, the file content became inaccessible and the procps library init failed with "/proc/self/auxv: Permission denied". The fix allowed to call the library functions with dlopen, but prevented users from using the library and procps tools with different euid. This update introduces a fallback to the previous approach when the /proc/self/auxv file is inaccessible. That, however, means the mentioned conditions are mutually exclusive and the library functions cannot be called with dlopen and different euid at the same time.
Story Points: ---
Clone Of:
Last Closed: 2016-05-10 20:29:05 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
procps-3.2.8-find_elf_note-memory-error-fix.patch (2.00 KB, patch)
2015-12-16 08:16 EST, Jaromír Cápík
no flags Details | Diff

  None (edit)
Description Todd Stansell 2015-12-03 15:13:54 EST
Description of problem:
The change from bug 1163404 seems to introduce an issue where a process that has changed it's effective uid can no longer access /proc/self/auxv, preventing ps from running (even --help).

Version-Release number of selected component (if applicable):

How reproducible:
Always fails when process has changed euid.

Steps to Reproduce:
1. install procps-3.2.8-31.el6 or newer
2. run the following perl script as root that changes the euid and tries to call ps:

($),$>) = (1000,1000);
my $psOutput = `/bin/ps --help`;
print "output: $psOutput\n";

Actual results:
# perl /var/tmp/test-ps.pl
/proc/self/auxv: Permission denied

Expected results:
# perl /var/tmp/test-ps.pl
output: ********* simple selection *********  ********* selection by list *********
-A all processes                      -C by command name
-N negate selection                   -G by real group ID (supports names)
-a all w/ tty except session leaders  -U by real user ID (supports names)
-d all except session leaders         -g by session OR by effective group name
-e all processes                      -p by process ID

Additional info:
Comment 2 Jaromír Cápík 2015-12-04 04:37:00 EST
Hello Todd.

Thanks a lot for the report. This apparently becomes more complicated than we thought. Reverting the change back is also no option. I'm thinking about a fallback based on the previous solution where a failure of the new approach would lead to retry with the old approach. But I'll think about that once again and if a better solution exists, I'll try to redesign that in a different way.
Comment 3 Jaromír Cápík 2015-12-16 08:16 EST
Created attachment 1106403 [details]

replacement for the previous elf note patch
Comment 9 errata-xmlrpc 2016-05-10 20:29:05 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.