Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120805210709.GA5939@albatros>
Date: Mon, 6 Aug 2012 01:07:09 +0400
From: Vasily Kulikov <segoon@...nwall.com>
To: owl-dev@...ts.openwall.com
Subject: HARDEN_STACK

Hi,

The patch of forcing nonexecutable stack is ready.  It can be configured
via sysctl kernel.execstack_mode.  It is a bitwise 'or' of following
values:

enum execstack_mode {
	GNU_STACK_X_FORCE_NX 	= (1 << 0),
	GNU_STACK_X_EMULTRAMP 	= (1 << 1),
	NO_GNU_STACK_FORCE_NX 	= (1 << 2),
	NO_GNU_STACK_EMULTRAMP 	= (1 << 3),
	GNU_STACK_NX_EMULTRAMP 	= (1 << 4),
};

GNU_STACK_X_ handles the case of existing PT_GNU_STACK of _executable_
(not a library), NO_GNU_STACK_ handles the case of missing PT_GNU_STACK.

_FORCE_NX forces nonexecutable stack creation, _EMULTRAMP enables
trampolines emulation (almost as in -ow's HARDEN_STACK_SMART).

The meaningful values are:

3 - to handle cases of a binary using trampolines.
12 - to handle cases of an old (pre-PT_GNU_STACK) binary using
trampolines.
16 - to handle cases of libraries using trampolines, but binary not
using them.


Glibc 2.3.6 was patched to use kernel information passed via AT_FLAGS
(0 and 1 bits) - GNU_STACK_X_FORCE_NX and NO_GNU_STACK_FORCE_NX
propagation.


Three OS cases were tested - 64-bit kernel and 32-bit userspace, 64-bit
kernel and 64-bit userspace, 32-bit kernel using exec-shield.  Note that
without exec-shield execstack_mode makes no sense as readable stack
means executable stack.


As ASCII-ARMOR feature is already ported to the kernel, our 2.6.32
kernel is able to spawn processes with no executable areas outside of
0x00XXXXXX range.  On just booted Owl-current "grep xp /proc/*/maps"
shows only non-PIE binaries.

Probably we could patch our ld for using some address from 0x00XXXXXX
range for base addresses to move everything that cannot be made PIE to
the ascii armor zone.

The patch for glibc is attached.

-- 
Vasily

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.