From 3f4d116978044e2acc5e9a36196cf2a7d790319e Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Wed, 3 Sep 2025 06:00:10 -0700 Subject: [PATCH] [BOLT] close map_files FD (#156489) The BOLT runtime currently does not close the FD pointing to /proc/self/map_files. This does not actually hurt anything but was at least a bit of a red herring for me when looking through strace on a BOLT instrumented binary. --- bolt/runtime/instr.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bolt/runtime/instr.cpp b/bolt/runtime/instr.cpp index a42750cef6b6..1f54a500dbf9 100644 --- a/bolt/runtime/instr.cpp +++ b/bolt/runtime/instr.cpp @@ -714,9 +714,11 @@ static char *getBinaryPath() { uint32_t Ret = __readlink(FindBuf, TargetPath, sizeof(TargetPath)); assert(Ret != -1 && Ret != BufSize, "readlink error"); TargetPath[Ret] = '\0'; + __close(FDdir); return TargetPath; } } + __close(FDdir); return nullptr; }