Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 404389

Summary: =sys-process/procps-3.3.6 fails pmap test without CONFIG_PROC_PAGE_MONITOR=y which conflicts with GRKERNSEC=y
Product: Gentoo Linux Reporter: Markus Walter <gentoo>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: hardened, kensington, phajdan.jr, quantheory, rhill, roman.zilka
Priority: Normal Keywords: TESTFAILURE
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://gitlab.com/procps-ng/procps/commit/92071e963e6ff50f0e221dde286f3229267b2ff9
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 461272    
Bug Blocks:    
Attachments: build log
emerge --info
build log for procps-3.3.3
build log
emerge --info
build log
pmap1-out
pmap1-str
pmap2-out
pmap2-str
pmap3-out
pmap3-str

Description Markus Walter 2012-02-18 14:08:32 UTC
Created attachment 302355 [details]
build log

On my hardened ~amd64 machine with gcc-4.6.2 procps fails a lot of tests.
Comment 1 Markus Walter 2012-02-18 14:08:51 UTC
Created attachment 302357 [details]
emerge --info
Comment 2 Markus Walter 2012-02-18 14:10:52 UTC
I found the following lines in grsec.log corresponding to the test failure of procps.

Feb 18 14:59:55 localhost kernel: [1439677.980286] grsec: Segmentation fault occurred at fffffffffffffff0 in /var/tmp/portage/sys-process/procps-3.3.2_p2-r1/work/procps-ng-3.3.2/.libs/vmstat[vmstat:17873] uid/euid:250/250 gid/egid:250/250, parent /usr/bin/expect[expect:17697] uid/euid:250/250 gid/egid:250/250
Feb 18 14:59:55 localhost kernel: [1439677.980300] grsec: denied resource overstep by requesting 4096 for RLIMIT_CORE against limit 0 for /var/tmp/portage/sys-process/procps-3.3.2_p2-r1/work/procps-ng-3.3.2/.libs/vmstat[vmstat:17873] uid/euid:250/250 gid/egid:250/250, parent /usr/bin/expect[expect:17697] uid/euid:250/250 gid/egid:250/250
Feb 18 14:59:55 localhost kernel: [1439678.021391] grsec: Segmentation fault occurred at fffffffffffffff0 in /var/tmp/portage/sys-process/procps-3.3.2_p2-r1/work/procps-ng-3.3.2/.libs/vmstat[vmstat:17906] uid/euid:250/250 gid/egid:250/250, parent /usr/bin/expect[expect:17697] uid/euid:250/250 gid/egid:250/250
Feb 18 14:59:55 localhost kernel: [1439678.021405] grsec: denied resource overstep by requesting 4096 for RLIMIT_CORE against limit 0 for /var/tmp/portage/sys-process/procps-3.3.2_p2-r1/work/procps-ng-3.3.2/.libs/vmstat[vmstat:17906] uid/euid:250/250 gid/egid:250/250, parent /usr/bin/expect[expect:17697] uid/euid:250/250 gid/egid:250/250
Comment 3 Markus Walter 2012-05-20 20:24:16 UTC
Created attachment 312407 [details]
build log for procps-3.3.3

An update on this: I see far less failing test with procps-3.3.3.
Comment 4 Toralf Förster gentoo-dev 2012-05-21 14:22:08 UTC
Created attachment 312519 [details]
build log

similar here at an unstable x86 user mode linux image
Comment 5 SpanKY gentoo-dev 2012-11-05 19:30:53 UTC
3.3.4 passes tests for me
Comment 6 Markus Walter 2012-11-05 20:24:49 UTC
For me the error is unchanged with procps-3.4.2.
Comment 7 Markus Walter 2013-01-12 11:43:39 UTC
(In reply to comment #6)
> For me the error is unchanged with procps-3.4.2.

Ignore that, for me 3.3.4 passes tests too.
Comment 8 Sean Santos 2013-03-06 08:26:28 UTC
Created attachment 341080 [details]
emerge --info

I also have the pmap test fail with:

FAIL: pmap extended output (header)

This looks like a hardened issue to me.

Neither removing all CFLAGS nor using FEATURES="-userpriv" helped.
Comment 9 Sean Santos 2013-03-06 08:27:13 UTC
Oh, I should mention that this is version 3.3.4 (which apparently worked for Markus?).
Comment 10 Markus Walter 2013-03-07 10:47:51 UTC
This is a strange error. I reran and saw the the same errors as in the original report. Also no notable entries in grsec.log (besides two segfaults).
Comment 11 Roman Žilka 2013-03-10 15:09:50 UTC
I still get fails with procps-3.3.4.

The "pmap" test fails while trying to run "pmap -x <PID>". strace of that shows that pmap cannot open /proc/PID/smaps. This is indeed missing on both my systems (hardened and not). It is missing because CONFIG_PROC_PAGE_MONITOR is not set in kernel (see /usr/src/linux/fs/proc/Kconfig). Please, confirm normal function of the pmap test with CONFIG_PROC_PAGE_MONITOR on your system. The testsuite should probably skip the test when smaps is not available. I'm letting the core team know first; I don't know if this is something to talk to the upstream about (??).

The "lib" test fails because a file is missing in the original procps-ng package. This has been fixed in 3.3.6. I can confirm normal function of the test there. I'm filing a bug requesting version bump.

The "pmap" test fails even in 3.3.6.

I still get fails on the "ps", "pgrep" and "pkill" tests:
ERROR: not a tty
child process exited abnormally
    while executing
"exec tty "
Comment 12 Samuli Suominen (RETIRED) gentoo-dev 2013-03-10 15:49:57 UTC
3.3.6 in portage with this fixed, and 3.3.4 has this now restricted
Comment 13 Sean Santos 2013-03-10 17:50:09 UTC
I just want to note that CONFIG_PROC_PAGE_MONITOR depends on !GRKERNSEC, so this *is* in fact an incompatibility with Grsecurity.
Comment 14 Samuli Suominen (RETIRED) gentoo-dev 2013-03-10 18:07:58 UTC
(In reply to comment #13)
> I just want to note that CONFIG_PROC_PAGE_MONITOR depends on !GRKERNSEC, so
> this *is* in fact an incompatibility with Grsecurity.

You are right. I only took one of the errors mentioned here into account.
Comment 15 Roman Žilka 2013-03-10 18:28:40 UTC
I also didn't have CONFIG_PROC_PAGE_MONITOR=y in a non-hardened kernel with CONFIG_EXPERT=y.
Comment 16 Roman Žilka 2013-03-10 18:36:32 UTC
(The point being it's not enought to check for grsec if that's the plan now.)
Comment 17 Toralf Förster gentoo-dev 2013-04-13 08:01:20 UTC
Created attachment 345444 [details]
build log

I do not have a hardened system but these tests fails here at an unstable 32 bit Gentoo : 

FAIL: pmap extra extended output (footer)
FAIL: pmap X with unreachable process
FAIL: pmap XX with unreachable process

zgrep -e CONFIG_EXPERT -e CONFIG_PROC_PAGE_MONITOR /proc/config.gz
# CONFIG_EXPERT is not set
CONFIG_PROC_PAGE_MONITOR=y
Comment 18 Roman Žilka 2013-04-13 10:53:27 UTC
Please post all 6 files created by these commands (from procps-3.3.6, run as root):

strace -o pmap1-str pmap -X $BASHPID &>pmap1-out
strace -o pmap2-str pmap -X 1 &>pmap2-out
strace -o pmap3-str pmap -XX 1 &>pmap3-out

If you don't run bash, substitute $BASHPID with a PID of some other common process.
Comment 19 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-07-16 10:18:56 UTC
Created attachment 353422 [details]
pmap1-out
Comment 20 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-07-16 10:19:09 UTC
Created attachment 353424 [details]
pmap1-str
Comment 21 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-07-16 10:19:20 UTC
Created attachment 353426 [details]
pmap2-out
Comment 22 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-07-16 10:19:31 UTC
Created attachment 353428 [details]
pmap2-str
Comment 23 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-07-16 10:19:41 UTC
Created attachment 353430 [details]
pmap3-out
Comment 24 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-07-16 10:19:52 UTC
Created attachment 353432 [details]
pmap3-str
Comment 25 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-07-16 10:23:10 UTC
(In reply to Roman Žilka from comment #18)
> Please post all 6 files created by these commands (from procps-3.3.6, run as
> root):
> 
> strace -o pmap1-str pmap -X $BASHPID &>pmap1-out
> strace -o pmap2-str pmap -X 1 &>pmap2-out
> strace -o pmap3-str pmap -XX 1 &>pmap3-out

I've attached these (ran as user, oops). procps-3.3.6. There is an interesting thing in pmap1-out:

pmap: Unknown format in smaps file!

Just in case, I'm running 3.8.13-gentoo kernel on 32-bit system, CONFIG_PROC_PAGE_MONITOR=y .
Comment 26 Ryan Hill (RETIRED) gentoo-dev 2015-05-16 04:32:14 UTC
FAIL: pmap X with unreachable process
FAIL: pmap XX with unreachable process

These two will fail even with CONFIG_PROC_PAGE_MONITOR=y if you're using FEATURES=userpriv, probably because the portage user doesn't have read access to /proc/<pid>/smaps.
Comment 27 SpanKY gentoo-dev 2015-05-18 04:14:31 UTC
upstream has 92071e963e6ff50f0e221dde286f3229267b2ff9 which fixes at least the latest error.  i'm going to push that and close out this bug.  if people are still seeing problems, lets start a new one as i suspect this has more than one issue squashed in it at this point.

https://gitlab.com/procps-ng/procps/commit/92071e963e6ff50f0e221dde286f3229267b2ff9
Comment 28 SpanKY gentoo-dev 2015-05-18 04:19:05 UTC
should be all set now in the tree; thanks for the report!

Commit message: Fix pmap test when running under restrictive kernel/user settings
http://sources.gentoo.org/sys-process/procps/files/procps-3.3.10-pmap-unreadable.patch?rev=1.1
http://sources.gentoo.org/sys-process/procps/procps-3.3.10-r1.ebuild?r1=1.1&r2=1.2