Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix adjusting startPage #127

Merged
merged 1 commit into from
Jun 3, 2020
Merged

fix adjusting startPage #127

merged 1 commit into from
Jun 3, 2020

Conversation

bartosh
Copy link

@bartosh bartosh commented Jul 21, 2017

startPage is adjusted unconditionally for all executables.
This results in incorrect addresses assigned to INTERP and LOAD
program headers, which breaks patched executable.

Adjusting startPage variable only when startOffset > startPage
should fix this.

This change is related to the issue #10

Signed-off-by: Ed Bartosh ed.bartosh@linux.intel.com

startPage is adjusted unconditionally for all executables.
This results in incorrect addresses assigned to INTERP and LOAD
program headers, which breaks patched executable.

Adjusting startPage variable only when startOffset > startPage
should fix this.

This change is related to the issue #10

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
@domenkozar
Copy link
Member

cc @edolstra

@domenkozar
Copy link
Member

Can you provide a test case? For me, applying patchelf on rescuetime and then stripping, even with this patch fails with:

$ /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime 
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: no version information available (required by /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime)
/nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: relocation error: /nix/store/7i2vzpxy2fifprh0c0ga2wrcdd6gjya7-rescuetime-2.10.0.1322/bin/rescuetime: symbol , version  not defined in file  with link time reference

@rpurdie
Copy link
Contributor

rpurdie commented Jun 3, 2020

FWIW Yocto Project has been using this patch for a few years now, we'd love to see it merged and in any new releases.

@domenkozar domenkozar merged commit 12e2b7b into NixOS:master Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants