{"id":33386170,"url":"https://github.com/rrbutani/rtld-shim","last_synced_at":"2026-06-11T00:31:36.072Z","repository":{"id":325584995,"uuid":"1089924825","full_name":"rrbutani/rtld-shim","owner":"rrbutani","description":null,"archived":false,"fork":false,"pushed_at":"2025-11-11T16:08:16.000Z","size":190,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-22T08:02:36.901Z","etag":null,"topics":["bazel","bazelcon25","hermetic-builds","rtld"],"latest_commit_sha":null,"homepage":"https://youtu.be/RCcE5sxOn2o","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rrbutani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-05T02:02:10.000Z","updated_at":"2025-11-19T02:28:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rrbutani/rtld-shim","commit_stats":null,"previous_names":["rrbutani/rtld-shim"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/rrbutani/rtld-shim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrbutani%2Frtld-shim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrbutani%2Frtld-shim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrbutani%2Frtld-shim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrbutani%2Frtld-shim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rrbutani","download_url":"https://codeload.github.com/rrbutani/rtld-shim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrbutani%2Frtld-shim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34177445,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","bazelcon25","hermetic-builds","rtld"],"created_at":"2025-11-23T05:00:55.982Z","updated_at":"2026-06-11T00:31:36.034Z","avatar_url":"https://github.com/rrbutani.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Runtime Loader Shim\n\n## what\n\n## why\n\n## how\n\n#### normal execution\n\n```mermaid\nflowchart TB\n  exec[\"`\u003ccode\u003eexec \u003cspan style=\"color: yellow;\"\u003epath/to/binary\u003c/span\u003e\u003c/code\u003e`\"]\n\n  bin_load@{ shape: procs, label: \"\u003ccode\u003emmap\u003c/code\u003e from \u003ccode\u003e\u003cspan style=\"color: yellow\"\u003ebinary\u003c/span\u003e\u003c/code\u003e\"}\n\n  interp@{ shape: hex, label: \"has\n  \u003ccode\u003e\u003cspan style=\"color: orange;\"\u003ePT_INTERP\u003c/span\u003e\u003c/code\u003e?\" }\n\n  interp_load@{ shape: procs, label: \"\u003ccode\u003emmap\u003c/code\u003e from \u003ccode\u003e\u003cspan style=\"color: lime\"\u003eld.so\u003c/span\u003e\u003c/code\u003e\"}\n\n  bin_entry@{ shape: stadium, label: \"➡️ \u003ccode\u003e\u003cspan style=\"color: yellow\"\u003ebinary\u003c/span\u003e\u003c/code\u003e's entrypoint\" }\n\n  interp_entry@{ shape: stadium, label: \"➡️ \u003ccode\u003e\u003cspan style=\"color: lime\"\u003eld.so\u003c/span\u003e\u003c/code\u003e's entrypoint\" }\n\n  interp_run@{ shape: procs, label: \"resolve \u003ccode\u003edylib\u003c/code\u003es\n  apply relocations\" }\n\n  %% edges:\n\n  exec --\u003e bin_load --\u003e interp\n\n  interp -- \"`no`\" --\u003e bin_entry\n\n  interp -- \"`yes\n  \u003ccode\u003e\u003cspan style=\"color: lime;\"\u003e/lib64/ld-linux-x86-64.so.2\u003c/span\u003e\u003c/code\u003e`\" --\u003e interp_load\n\n  interp_load --\u003e interp_entry --\u003e interp_run --\u003e bin_entry\n\n  style interp fill:#444\n```\n\n#### explicit `ld.so` invocation\n\n```mermaid\nflowchart TB\n  exec[\"`\u003ccode\u003eexec \u003cspan style=\"color: lime\"\u003eld.so\u003c/span\u003e\u003c/code\u003e \u003ccode\u003e\u003cspan style=\"color: yellow;\"\u003epath/to/binary\u003c/span\u003e\u003c/code\u003e`\"]\n\n  bin_load@{ shape: procs, label: \"\u003ccode\u003emmap\u003c/code\u003e from \u003ccode\u003e\u003cspan style=\"color: yellow\"\u003ebinary\u003c/span\u003e\u003c/code\u003e\"}\n\n  interp_load@{ shape: procs, label: \"\u003ccode\u003emmap\u003c/code\u003e from \u003ccode\u003e\u003cspan style=\"color: lime\"\u003eld.so\u003c/span\u003e\u003c/code\u003e\"}\n\n  bin_entry@{ shape: stadium, label: \"➡️ \u003ccode\u003e\u003cspan style=\"color: yellow\"\u003ebinary\u003c/span\u003e\u003c/code\u003e's entrypoint\" }\n\n  interp_entry@{ shape: stadium, label: \"➡️ \u003ccode\u003e\u003cspan style=\"color: lime\"\u003eld.so\u003c/span\u003e\u003c/code\u003e's entrypoint\" }\n\n  interp_run@{ shape: procs, label: \"resolve \u003ccode\u003edylib\u003c/code\u003es\n  apply relocations\" }\n\n  %% edges:\n\n  exec --\u003e interp_load --\u003e interp_entry --\u003e bin_load --\u003e interp_run --\u003e bin_entry\n```\n\n#### with loader shim\n\n```mermaid\nflowchart TB\n  exec[\"\u003ccode\u003eexec \u003cspan style=\"color: yellow;\"\u003epath/to/binary\u003c/span\u003e\u003c/code\u003e\n  (patched w/\u003ccode\u003e\u003cspan style=\"color: red\"\u003eloader shim\u003c/span\u003e\u003c/code\u003e)\"]\n\n  bin_load@{ shape: procs, label: \"\u003ccode\u003emmap\u003c/code\u003e from \u003ccode\u003e\u003cspan style=\"color: yellow\"\u003ebinary\u003c/span\u003e\u003c/code\u003e\"}\n\n  interp@{ shape: hex, label: \"has\n  \u003ccode\u003e\u003cspan style=\"color: orange;\"\u003ePT_INTERP\u003c/span\u003e\u003c/code\u003e?\" }\n\n  bin_entry@{ shape: stadium, label: \"➡️ \u003ccode\u003e\u003cspan style=\"color: yellow\"\u003ebinary\u003c/span\u003e\u003c/code\u003e's entrypoint\n  (\u003ccode\u003e\u003cspan style=\"color: red\"\u003eloader shim\u003c/span\u003e\u003c/code\u003e)\" }\n\n  under_rtld@{ shape: hex, label: \"under \u003ccode\u003e\u003cspan style=\"color: lime;\"\u003eld.so\u003c/span\u003e\u003c/code\u003e?\" }\n\n  %% edges:\n\n  exec --\u003e bin_load --\u003e interp\n\n  interp -- \"`no`\" --\u003e bin_entry --\u003e under_rtld\n\n  under_rtld -- \"no\" --\u003e runfiles_lookup --\u003e rtld_exec\n  under_rtld -- \"yes\" --\u003e rtld_bin_entry\n\n  style interp fill:#444\n  style under_rtld fill:#444\n\n  subgraph rtld_exec_sub [\".\"]\n    direction TB\n    rtld_exec[\"`\u003ccode\u003eexec \u003cspan style=\"color: lime\"\u003eld.so\u003c/span\u003e\u003c/code\u003e \u003ccode\u003e\u003cspan style=\"color: yellow;\"\u003epath/to/binary\u003c/span\u003e\u003c/code\u003e`\"]\n\n    rtld_bin_load@{ shape: procs, label: \"\u003ccode\u003emmap\u003c/code\u003e from \u003ccode\u003e\u003cspan style=\"color: yellow\"\u003ebinary\u003c/span\u003e\u003c/code\u003e\"}\n\n    rtld_load@{ shape: procs, label: \"\u003ccode\u003emmap\u003c/code\u003e from \u003ccode\u003e\u003cspan style=\"color: lime\"\u003eld.so\u003c/span\u003e\u003c/code\u003e\"}\n\n    rtld_bin_entry@{ shape: stadium, label: \"➡️ \u003ccode\u003e\u003cspan style=\"color: yellow\"\u003ebinary\u003c/span\u003e\u003c/code\u003e's entrypoint\n    (\u003ccode\u003e\u003cspan style=\"color: yellow\"\u003eoriginal\u003c/span\u003e\u003c/code\u003e)\" }\n\n    rtld_entry@{ shape: stadium, label: \"➡️ \u003ccode\u003e\u003cspan style=\"color: lime\"\u003eld.so\u003c/span\u003e\u003c/code\u003e's entrypoint\" }\n\n    rtld_run@{ shape: procs, label: \"resolve \u003ccode\u003edylib\u003c/code\u003es\n    apply relocations\" }\n\n    runfiles_lookup@{ shape: event, label: \"\u003ccode style=\"color: red\"\u003erunfiles lookup\u003c/code\u003e\n    for \u003ccode style=\"color: lime\"\u003e ld.so\u003c/code\u003e\" }\n\n    under_rtld@{ shape: hex, label: \"under \u003ccode\u003e\u003cspan style=\"color: lime;\"\u003eld.so\u003c/span\u003e\u003c/code\u003e?\" }\n\n    %% edges:\n\n    rtld_exec --\u003e rtld_load --\u003e rtld_entry --\u003e rtld_bin_load --\u003e rtld_run --\u003e bin_entry\n  end\n```\n\n## demo?\n\n\u003e [!CAUTION]\n\u003e Hacky, coupled to Bazel 8, x86-64 only for now.\n\n\u003e [!IMPORTANT]\n\u003e As of this writing, Bazel's experimental hermetic linux sandbox does not set up procfs appropriately; this causes `ld.so` to fail to canonicalize program paths which then causes shared object resolution (i.e. for `DT_NEEDED` entries with `$ORIGIN` and such) to fail.\n\n1. Set up an RBE service of your choosing to use an [empty container image](bzl/Dockerfile) for action execution\n    - the [bundled example workspace's `--config=rbe`](bzl/.bazelrc) is set up for [buildbuddy](https://www.buildbuddy.io/) w/the [`rrbutani/empty`](https://hub.docker.com/repository/docker/rrbutani/empty/general) container image\n      + be sure to create an account, get an API key, and place it in `bzl/.buildbuddy-api-key.bazelrc`\n2. Run `bazel build //:out --config=rbe` in [`bzl`](./bzl/)\n    - if you're using [`nix`](flake.nix) + [`direnv`](bzl/.envrc), Bazel 8.4.2 will be fetched for you; if not you'll need to [grab it yourself](https://github.com/bazelbuild/bazelisk)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrbutani%2Frtld-shim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frrbutani%2Frtld-shim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrbutani%2Frtld-shim/lists"}