Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: src/trusted/service_runtime/sys_memory.c

Issue 1264783002: Remove failure for bad mmap address hints. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Dodging copyright presubmit warning Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/syscalls/mem_test.cc » ('j') | tests/syscalls/mem_test.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/trusted/service_runtime/sys_memory.h" 7 #include "native_client/src/trusted/service_runtime/sys_memory.h"
8 8
9 #include <errno.h> 9 #include <errno.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } else if (0 != (prot & NACL_ABI_PROT_EXEC)) { 322 } else if (0 != (prot & NACL_ABI_PROT_EXEC)) {
323 map_result = -NACL_ABI_EINVAL; 323 map_result = -NACL_ABI_EINVAL;
324 goto cleanup; 324 goto cleanup;
325 } 325 }
326 326
327 /* 327 /*
328 * Starting address must be aligned to worst-case allocation 328 * Starting address must be aligned to worst-case allocation
329 * granularity. (Windows.) 329 * granularity. (Windows.)
330 */ 330 */
331 if (!NaClIsAllocPageMultiple(usraddr)) { 331 if (!NaClIsAllocPageMultiple(usraddr)) {
332 NaClLog(2, "NaClSysMmap: address not allocation granularity aligned\n"); 332 if ((NACL_ABI_MAP_FIXED & flags) != 0) {
333 map_result = -NACL_ABI_EINVAL; 333 NaClLog(2, "NaClSysMmap: address not allocation granularity aligned\n");
334 goto cleanup; 334 map_result = -NACL_ABI_EINVAL;
335 goto cleanup;
336 } else {
337 NaClLog(2, "NaClSysMmap: Force alignment of misaligned hint address\n");
338 usraddr = NaClRoundAllocPage(usraddr);
Sean Klein 2015/07/30 21:49:16 Regarding your comment of 0xffffffff as a usraddr
339 }
335 } 340 }
336 /* 341 /*
337 * Offset should be non-negative (nacl_abi_off_t is signed). This 342 * Offset should be non-negative (nacl_abi_off_t is signed). This
338 * condition is caught when the file is stat'd and checked, and 343 * condition is caught when the file is stat'd and checked, and
339 * offset is ignored for anonymous mappings. 344 * offset is ignored for anonymous mappings.
340 */ 345 */
341 if (offset < 0) { 346 if (offset < 0) {
342 NaClLog(1, /* application bug */ 347 NaClLog(1, /* application bug */
343 "NaClSysMmap: negative file offset: %"NACL_PRId64"\n", 348 "NaClSysMmap: negative file offset: %"NACL_PRId64"\n",
344 (int64_t) offset); 349 (int64_t) offset);
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 size_t length, 1373 size_t length,
1369 int prot) { 1374 int prot) {
1370 struct NaClApp *nap = natp->nap; 1375 struct NaClApp *nap = natp->nap;
1371 1376
1372 NaClLog(3, "Entered NaClSysMprotect(0x%08"NACL_PRIxPTR", " 1377 NaClLog(3, "Entered NaClSysMprotect(0x%08"NACL_PRIxPTR", "
1373 "0x%08"NACL_PRIxPTR", 0x%"NACL_PRIxS", 0x%x)\n", 1378 "0x%08"NACL_PRIxPTR", 0x%"NACL_PRIxS", 0x%x)\n",
1374 (uintptr_t) natp, (uintptr_t) start, length, prot); 1379 (uintptr_t) natp, (uintptr_t) start, length, prot);
1375 1380
1376 return NaClSysMprotectInternal(nap, start, length, prot); 1381 return NaClSysMprotectInternal(nap, start, length, prot);
1377 } 1382 }
OLDNEW
« no previous file with comments | « no previous file | tests/syscalls/mem_test.cc » ('j') | tests/syscalls/mem_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698