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

Revamp efi_well_known_* variable handling #235

Merged
merged 1 commit into from
Feb 6, 2023

Conversation

nvinson
Copy link

@nvinson nvinson commented Oct 11, 2022

The current implementation attempts to use the linker to create aliases for efi_well_known_guids and efi_well_known_names. It also tries to use the linker to generate the variables efi_well_known_guids_end and efi_well_known_names_end.

When building with clang, the generated linker result results in a broken libefivar.so that causes programs to segfault when linked against it. This change does away with linker script hacker and instead introduces pointers to store the locations of efi_well_known_guids_end and efi_well_known_names_end.

Additionally, efi_well_known_guids and efi_well_known_names are now created as pointers that point to the beginning of their respective arrays.

Signed-off-by: Nicholas Vinson nvinson234@gmail.com
Fixes: #234

The current implementation attempts to use the linker to create aliases
for efi_well_known_guids and efi_well_known_names. It also tries to use
the linker to generate the variables efi_well_known_guids_end and
efi_well_known_names_end.

When building with clang, the generated linker result results in a
broken libefivar.so that causes programs to segfault when linked against
it.  This change does away with linker script hacker and instead
introduces pointers to store the locations of efi_well_known_guids_end
and efi_well_known_names_end.

Additionally, efi_well_known_guids and efi_well_known_names are now
created as pointers that point to the beginning of their respective
arrays.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Fixes: rhboot#234
@tedbrandston
Copy link
Contributor

For what it's worth: I ran into an issue trying to switch from 37 -> 38 where the latter would cause my application to fail with error while loading shared libraries: libefivar.so.1: ELF load command address/offset not page-aligned. This patch does appear to fix my issue, though I don't think I'm exercising the functionality this touches.

Happy to provide any additional info I can.

@ghost
Copy link

ghost commented Nov 27, 2022

Thanks a lot for your work on this @nvinson! i was having a similar problem while trying to build static efivar libraries, by compiling from your branch i managed to get rid of those errors

@nvinson
Copy link
Author

nvinson commented Jan 3, 2023

@vathpela @frozencemetery Could this PR be merged please? It's been in review for almost 3 months with no negative reviews.

@juliakreger
Copy link

So I was chatting with @jayofdoom and he raised this patch up to my attention in passing, and I took a look. Looks okay to me, but I'll caveat that statement on my C days being far off in the past. :)

@WavyEbuilder
Copy link

Nice work @nvinson! RedHat, you should merge this.

@heitbaum
Copy link

@frozencemetery frozencemetery merged commit cfd686d into rhboot:main Feb 6, 2023
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.

Invalid libefivar.so generated when building with clang-15.
6 participants