From 01f2f3c4b9aab357ffb86e641dd5bd2b8de2bd67 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Mon, 8 Dec 2025 21:53:53 +0100 Subject: [PATCH] Disable MSAn for lapack_LU One of the arguments is sent to Fortran so the whole function has to be disabled fro MSAN. Arguments cannot be unpoisoned, cf https://g3doc.corp.google.com/testing/msan/g3doc/index.md?cl=head#memorysanitizer-api --- modules/core/src/hal_internal.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/core/src/hal_internal.cpp b/modules/core/src/hal_internal.cpp index 377c688015..f3f23a3b3c 100644 --- a/modules/core/src/hal_internal.cpp +++ b/modules/core/src/hal_internal.cpp @@ -69,10 +69,12 @@ #include #define CV_ANNOTATE_MEMORY_IS_INITIALIZED(address, size) \ __msan_unpoison(address, size) +#define CV_ANNOTATE_NO_SANITIZE_MEMORY __attribute__((no_sanitize("memory"))) #endif #endif #ifndef CV_ANNOTATE_MEMORY_IS_INITIALIZED #define CV_ANNOTATE_MEMORY_IS_INITIALIZED(address, size) do { } while(0) +#define CV_ANNOTATE_NO_SANITIZE_MEMORY #endif //lapack stores matrices in column-major order so transposing is needed everywhere @@ -108,8 +110,9 @@ set_value(fptype *dst, size_t dst_ld, fptype value, size_t m, size_t n) dst[i*dst_ld + j] = value; } +// MSAN can't see that the fortran LAPACK functions initialize `info` template static inline int -lapack_LU(fptype* a, size_t a_step, int m, fptype* b, size_t b_step, int n, int* info) +CV_ANNOTATE_NO_SANITIZE_MEMORY lapack_LU(fptype* a, size_t a_step, int m, fptype* b, size_t b_step, int n, int* info) { #if defined (ACCELERATE_NEW_LAPACK) && defined (ACCELERATE_LAPACK_ILP64) cv::AutoBuffer piv_buff(m);