Re: [CRIU] [PATCH 1/3] prctl: reduce permissions to change boundaries of data, brk and stack

From: Eric W. Biederman
Date: Sat Feb 15 2014 - 18:05:56 EST


Andrey Wagin <avagin@xxxxxxxxx> writes:

> 2014-02-14 23:16 GMT+04:00 Eric W. Biederman <ebiederm@xxxxxxxxxxxx>:
>>
>> Hmm. Let me rewind this a little bit.
>>
>> I want to be very stupid and ask the following.
>>
>> Why can't you have the process of interest do:
>> ptrace(PTRACE_ATTACHME);
>> execve(executable, args, ...);
>>
>> /* Have the ptracer inject the recovery/fixup code */
>> /* Fix up the mostly correct process to look like it has been
>> * executing for a while.
>> */
>>
>> That should work, set all of the interesting fields, and works as
>> non-root today. My gut feel says do that and we can just
>> deprecate/remove prctl_set_mm.
>
> start_brk and start_stack are randomized each time. I don't understand
> how execve() can restore the origin values of attributes.

As is the location of the vdso and there isn't a way to set that.

So perhaps what we want to do is to change the randomization with
mremap(old_addr, size, size, MREMAP_MAYMOVE | MREMAP_FIXED, new_addr)
and just have the kernel update all of the addresses in bulk when we
move the location.

I don't know what the folks who are worried about losing tampering
evidence will think but as a targeted special case it may not be at all
crazy.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/