Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bsd-user: Use page_check_range_empty for MAP_EXCL
The previous check returned -1 when any page within
[start, start+len) is unmapped, not when all are unmapped.

Cc: Warner Losh <imp@bsdimp.com>
Cc: Kyle Evans <kevans@freebsd.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Message-Id: <20230707204054.8792-11-richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Jul 15, 2023
1 parent c2281dd commit 9c255cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bsd-user/mmap.c
Expand Up @@ -609,7 +609,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
}

/* Reject the mapping if any page within the range is mapped */
if ((flags & MAP_EXCL) && page_check_range(start, len, 0) < 0) {
if ((flags & MAP_EXCL) && !page_check_range_empty(start, end - 1)) {
errno = EINVAL;
goto fail;
}
Expand Down

0 comments on commit 9c255cb

Please sign in to comment.