[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/32048] SEGFAULT on arm32 with abnormal page size
From: |
c.luck at datact dot ch |
Subject: |
[Bug binutils/32048] SEGFAULT on arm32 with abnormal page size |
Date: |
Mon, 06 Jan 2025 13:15:45 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=32048
--- Comment #8 from Claudio Luck <c.luck at datact dot ch> ---
I hope this is what you asked for:
# In each of bullseye and bookworm images, called for both QEMU_PAGESIZE 4096
and 32768 I prepare two binaries with/without shared lib:
mkdir test
docker run -e "QEMU_CPU=cortex-a15" -e "QEMU_PAGESIZE=4096" --rm --platform
linux/arm/v7 -v $PWD/test:/root -w /root -it debian:bullseye /bin/bash -l
docker run -e "QEMU_CPU=cortex-a15" -e "QEMU_PAGESIZE=32768" --rm --platform
linux/arm/v7 -v $PWD/test:/root -w /root -it debian:bullseye /bin/bash -l
docker run -e "QEMU_CPU=cortex-a15" -e "QEMU_PAGESIZE=4096" --rm --platform
linux/arm/v7 -v $PWD/test:/root -w /root -it debian:bookworm /bin/bash -l
docker run -e "QEMU_CPU=cortex-a15" -e "QEMU_PAGESIZE=32768" --rm --platform
linux/arm/v7 -v $PWD/test:/root -w /root -it debian:bookworm /bin/bash -l
I run these commands in each:
#
apt-get update
apt-get install --no-install-recommends gcc libc6-dev -y
cat >helloworld.c <<EOF
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
EOF
cat >helloworld-lib.c <<EOF
#include <stdio.h>
#include <math.h>
#include <sys/time.h>
int main()
{
double x = 1.00;
double y = sin(x);
printf("Hello, World!\n%f\n", y);
struct timeval tv;
struct timezone tz;
gettimeofday(&tv,&tz);
printf("Seconds since 1/1/1970: %lu\n",tv.tv_sec);
return 0;
}
EOF
BINUTILS_VER=$(grep -E -A20 "^Package: binutils$" /var/lib/dpkg/status | awk
'/^Version: / {print $2}')
DEBIAN_VER=$(</etc/debian_version)
gcc helloworld.c -o
helloworld-binutils_${BINUTILS_VER%-*}-pagesize_${QEMU_PAGESIZE}
gcc helloworld-lib.c -o
helloworld-binutils_${BINUTILS_VER%-*}-pagesize_${QEMU_PAGESIZE}-lib -ldl -lm
exit
I also collected the getconf binary from bullseye and bookworm into
getconf-binutils_<ver>
Resulting in the following files
# ls -ls helloworld-binutils_* getconf-binutils_*
24 -rwxr-xr-x 1 root root 22156 Jan 6 12:36 getconf-binutils_2.35.2
24 -rwxr-xr-x 1 root root 22108 Jan 6 13:10 getconf-binutils_2.40
12 -rwxr-xr-x 1 root root 8232 Jan 6 13:01
helloworld-binutils_2.35.2-pagesize_32768
12 -rwxr-xr-x 1 root root 8312 Jan 6 13:01
helloworld-binutils_2.35.2-pagesize_32768-lib
12 -rwxr-xr-x 1 root root 8232 Jan 6 13:01
helloworld-binutils_2.35.2-pagesize_4096
12 -rwxr-xr-x 1 root root 8312 Jan 6 13:01
helloworld-binutils_2.35.2-pagesize_4096-lib
8 -rwxr-xr-x 1 root root 7856 Jan 6 13:01
helloworld-binutils_2.40-pagesize_4096
8 -rwxr-xr-x 1 root root 7940 Jan 6 13:01
helloworld-binutils_2.40-pagesize_4096-lib
I then check if the binaries work on each instance:
ulimit -c 0
#
works=( )
fails=( )
for bin in ./helloworld-binutils_* ./getconf-binutils_* ; do
echo "\n========$bin"
if $bin ; then
works+=( "${bin}" )
elif [ $? -gt 126 ] ; then
fails+=( "${bin}" )
else
works+=( "${bin}" )
fi
done
#
BINUTILS_VER=$(grep -E -A20 "^Package: binutils$" /var/lib/dpkg/status | awk
'/^Version: / {print $2}')
BINUTILS_VER=${BINUTILS_VER:-2.40}
LINUX_VER=$(</proc/version)
DEBIAN_VER=$(</etc/debian_version)
(
echo $LINUX_VER
echo OS: ${DEBIAN_VER+Debian }${DEBIAN_VER}
echo Binutils: ${BINUTILS_VER%-*}
echo "Pagesize: ${QEMU_PAGESIZE} (getconf PAGESIZE = $(getconf PAGESIZE))"
echo Works: ; for x in ${works[@]} ; do echo " - $x" ; done
echo Fails: ; for x in ${fails[@]} ; do echo " - $x" ; done
echo
) > report-binutils_${BINUTILS_VER%-*}-pagesize_${QEMU_PAGESIZE}
The result:
Linux version 5.15.167.4-microsoft-standard-WSL2 (root@f9c826d3017f) (gcc (GCC)
11.2.0, GNU ld (GNU Binutils) 2.37) #1 SMP Tue Nov 5 00:21:55 UTC 2024
OS: Debian 11.11
Binutils: 2.35.2
Pagesize: 4096 (getconf PAGESIZE = 4096)
Works:
- ./helloworld-binutils_2.35.2-pagesize_32768
- ./helloworld-binutils_2.35.2-pagesize_32768-lib
- ./helloworld-binutils_2.35.2-pagesize_4096
- ./helloworld-binutils_2.35.2-pagesize_4096-lib
- ./helloworld-binutils_2.40-pagesize_4096
- ./helloworld-binutils_2.40-pagesize_4096-lib
- ./getconf-binutils_2.35.2
- ./getconf-binutils_2.40
Fails:
Linux version 5.15.167.4-microsoft-standard-WSL2 (root@f9c826d3017f) (gcc (GCC)
11.2.0, GNU ld (GNU Binutils) 2.37) #1 SMP Tue Nov 5 00:21:55 UTC 2024
OS: Debian 11.11
Binutils: 2.35.2
Pagesize: 32768 (getconf PAGESIZE = 32768)
Works:
- ./helloworld-binutils_2.35.2-pagesize_32768
- ./helloworld-binutils_2.35.2-pagesize_32768-lib
- ./helloworld-binutils_2.35.2-pagesize_4096
- ./helloworld-binutils_2.35.2-pagesize_4096-lib
- ./helloworld-binutils_2.40-pagesize_4096
- ./helloworld-binutils_2.40-pagesize_4096-lib
- ./getconf-binutils_2.35.2
- ./getconf-binutils_2.40
Fails:
Linux version 5.15.167.4-microsoft-standard-WSL2 (root@f9c826d3017f) (gcc (GCC)
11.2.0, GNU ld (GNU Binutils) 2.37) #1 SMP Tue Nov 5 00:21:55 UTC 2024
OS: Debian 12.8
Binutils: 2.40
Pagesize: 4096 (getconf PAGESIZE = 4096)
Works:
- ./helloworld-binutils_2.35.2-pagesize_32768
- ./helloworld-binutils_2.35.2-pagesize_32768-lib
- ./helloworld-binutils_2.35.2-pagesize_4096
- ./helloworld-binutils_2.35.2-pagesize_4096-lib
- ./helloworld-binutils_2.40-pagesize_4096
- ./helloworld-binutils_2.40-pagesize_4096-lib
- ./getconf-binutils_2.35.2
- ./getconf-binutils_2.40
Fails:
Linux version 5.15.167.4-microsoft-standard-WSL2 (root@f9c826d3017f) (gcc (GCC)
11.2.0, GNU ld (GNU Binutils) 2.37) #1 SMP Tue Nov 5 00:21:55 UTC 2024
OS: Debian 12.8
Binutils: 2.40
Pagesize: 32768 (getconf PAGESIZE = 4096)
Works:
- ./helloworld-binutils_2.40-pagesize_4096
- ./helloworld-binutils_2.40-pagesize_4096-lib
- ./getconf-binutils_2.40
Fails:
- ./helloworld-binutils_2.35.2-pagesize_32768
- ./helloworld-binutils_2.35.2-pagesize_32768-lib
- ./helloworld-binutils_2.35.2-pagesize_4096
- ./helloworld-binutils_2.35.2-pagesize_4096-lib
- ./getconf-binutils_2.35.2
NOTE: On Debian Bookworm 12.8 with 32k pagesize, tihs doesn't work:
./helloworld-binutils_2.35.2-pagesize_4096-lib
... but this actually works:
/lib/ld-linux-armhf.so.3 ./helloworld-binutils_2.35.2-pagesize_4096-lib
--
You are receiving this mail because:
You are on the CC list for the bug.