Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Mar 2019 14:48:23 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 169608] [libc] the mmap(), mprotect(), and munmap() functions get screwed by some corner-case arguments
Message-ID:  <bug-169608-227-DhJeb5HTyB@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-169608-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-169608-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

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

--- Comment #3 from Konstantin Belousov <kib@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.

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-169608-227-DhJeb5HTyB>