[compiler-rt] [sanitizer_common] Log a backtrace for unexpected format printf specifiers (PR #222658)

Dan Blackwell via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 13:55:35 PDT 2026


================
@@ -538,11 +541,18 @@ static void printf_common(void *ctx, const char *format, va_list aq) {
     int size = printf_get_value_size(&dir);
     if (size == FSS_INVALID) {
       static int ReportedOnce;
-      if (!ReportedOnce++)
+      if (!ReportedOnce++) {
         Report(
             "%s: WARNING: unexpected format specifier in printf "
             "interceptor: %.*s (reported once per process)\n",
             SanitizerToolName, static_cast<int>(dir.end - dir.begin), dir.begin);
+        auto* stack = new (InternalAlloc(sizeof(BufferedStackTrace)))
----------------
DanBlackwell wrote:

I did try the stack allocation at first but TSan has a 530 byte limit https://github.com/llvm/llvm-project/blob/f156865f68e8f169120d192bb7400522f04e606e/compiler-rt/lib/tsan/rtl/CMakeLists.txt#L5

I have gone with a single element InternalMmapVector instead

https://github.com/llvm/llvm-project/pull/222658


More information about the llvm-commits mailing list