Index: src/trusted/service_runtime/sys_memory.c |
diff --git a/src/trusted/service_runtime/sys_memory.c b/src/trusted/service_runtime/sys_memory.c |
index 7b0d7033d81a0b7192236b7dc312bb997d656b7a..08f4853a31cd07de7b586043554482f99d0aacd1 100644 |
--- a/src/trusted/service_runtime/sys_memory.c |
+++ b/src/trusted/service_runtime/sys_memory.c |
@@ -329,9 +329,15 @@ int32_t NaClSysMmapIntern(struct NaClApp *nap, |
* granularity. (Windows.) |
*/ |
if (!NaClIsAllocPageMultiple(usraddr)) { |
- NaClLog(2, "NaClSysMmap: address not allocation granularity aligned\n"); |
- map_result = -NACL_ABI_EINVAL; |
- goto cleanup; |
+ if (NACL_ABI_MAP_FIXED & flags) { |
Mark Seaborn
2015/07/30 15:20:14
Nit: use "(NACL_ABI_MAP_FIXED & flags) != 0"
NaCl
Sean Klein
2015/07/30 16:04:29
Done.
|
+ NaClLog(2, "NaClSysMmap: address not allocation granularity aligned\n"); |
+ map_result = -NACL_ABI_EINVAL; |
Mark Seaborn
2015/07/30 15:20:14
Is there a test case covering this code path?
Sean Klein
2015/07/30 16:04:29
There is now (added to mem_test.cc).
|
+ goto cleanup; |
+ } else { |
+ /* Ignore the hint, as we do not need it. */ |
Mark Seaborn
2015/07/30 15:20:14
So we use the hint if it's aligned but ignore it o
Sean Klein
2015/07/30 16:04:29
Linux rounds the address to a minimum value, and t
|
+ NaClLog(2, "NaClSysMmap: ignoring misaligned hint address\n"); |
+ usraddr = 0; |
+ } |
} |
/* |
* Offset should be non-negative (nacl_abi_off_t is signed). This |