7#if V8_ENABLE_SANDBOX_HARDWARE_SUPPORT
14#if V8_ENABLE_SANDBOX_HARDWARE_SUPPORT
16int SandboxHardwareSupport::pkey_ =
17 base::MemoryProtectionKey::kNoMemoryProtectionKey;
21 if (pkey_ != base::MemoryProtectionKey::kNoMemoryProtectionKey) {
22 return base::MemoryProtectionKey::SetPermissionsAndKey(
30 DCHECK_EQ(pkey_, base::MemoryProtectionKey::kNoMemoryProtectionKey);
31 pkey_ = base::MemoryProtectionKey::AllocateKey();
36 if (pkey_ != base::MemoryProtectionKey::kNoMemoryProtectionKey) {
37 base::MemoryProtectionKey::SetPermissionsForKey(
38 pkey_, base::MemoryProtectionKey::Permission::kNoRestrictions);
45 if (pkey_ != base::MemoryProtectionKey::kNoMemoryProtectionKey) {
48 base::MemoryProtectionKey::SetPermissionsAndKey(
49 {addr, size}, perm, base::MemoryProtectionKey::kDefaultProtectionKey);
54SandboxHardwareSupport::BlockAccessScope
56 return BlockAccessScope(pkey_);
61 if (pkey_ != base::MemoryProtectionKey::kNoMemoryProtectionKey) {
62 base::MemoryProtectionKey::SetPermissionsForKey(
63 pkey_, base::MemoryProtectionKey::Permission::kDisableAccess);
67SandboxHardwareSupport::BlockAccessScope::~BlockAccessScope() {
68 if (pkey_ != base::MemoryProtectionKey::kNoMemoryProtectionKey) {
69 base::MemoryProtectionKey::SetPermissionsForKey(
70 pkey_, base::MemoryProtectionKey::Permission::kNoRestrictions);
77bool SandboxHardwareSupport::TryEnable(Address addr,
size_t size) {
82void SandboxHardwareSupport::InitializeBeforeThreadCreation() {}
85void SandboxHardwareSupport::SetDefaultPermissionsForSignalHandler() {}
88void SandboxHardwareSupport::NotifyReadOnlyPageCreated(
93SandboxHardwareSupport::MaybeBlockAccess() {
BlockAccessScope()=default
static void NotifyReadOnlyPageCreated(Address addr, size_t size, PageAllocator::Permission current_permissions)
static void InitializeBeforeThreadCreation()
static bool TryEnable(Address addr, size_t size)
static void SetDefaultPermissionsForSignalHandler()
static BlockAccessScope MaybeBlockAccess()
#define DCHECK_EQ(v1, v2)