Skip to content

Commit ba80cdd

Browse files
MaskRaytru
authored andcommitted
[asan,test] Disable _FORTIFY_SOURCE test incompatible with glibc 2.40
In terms of bug catching capability, `_FORTIFY_SOURCE` does not perform as well as some dynamic instrumentation tools. When a sanitizer is used, generally `_FORTIFY_SOURCE` should be disabled since sanitizer runtime does not implement most `*_chk` functions. Using `_FORTIFY_SOURCE` will regress error checking (asan/hwasan/tsan) or cause false positives (msan). `*printf_chk` are the most pronounced `_chk` interceptors for uninstrumented DSOes (https://reviews.llvm.org/D40951). glibc 2.40 introduced `pass_object_info` style fortified source for some functions ([1]). `fprintf` will be mangled as `_ZL7fprintfP8_IO_FILEU17pass_object_size1PKcz`, which has no associated interceptor, leading to printf-fortify-5.c failure. Just disable the test. Fix #100877 [1]: https://sourceware.org/pipermail/libc-alpha/2024-February/154531.html Pull Request: #101566 (cherry picked from commit bbdccf4)
1 parent 56fa019 commit ba80cdd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

compiler-rt/test/asan/TestCases/Linux/printf-fortify-5.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// RUN: %clang -fPIC -shared -O2 -D_FORTIFY_SOURCE=2 -D_DSO %s -o %t.so
22
// RUN: %clang_asan -o %t %t.so %s
33
// RUN: not %run %t 2>&1 | FileCheck %s
4-
// REQUIRES: glibc-2.27
4+
/// Incompatible with pass_object_info style fortified source since glibc 2.40.
5+
// REQUIRES: glibc-2.27 && !glibc-2.40
56
#ifdef _DSO
67
#include <stdio.h>
78
#include <stdlib.h>

compiler-rt/test/lit.common.cfg.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,16 @@ def add_glibc_versions(ver_string):
674674

675675
ver = LooseVersion(ver_string)
676676
any_glibc = False
677-
for required in ["2.19", "2.27", "2.30", "2.33", "2.34", "2.37", "2.38"]:
677+
for required in [
678+
"2.19",
679+
"2.27",
680+
"2.30",
681+
"2.33",
682+
"2.34",
683+
"2.37",
684+
"2.38",
685+
"2.40",
686+
]:
678687
if ver >= LooseVersion(required):
679688
config.available_features.add("glibc-" + required)
680689
any_glibc = True

0 commit comments

Comments
 (0)