[llvm-branch-commits] [compiler-rt] f044508 - Revert "Revert "[sanitizer] Fix race condition in GetNamedMappingFd with deco…"
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Apr 26 16:55:01 PDT 2026
Author: Vitaly Buka
Date: 2026-04-26T16:54:57-07:00
New Revision: f044508ea74f22d4b6cd812714fdd05bc30fcdc5
URL: https://github.com/llvm/llvm-project/commit/f044508ea74f22d4b6cd812714fdd05bc30fcdc5
DIFF: https://github.com/llvm/llvm-project/commit/f044508ea74f22d4b6cd812714fdd05bc30fcdc5.diff
LOG: Revert "Revert "[sanitizer] Fix race condition in GetNamedMappingFd with deco…"
This reverts commit 57494cc7b4e8b59714ee9e312812d8421f41d27c.
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp
index 5b2c4e668ca8f..75606bcc6b325 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp
@@ -357,9 +357,9 @@ int GetNamedMappingFd(const char *name, uptr size, int *flags) {
if (!common_flags()->decorate_proc_maps || !name)
return -1;
char shmname[200];
- CHECK(internal_strlen(name) < sizeof(shmname) - 10);
- internal_snprintf(shmname, sizeof(shmname), "/dev/shm/%zu [%s]",
- internal_getpid(), name);
+ int len = internal_snprintf(shmname, sizeof(shmname), "/dev/shm/%zu.%zu [%s]",
+ internal_getpid(), GetTid(), name);
+ CHECK_LT(len, sizeof(shmname));
int o_cloexec = 0;
#if defined(O_CLOEXEC)
o_cloexec = O_CLOEXEC;
More information about the llvm-branch-commits
mailing list