[PATCH] Fix i386 memmove issue [BZ #22644]

Szabolcs Nagy szabolcs.nagy@arm.com
Mon Mar 19 14:25:00 GMT 2018


On 19/03/18 13:17, Florian Weimer wrote:
> On 03/19/2018 02:11 PM, Andreas Schwab wrote:
>> On Mär 19 2018, Andrew Senkevich<andrew.n.senkevich@gmail.com>  wrote:
>>
>>> +static void
>>> +do_test2 (void)
>>> +{
>>> +  uint32_t num = 0x20000000;
>>> +  uint32_t * large_buf;
>>> +
>>> +  large_buf = mmap ((void*)0x70000000, num, PROT_READ | PROT_WRITE,
>>> +     MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
>> Since you are using MAP_FIXED this may overwrite an existing mapping.
> 
> Leading to a hard-to-debug crash, maybe sporadically due to ASLR.  Yes, I have this concern as well.
> 
> There was a long, long Linux thread about a non-overriding MAP_FIXED variant, but as far as I can see, this has not been merged.  Maybe it would 
> have helped here.
> 

i thought not using MAP_FIXED is the 'non-overriding MAP_FIXED variant'

if you use an address hint then the kernel will use that unless
it's not available and you can check the result.



More information about the Libc-alpha mailing list