From nobody Sun Apr 28 08:05:10 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 4VRzXQ37Cfz5JDVs; Sun, 28 Apr 2024 08:05:10 +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 4VRzXQ2bmQz49vv; Sun, 28 Apr 2024 08:05:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714291510; 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=yQ2M004TPoj/A86LItY6kXxJkWxyqSDPgUrKkDj1C6g=; b=cT7UjyhuYcW+8h6OB33DcuBBh+uYCgYPYQDCkt5kTsrxDnG6kW4kcCNtYIuXHc9BahhHwi rM4nJlagVl4gszJ4CzZ4nBNShWvC130Bf72vVXbGFpzwUgVZjz6mmcHz+shqp1ZaYF1Pzi c4auxBoqYozqNoNBi2aAbm5ZoBrCVfei8cghFxf3xzN5GqQhFGQ3DbPHwFxcIJQwXtjsTG vWC+NNDdo4bvqgx4Gt7oA4omwdemCXHnOcVpR89FYsKsFCUI9a0l7SeLml/Ti4Nw3GVUys tEkrMGnhRZvBeFIg1q2SeMcRziFK8FHSFBQNp6C/uI4WsQMWR8V4AfXaUH/JUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714291510; a=rsa-sha256; cv=none; b=KKY432/ZeBVyVm255LFQ3KjYG6RTqGSTtTxUIzlT/VUKC57THxavp/s3NK976tJxZ8hRly gtTurZiCTmJU75ugSnidVZ+uB6qoCp/z0N3KVH6KvHRI7L1wfN7J/a29ThBbhRTjII5Ac4 0ikdtuxqq2i6ZuxrQEUGxmD/4b9b+sPB5OIECXwnfOk2koNPFUd5fc1mTGe1FxyZ0+RaPh wJf3e+3eiNQbVOZvfQkPZk7nCpBQr5UM7jMvgNeRfOaoD9Nwvfz8NPjWS5f78pr/OZfbF1 9uam8e+TGTakjsIL8i6ceEanO275xPN9r/5HYhniJL/4lz7FP0KJBzGwhtV2SA== 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=1714291510; 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=yQ2M004TPoj/A86LItY6kXxJkWxyqSDPgUrKkDj1C6g=; b=bq+eEc5n6H7QcYwlo2SD2jGVpetpDkzGuBtjYdiOAFtsDHW8wL99X7Sk5EKfqpCYx7BTky pDO7pnUyLdESaaJDwxyWlG2yldg5/2fyOhq5N/Q2LTeE/nyjbAo5N4qwONjM+jpgrrCzDH lDUZ8sYK2hEcqkTrGwGkhkXOxfG4zssK31+TcOnRyBiOoWNahnGzaHUyGlDIkg4HQ4BnaN UaTBbHzA8NbvgvXL1ierfadOX+0q5hoeiGwJTETc0hYd4GBbySS/hG4flpA4zkNrc5fd3m hIJZea8ex316vOETWVg0eF/CCwxdEHn1BVxmV71W9Y50qWPAkdnrA4YDSNGVvw== 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 4VRzXQ1vFYzHPr; Sun, 28 Apr 2024 08:05:10 +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 43S85AEv076025; Sun, 28 Apr 2024 08:05:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43S85Aeo076022; Sun, 28 Apr 2024 08:05:10 GMT (envelope-from git) Date: Sun, 28 Apr 2024 08:05:10 GMT Message-Id: <202404280805.43S85Aeo076022@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: b9b248b1df62 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b9b248b1df62579913ce93ef4583e185e798a717 Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=b9b248b1df62579913ce93ef4583e185e798a717 commit b9b248b1df62579913ce93ef4583e185e798a717 Author: Dimitry Andric AuthorDate: 2024-04-25 16:47:31 +0000 Commit: Dimitry Andric CommitDate: 2024-04-28 08:04:33 +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}}}"