Skip to content

Conversation

pablogsal
Copy link
Contributor

When checking for already replaced libs, the check against the size must
be done using the section header offset, not the section file address.
This was not crashing in many situations because normally sh_address and
sh_offset have the same value but these two may differ and using the
sh_address value instead can cause library corruption in these
situations.

Closes: #239

When checking for already replaced libs, the check against the size must
be done using the section header offset, not the section file address.
This was not crashing in many situations because normally sh_address and
sh_offset have the same value but these two may differ and using the
sh_address value instead can cause library corruption in these
situations.
@pablogsal
Copy link
Contributor Author

Note: I am not including a test because unfortunately, producing libraries with this setup requires some linker scripts as it needs to modify the program header address. and that will complicate considerably the test suite in order to make it portable. Given that this code path is always hit, we still have certainty that works as expected in previous cases.

The only way that I can think of including a test is vendoring some of the libraries we know that have problems.

@pablogsal
Copy link
Contributor Author

CC: @edolstra @domenkozar

@domenkozar domenkozar merged commit d2e81f0 into NixOS:master Sep 22, 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.

Library corruption when setting RPATH

2 participants