https://github.com/delcypher created https://github.com/llvm/llvm-project/pull/91032
Due to how `CodeGenFunction::EmitTrapCheck` is implemented `SanitizerHandler` with numeric value 0x19 needs to be reserved because `-fbounds-safety` generates trap instructions with that value embedded in the trap instructions for x86_64 and arm64 just like for UBSan traps. ** x86_64 ** ``` ud1l 0x19(%eax), %eax ``` ** arm64 ** ``` brk #0x5519 ``` To avoid upstream Clang and AppleClang diverging their ABIs for `-fbounds-safety` the slot is being reserved in this patch. `SanitizerHandler::BoundsSafety` currently has no uses in the code but uses will be introduced when the CodeGen side of `-fbounds-safety`'s implementation is upstreamed. rdar://126884014 >From 644a56944963bb6445b58fd2162b2781e3180ba9 Mon Sep 17 00:00:00 2001 From: Dan Liew <d...@su-root.co.uk> Date: Fri, 3 May 2024 16:16:17 -0700 Subject: [PATCH] [Bounds-Safety] Reserve slot in SanitizerHandler enum for Bounds-Safety Due to how `CodeGenFunction::EmitTrapCheck` is implemented `SanitizerHandler` with numeric value 0x19 needs to be reserved because `-fbounds-safety` generates trap instructions with that value embedded in the trap instructions for x86_64 and arm64 just like for UBSan traps. ** x86_64 ** ``` ud1l 0x19(%eax), %eax ``` ** arm64 ** ``` brk #0x5519 ``` To avoid upstream Clang and AppleClang diverging their ABIs for `-fbounds-safety` the slot is being reserved in this patch. `SanitizerHandler::BoundsSafety` currently has no uses in the code but uses will be introduced when the CodeGen side of `-fbounds-safety`'s implementation is upstreamed. rdar://126884014 --- clang/lib/CodeGen/CodeGenFunction.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 6e7417fc7f52b6..34bdc35d5daffa 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -137,7 +137,8 @@ enum TypeEvaluationKind { SANITIZER_CHECK(SubOverflow, sub_overflow, 0) \ SANITIZER_CHECK(TypeMismatch, type_mismatch, 1) \ SANITIZER_CHECK(AlignmentAssumption, alignment_assumption, 0) \ - SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0) + SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0) \ + SANITIZER_CHECK(BoundsSafety, bounds_safety, 0) enum SanitizerHandler { #define SANITIZER_CHECK(Enum, Name, Version) Enum, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits