[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1115981: ubiformat: Floating point exception



Package: mtd-utils
Version: 1:2.1.5-1
Severity: normal
X-Debbugs-Cc: tj.iam.tj@proton.me

$ sudo /usr/sbin/ubiformat /dev/mtd0 --vid-hdr-offset=512 --sub-page-size=512 --flash-image=/dev/loop0
ubiformat: mtd0 (nand), size 536870912 bytes (512.0 MiB), 4096 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4095 -- 100 % complete
ubiformat: 4096 eraseblocks have valid erase counter, mean value is 3
Floating point exception

However, adding --verbose option the FPE does not occur.

gdb shows:

(gdb) c
Continuing.
ubiformat: mtd0 (nand), size 536870912 bytes (512.0 MiB), 4096 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4095 -- 100 % complete
ubiformat: 4096 eraseblocks have valid erase counter, mean value is 2

Program received signal SIGFPE, Arithmetic exception.
0x0000555555556ea2 in flash_image (si=<optimized out>, ui=0x7fffffffe0b0, mtd=0x7fffffffe170, libmtd=<optimized out>) at ubi-utils/ubiformat.c:443
443                             printf("\r" PROGRAM_NAME ": flashing eraseblock %d -- %2lld %% complete  ",
(gdb) bt full
#0  0x0000555555556ea2 in flash_image (si=<optimized out>, ui=0x7fffffffe0b0, mtd=0x7fffffffe170, libmtd=<optimized out>) at ubi-utils/ubiformat.c:443
        err = <optimized out>
        new_len = <optimized out>
        buf = <error reading variable buf (value requires 131072 bytes, which is more than max-value-size)>
        ec = <optimized out>
        fd = <optimized out>
        st_size = <optimized out>
        img_ebs = <optimized out>
        eb = 0
        written_ebs = 0
        divisor = 0
        skip_data_read = 0
        fd = <optimized out>
        img_ebs = <optimized out>
        eb = <optimized out>
        written_ebs = <optimized out>
        divisor = <optimized out>
        skip_data_read = <optimized out>
        st_size = <optimized out>
        out_close = <optimized out>
        _err = <optimized out>
        _err = <optimized out>
        err = <optimized out>
        new_len = <optimized out>
        buf = <optimized out>
        ec = <optimized out>
        _err = <optimized out>
        _err = <optimized out>
        _err = <optimized out>
#1  main (argc=<optimized out>, argv=<optimized out>) at ubi-utils/ubiformat.c:909

Note the "divisor = 0"

The code:

    if (!args.quiet && !args.verbose) {
      printf("\r" PROGRAM_NAME ": flashing eraseblock %d -- %2lld %% complete  ",
             eb, (long long)(eb + 1) * 100 / divisor);

So this seems to mean --quiet or --verbose will avoid the error.

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

Kernel: Linux 6.16.7 (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/bash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages mtd-utils depends on:
ii  libc6          2.36-9+deb12u13
ii  libiniparser1  4.1-6
ii  liblzo2-2      2.10-2
ii  libselinux1    3.4-1+b6
ii  libssl3        3.0.17-1~deb12u2
ii  libuuid1       2.38.1-5+deb12u3
ii  libzstd1       1.5.4+dfsg2-5
ii  zlib1g         1:1.2.13.dfsg-1

mtd-utils recommends no packages.

mtd-utils suggests no packages.

-- no debconf information


Reply to: