From nobody Sun Apr 28 08:04:48 2024 X-Original-To: dev-commits-src-branches@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 4VRzX11NBWz5JDVp; Sun, 28 Apr 2024 08:04:49 +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 4VRzX10p7Tz49WD; Sun, 28 Apr 2024 08:04:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714291489; 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=lmxoPIcJS2t9+o1aOz+YF7OWZv02WEfqsvNScGBxEIw=; b=hXX2Z4V/wAYskQqfhMKbu4n81C7UlmyWjY8APITh2tzA1oZhnN/dKc2b0rukRlPGEajXl0 GWZr8U7uZNWTOp+159NzTZZiFdpL+Btfev1ruSZZD6swQlHAgF/rh8ZsYlFXugyy/ljvaH piqQm2FdY29M8TSUtrfySynVzbRX0zkaPVd9y7Q2b20+0bUlxMFimDvCjA0ozirKcxPstu u39RA2J01/Wla28pQAnQqHbcN/hfwSPsWmtdUwm/wmcfxt5z2PkXuZ0MTvU3xrhwAhBmaq ZClM2XunuyvYV6EV8MYFsLavSVCKWOgoly3oL+sqs7vI3r9gCbMXG363Ey/pZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714291489; a=rsa-sha256; cv=none; b=XXJ1/VPbJig8JE/uTaGFmDvBDw8oN+SyEvY3Z0xO2Arwvg4apHZAma6X0iaDsASP6wVdrJ G9qkjDVhA3PLY/kuwGZYljOruBptUaisb2Bw+i0GhhzzM1g7G4GA1dej0SUfYPxhMmLmjq wYkpYL2cYzlc0X/Zolw7e3HdXbq3KN5aB13BpQTdDXrbQ8U9tlL00I9NAGnQxt1Fw5rlQg M7sRYXt/Kxt8B3NJxoC4gQb/T8dnbUKmfe0Gh87ZKqTmsahXldBVmFmGFYDM0FTpPRE5G0 Ltd7gvzk8S/v0EAxXFzus6oOB/kHUgGakQzO2BvcMh/hOZQ3daouamBtNxD8EQ== 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=1714291489; 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=lmxoPIcJS2t9+o1aOz+YF7OWZv02WEfqsvNScGBxEIw=; b=Po3xNF2ErFp7aMJBZhD6CDCSErAO3fwNktZrfZ4D9cwCeX3GLDXhfVDbTHXf4pdGEfXi63 ekcBznKd1bphXM1UGTJXtgoQ1VNeYm+yzrtF3e1lF+lOaQrezzz/VP+PNrI2AwZbHMAiDb mekbUtiuAyquppv3ufitxptYyL99ls1B7uTTh+UnTSHjEHb1W4VFC6hxEajywrAes/Kvyj coCbBIv/88IMPVA64bHHl5KAcN0nBPK0VNgtFR33+hHM8ZUxp/0Gvrc4mBosHOtmEu0YGj zBdQIrY9n+bop6607SyeJQbsmJMK8VxE4+epNZ/dlkBVyuiBK9N2Mkj9PBPNMA== 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 4VRzX10QM7zHVJ; Sun, 28 Apr 2024 08:04:49 +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 43S84mp3075808; Sun, 28 Apr 2024 08:04:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43S84m4t075805; Sun, 28 Apr 2024 08:04:48 GMT (envelope-from git) Date: Sun, 28 Apr 2024 08:04:48 GMT Message-Id: <202404280804.43S84m4t075805@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 43fae14940a5 - stable/14 - Merge commit 0f329e0246d1 from llvm-project (by Dimitry Andric): List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 43fae14940a5db63e30acd48c2d1a2fcc35f6aaf Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=43fae14940a5db63e30acd48c2d1a2fcc35f6aaf commit 43fae14940a5db63e30acd48c2d1a2fcc35f6aaf Author: Dimitry Andric AuthorDate: 2024-04-25 16:47:31 +0000 Commit: Dimitry Andric CommitDate: 2024-04-28 08:03:46 +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 (cherry picked from commit f08bf5a3acf146b17794fbde41279645ddbaa086) --- .../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}}}"