NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PR/56780 CVS commit: src/tests/lib/libc/sys



The following reply was made to PR kern/56780; it has been noted by GNATS.

From: Andreas Gustafsson <gson%gson.org@localhost>
To: Martin Husemann <martin%duskware.de@localhost>, gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: PR/56780 CVS commit: src/tests/lib/libc/sys
Date: Tue, 5 Apr 2022 22:11:24 +0300

 Martin Husemann wrote:
 >  I don't think this is the best possible fix.
 >  
 >  The test could have been meant to test for two things, and IMHO should
 >  test for both:
 >
 >   - mmap with MAP_FIXED for a not page aligned value (that is what you
 >     have made it to do in most cases, but not very portable), but I think
 >     this is not what it was originally about.
 >     If we want to make it test for that, the fixed address should be picked
 >     better and get a comment (i.e. it should be within the VM space limits
 >     for the architecture, and if we do below maybe it should be made sure
 >     that the address is inside an unmapped region)
 
 Whatever the original intent of the test, in practice it was testing
 the case of non-page-aligned address (except in the rare cases where it
 randomly failed because the address happened to be aligned), and that
 is what it still does (only without the random failures).
 
 >   - mmap with MAP_FIXED and a address that is already mapped (this was my
 >     initial reading and what the test did test most of the time before we
 >     started to randomize stack addresses)
 
 I'm sorry, but I don't follow.  How exactly does randomizing stack
 addresses change things?  Wouldn't the "addr" variable almost always
 be located at a non-page-aligned address whether or not randomization
 is in use?  Also, how would this case result in an errno of EINVAL?
 -- 
 Andreas Gustafsson, gson%gson.org@localhost
 


Home | Main Index | Thread Index | Old Index