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

Older objcopy mangles bootloader built with musl #205

Open
JonathonReinhart opened this issue Oct 14, 2021 · 1 comment
Open

Older objcopy mangles bootloader built with musl #205

JonathonReinhart opened this issue Oct 14, 2021 · 1 comment
Labels

Comments

@JonathonReinhart
Copy link
Owner

JonathonReinhart commented Oct 14, 2021

Long stories (#198, #203) very short: objcopy on CentOS 7 mangles the program headers of a bootloader built with musl-gcc on Debian bullseye.

Built on: Debian bulseye, gcc 10.2.1, musl-tools 1.2.2-1

Distro objcopy Status
CentOS 7 2.27-44.base.el7 ❌ Fail
Debian 9 2.28 ❌ Fail
Ubuntu 18.04 2.30 ❌ Fail
Debian 10 2.31.1 ❌ Fail
Debian 11 2.35.2 ✔️ OK

Workaround

Don't install the published wheels:

pip install --no-binary=staticx staticx

Test data

CentOS 7
$ docker run --rm -it centos:7-python3 
[root@84d569a38121 /]# objcopy --version
GNU objcopy version 2.27-44.base.el7
...
[root@84d569a38121 /]# pip3 install staticx==0.13.3
...
[root@84d569a38121 /]# staticx $(which date) date.sx
[root@84d569a38121 /]# ./date.sx 
Segmentation fault
Debian 9
$ docker run --rm -it debian:9
root@74d70c11f933:/# apt update && apt install -y --no-install-recommends python3-pip python3-wheel python3-pkg-resources python3-setuptools binutils patchelf
...
root@74d70c11f933:/# pip3 install staticx==0.13.3
root@74d70c11f933:/# objcopy --version
GNU objcopy (GNU Binutils for Debian) 2.28
root@74d70c11f933:/# staticx $(which date) date.sx
root@74d70c11f933:/# ./date.sx 
Ubuntu 18.04
$ docker run --rm -it ubuntu:18.04
root@4ade3afa85e7:/# objcopy --version
GNU objcopy (GNU Binutils for Ubuntu) 2.30
root@4ade3afa85e7:/# apt update && apt install -y --no-install-recommends python3-pip python3-wheel python3-pkg-resources python3-setuptools binutils patchelf
...
root@4ade3afa85e7:/# pip3 install staticx==0.13.3
...
root@4ade3afa85e7:/# staticx $(which date) date.sx
root@4ade3afa85e7:/# ./date.sx 
Segmentation fault
Debian 10
$ docker run --rm -it debian:10
root@15dface5550b:/# apt update && apt install -y --no-install-recommends python3-pip python3-wheel python3-pkg-resources python3-setuptools binutils patchelf
...
root@15dface5550b:/# objcopy --version
GNU objcopy (GNU Binutils for Debian) 2.31.1
root@15dface5550b:/# pip3 install staticx
...
root@15dface5550b:/# staticx $(which date) date.sx
root@15dface5550b:/# ./date.sx 
Segmentation fault
Debian 11
$ objcopy --version
GNU objcopy (GNU Binutils for Debian) 2.35.2
$ pip3 install staticx
...
$ staticx $(which date) date.sx
$ ./date.sx 
Thu 14 Oct 2021 03:54:46 AM EDT
@Andrwe
Copy link

Andrwe commented Jan 31, 2022

Just for your information.
The install of staticx from source worked to solve segfaulting binaries generated within docker container based on official python:3 image.
To get the installation running I had to install scons within the container first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants