Skip to content

release 载荷二进制内嵌 CI 构建机绝对路径(strip 后仍残留于 .rodata) #66

Open

Description

@Sunrisepeak

环境

  • mcppls v0.0.16 payload-linux-x64.tar.gz(官方 release 载荷,非源码自建)
  • Linux x86_64

现象

mcppls/bin/mcppls 为静态链接且已 strip 的 ELF,但 strings 仍可见构建机绝对路径。它们来自依赖包源码中断言宏的 __FILE__,位于只读数据段,strip 无法去除:

$ strings -a bin/mcppls | grep -E '^/home/runner' | sort -u | head -4
/home/runner/.mcpp/registry/data/xpkgs/mcpplibs-x-openkal-llvm-runtime/0.15.1/openkal-llvm-runtime-0.15.1/llvm/libcxxabi/src/cxa_demangle.cpp
/home/runner/.mcpp/registry/data/xpkgs/mcpplibs-x-openkal-llvm-runtime/0.15.1/openkal-llvm-runtime-0.15.1/llvm/libcxxabi/src/demangle/ItaniumDemangle.h
/home/runner/.mcpp/registry/data/xpkgs/nlohmann-x-json/3.12.0/json-3.12.0/single_include/nlohmann/json.hpp

影响

  1. 断言/诊断消息会把 CI 机器路径打印给最终用户。
  2. 下游再分发的产物隐私/供应链扫描会因嵌入构建机路径而拒绝发布(meditor 的发布门禁即如此,无法放行包含构建环境路径的载荷)。

建议

release 构建加入 -ffile-prefix-map=<abs>=.(或等价的相对路径编译),使 __FILE__/断言消息不含 CI 绝对路径。参照:同载荷中 clangd/bin/clangd 使用 $ORIGIN 相对 RUNPATH 且无内嵌构建路径,说明流程上可以做到干净。

背景

meditor(https://github.com/speak-agent/meditor ,GPL-3.0-only,专注 mcpp 与 C++ Modules 的编辑器)按 SHA-256 固定引用 mcppls 官方 release 载荷随包分发。下游已用打包期处理临时解决,但希望上游在 release 流程根治,之后下游可直接升级 pin。

Activity

  1. Sunrisepeak commented on Nov 26, 2026

    @Sunrisepeak
    OwnerAuthor

    Considered for the 0.24.2 batch and not carried: the leaked paths are those of the dependency packages (<home>/.mcpp/registry/data/xpkgs/..., /home/runner/...), which differ per host and are not known when mcpp.toml is written. A -ffile-prefix-map for them needs mcpp to supply the package roots, or a flag with the runner's path computed in CI, and is not something to add blindly to a release. Still open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions