llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.78k stars 11.9k forks source link

TSAN doesn't support real-time signals on FreeBSD #92313

Open tavianator opened 5 months ago

tavianator commented 5 months ago
tavianator@muon $ cat foo.c
#include <signal.h>
#include <stdio.h>

int main(void) {
        if (signal(SIGRTMIN, SIG_DFL) == SIG_ERR) {
                perror("signal()");
        }
        return 0;
}
tavianator@muon $ clang18 foo.c -o foo
tavianator@muon $ ./foo
tavianator@muon $ clang18 -fsanitize=thread foo.c -o foo
tavianator@muon $ ./foo
signal(): Invalid argument
tavianator@muon $ clang18 --version
clang version 18.1.3
Target: x86_64-portbld-freebsd14.0
Thread model: posix
InstalledDir: /usr/local/llvm18/bin
tavianator@muon $ uname -a
FreeBSD muon 14.0-RELEASE-p5 FreeBSD 14.0-RELEASE-p5 #0: Tue Feb 13 23:37:36 UTC 2024     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

I think kSigCount is wrong here: https://github.com/llvm/llvm-project/blob/ee765b0c94df7e636d9739216b1646d3a2d3b5db/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp#L64