llvm-project/clang/lib/AST/Interp
Jessica Clarke 40080e7e7f [Clang interpreter] Avoid storing pointers at unaligned locations
The Clang interpreter's bytecode uses a packed stream of bytes
representation, but also wants to have some opcodes take pointers as
arguments, which are currently embedded in the bytecode directly.

However, CHERI, and thus Arm's upcoming experimental Morello prototype,
provide spatial memory safety for C/C++ by implementing language-level
(and sub-language-level) pointers as capabilities, which track bounds,
permissions and validity in hardware. This uses tagged memory with a
single tag bit at every capability-aligned address, and so storing
pointers to unaligned addresses results in the tag being stripped,
leading to a tag fault when the pointer is ultimately dereferenced at a
later point.

In order to support a stricter C/C++ implementation like CHERI, we no
longer store pointers directly in the bytecode, instead storing them in
a table and embedding the index in the bytecode.

Reviewed By: nand

Differential Revision: https://reviews.llvm.org/D97606
2021-07-28 16:03:41 +01:00
..
Boolean.h Use std::foo_t rather than std::foo in clang. 2020-02-11 10:37:08 -08:00
ByteCodeEmitter.cpp [Clang interpreter] Avoid storing pointers at unaligned locations 2021-07-28 16:03:41 +01:00
ByteCodeEmitter.h
ByteCodeExprGen.cpp
ByteCodeExprGen.h Avoid ASTContext.h -> TargetInfo.h dep 2020-02-27 14:35:00 -08:00
ByteCodeGenError.cpp
ByteCodeGenError.h
ByteCodeStmtGen.cpp Remove unneeded template alias, causes issues with some MSVC version 2019-10-31 14:20:54 -07:00
ByteCodeStmtGen.h
Context.cpp Avoid ASTContext.h -> TargetInfo.h dep 2020-02-27 14:35:00 -08:00
Context.h [NFC] Remove some include cycles 2021-06-08 14:00:39 +02:00
Descriptor.cpp
Descriptor.h
Disasm.cpp [Clang interpreter] Avoid storing pointers at unaligned locations 2021-07-28 16:03:41 +01:00
EvalEmitter.cpp
EvalEmitter.h
Frame.cpp
Frame.h
Function.cpp
Function.h
Integral.h Use std::foo_t rather than std::foo in clang. 2020-02-11 10:37:08 -08:00
Interp.cpp C++2a -> C++20 in some identifiers; NFC. 2020-04-21 15:37:19 -04:00
Interp.h [Clang interpreter] Avoid storing pointers at unaligned locations 2021-07-28 16:03:41 +01:00
InterpBlock.cpp [Clang interpreter] Rename Block.{h,cpp} to InterpBlock.{h,cpp} 2020-02-21 09:47:28 -08:00
InterpBlock.h [Clang interpreter] Rename Block.{h,cpp} to InterpBlock.{h,cpp} 2020-02-21 09:47:28 -08:00
InterpFrame.cpp
InterpFrame.h [clang][NFC] Add 'override' keyword to virtual function overrides 2020-07-14 08:59:57 -07:00
InterpStack.cpp
InterpStack.h
InterpState.cpp
InterpState.h
Opcode.h
Opcodes.td
Pointer.cpp [Clang interpreter] Rename Block.{h,cpp} to InterpBlock.{h,cpp} 2020-02-21 09:47:28 -08:00
Pointer.h [Clang interpreter] Rename Block.{h,cpp} to InterpBlock.{h,cpp} 2020-02-21 09:47:28 -08:00
PrimType.cpp
PrimType.h
Program.cpp [Clang interpreter] Avoid storing pointers at unaligned locations 2021-07-28 16:03:41 +01:00
Program.h [Clang interpreter] Avoid storing pointers at unaligned locations 2021-07-28 16:03:41 +01:00
Record.cpp
Record.h
Source.cpp
Source.h [Clang interpreter] Avoid storing pointers at unaligned locations 2021-07-28 16:03:41 +01:00
State.cpp [clang][NFC] Use SmallString instead of SmallVector<char 2020-11-17 13:02:58 +00:00
State.h