Re: [RFC PATCH v2 0/2] Randomization of address chosen by mmap.

From: Ilya Smith
Date: Fri Mar 30 2018 - 07:10:30 EST



> On 30 Mar 2018, at 12:57, Pavel Machek <pavel@xxxxxx> wrote:
>
> On Fri 2018-03-30 12:07:58, Ilya Smith wrote:
>> Hi
>>
>>> On 30 Mar 2018, at 10:55, Pavel Machek <pavel@xxxxxx> wrote:
>>>
>>> Hi!
>>>
>>>> Current implementation doesn't randomize address returned by mmap.
>>>> All the entropy ends with choosing mmap_base_addr at the process
>>>> creation. After that mmap build very predictable layout of address
>>>> space. It allows to bypass ASLR in many cases. This patch make
>>>> randomization of address on any mmap call.
>>>
>>> How will this interact with people debugging their application, and
>>> getting different behaviours based on memory layout?
>>>
>>> strace, strace again, get different results?
>>>
>>
>> Honestly Iâm confused about your question. If the only one way for debugging
>> application is to use predictable mmap behaviour, then something went wrong in
>> this live and we should stop using computers at all.
>
> I'm not saying "only way". I'm saying one way, and you are breaking
> that. There's advanced stuff like debuggers going "back in time".
>

Correct me if I wrong, when you run gdb for instance and try to debug some
application, gdb will disable randomization. This behaviour works with gdb
command: set disable-randomization on. As I know, gdb remove flag PF_RANDOMIZE
from current personality thats how it disables ASLR for debugging process.
According to my patch, flag PF_RANDOMIZE is checked before calling
unmapped_area_random. So I donât breaking debugging. If you talking about the
case, when your application crashes under customer environment and you want to
debug it; in this case layout of memory is what you donât control at all and
you have to understand what is where. So for debugging memory process layout is
not what you should care of.

Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html