NVIDIA / enroot

A simple yet powerful tool to turn traditional container/OS images into unprivileged sandboxes.
Apache License 2.0
648 stars 94 forks source link

Build on Centos 8 and RHEL 8 creates broken binaries #68

Closed dchirikov closed 3 years ago

dchirikov commented 3 years ago

For some weird reason, binaries are being built in RHEL8 or Centos 8 are broken in a pretty bad way. This snippet will return Segmentation fault (core dumped) ./bin/enroot-mount as a last line

git clone https://github.com/NVIDIA/enroot
docker run -it --rm --name cos8 -v $(pwd)/enroot:/w -w /w centos:8 /bin/bash -c 'yum install git make rpm-build gcc libtool -y && make clean && make ; ./bin/enroot-mount'

If the image is centos:7 then binaries in ./bin are pretty healthy

3XX0 commented 3 years ago

Can you check if it's the same issue as we've seen for ppc64? Namely static PIE seems to be broken on rhel8

https://github.com/NVIDIA/enroot/issues/52

dchirikov commented 3 years ago

I removed -fPIE and replaced -static-pie with just -static, as advised here but for some reason musl-gcc still builds binaries with -static-pie:

/w/deps/dist/musl/bin/musl-gcc -std=c99 -O2 -fstack-protector -pedantic -Wall -Wextra -Wcast-align \
-Wpointer-arith -Wmissing-prototypes -Wnonnull -Wwrite-strings -Wlogical-op -Wformat=2 \
-Wmissing-format-attribute -Winit-self -Wshadow -Wstrict-prototypes -Wunreachable-code \
-Wconversion -Wsign-conversion  -s -D_FORTIFY_SOURCE=2 -isystem /w/deps/dist/libbsd/include/bsd \
-DLIBBSD_OVERLAY  -Wl,-zrelro -Wl,-znow -Wl,-zdefs -Wl,--as-needed -Wl,--gc-sections -L/w/deps/dist/libbsd/lib  \
-pie -static-pie  bin/enroot-mount.c  -lbsd -o bin/enroot-mount

So the issue still persists.