[Bug 169608] [libc] the mmap(), mprotect(), and munmap() functions get screwed by some corner-case arguments

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Mar 30 14:48:25 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=169608

--- Comment #3 from Konstantin Belousov <kib at FreeBSD.org> ---
(In reply to Glenn Weinberg from comment #2)
What happens is (all arithmetic is done using unsigned native register size):
- we truncate the base address down to the page boundary
- size is increased by the truncated amount
- size is rounded up to the page boundary
- if base + size < base, we decline
- base is set to max(min user address, base)
- end is set to min(max user address, base + size)
- base > end, base = end

I think that corner cases of this algorithm are put in stone after 30 years of
FreeBSD history.  In particular, I do not think we can remove the automatic
realignment.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list