Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201229061500.7eksavfiobh326lk@gmail.com>
Date: Mon, 28 Dec 2020 22:15:00 -0800
From: Fangrui Song <i@...kray.me>
To: musl@...ts.openwall.com
Subject: sanitizers and musl

With https://reviews.llvm.org/D93848 (and various random fixes I pushed
separately), many sanitizers will build and work on a musl based distribution.
A maintainer said the patch is in a pretty good shape and is very likely
accepted.

For folks who want to play with sanitizers ( https://github.com/llvm/llvm-project )

cmake -GNinja -Hllvm -BRelease -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='clang;lld;libunwind;compiler-rt;libcxx;libcxxabi' -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-alpine-linux-musl -DLLVM_TARGETS_TO_BUILD=X86 -DLIBCXX_HAS_MUSL_LIBC=On -DLLVM_APPEND_VC_REV=OFF
ninja -C Release asan cfi msan tsan ubsan

Release/bin/clang -fsanitize=address
Release/bin/clang -fsanitize=memory
Release/bin/clang -fsanitize=thread
Release/bin/clang -fsanitize=undefined
Release/bin/clang -fsanitize=cfi -flto -fvisibility=default

Hopefully this can be available before LLVM 12.0 is branched.

There is currently a CMake issue making check-msan/check-tsan fail to build
with libc++. I filed https://bugs.llvm.org/show_bug.cgi?id=48618 Hope someone
with CMake experience can figure out the solution:) 

(
Are interceptors poking into internals brittle?

Yes and no. sanitizer_platform_limits_posix.h has many structures which assume specific struct layouts.
Functions using them are surely less reliable. For asan (which tracks
addressability)/tsan (which detects concurrency issues in libc functions),
failure to intercept libc functions in many cases just increase false
negatives, which is not an insurmountable problem. For msan (initialized bits),
smaller interception coverage can increase false positives, which is a big problem.)

% ninja check-asan
(known issues:
* ASAN_OPTIONS=fast_unwind_on_malloc=0 odr-violations hangs
)
...
Testing Time: 332.62s
   Unsupported      : 185
   Passed           : 511
   Expectedly Failed:   1
   Failed           :  13

% ninja check-ubsan check-ubsan-minimal check-memprof # all passed

% ninja check-cfi
( all cross-dso/)
...
Testing Time: 8.68s
   Unsupported      : 264
   Passed           :  80
   Expectedly Failed:   8
   Failed           :  32

% ninja check-msan
(Work around a CMake problem (https://bugs.llvm.org/show_bug.cgi?id=48618))
Testing Time: 23.48s
   Unsupported      :   6
   Passed           : 756
   Expectedly Failed:   2
   Failed           :  66

% ninja check-tsan
(Work around a CMake problem (https://bugs.llvm.org/show_bug.cgi?id=48618))
Testing Time: 23.21s
   Unsupported      :  86
   Passed           : 295
   Expectedly Failed:   1
   Failed           :  25

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.