Device: Samsung Galaxy Fame
Android version: 7.1.2 (doesn't matter for this case)
Magisk version name: 30.7 (Run #6047 from CI)
Magisk version code: 30700
Issue description
I'm working in a script that uses MagiskBoot on recovery to modify the installed boot image.
While unpacking works fine, repacking crashes with "Illegal instruction" since Magisk v30.1 (unlike #9550 where v30.2 worked).
v30.0 and earlier works, and this coincides with the migration to lzma-rust2 (while not sure if directly related).
This issue is like #9660 and #9550 but the other way around (unpack works, repack fails).
Funnily enough, the output boot.img (attached as boot-output.img.gz) is truncated and at the end it contains "LZMA data is corrupt". This is not a log, it's just a coincidence since the original (uploaded as boot.img.gz) contains it too; I just found it curious enough to point it out.
Some debugging
I've used GDB on the debug binary and symbols to give a proper backtrace, I don't know Rust but it may help finding the issue.
/tmp/boot # /tmp/gdb --symbols=/tmp/magiskboot.dbg --exec=/tmp/magiskboot -ex 'set args repack /dev/block/mmcblk0p5 ./boot.img'
/tmp/gdb: warning: Couldn't determine a path for the index cache directory.
GNU gdb (GDB) 17.2
Copyright (C) 2025 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-musleabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /tmp/magiskboot.dbg...
(gdb) r
Starting program: /tmp/magiskboot repack /dev/block/mmcblk0p5 ./boot.img
Parsing boot image: [/dev/block/mmcblk0p5]
HEADER_VER [0]
KERNEL_SZ [3100276]
RAMDISK_SZ [702560]
SECOND_SZ [0]
EXTRA_SZ [0]
PAGESIZE [4096]
NAME []
CMDLINE [console=ttyS1,115200n8 mem=456M androidboot.console=ttyS1 gpt v3d_mem=67108864 pmem=24M@0x9E800000]
CHECKSUM [2383a82055e1f874fba002704f093facbc06750f000000000000000000000000]
ZIMAGE_KERNEL
KERNEL_FMT [lzma]
RAMDISK_FMT [gzip]
Repack to boot image: [./boot.img]
Program received signal SIGILL, Illegal instruction.
0x000c1f40 in <alloc::raw_vec::RawVecInner>::with_capacity_zeroed_in ()
(gdb) bt
#0 0x000c1f40 in <alloc::raw_vec::RawVecInner>::with_capacity_zeroed_in ()
#1 0x000c1d70 in alloc::vec::from_elem::<i32> ()
#2 0x000bf75c in <lzma_rust2::lz::bt4::Bt4>::new ()
#3 0x000bf1ac in <lzma_rust2::lz::lz_encoder::LzEncoder>::new_bt4 ()
#4 0x000c4f2c in <lzma_rust2::enc::encoder::LzmaEncoder>::new ()
#5 0x0006dc26 in <lzma_rust2::enc::lzma_writer::LzmaWriter<&mut std::fs::File>>::new ()
#6 0x0003a352 in magiskboot::compress::compress_bytes ()
#7 0x00037f38 in cxxbridge1$189$compress_bytes ()
#8 0x00032184 in compress_bytes (format=FileFormat::LZMA, out_fd=3,
in_bytes=...) at src/boot/boot-rs.cpp:202
#9 compress_len (type=FileFormat::CHROMEOS, in=..., fd=3)
at src/boot/bootimg.cpp:29
#10 0x00031500 in repack (src_img=..., out_img=..., skip_comp=false)
at src/boot/bootimg.cpp:778
#11 0x00050d06 in main ()
(gdb)
boot.img.gz
boot-output.img.gz
Device: Samsung Galaxy Fame
Android version: 7.1.2 (doesn't matter for this case)
Magisk version name: 30.7 (Run #6047 from CI)
Magisk version code: 30700
Issue description
I'm working in a script that uses MagiskBoot on recovery to modify the installed boot image.
While unpacking works fine, repacking crashes with "Illegal instruction" since Magisk v30.1 (unlike #9550 where v30.2 worked).
v30.0 and earlier works, and this coincides with the migration to lzma-rust2 (while not sure if directly related).
This issue is like #9660 and #9550 but the other way around (unpack works, repack fails).
Funnily enough, the output boot.img (attached as boot-output.img.gz) is truncated and at the end it contains "LZMA data is corrupt". This is not a log, it's just a coincidence since the original (uploaded as boot.img.gz) contains it too; I just found it curious enough to point it out.
Some debugging
I've used GDB on the debug binary and symbols to give a proper backtrace, I don't know Rust but it may help finding the issue.
boot.img.gz
boot-output.img.gz