docker-library / busybox

Docker Official Image packaging for Busybox
http://busybox.net
396 stars 127 forks source link

busybox 1.34.1 exited in arm64 with code 139 #149

Closed vettalwu closed 2 years ago

vettalwu commented 2 years ago

Hi, I encounter a problem in a arm64 machine.

Machine info:

» uname -a                                                                                                                                                                      
Linux dizhe-opensource-arm 4.18.0-372.19.1.an8_6.aarch64 #1 SMP Mon Aug 8 10:21:27 CST 2022 aarch64 aarch64 aarch64 GNU/Linux

I run following commnad and got a exited code: 139

docker run -it --rm busybox:1.34.1

When I changed the version to 1.34.0, it's working fine.

tianon commented 2 years ago

Interesting - 139 is typically a segmentation fault. Unfortunately, I'm not able to reproduce:

$ uname -m
aarch64
$ docker run -it --rm --pull=always busybox
latest: Pulling from library/busybox
89485c9dae0b: Pull complete 
Digest: sha256:9810966b5f712084ea05bf28fc8ba2c8fb110baa2531a10e2da52c1efc504698
Status: Downloaded newer image for busybox:latest
/ # 
vettalwu commented 2 years ago

I test on another arm64 machine, it can also be reproduced.

#uname -a
Linux ky1 4.19.90-24.4.v2101.ky10.aarch64 #1 SMP Mon May 24 14:45:37 CST 2021 aarch64 aarch64 aarch64 GNU/Linux

@tianon What's your kernel version?

yosifkit commented 2 years ago

I think the kernel he'd likely be using would be from Debian stable; so 5.10.140 or 5.18.16 depending on whether backports are being used.

Just a random hunch, try adding --ulimit nofile=1024:1024 in the docker run? Might be similar to https://github.com/docker-library/haproxy/issues/194 & https://github.com/docker-library/rabbitmq/issues/545 or maybe https://github.com/nodejs/help/issues/3202?

vettalwu commented 2 years ago

@yosifkit I tried the following command, but still failed, exit code is also: 139

docker run --ulimit nofile=1024:1024 -it --rm busybox:1.34.1
jayl1e commented 2 years ago

It is because many arm64 distribution use pagesize 64k. However latest build use page size 4k. Please fix it, old busybox does not have this problem. Some machine can't reproduce it because your kernel page size is 4k.

# /lib/ld-linux-aarch64.so.1 /root/busybox
/root/del/busybox: error while loading shared libraries: /root/busybox: ELF load command alignment not page-aligned
# readelf -l busybox

Elf file type is EXEC (Executable file)
Entry point 0x400740
There are 5 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x000000000012b2f8 0x000000000012b2f8  R E    1000
  LOAD           0x000000000012bdf0 0x000000000052cdf0 0x000000000052cdf0
                 0x0000000000000611 0x0000000000005070  RW     1000
# getconf PAGESIZE
65536