Re: [PATCH v4 0/4] SROP Mitigation: Sigreturn Cookies

From: Andy Lutomirski
Date: Tue Mar 29 2016 - 19:05:32 EST


On Tue, Mar 29, 2016 at 3:54 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, Mar 29, 2016 at 2:53 PM, Scott Bauer <sbauer@xxxxxxxxxxxx> wrote:
>>
>> These patches implement the necessary changes to generate a cookie
>> which will be placed above signal frame upon signal delivery to userland.
>> The cookie is generated using a per-process random value xor'd with
>> the address where the cookie will be stored on the stack.
>

> I realize that this would likely need to be a separate and non-default
> extra hardening mode, because there are *definitely* applications that
> take signals and then update the return address (maybe single-stepping
> over instructions etc). But for a *lot* of applications, signal return
> implies changing no signal state at all, and mixing in the returning
> IP and SP would seem to be a fundamentally stronger cookie.

Like selftests/x86? :)

If we wanted to increase confidence that this wouldn't break existing
applications, I've been thinking about adding an extensible bit mask
of backwards compatibility breaks that an and/or libc is okay with.
One of these would be "I don't use vsyscalls", in which case the
vsyscall page would be unmapped entirely. Another could be
"sigcontext cookies are okay". These could potentially be programmed
by syscall and/or ELF notes.

--Andy