4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-22 00:38:06 +08:00
Ken Brown 8adc45fdec Cygwin: mmap: fix mmap_is_attached_or_noreserve
This commit fixes two problems.  The first is that
mmap_is_attached_or_noreserve would sometimes call VirtualAlloc with
MEM_COMMIT on address ranges that were not known to have MEM_RESERVE
status.  These calls could fail, causing SIGBUS to be raised
incorrectly.  See

  https://cygwin.com/pipermail/cygwin-developers/2024-December/012725.html

for details.  Fix this by calling VirtualAlloc only on the part of the
address range that's contained in the current mmap_record.

The second problem is that the code would sometimes break out of the
main loop without knowing whether attached mappings still occur later
in the mmap_list.  This could cause SIGBUS to not be raised when it
should be.  Fix this by using "continue" rather than "break".  For
efficiency, introduce a boolean variable "nocover" that's set to true
if we discover that the address range cannot be covered by noreserve
mmap regions.

Addresses:
https://cygwin.com/pipermail/cygwin-developers/2024-December/012725.html
Fixes: 70e476d27be8 ("* include/cygwin/version.h: Bump DLL version to
1.7.0")
Signed-off-by: Ken Brown <kbrown@cornell.edu>
2025-01-07 16:34:27 -05:00
..
2022-08-04 20:54:09 +02:00
2022-08-04 22:13:59 +02:00
2023-02-25 16:12:51 +01:00
2022-05-29 17:45:52 -04:00
2022-08-04 22:13:59 +02:00
2022-05-29 17:45:52 -04:00
2022-08-04 22:13:59 +02:00
2022-05-29 17:45:52 -04:00
2022-08-04 22:13:59 +02:00
2022-08-04 22:13:59 +02:00
2024-02-14 14:00:34 +01:00
2022-08-04 22:13:59 +02:00