Repository navigation
fix: patch PT_INTERP/RUNPATH on agy.va39 so plugin-cli shims resolve /proc/self/exe - #55
Open
krshforever wants to merge 1 commit into
Open
krshforever wants to merge 1 commit into
krshforever wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
agylaunchesagy.va39indirectly viald-linux-aarch64.so.1 --library-path ... agy.va39, the kernel sets/proc/self/exeto.../glibc/lib/ld-linux-aarch64.so.1.When
agy.va39generates temporary plugin-cli shims in$TMPDIR/agy-plugin-cli-*/<tool>(e.g.gmail,gsheets), it embeds its/proc/self/exepath:Running that shim fails with:
Fix
build.sh: Requirepatchelfand patchPT_INTERP(${TERMUX_PREFIX}/glibc/lib/ld-linux-aarch64.so.1) andDT_RUNPATH(${TERMUX_PREFIX}/glibc/lib) onbin/agy.va39.lib/agy_helper.c: Executeagy.va39directly (or viaqemu-aarch64) whenPREFIXis/data/data/com.termux/files/usr, so/proc/self/exeresolves toagy.va39instead ofld-linux-aarch64.so.1. Non-standardPREFIXvalues retain theld-linux-aarch64.so.1 --library-pathfallback..github/workflows/pr-check.yml&.github/workflows/auto-sync-release.yml: Ensurepatchelfis installed in CI build jobs.Verification
patchelf --set-interpreter ... --set-rpath ...on a copy ofagy.va39and confirmed direct execution (--version->1.5.19, exit code 0).lib/agy_helper.ccompiles cleanly under strictclangflags (-std=gnu11 -Wall -Wextra -Wpedantic -Wshadow -Wformat=2 -Wundef -Wcast-align -Werror -O2) and passesclang-format --dry-run --Werror.bash -n build.sh.