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

feat: add --no-clobber-old-sections switch #521

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

K900
Copy link
Contributor

@K900 K900 commented Sep 21, 2023

Works around #520, may be useful for other cursed self-modifying things.

src/patchelf.cc Outdated Show resolved Hide resolved
src/patchelf.cc Outdated
@@ -2505,6 +2508,7 @@ static void showHelp(const std::string & progName)
[--clear-execstack]\n\
[--set-execstack]\n\
[--rename-dynamic-symbols NAME_MAP_FILE]\tRenames dynamic symbols. The map file should contain two symbols (old_name new_name) per line\n\
[--no-clobber-old-sections]\t\tDo not clobber old section values - only use when executable does self-referential tricks.\n\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are self-referential tricks? Can you add more details here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically anything that relies on things remaining at the same offset in the binary.

src/patchelf.cc Outdated
@@ -2505,6 +2508,7 @@ static void showHelp(const std::string & progName)
[--clear-execstack]\n\
[--set-execstack]\n\
[--rename-dynamic-symbols NAME_MAP_FILE]\tRenames dynamic symbols. The map file should contain two symbols (old_name new_name) per line\n\
[--no-clobber-old-sections]\t\tDo not clobber old section values - only use when executable does self-referential tricks.\n\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[--no-clobber-old-sections]\t\tDo not clobber old section values - only use when executable does self-referential tricks.\n\
[--no-clobber-old-sections]\t\tDo not clobber old section values - only use when executables rely on sections remain at the same offset in the binary.\n\

@K900
Copy link
Contributor Author

K900 commented Sep 25, 2023

How's this phrasing?

@Mic92
Copy link
Member

Mic92 commented Sep 27, 2023

Better. Could you also update https://github.com/NixOS/patchelf/blob/master/patchelf.1 ?

Works around NixOS#520, may be useful for other cursed self-modifying things.
@K900
Copy link
Contributor Author

K900 commented Sep 27, 2023

Done. Tried to elaborate a bit on the behavior in the man page too.

@Mic92 Mic92 merged commit 917ea45 into NixOS:master Sep 27, 2023
14 checks passed
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