Bug#1121758: dpkg-deb crashing on liblzma5

2025-12-03 Thread Guillem Jover
Control: tag -1 moreinfo unreproducible

Hi!

On Mon, 2025-12-01 at 23:33:10 +0100, Eduard Bloch wrote:
> Package: liblzma5
> Version: 5.8.1-2
> Severity: serious

> see below for the stacktrace. This nonsense started a few days ago. The
> system is perfectly stable otherwise, so I don't think this is a
> hardware issue.
> 
> So I was trying to compile an upstream Linux kernel. Command, which has
> been working for years, is:
> 
> $ nice -n20 make bindeb-pkg -j14 KCFLAGS='-march=x86-64-v3 -mtune=znver3'
> 
> And now it keeps segfaulting, like:
> 
>   STRIP   
> debian/linux-image-6.18.0/lib/modules/6.18.0/kernel/virt/lib/irqbypass.ko
>   DEPMOD  debian/linux-image-6.18.0/lib/modules/6.18.0
> dpkg-deb: Paket »linux-image-6.18.0« wird in 
> »../linux-image-6.18.0_6.18.0-84_amd64.deb« gebaut.
> dh_builddeb: error: dpkg-deb --root-owner-group --build 
> debian/linux-image-6.18.0 .. died with signal 13
> dh_builddeb: error: Aborting due to earlier error
> make[3]: *** [debian/rules:66: binary-image] Fehler 2
> 
> And why? The stacktrace from coredumpctl reveals:
> 
> #0  0x7f4343d7b058 in bt_skip_func (len_limit=64, pos=8388609, 
> cur=cur@entry=0x7f4308379010 "\200\005", cur_match=253073, depth=47, 
> son=0x7f42fefbd010, cyclic_pos=0, cyclic_size=8388609)
> at ../../../../src/liblzma/lz/lz_encoder_mf.c:546
> warning: 546  ../../../../src/liblzma/lz/lz_encoder_mf.c: Datei oder 
> Verzeichnis nicht gefunden
> [Current thread is 1 (Thread 0x7f4314e6f6c0 (LWP 3883979))]
> (gdb) bt
> #0  0x7f4343d7b058 in bt_skip_func (len_limit=64, pos=8388609, 
> cur=cur@entry=0x7f4308379010 "\200\005", cur_match=253073, depth=47, 
> son=0x7f42fefbd010, cyclic_pos=0, cyclic_size=8388609)
> at ../../../../src/liblzma/lz/lz_encoder_mf.c:546
> #1  0x7f4343d7bebe in lzma_mf_bt4_skip (mf=0x7f4304000c88, amount=1) at 
> ../../../../src/liblzma/lz/lz_encoder_mf.c:740
> #2  0x7f4343d7cdef in mf_skip (mf=0x7f4304000c88, amount=1) at 
> ../../../../src/liblzma/lz/lz_encoder.h:294
> #3  encode_init (coder=0x7f433c4f9010, mf=0x7f4304000c88) at 
> ../../../../src/liblzma/lzma/lzma_encoder.c:282
> #4  lzma_lzma_encode (coder=0x7f433c4f9010, mf=mf@entry=0x7f4304000c88, 
> out=out@entry=0x7f4304000e06 "", out_pos=out_pos@entry=0x7f4304000df0, 
> out_size=out_size@entry=65536, limit=2096879)
> at ../../../../src/liblzma/lzma/lzma_encoder.c:318
> #5  0x7f4343d845cd in lzma2_encode (coder_ptr=0x7f4304000d60, 
> mf=0x7f4304000c88, out=0x7f430a7fe050 "", out_pos=0x7f4314e6ee88, 
> out_size=25167072) at ../../../../src/liblzma/lzma/lzma2_encoder.c:188
> #6  0x7f4343d7a5c3 in lz_encode (coder_ptr=0x7f4304000c60, allocator=0x0, 
> in=0x7f4308ffd010 "\200\005", in_pos=0x7f4314e6ee90, in_size=16384, 
> out=0x7f430a7fe050 "", out_pos=0x7f4314e6ee88, out_size=25167072, 
> action=LZMA_RUN)
> at ../../../../src/liblzma/lz/lz_encoder.c:176
> #7  0x7f4343d6e27c in block_encode (coder_ptr=0x7f4304000b70, 
> allocator=, in=0x7f4308ffd010 "\200\005", 
> in_pos=0x7f4314e6ee90, in_size=, out=0x7f430a7fe050 "", 
> out_pos=0x7f4314e6ee88, out_size=25167072, 
> action=LZMA_RUN) at ../../../../src/liblzma/common/block_encoder.c:63
> #8  0x7f4343d71907 in worker_encode (thr=0x55af3efeb580, 
> out_pos=0x7f4314e6ee88, state=) at 
> ../../../../src/liblzma/common/stream_encoder_mt.c:294
> #9  worker_start (thr_ptr=0x55af3efeb580) at 
> ../../../../src/liblzma/common/stream_encoder_mt.c:393
> #10 0x7f4343b12b7b in start_thread (arg=) at 
> ./nptl/pthread_create.c:448
> #11 0x7f4343b907b8 in __GI___clone3 () at 
> ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
> 
> But why?
> 
> Okay, then I wanted to install one of my existing kernel-image DEBs. And then 
> initramfs build also started crashing.
> 
> But why? The common factor here was, again, liblzma5!
> 
> So I have changed the compression type of initramfs to zstd and now it 
> works... somehow. Still not explaining what is happening with liblzma5 here.

I cannot reproduce this problem within liblzma5 (which would seem
independent from dpkg, that has seen no upload since the release of
Debian stable).

On Tue, 2025-12-02 at 21:28:43 +0100, Eduard Bloch wrote:
> I checked the symptoms again. I can call the command shown in the
> stacktrace with the same arguments and it does not crash. With or
> without fakeroot.
> 
> Then I tried injecting the same env. vars (extracted from the coredump)
> into the shell prior to calling. Still no crash.
> 
> Then I tried the run in gdb directly. Result:
> 
> (gdb) run --root-owner-group --build debian/linux-image-6.18.0 ..
> Starting program: /usr/bin/dpkg-deb --root-owner-group --build 
> debian/linux-image-6.18.0 ..
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> dpkg-deb: Paket »linux-image-6.18.0« wird in 
> »../linux-image-6.18.0_6.18.0-85_amd64.deb« gebaut.
> [Detaching after fork from child process 1135101]
> [Detaching after fork from child pro

Bug#1121758: dpkg-deb crashing on liblzma5

2025-12-01 Thread Eduard Bloch
Package: liblzma5
Version: 5.8.1-2
Severity: serious

Hi,

see below for the stacktrace. This nonsense started a few days ago. The
system is perfectly stable otherwise, so I don't think this is a
hardware issue.

So I was trying to compile an upstream Linux kernel. Command, which has
been working for years, is:

$ nice -n20 make bindeb-pkg -j14 KCFLAGS='-march=x86-64-v3 -mtune=znver3'

And now it keeps segfaulting, like:

  STRIP   
debian/linux-image-6.18.0/lib/modules/6.18.0/kernel/virt/lib/irqbypass.ko
  DEPMOD  debian/linux-image-6.18.0/lib/modules/6.18.0
dpkg-deb: Paket »linux-image-6.18.0« wird in 
»../linux-image-6.18.0_6.18.0-84_amd64.deb« gebaut.
dh_builddeb: error: dpkg-deb --root-owner-group --build 
debian/linux-image-6.18.0 .. died with signal 13
dh_builddeb: error: Aborting due to earlier error
make[3]: *** [debian/rules:66: binary-image] Fehler 2

And why? The stacktrace from coredumpctl reveals:

#0  0x7f4343d7b058 in bt_skip_func (len_limit=64, pos=8388609, 
cur=cur@entry=0x7f4308379010 "\200\005", cur_match=253073, depth=47, 
son=0x7f42fefbd010, cyclic_pos=0, cyclic_size=8388609)
at ../../../../src/liblzma/lz/lz_encoder_mf.c:546
warning: 546../../../../src/liblzma/lz/lz_encoder_mf.c: Datei oder 
Verzeichnis nicht gefunden
[Current thread is 1 (Thread 0x7f4314e6f6c0 (LWP 3883979))]
(gdb) bt
#0  0x7f4343d7b058 in bt_skip_func (len_limit=64, pos=8388609, 
cur=cur@entry=0x7f4308379010 "\200\005", cur_match=253073, depth=47, 
son=0x7f42fefbd010, cyclic_pos=0, cyclic_size=8388609)
at ../../../../src/liblzma/lz/lz_encoder_mf.c:546
#1  0x7f4343d7bebe in lzma_mf_bt4_skip (mf=0x7f4304000c88, amount=1) at 
../../../../src/liblzma/lz/lz_encoder_mf.c:740
#2  0x7f4343d7cdef in mf_skip (mf=0x7f4304000c88, amount=1) at 
../../../../src/liblzma/lz/lz_encoder.h:294
#3  encode_init (coder=0x7f433c4f9010, mf=0x7f4304000c88) at 
../../../../src/liblzma/lzma/lzma_encoder.c:282
#4  lzma_lzma_encode (coder=0x7f433c4f9010, mf=mf@entry=0x7f4304000c88, 
out=out@entry=0x7f4304000e06 "", out_pos=out_pos@entry=0x7f4304000df0, 
out_size=out_size@entry=65536, limit=2096879)
at ../../../../src/liblzma/lzma/lzma_encoder.c:318
#5  0x7f4343d845cd in lzma2_encode (coder_ptr=0x7f4304000d60, 
mf=0x7f4304000c88, out=0x7f430a7fe050 "", out_pos=0x7f4314e6ee88, 
out_size=25167072) at ../../../../src/liblzma/lzma/lzma2_encoder.c:188
#6  0x7f4343d7a5c3 in lz_encode (coder_ptr=0x7f4304000c60, allocator=0x0, 
in=0x7f4308ffd010 "\200\005", in_pos=0x7f4314e6ee90, in_size=16384, 
out=0x7f430a7fe050 "", out_pos=0x7f4314e6ee88, out_size=25167072, 
action=LZMA_RUN)
at ../../../../src/liblzma/lz/lz_encoder.c:176
#7  0x7f4343d6e27c in block_encode (coder_ptr=0x7f4304000b70, 
allocator=, in=0x7f4308ffd010 "\200\005", in_pos=0x7f4314e6ee90, 
in_size=, out=0x7f430a7fe050 "", out_pos=0x7f4314e6ee88, 
out_size=25167072, 
action=LZMA_RUN) at ../../../../src/liblzma/common/block_encoder.c:63
#8  0x7f4343d71907 in worker_encode (thr=0x55af3efeb580, 
out_pos=0x7f4314e6ee88, state=) at 
../../../../src/liblzma/common/stream_encoder_mt.c:294
#9  worker_start (thr_ptr=0x55af3efeb580) at 
../../../../src/liblzma/common/stream_encoder_mt.c:393
#10 0x7f4343b12b7b in start_thread (arg=) at 
./nptl/pthread_create.c:448
#11 0x7f4343b907b8 in __GI___clone3 () at 
../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

But why?

Okay, then I wanted to install one of my existing kernel-image DEBs. And then 
initramfs build also started crashing.

But why? The common factor here was, again, liblzma5!

So I have changed the compression type of initramfs to zstd and now it works... 
somehow. Still not explaining what is happening with liblzma5 here.

Best regards,
Eduard.

-- System Information:
Debian Release: forky/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'oldoldstable'), (500, 
'unstable'), (500, 'testing'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.18.0-rc5+ (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.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 dpkg depends on:
ii  libbz2-1.0   1.0.8-6
ii  libc62.41-12
ii  liblzma5 5.8.1-2
ii  libmd0   1.1.0-2+b1
ii  libselinux1  3.9-2
ii  libzstd1 1.5.7+dfsg-2
ii  tar  1.35+dfsg-3.1
ii  zlib1g   1:1.3.dfsg+really1.3.1-1+b1

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt3.1.12
pn  debsig-verify  

-- no debconf information

-- 
Atheismus ist keine Philosophie, er ist noch nicht ein mal eine
Weltsicht. Er ist schlichtweg die Weigerung, ohne Grund das Gegenteil
des Offensichtlichen zu glauben.