From nobody Thu Apr 25 16:47:59 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VQMH33l8xz5J5wR; Thu, 25 Apr 2024 16:47:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VQMH33DJCz4LZr; Thu, 25 Apr 2024 16:47:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714063679; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VtCIOnjJRf0w2s2OsYdd9l/8ZjtGJcLFMtHKJzp2kNs=; b=d3/Ecsur5SeRUIgaxOLK/zD+XfnOYG/N35y7qFm4dg8LE8jF+U+61m/gECVbvpRsyc2z3l ZzHFVveD8x1I8aPgU/Y9ougD8pxJpZNCuqCsHFPG/xB0PFWtT/5paqfB0gKrLvQ9+5AEtH Ifw4rR5kyRg1ne533qWaQP+WKDAIJfw5F5eP54sBetZkvR/FRRXNy5eWmLbsIzjQQTtA9Y qIjx9hd2oWxbnfiyy66SjQSLm0TTzQDQPLlbHH5jSSbOv5KtO6tSplkFEI5lsLKtjdyCqh S+RqkClNzfhOa+Jb7asdiwgmDI4JtGfG72sYBPOw6gVkTLABq31NPX0MUpVnJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714063679; a=rsa-sha256; cv=none; b=cLmci8TnFpLIPeHBw2QDbu9FQ3In0ciZgx/+5rCrayZX9gehsNdaJ7vewrNirItTM2em9B ZxhKw6gIPdYQ93E+VP6nyibXhbfA0mnR9E846njjUiw3fg1iJhKKwrHaZMGTK1P7XeYwUa YMmKrXJadHN9/uQANsZ7utYNKJEaOMlq0/d54xzgZjuqD7eHGoqboqRv4WS3RonhImpYXV RPryWu9XG9tAhwupe8zbyXgzZCo10gYMRmpgXHT2AccynBIm0aUtm4MwG4uBAOLi3qO+2J nnxBy3+TOio+AVO86naFTSYmb24aH9IqvlCUETQ8kws1hKM0drjQDwgaZGxQvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714063679; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VtCIOnjJRf0w2s2OsYdd9l/8ZjtGJcLFMtHKJzp2kNs=; b=O6s0Fk0ahYHjiQVE40Zis7xg5PxgvE7uOiildHUVbgH+AmsYfUJmyq6bZWZeV5Z1pxpcnM 10XoPNtqDQGKNuF5qwP0wnKqsduy5vA7EpmfnNJ0PLxjycBU2kYIHLqAfnAVqff6NhQRoU fxTJB+NwPGsFYS2deK+RgRsYEh67oalq0jMS3mbw92l7PA8aL1hllC33IPvAr/l7uDGmXq Vz6yx1jKq/LS5+Jtx+ntsQRpX2lkY0PAA93FmXr3rY2VAq3SA7/Li2aBt5/y2JwUsYu+Cc Wsqr0eXbP/dTZw6+ex7hp1AyuTi7Z36QYxOEwgVvnmE4OtPKxpqiqHZrBhKFPw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VQMH32qWZz16Hc; Thu, 25 Apr 2024 16:47:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43PGlxig047247; Thu, 25 Apr 2024 16:47:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43PGlxn7047244; Thu, 25 Apr 2024 16:47:59 GMT (envelope-from git) Date: Thu, 25 Apr 2024 16:47:59 GMT Message-Id: <202404251647.43PGlxn7047244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: f08bf5a3acf1 - main - Merge commit 0f329e0246d1 from llvm-project (by Dimitry Andric): List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f08bf5a3acf146b17794fbde41279645ddbaa086 Auto-Submitted: auto-generated The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=f08bf5a3acf146b17794fbde41279645ddbaa086 commit f08bf5a3acf146b17794fbde41279645ddbaa086 Author: Dimitry Andric AuthorDate: 2024-04-25 16:47:31 +0000 Commit: Dimitry Andric CommitDate: 2024-04-25 16:47:47 +0000 Merge commit 0f329e0246d1 from llvm-project (by Dimitry Andric): [sanitizer_symbolizer] Cast arguments for format strings in markup (#89815) When compiling the common sanitizer libraries, there are many warnings about format specifiers, similar to: compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp:31:32: warning: format specifies type 'void *' but the argument has type 'uptr' (aka 'unsigned long') [-Wformat] 31 | buffer->AppendF(kFormatData, DI->start); | ~~~~~~~~~~~ ^~~~~~~~~ compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h:33:46: note: format string is defined here 33 | constexpr const char *kFormatData = "{{{data:%p}}}"; | ^~ | %lu compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp:46:43: warning: format specifies type 'void *' but the argument has type 'uptr' (aka 'unsigned long') [-Wformat] 46 | buffer->AppendF(kFormatFrame, frame_no, address); | ~~~~~~~~~~~~ ^~~~~~~ compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h:36:48: note: format string is defined here 36 | constexpr const char *kFormatFrame = "{{{bt:%u:%p}}}"; | ^~ | %lu ... This is because `uptr` is dependent on the platform, and can be either `unsigned long long`, `unsigned long`, or `unsigned int`. To fix the warnings, cast the arguments to the expected type of the format strings. PR: 276104 Reported by: pstef MFC after: 3 days --- .../lib/sanitizer_common/sanitizer_symbolizer_markup.cpp | 10 ++++++---- .../sanitizer_common/sanitizer_symbolizer_markup_constants.h | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp index b2a1069a9a61..31d91ef3c739 100644 --- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp +++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp @@ -28,7 +28,7 @@ void MarkupStackTracePrinter::RenderData(InternalScopedString *buffer, const char *format, const DataInfo *DI, const char *strip_path_prefix) { RenderContext(buffer); - buffer->AppendF(kFormatData, DI->start); + buffer->AppendF(kFormatData, reinterpret_cast(DI->start)); } bool MarkupStackTracePrinter::RenderNeedsSymbolization(const char *format) { @@ -43,12 +43,13 @@ void MarkupStackTracePrinter::RenderFrame(InternalScopedString *buffer, const char *strip_path_prefix) { CHECK(!RenderNeedsSymbolization(format)); RenderContext(buffer); - buffer->AppendF(kFormatFrame, frame_no, address); + buffer->AppendF(kFormatFrame, frame_no, reinterpret_cast(address)); } bool MarkupSymbolizerTool::SymbolizePC(uptr addr, SymbolizedStack *stack) { char buffer[kFormatFunctionMax]; - internal_snprintf(buffer, sizeof(buffer), kFormatFunction, addr); + internal_snprintf(buffer, sizeof(buffer), kFormatFunction, + reinterpret_cast(addr)); stack->info.function = internal_strdup(buffer); return true; } @@ -118,7 +119,8 @@ static void RenderMmaps(InternalScopedString *buffer, // module.base_address == dlpi_addr // range.beg == dlpi_addr + p_vaddr // relative address == p_vaddr == range.beg - module.base_address - buffer->AppendF(kFormatMmap, range.beg, range.end - range.beg, moduleId, + buffer->AppendF(kFormatMmap, reinterpret_cast(range.beg), + range.end - range.beg, static_cast(moduleId), accessBuffer.data(), range.beg - module.base_address()); buffer->Append("\n"); diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h index 83643504e128..a43661eaecf2 100644 --- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h +++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h @@ -33,13 +33,13 @@ constexpr uptr kFormatFunctionMax = 64; // More than big enough for 64-bit hex. constexpr const char *kFormatData = "{{{data:%p}}}"; // One frame in a backtrace (printed on a line by itself). -constexpr const char *kFormatFrame = "{{{bt:%u:%p}}}"; +constexpr const char *kFormatFrame = "{{{bt:%d:%p}}}"; // Module contextual element. -constexpr const char *kFormatModule = "{{{module:%d:%s:elf:%s}}}"; +constexpr const char *kFormatModule = "{{{module:%zu:%s:elf:%s}}}"; // mmap for a module segment. -constexpr const char *kFormatMmap = "{{{mmap:%p:0x%x:load:%d:%s:0x%x}}}"; +constexpr const char *kFormatMmap = "{{{mmap:%p:0x%zx:load:%d:%s:0x%zx}}}"; // Dump trigger element. #define FORMAT_DUMPFILE "{{{dumpfile:%s:%s}}}"