From 5c73b4ef5829f0d722fdbb8ba8d84709563505a0 Mon Sep 17 00:00:00 2001 From: Lucas Perlind Date: Thu, 1 May 2025 20:42:21 +1000 Subject: Add attribute @(no_sanitize_address) The purposes of this attribute is to let procedures opt-out of being instrumented with asan. Typically an allocator that includes 'in-band' meta-data will be accessing poisoned values (such as tlsf). Making asan work with these allocators becomes very challenging so just being to ignore asan within specific allocator procedures makes it easier to reason and removes the need to temporarily poison and unpoison allocator data. --- src/llvm_backend_proc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/llvm_backend_proc.cpp') diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp index 3212abd9a..c442f3d58 100644 --- a/src/llvm_backend_proc.cpp +++ b/src/llvm_backend_proc.cpp @@ -333,7 +333,7 @@ gb_internal lbProcedure *lb_create_procedure(lbModule *m, Entity *entity, bool i } if (p->body && entity->pkg && ((entity->pkg->kind == Package_Normal) || (entity->pkg->kind == Package_Init))) { - if (build_context.sanitizer_flags & SanitizerFlag_Address) { + if (build_context.sanitizer_flags & SanitizerFlag_Address && !entity->Procedure.no_sanitize_address) { lb_add_attribute_to_proc(m, p->value, "sanitize_address"); } if (build_context.sanitizer_flags & SanitizerFlag_Memory) { -- cgit v1.2.3