v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
pointer-authentication.h
Go to the documentation of this file.
1// Copyright 2019 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_EXECUTION_POINTER_AUTHENTICATION_H_
6#define V8_EXECUTION_POINTER_AUTHENTICATION_H_
7
9#include "src/base/macros.h"
10#include "src/common/globals.h"
11
12namespace v8 {
13namespace internal {
14
16 public:
17 // When CFI is enabled, authenticate the address stored in {pc_address} and
18 // return the authenticated address. {offset_from_sp} is the offset between
19 // {pc_address} and the pointer used as a context for signing.
20 // When CFI is not enabled, simply load return address from {pc_address} and
21 // return it.
22 V8_INLINE static Address AuthenticatePC(Address* pc_address,
23 unsigned offset_from_sp);
24
25 // When CFI is enabled, strip Pointer Authentication Code (PAC) from {pc} and
26 // return the raw value.
27 // When CFI is not enabled, return {pc} unmodified.
29
30 // When CFI is enabled, authenticate the address stored in {pc_address} and
31 // replace it with {new_pc}, after signing it. {offset_from_sp} is the offset
32 // between {pc_address} and the pointer used as a context for signing.
33 // When CFI is not enabled, store {new_pc} to {pc_address} without signing.
34 V8_INLINE static void ReplacePC(Address* pc_address, Address new_pc,
35 int offset_from_sp);
36
37 // When CFI is enabled, sign {pc} using {sp}, check the address and return the
38 // signed value. When CFI is not enabled, return {pc} unmodified. This method
39 // only applies in the deoptimizer.
41 Address sp);
42
43 // When CFI is enabled, verify that {pc} is signed correctly for {old_sp},
44 // then re-sign {pc} using {new_sp} and return the signed value. When CFI is
45 // not enabled, return {pc} unmodified. This method only applies in the
46 // deoptimizer for wasm deoptimizations.
48 Address new_sp, Address old_sp);
49};
50
51} // namespace internal
52} // namespace v8
53
54#ifdef V8_ENABLE_CONTROL_FLOW_INTEGRITY
55
56#ifndef V8_TARGET_ARCH_ARM64
57#error "V8_ENABLE_CONTROL_FLOW_INTEGRITY should imply V8_TARGET_ARCH_ARM64"
58#endif
60
61#else
62
64
65#endif
66
67#endif // V8_EXECUTION_POINTER_AUTHENTICATION_H_
static V8_INLINE void ReplacePC(Address *pc_address, Address new_pc, int offset_from_sp)
static V8_INLINE Address SignAndCheckPC(Isolate *isolate, Address pc, Address sp)
static V8_INLINE Address StripPAC(Address pc)
static V8_INLINE Address MoveSignedPC(Isolate *isolate, Address pc, Address new_sp, Address old_sp)
static V8_INLINE Address AuthenticatePC(Address *pc_address, unsigned offset_from_sp)
#define V8_INLINE
Definition v8config.h:500