| 1 | //===-- ubsan_offload_packet.h ----------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // Offload/host RPC packet for UBSan reports. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef UBSAN_OFFLOAD_PACKET_H |
| 14 | #define UBSAN_OFFLOAD_PACKET_H |
| 15 | |
| 16 | #include "sanitizer_common/sanitizer_offload_opcodes.h" |
| 17 | #include <stdint.h> |
| 18 | |
| 19 | enum __ubsan_report_kind : uint8_t { |
| 20 | #define UBSAN_OFFLOAD_HANDLER(kind, ...) UBSAN_OFFLOAD_##kind, |
| 21 | #define UBSAN_OFFLOAD_HANDLER_NORETURN(kind, ...) UBSAN_OFFLOAD_##kind, |
| 22 | #include "ubsan_offload_checks.inc" |
| 23 | UBSAN_OFFLOAD_KIND_COUNT |
| 24 | }; |
| 25 | |
| 26 | // A single offload packet to initiate the report in the UBSan host runtime. |
| 27 | struct __ubsan_offload_report { |
| 28 | uint64_t pc; |
| 29 | uint64_t data; |
| 30 | uint64_t val0; |
| 31 | uint8_t reserved0[8]; |
| 32 | uint64_t val1; |
| 33 | uint8_t reserved1[8]; |
| 34 | uint64_t val2; |
| 35 | uint8_t kind; |
| 36 | uint8_t fatal; |
| 37 | uint8_t reserved2[3]; |
| 38 | }; |
| 39 | |
| 40 | static_assert(sizeof(__ubsan_offload_report) == 64, |
| 41 | "Offload UBSan report must fit one RPC packet" ); |
| 42 | |
| 43 | #endif // UBSAN_OFFLOAD_PACKET_H |
| 44 | |