NetBSD-Bugs archive

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

Re: kern/56780: lib/libc/sys/t_mmap:mmap_err test case fails randomly



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

From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/56780: lib/libc/sys/t_mmap:mmap_err test case fails randomly
Date: Tue, 5 Apr 2022 14:09:25 -0000 (UTC)

 gson%gson.org@localhost (Andreas Gustafsson) writes:
 
 >  FAILED: /tmp/build/2022.04.02.22.15.57-i386/src/tests/lib/libc/sys/t_mmap.c:231: errno == EINVAL not met
 
 >I committed a change to make the test print the actual errno value at
 >the time of failure, and it's 9 (EBADF).
 
 
 The test does something funny and uses the address of the stack
 variable 'addr' as as the address hint instead of its value.
 
         size_t addr = SIZE_MAX;
 
         errno = 0;
         map = mmap(&addr, page, PROT_READ, MAP_FIXED|MAP_PRIVATE, -1, 0);
 
 It's possible with enough address randomization that the variable
 ends up page aligned, and then the alignment check won't fail
 with EINVAL, but the descriptor check fails with EBADF.
 


Home | Main Index | Thread Index | Old Index