Gentoo Archives: gentoo-hardened

From: "Tóth Attila" <atoth@××××××××××.hu>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] denied RWX mmap by layman
Date: Sun, 08 Jun 2014 08:32:13
Message-Id: 3a432860fa3125c99727f639d1934020.squirrel@atoth.sote.hu
In Reply to: Re: [gentoo-hardened] denied RWX mmap by layman by "Anthony G. Basile"
1 2014.Június 8.(V) 02:55 időpontban Anthony G. Basile ezt írta:
2 > On 06/07/14 17:48, "Tóth Attila" wrote:
3 >> 2014.Június 7.(Szo) 23:22 időpontban Alex Efros ezt írta:
4 >>> Some time ago I noticed this in kernel logs:
5 >>> kern.alert: grsec: denied RWX mmap of <anonymous mapping> by
6 >>> /usr/lib64/python-exec/python2.7/layman[layman:9717] uid/euid:0/0
7 >>> gid/egid:0/0, parent /bin/bash[sh:9695] uid/euid:0/0 gid/egid:0/0
8 >>>
9 >>> Looks like it doesn't break layman, but I still wonder why it happens
10 >>> and
11 >>> is it possible to fix this (without paxmarking python, of course)?
12 >>
13 >> I don't see this in my logs. The python executable has the "E" flag on
14 >> my
15 >> systems.
16 >>
17 >> Dw.
18 >>
19 >
20 > Okay I need to document this loudly --- not sure how to do that except
21 > to just keep repeating it until it becomes public knowledge:
22 >
23 > When running with a pax kernel, you must enable EMUTRAMP in your Kconfig
24 > and you must paxmark your python exe's with E. Note: EMUTRAMP is on by
25 > default and the ebuild automatically does the markings for you, so leave
26 > the defaults alone.
27 >
28 > If you don't, python apps will hit rwx mmap denials by the pax kernel.
29 > Things like libffi try to work around this by spitting out little
30 > snippets of code to the filesystem when the mmap fails; but, if you have
31 > strict TPE on, even this workaround fails and you get a pretty dead
32 > system (all python apps badly crippled). There are various ways around
33 > this but we've settled on the EMUTRAMP solution. See
34
35 I see a problem here, that Alex has python binaries installed on his
36 system with inconsistent PAX markings (PT: e, XATTR: E). I don't know his
37 kernel config, but in my experience these flags can get misinterpreted
38 instead of taking the XATTR:E flag or the default EMUTRAMP enabled.
39 Despite it is not advised to keep both PT and XATTR markings on a system
40 at the same time, some users may still have both and run into problems
41 like Alex.
42 I introduced kinda chpax init style logic as a workaround on my systems to
43 double check sensitive binaries have correct PAX markings.
44 Can we expect these symptoms to go away by the advent of the new hardened
45 install helper?
46
47 BR: Dw.
48 --
49 dr Tóth Attila, Radiológus, 06-20-825-8057
50 Attila Toth MD, Radiologist, +36-20-825-8057

Replies

Subject Author
Re: [gentoo-hardened] denied RWX mmap by layman Alex Efros <powerman@××××××××.name>
Re: [gentoo-hardened] denied RWX mmap by layman "Anthony G. Basile" <basile@××××××××××××××.edu>