mirror of
https://github.com/microsoft/vscode.git
synced 2026-06-29 10:56:24 +01:00
e6f4d6c6f2
* Avoid CPU-pegging process report in libc detection detectLibc() called process.report.getReport() on every Linux process to tell glibc from musl. That report serializes heap, native stack and libuv state, and the network/socket enumeration can peg the CPU on busy hosts. Detect cheapest-first instead: parse the ELF PT_INTERP dynamic-linker path from the head of /proc/self/exe, then string-match the head of /usr/bin/ldd, and only fall back to the process report (now with excludeNetwork = true to skip the expensive libuv section, also inspecting sharedObjects). Default to glibc when nothing is conclusive. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Read ELF64 offsets as 64-bit with safe-integer guards Address PR review: e_phoff, p_offset and p_filesz are 64-bit fields in ELF64. Read them via readBigUInt64LE through a bounded helper that rejects values past Number.MAX_SAFE_INTEGER, validate e_phentsize covers a full Elf64_Phdr, and widen the per-entry bounds check to the 8-byte p_filesz. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Use detect-libc package instead of hand-rolled libc detection Replace the bespoke ELF/ldd/process-report probing in detectLibc() with the detect-libc package (already present transitively, now a direct dependency). It performs the same cheapest-first detection and sets process.report's excludeNetwork flag internally, so the CPU-pegging libuv enumeration is still avoided without us maintaining the ELF parser. Add detect-libc to the hasNode import allowlist in eslint.config.js. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Declare detect-libc in remote/package.json detectLibc() (via agentSdkDownloader) is reached from agentHostServerMain, so the server/REH build requires detect-libc. It was only present in the remote node_modules transitively (through @parcel/watcher); declare it directly to match the root manifest and the direct import. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename detectLibc to detectLibcSync Signal the blocking nature in the name and leave room for a future promise-based detectLibc that wraps detect-libc's async family(). Update the agentSdkDownloader consumer and the unit test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>