v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
trusted-range.h
Go to the documentation of this file.
1// Copyright 2023 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_HEAP_TRUSTED_RANGE_H_
6#define V8_HEAP_TRUSTED_RANGE_H_
7
10#include "v8-internal.h"
11
12namespace v8 {
13namespace internal {
14
15#ifdef V8_ENABLE_SANDBOX
16
17// When the sandbox is enabled, the heap's trusted spaces are located outside
18// of the sandbox so that an attacker cannot corrupt their contents. This
19// special virtual memory cage hosts them. It also acts as a pointer
20// compression cage inside of which compressed pointers can be used to
21// reference objects.
22class TrustedRange final : public VirtualMemoryCage {
23 public:
24 bool InitReservation(size_t requested);
25
26 // Initializes the process-wide TrustedRange if it hasn't been initialized
27 // yet. Returns the (initialized) TrustedRange or terminates the process if
28 // the virtual memory cannot be reserved.
29 static TrustedRange* EnsureProcessWideTrustedRange(size_t requested_size);
30
31 // Returns the process-wide TrustedRange if it has been initialized (via
32 // EnsureProcessWideTrustedRange), otherwise nullptr.
33 V8_EXPORT_PRIVATE static TrustedRange* GetProcessWideTrustedRange();
34};
35
36#endif // V8_ENABLE_SANDBOX
37
38} // namespace internal
39} // namespace v8
40
41#endif // V8_HEAP_TRUSTED_RANGE_H_
#define V8_EXPORT_PRIVATE
Definition macros.h:460