Skip to content

FreeBSD doesn't like rearranged program headers #153

Closed

Description

@staticfloat

FreeBSD has decided that the program header of ELF files must fit within the first page. This is a bit of a problem, as patchelf often relocates the program header to the end of the ELF header, causing it to no longer fit within the first page. I'm not sure the best way to fix this, but I thought I would open an issue so others that run into the program header too large issue that FreeBSD often spits out can gather here to discuss possible solutions (other than rewriting the FreeBSD dynamic loader, of course).

Activity

  1. ararslan commented on Jul 11, 2018

    @ararslan
  2. domenkozar commented on Jun 9, 2020

    @domenkozar
    Member

    Could you try with 0.11 / master?

  3. ararslan commented on Jun 9, 2020

    @ararslan

    Reproducing this 2 years later will be a bit tricky, as much has changed... The problematic binaries used originally are from the FreeBSD release asset from v1.0.1 of https://github.com/bicycle1885/XML2Builder. The infrastructure used to cross compile binaries has evolved, and the resulting libxml2 no longer exhibits this problem. @staticfloat, any idea on how we might be able to verify whether this has been fixed?

  4. vchuravy commented on Oct 25, 2021

    @vchuravy

    any idea on how we might be able to verify whether this has been fixed?

    Apparently running patchelf on libLLVM.so also shows the problem.

  5. Mic92 commented on Oct 26, 2021

    @Mic92
    Member

    any idea on how we might be able to verify whether this has been fixed?

    Apparently running patchelf on libLLVM.so also shows the problem.

    Do you mean patching libLLVM.so with patchelf on freebsd?

  6. ararslan commented on Oct 26, 2021

    @ararslan

    FYI this has apparently been fixed upstream in FreeBSD and backported to multiple active release branches. See the bug report I opened a while back: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229708. Based on the timing, I imagine it will be in FreeBSD 12.3.

  7. ararslan commented on Oct 29, 2021

    @ararslan

    Note though that the problem remains for current FreeBSD versions.

  8. rhaberkorn commented on Feb 25, 2025

    @rhaberkorn

    I have no experience with the binary in question but trying to run a particular AppImage on Linuxulator also gave me the "Program headers not in the first page" error. This check is still in /usr/src/sys/kern/imgact_elf.c:1130 as of 14.2-RELEASE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions