libmd has a few Init/Update/Final implementations of the same name as OpenSSL but with incompatible signature. For FreeBSD this is at least SHA2 and MD5. This causes issues when using ASAN, in particular in combination with EVP. See https://github.com/libressl/portable/issues/1098 and https://github.com/openssl/openssl/issues/25456 for an example. I suspect defining `SANITIZER_INTERCEPT_*` for these needs to be reconsidered.
I reported this to LLVM upstream to make the NetBSD developers who added this aware. https://github.com/llvm/llvm-project/issues/110215
Looks like this has been addressed upstream by simply removing the interceptors: https://github.com/llvm/llvm-project/issues/110215
I think we can close this, since LLVM will be released w/ this patch for upcoming FreeBSD 14.2?
(In reply to Rafael Grether from comment #3) As far as I can see, this patch isn't in 14.2 (though it is in stable/14). It's not in stable/13 either. It seems low-risk enough that we could include it in 14.2, but it's getting a bit late in the release cycle. Dimitry, do you have an opinion on what to do here?
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=4f1754bccef155c0fd24547ab3c872bd0f182224 commit 4f1754bccef155c0fd24547ab3c872bd0f182224 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2024-11-07 16:12:12 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2024-11-07 16:13:43 +0000 Merge commit d0b9c2c56476 from llvm git (by David CARLIER): [compiler-rt] Remove SHA2 interceptions for NetBSD/FreeBSD. (#110246) To Fix #110215 Interceptors introduced with 18a7ebda99044473fdbce6376993714ff54e6690 This fixes undesirable runtime failures when using -fsanitize=-address in combination with -lcrypto. Direct commit to stable/14, because main already got this change as part of the llvm-19 import. Reported by: Theo Buehler <tb@openbsd.org> PR: 281685 .../sanitizer_common_interceptors.inc | 180 --------------------- .../sanitizer_platform_interceptors.h | 2 - 2 files changed, 182 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=56d38dda6b909031995bac73d166efa1b6cccb26 commit 56d38dda6b909031995bac73d166efa1b6cccb26 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2024-11-07 16:12:50 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2024-11-07 16:12:50 +0000 Merge commit d0b9c2c56476 from llvm git (by David CARLIER): [compiler-rt] Remove SHA2 interceptions for NetBSD/FreeBSD. (#110246) To Fix #110215 Interceptors introduced with 18a7ebda99044473fdbce6376993714ff54e6690 This fixes undesirable runtime failures when using -fsanitize=-address in combination with -lcrypto. Direct commit to stable/13, because main already got this change as part of the llvm-19 import. Reported by: Theo Buehler <tb@openbsd.org> PR: 281685 .../sanitizer_common_interceptors.inc | 180 --------------------- .../sanitizer_platform_interceptors.h | 2 - 2 files changed, 182 deletions(-)
(In reply to Mark Johnston from comment #4) No, it wasn't in stable/14 yet. I have committed that now, and if you like I can mail re@ again for another eleventh-hour fix. :)
(In reply to Dimitry Andric from comment #7) Oops, thanks for merging. I suspect that this is low-risk enough to consider for 14.2. cc'ing releng. I'll do some testing using the bug report from libressl.
(In reply to Mark Johnston from comment #8) Thanks for fixing this in various branches. FWIW, I have been running a test box with 14.1-stable with a variant of this patch applied for about a month and have done a few simple tests like building test programs of a few related bug reports with -fsanitize=address. I also built and ran tests for several LibreSSL versions and all things work as expected. This is only light testing, but I encourage you to land this if at all possible. I think it can only improve things. The bug has very confusing side effects, is quite annoying and it breaks tons of serious usage of ASAN with OpenSSL in play.
A commit in branch releng/14.2 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=57921ae825dcf690b06b63db2e38613ee32d1b8e commit 57921ae825dcf690b06b63db2e38613ee32d1b8e Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2024-11-07 16:12:12 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-11-09 16:49:52 +0000 Merge commit d0b9c2c56476 from llvm git (by David CARLIER): [compiler-rt] Remove SHA2 interceptions for NetBSD/FreeBSD. (#110246) To Fix #110215 Interceptors introduced with 18a7ebda99044473fdbce6376993714ff54e6690 This fixes undesirable runtime failures when using -fsanitize=-address in combination with -lcrypto. Direct commit to stable/14, because main already got this change as part of the llvm-19 import. Approved by: re (cperciva) Reported by: Theo Buehler <tb@openbsd.org> PR: 281685 (cherry picked from commit 4f1754bccef155c0fd24547ab3c872bd0f182224) .../sanitizer_common_interceptors.inc | 180 --------------------- .../sanitizer_platform_interceptors.h | 2 - 2 files changed, 182 deletions(-)
The patch will be in 14.2-RELEASE. Thank you for the report.