Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[asan] Stop instrumenting user-defined ELF sections
Do not instrument user-defined ELF sections (whose names resemble valid C identifiers). They may have special use semantics and modifying them may break programs. This is e.g. the case with NetBSD __link_set API that expects these sections to store consecutive array elements. Differential Revision: https://reviews.llvm.org/D76665
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-netbsd-link_set.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
; This test checks that NetBSD link_set array elements remain consecutive. | ||
; RUN: opt < %s -asan -asan-module -S | FileCheck %s | ||
|
||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64-unknown-netbsd" | ||
|
||
module asm ".hidden __stop_link_set_test_set" | ||
|
||
@data1 = dso_local global i32 1, align 4 | ||
@data2 = dso_local global i32 2, align 4 | ||
@__link_set_test_set_sym_data1 = internal constant i8* bitcast (i32* @data1 to i8*), section "link_set_test_set", align 8 | ||
@__link_set_test_set_sym_data2 = internal constant i8* bitcast (i32* @data2 to i8*), section "link_set_test_set", align 8 | ||
; CHECK: @__link_set_test_set_sym_data1 = internal constant i8*{{.*}}, section "link_set_test_set" | ||
; CHECK-NEXT: @__link_set_test_set_sym_data2 = internal constant i8*{{.*}}, section "link_set_test_set" |
17 changes: 17 additions & 0 deletions
17
llvm/test/Instrumentation/AddressSanitizer/instrument-section-invalid-c-ident.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
; This test checks that sections with names not resembling valid C identifiers | ||
; are instrumented. | ||
; RUN: opt < %s -asan -asan-module -S | FileCheck %s | ||
|
||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64-unknown-netbsd" | ||
|
||
module asm ".hidden invalid$c$name" | ||
|
||
@data1 = dso_local global i32 1, align 4 | ||
@data2 = dso_local global i32 2, align 4 | ||
@__invalid$c$name_sym_data1 = internal constant i8* bitcast (i32* @data1 to i8*), section "invalid$c$name", align 8 | ||
@__invalid$c$name_sym_data2 = internal constant i8* bitcast (i32* @data2 to i8*), section "invalid$c$name", align 8 | ||
; CHECK: @"__invalid$c$name_sym_data1" = internal constant{{.*}}, section "invalid$c$name", comdat | ||
; CHECK-NEXT: @"__invalid$c$name_sym_data2" = internal constant{{.*}}, section "invalid$c$name", comdat | ||
; CHECK: @"__asan_global___invalid$c$name_sym_data1" | ||
; CHECK-NEXT: @"__asan_global___invalid$c$name_sym_data2" |