meekrob wrote:Hi,
I've just started experimenting with grsecurity and am trying to load it on my Gentoo laptop. What PAX options can I safely enable and still use XFree?
the feature that interferes with a typical XFree86 server is the non-executable pages enforcement (both PAGEEXEC and SEGMEXEC), so they'd be the ones to be careful about when you enable them in the kernel config (which is recommended of course since that's one of the core features of PaX). there are two solutions for XFree86:
1. use 'chpax -sp' on the server binary to disable non-exec pages on it (or the ACL system).
2. compile a statically linked server and still have the non-exec protection on XFree86 as well.
the preferable solution is 2 of course and since you're using a source based distro, this should be easy enough for you to do. the trick to get a statically linked XFree86 server is very easy: before compiling/configuring it you have to add the following line to
xc/config/cf/host.def :
- Code: Select all
#define DoLoadableServer NO
note that gentoo may already define other things in there, so don't blindly overwrite this file. also if gentoo defines BeforeVendorCF/AfterVendorCF sections in host.def then the above line should go into the AfterVendorCF part. furthermore you can recompile the server as an ET_DYN executable to take advantage of full randomization (details are both on the PaX and the grsecurity sites). finally, here's a little table that will tell you how much memory is consumed (process RSS) using various feature combinations (numbers are in MB and taken just after startup):
- Code: Select all
ET_EXEC/dynamic/nothing:7.5
ET_EXEC/static/nothing: 6.5
ET_EXEC/static/SEGMEXEC:8.2
ET_DYN/static/nothing: 12
ET_DYN/static/SEGMEXEC:19.5
a few notes on this table:
1. the PAGEEXEC memory usage would be the same as the 'nothing' case, so i've omitted those cases (because of the large RSS i don't recommend using PAGEEXEC on XFree86).
2. this compilation used the default host.def file + that one line addition, so all default XFree86 features were enabled (and contributed to the binary size and memory usage).
3. the ET_DYN server was not compiled with -fPIC, so text relocations had to be applied dramatically increasing RSS. using -fPIC would have saved on the initial relocations a lot as the .text section is some 7 MB large itself, most of which is never used during runtime (and hence would not contribute to RSS).