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

Side by Side Diff: src/platform-macos.cc

Issue 9452002: Ensure that executable pages are properly guarded. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 bool VirtualMemory::IsReserved() { 422 bool VirtualMemory::IsReserved() {
423 return address_ != NULL; 423 return address_ != NULL;
424 } 424 }
425 425
426 426
427 bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) { 427 bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) {
428 return CommitRegion(address, size, is_executable); 428 return CommitRegion(address, size, is_executable);
429 } 429 }
430 430
431 431
432 bool VirtualMemory::Guard(void* address) {
433 OS::Guard(address, OS::CommitPageSize());
434 return true;
435 }
436
437
432 bool VirtualMemory::CommitRegion(void* address, 438 bool VirtualMemory::CommitRegion(void* address,
433 size_t size, 439 size_t size,
434 bool is_executable) { 440 bool is_executable) {
435 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); 441 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
436 if (MAP_FAILED == mmap(address, 442 if (MAP_FAILED == mmap(address,
437 size, 443 size,
438 prot, 444 prot,
439 MAP_PRIVATE | MAP_ANON | MAP_FIXED, 445 MAP_PRIVATE | MAP_ANON | MAP_FIXED,
440 kMmapFd, 446 kMmapFd,
441 kMmapFdOffset)) { 447 kMmapFdOffset)) {
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 892
887 893
888 void Sampler::Stop() { 894 void Sampler::Stop() {
889 ASSERT(IsActive()); 895 ASSERT(IsActive());
890 SamplerThread::RemoveActiveSampler(this); 896 SamplerThread::RemoveActiveSampler(this);
891 SetActive(false); 897 SetActive(false);
892 } 898 }
893 899
894 900
895 } } // namespace v8::internal 901 } } // namespace v8::internal
OLDNEW
« src/platform-freebsd.cc ('K') | « src/platform-linux.cc ('k') | src/platform-nullos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698