Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1011348: proot: Segmentation fault and bad address with proot trying to build wayland

82 views
Skip to first unread message

Charles Huber

unread,
May 20, 2022, 12:10:03 PM5/20/22
to
Package: proot
Version: 5.1.0-1.3
Severity: important
X-Debbugs-Cc: genp...@gmail.com

Dear Maintainer,

I'm running into a segmentation fault while fixing locales on a
mmdebstrap'd Bullseye chroot and a 'bad address' failure when trying to
build 'wayland' inside it.

Both operations complete without error when using proot 5.3.1 from:
https://github.com/proot-me/proot/archive/refs/tags/v5.3.1.tar.gz


Segmentation fault repro procedure
----------------------------------------------------------------

# setup
mkdir -p /tmp/test && cd /tmp/test
mmdebstrap --mode=proot --format=directory --arch=i386 --variant=buildd bullseye debian-i386 && \
proot -S /tmp/test/debian-i386 apt update && \
proot -S /tmp/test/debian-i386 apt install --yes locales && \
proot -S /tmp/test/debian-i386 sh -c 'echo "en_US.UTF-8 UTF-8" > /etc/locale.gen'

# failure
user@box:/tmp/test$ proot -S /tmp/test/debian-i386 /usr/sbin/locale-gen
Generating locales (this might take a while)...
en_US.UTF-8...Segmentation fault
done
Generation complete.


Bad address repro procedure
----------------------------------------------------------------

# setup, starting from a successful locale-gen
proot -S /tmp/test/debian-i386 apt install --yes devscripts equivs && \
mkdir -p /tmp/test/wayland && \
cd /tmp/test/wayland && \
apt --only-source source wayland/bullseye && \
cd wayland-*/ && \
PATH=/sbin:/usr/sbin:$PATH \
proot -S /tmp/test/debian-i386 mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' --remove

# 'bad address' with bullseye's proot 5.1.0
user@box:/tmp/test/wayland/wayland-1.18.0$ proot -R /tmp/test/debian-i386 dpkg-buildpackage --build=binary --unsigned-source --unsigned-changes
...
Option buildtype is: plain [default: debugoptimized]
Found ninja-1.10.1 at /usr/bin/ninja
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/mesonbuild/mesonmain.py", line 140, in run
return options.run_func(options)
File "/usr/lib/python3/dist-packages/mesonbuild/msetup.py", line 253, in run
app.generate()
File "/usr/lib/python3/dist-packages/mesonbuild/msetup.py", line 161, in generate
self._generate(env)
File "/usr/lib/python3/dist-packages/mesonbuild/msetup.py", line 223, in _generate
intr.backend.generate()
File "/usr/lib/python3/dist-packages/mesonbuild/backend/ninjabackend.py", line 519, in generate
self.generate_target(t)
File "/usr/lib/python3/dist-packages/mesonbuild/backend/ninjabackend.py", line 789, in generate_target
o = self.generate_single_compile(target, src, True,
File "/usr/lib/python3/dist-packages/mesonbuild/backend/ninjabackend.py", line 2372, in generate_single_compile
obj_basename = self.object_filename_from_source(target, src)
File "/usr/lib/python3/dist-packages/mesonbuild/backend/backends.py", line 581, in object_filename_from_source
source = 'meson-generated_' + os.path.relpath(rel_src, targetdir)
File "/usr/lib/python3.9/posixpath.py", line 471, in relpath
start_list = [x for x in abspath(start).split(sep) if x]
File "/usr/lib/python3.9/posixpath.py", line 379, in abspath
cwd = os.getcwd()
OSError: [Errno 14] Bad address
cd build && tail -v -n \+0 meson-logs/meson-log.txt
...


-- System Information:
Debian Release: 11.3
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.17.4 (SMP w/24 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages proot depends on:
ii libc6 2.31-13+deb11u3
ii libtalloc2 2.3.1-2+b1

proot recommends no packages.

proot suggests no packages.

-- no debconf information

Bernhard Übelacker

unread,
Jun 7, 2022, 4:50:04 AM6/7/22
to
Hello Charles,
I tried to collect some more information, at least for the segfault.

The crash could be more isolated to this:
# proot -q qemu-i386 -S debian-i386 su -
# localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
Segmentation fault

Adding a "catchsegv" to the command gives several different outputs like:
# catchsegv localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
localedef: malloc.c:2539: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted
*** Segmentation fault
...
# catchsegv localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
Bus error
*** Segmentation fault
...
# catchsegv localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
Segmentation fault
*** Segmentation fault

Sometimes also with a backtrace like below,
also when running a rebuilt localedef with intact debug information.


When disabling address layout randomization,
with 'echo 0 > /proc/sys/kernel/randomize_va_space',
the crash can still be observed.


Unfortunately I found no other hint how to further debug this below proot.


Kind regards,
Bernhard



# catchsegv /home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
Segmentation fault
*** Segmentation fault
Register dump:

EAX: b7f8cec8 EBX: b7f8bed8 ECX: 0000d139 EDX: 00000fe0
ESI: 00000ff0 EDI: b7f8bee0 EBP: b6f78740 ESP: bfcfbf90

EIP: b6e170cf EFLAGS: 00000001

CS: 0073 DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b

Trap: 0000000e Error: 00000006 OldMask: 00000000
ESP/signal: bfcfbf90 CR2: b7f8cecc

FPUCW: 00000000 FPUSW: 00000000 TAG: 0000037f
IPOFF: 00000000 CSSEL: 0000 DATAOFF: 00000000 DATASEL: 0000

ST(0) 0000 00001f8000000000 ST(1) 0000 0000000000000002
ST(2) 0000 0000000000000000 ST(3) 0000 0000000000000000
ST(4) 0000 0000000000000000 ST(5) 0000 0000000000000000
ST(6) 0000 0000000000000000 ST(7) 0000 0000000000000000

Backtrace:
/lib/i386-linux-gnu/libc.so.6(+0x840cf)[0xb6e170cf]
/lib/i386-linux-gnu/libc.so.6(__libc_malloc+0x6a)[0xb6e1809a]
/lib/i386-linux-gnu/libc.so.6(_obstack_newchunk+0x10e)[0xb6e1b3de]
/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef(+0x1c26d)[0xf01c26d]
/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef(+0x25026)[0xf025026]
/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef(+0x2a12e)[0xf02a12e]
/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef(+0x5787)[0xf005787]
/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef(+0x22cdb)[0xf022cdb]
/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef(+0x2a12e)[0xf02a12e]
/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef(+0x5787)[0xf005787]
/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef(+0x22cdb)[0xf022cdb]
/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef(+0x2a12e)[0xf02a12e]
/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef(+0x49ee)[0xf0049ee]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0x106)[0xb6db1e46]
/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef(+0x4f61)[0xf004f61]

Memory map:

08048000-08049000 r--p 00000000 08:11 154453 /tmp/prooted-7844-yXM6GV
0f000000-0f004000 r--p 00000000 08:11 834304 /home/benutzer/test/debian-i386-2/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef
0f004000-0f035000 r-xp 00004000 08:11 834304 /home/benutzer/test/debian-i386-2/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef
0f035000-0f047000 r--p 00035000 08:11 834304 /home/benutzer/test/debian-i386-2/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef
0f047000-0f04d000 r--p 00046000 08:11 834304 /home/benutzer/test/debian-i386-2/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef
0f04d000-0f050000 rw-p 0004c000 08:11 834304 /home/benutzer/test/debian-i386-2/home/benutzer/source/glibc/orig/glibc-2.31/build-tree/i386-libc/locale/localedef
a0000000-a0001000 r-xp 00001000 08:11 154453 /tmp/prooted-7844-yXM6GV
a0001000-a0002000 r--p 00002000 08:11 154453 /tmp/prooted-7844-yXM6GV
a0003000-a0004000 rw-p 00003000 08:11 154453 /tmp/prooted-7844-yXM6GV
af000000-af001000 r--p 00000000 08:11 420720 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/ld-2.31.so
af001000-af01e000 r-xp 00001000 08:11 420720 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/ld-2.31.so
af01e000-af029000 r--p 0001e000 08:11 420720 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/ld-2.31.so
af02a000-af02b000 r--p 00029000 08:11 420720 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/ld-2.31.so
af02b000-af02c000 rw-p 0002a000 08:11 420720 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/ld-2.31.so
b43b4000-b45b5000 rw-p 00000000 00:00 0
b45b5000-b4cb6000 rw-p 00000000 00:00 0
b4e36000-b5037000 rw-p 00000000 00:00 0
b5037000-b5238000 rw-p 00000000 00:00 0
b5239000-b5c83000 rw-p 00000000 00:00 0
b5d29000-b5f2a000 rw-p 00000000 00:00 0
b5f69000-b6279000 rw-p 00000000 00:00 0
b6324000-b6326000 r--p 00000000 08:11 418474 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libgcc_s.so.1
b6326000-b633c000 r-xp 00002000 08:11 418474 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libgcc_s.so.1
b633c000-b6341000 r--p 00018000 08:11 418474 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libgcc_s.so.1
b6341000-b6342000 r--p 0001c000 08:11 418474 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libgcc_s.so.1
b6342000-b6343000 rw-p 0001d000 08:11 418474 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libgcc_s.so.1
b6349000-b6d93000 rw-p 00000000 00:00 0
b6d93000-b6db0000 r--p 00000000 08:11 420724 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libc-2.31.so
b6db0000-b6f05000 r-xp 0001d000 08:11 420724 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libc-2.31.so
b6f05000-b6f76000 r--p 00172000 08:11 420724 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libc-2.31.so
b6f76000-b6f78000 r--p 001e2000 08:11 420724 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libc-2.31.so
b6f78000-b6f7a000 rw-p 001e4000 08:11 420724 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libc-2.31.so
b6f7a000-b6f7c000 rw-p 00000000 00:00 0
b6f80000-b6f81000 r--s 00000000 08:11 1071332 /home/benutzer/test/debian-i386-2/usr/share/i18n/locales/iso14651_t1
b6f81000-b6f82000 r--s 00000000 08:11 1071254 /home/benutzer/test/debian-i386-2/usr/share/i18n/locales/en_US
b6f82000-b6f83000 r--p 00000000 08:11 420722 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libSegFault.so
b6f83000-b6f86000 r-xp 00001000 08:11 420722 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libSegFault.so
b6f86000-b6f87000 r--p 00004000 08:11 420722 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libSegFault.so
b6f87000-b6f88000 r--p 00004000 08:11 420722 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libSegFault.so
b6f88000-b6f89000 rw-p 00005000 08:11 420722 /home/benutzer/test/debian-i386-2/lib/i386-linux-gnu/libSegFault.so
b6f89000-b7f8c000 rw-p 00000000 00:00 0
b7f8c000-b7f90000 r--p 00000000 00:00 0 [vvar]
b7f90000-b7f92000 r-xp 00000000 00:00 0 [vdso]
bfcdc000-bfcfd000 rwxp 00000000 00:00 0 [stack]

####

This would look with source line information something like this:

(gdb) bt
#0 0xb7e610cf in _int_malloc () at malloc.c:4116
#1 0xb7e6209a in __GI___libc_malloc () at malloc.c:3058
#2 0xb7e653de in __GI__obstack_newchunk () at obstack.c:261
#3 0x0041c26d in new_symbol () at programs/ld-collate.c:404
#4 0x00425026 in collate_read () at programs/ld-collate.c:2946
#5 0x0042a12e in locfile_read () at programs/locfile.c:180
#6 0x00405787 in load_locale () at programs/localedef.c:692
#7 0x00422cdb in collate_read () at programs/ld-collate.c:2629
#8 0x0042a12e in locfile_read () at programs/locfile.c:180
#9 0x00405787 in load_locale () at programs/localedef.c:692
#10 0x00422cdb in collate_read () at programs/ld-collate.c:2629
#11 0x0042a12e in locfile_read () at programs/locfile.c:180
#12 0x004049ee in main () at programs/localedef.c:262
#13 0xb7dfbe46 in __libc_start_main () at ../csu/libc-start.c:308
#14 0x00404f61 in _start () at ../sysdeps/i386/start.S:113

Bernhard Übelacker

unread,
Jun 8, 2022, 8:20:04 AM6/8/22
to
Dear Maintainer,
just a small addition to my mail from yesterday.

The current downstream version 5.1.0 is more or less from 2015.
And because current upstream version 5.3.0 is not showing this issue,
it might be worth considering to "just" update the debian package.

Kind regards,
Bernhard
0 new messages