Hi
I've noticed that NX bit support for i386 architectures has been recently implemented in PAX. I recompiled 2.6.23.16 with grsec grsecurity-2.1.11-2.6.23.14-200801231800.patch (with rejected mmap.c taken from 2.6.24.2 patch), CONFIG_PAX_PAGEEXEC enabled and CONFIG_PAX_SEGMEXEC disabled. On old Xeon CPU (CONFIG_MPENTIUM4=y) it works fine (I checked in cpuinfo that the CPU is NX-capable) and paxtest result is satisfactory. However, on the same kernel compiled for Opteron (CONFIG_MK8=y) run on a "Dual-Core AMD Opteron(tm) Processor 2214 HE" paxtest indicates that the system is less secure:
Mode: blackhat
Linux xxx 2.6.23.16-grsec #1 SMP Thu Feb 21 00:46:10 CET 2008 i686 GNU/Linux
Executable anonymous mapping : Vulnerable
Executable bss : Killed
Executable data : Killed
Executable heap : Vulnerable
Executable stack : Killed
Executable anonymous mapping (mprotect) : Vulnerable
Executable bss (mprotect) : Killed
Executable data (mprotect) : Killed
Executable heap (mprotect) : Vulnerable
Executable shared library bss (mprotect) : Killed
Executable shared library data (mprotect): Killed
Executable stack (mprotect) : Killed
Anonymous mapping randomisation test : 18 bits (guessed)
Heap randomisation test (ET_EXEC) : 5 bits (guessed)
Heap randomisation test (ET_DYN) : 16 bits (guessed)
Main executable randomisation (ET_EXEC) : 15 bits (guessed)
Main executable randomisation (ET_DYN) : 14 bits (guessed)
Shared library randomisation test : 15 bits (guessed)
Stack randomisation test (SEGMEXEC) : 24 bits (guessed)
Stack randomisation test (PAGEEXEC) : 24 bits (guessed)
Return to function (strcpy) : Vulnerable
Return to function (strcpy, RANDEXEC) : Vulnerable
Return to function (memcpy) : Vulnerable
Return to function (memcpy, RANDEXEC) : Vulnerable
Executable shared library bss : Killed
Executable shared library data : Killed
Writable text segments : Killed
According to /proc/cpuinfo the Opteron mentioned is also NX-capable. The same kernel compiled with CONFIG_PAX_SEGMEXEC=y passes paxtest on both CPUs (only strcpy/memcpy are vulnerable which I guess is normal).
By the way, is there any advantage or point in enabling both CONFIG_PAX_PAGEEXEC and CONFIG_PAX_SEGMEXEC for a NX-capable i386 CPU?