[libcxx-commits] [libcxx] beff64e - [msan][libcxx] Enable -fsanitize-memory-param-retval

Vitaly Buka via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 28 19:12:56 PDT 2022


Author: Vitaly Buka
Date: 2022-04-28T19:12:41-07:00
New Revision: beff64ee44acec4e7bfbc2ab165acba7579a6bb7

URL: https://github.com/llvm/llvm-project/commit/beff64ee44acec4e7bfbc2ab165acba7579a6bb7
DIFF: https://github.com/llvm/llvm-project/commit/beff64ee44acec4e7bfbc2ab165acba7579a6bb7.diff

LOG: [msan][libcxx] Enable -fsanitize-memory-param-retval

We are considering to make -fsanitize-memory-param-retval enabled by default so probably this patch is unnneded.

Reviewed By: #libc, EricWF

Differential Revision: https://reviews.llvm.org/D123979

Added: 
    

Modified: 
    libcxx/CMakeLists.txt
    libcxx/utils/libcxx/test/params.py

Removed: 
    


################################################################################
diff  --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 9ad93a39b43f3..4314bc2eddb8d 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -733,7 +733,7 @@ function(get_sanitizer_flags OUT_VAR  USE_SANITIZER)
     if (USE_SANITIZER STREQUAL "Address")
       append_flags(SANITIZER_FLAGS "-fsanitize=address")
     elseif (USE_SANITIZER MATCHES "Memory(WithOrigins)?")
-      append_flags(SANITIZER_FLAGS -fsanitize=memory)
+      append_flags(SANITIZER_FLAGS -fsanitize=memory -fsanitize-memory-param-retval)
       if (USE_SANITIZER STREQUAL "MemoryWithOrigins")
         append_flags(SANITIZER_FLAGS "-fsanitize-memory-track-origins")
       endif()

diff  --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 2c18aba41af63..79b58a04413b8 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -146,9 +146,9 @@ def getStdFlag(cfg, std):
               AddFlag('-fsanitize=address') if sanitizer == 'Address' else None,
               AddFeature('asan')            if sanitizer == 'Address' else None,
 
-              AddFlag('-fsanitize=memory')               if sanitizer in ['Memory', 'MemoryWithOrigins'] else None,
-              AddFeature('msan')                         if sanitizer in ['Memory', 'MemoryWithOrigins'] else None,
-              AddFlag('-fsanitize-memory-track-origins') if sanitizer == 'MemoryWithOrigins' else None,
+              AddFlag('-fsanitize=memory -fsanitize-memory-param-retval') if sanitizer in ['Memory', 'MemoryWithOrigins'] else None,
+              AddFeature('msan')                                          if sanitizer in ['Memory', 'MemoryWithOrigins'] else None,
+              AddFlag('-fsanitize-memory-track-origins')                  if sanitizer == 'MemoryWithOrigins' else None,
 
               AddFlag('-fsanitize=thread') if sanitizer == 'Thread' else None,
               AddFeature('tsan')           if sanitizer == 'Thread' else None,


        


More information about the libcxx-commits mailing list