Commit a49a173
MmapRegion: relax mmap size constraints
For the build_raw() alternative of the MmapRegion,
the implementation was validating that the length of
the mapping was a multiple of the page size.
This generally makes sense, since the OS will round up
to the nearest multiple anyway and only allocate full
pages.
There is one corner case though where this needs to be
relaxed: when mapping a file with a length not divisible
by the pagesize.
According to the POSIX reference, the length will be rounded
up and the extra memory zero-ed. Memory accesses will work
as expected, even beyond the actual file length (but within the
allocated memory), but any writes will not be persisted to the
filesystem and the backing device.
This is a use case where mapping an "uneven" length makes sense,
so that such "out-of-bounds" checks can be caught by accesses
via vm-memory primitives.
This commit removes this constraint.
Signed-off-by: alindima <alindima@amazon.com>1 parent 0343e0a commit a49a173
1 file changed
+1
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
| |||
52 | 50 | | |
53 | 51 | | |
54 | 52 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 53 | | |
60 | 54 | | |
61 | 55 | | |
| |||
204 | 198 | | |
205 | 199 | | |
206 | 200 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | 201 | | |
213 | 202 | | |
214 | 203 | | |
| |||
309 | 298 | | |
310 | 299 | | |
311 | 300 | | |
312 | | - | |
| 301 | + | |
313 | 302 | | |
314 | 303 | | |
315 | 304 | | |
| |||
636 | 625 | | |
637 | 626 | | |
638 | 627 | | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | 628 | | |
643 | 629 | | |
644 | 630 | | |
| |||
0 commit comments