[BUG] UBIFS corruption on powerpc 32-bit targets

Tomas Alvarez Vanoli tomas.alvarez-vanoli at hitachienergy.com
Wed Feb 4 06:04:18 PST 2026


>Try 'fsck.ubifs -g3 -y /dev/ubi0_1'.

I downloaded and cross-compiled mtd-utils for ppc, not sure if I had given
some wrong param for configure but I was getting a segfault at 
ubifs-utils/fsck.ubifs/problem.c:236 (log_out in FILE_IS_INCONSISTENT).

This is the backtrace of the crash in case you are interested (otherwise skip
ahead to the run that worked):

```
(gdb) bt
#0 __GI_strlen () at ../sysdeps/powerpc/powerpc32/strlen.S:98
#1 0x0f7ec038 in __printf_buffer (buf=buf at entry=0xbffff748,
format=format at entry=0x1005bd38 "%s[%d] (%s%s): problem: %s, ino %lu type %s,
nlink %u xcnt %u xsz %u xnms %u size %llu, should be nlink %u xcnt %u xsz %u
xnms %u size %llu\n", ap=ap at entry=0xbffff838,
mode_flags=mode_flags at entry=0) at vfprintf-process-arg.c:435
#2 0x0f7ec608 in __vfprintf_internal (s=<optimized out>,
format=0x1005bd38 "%s[%d] (%s%s): problem: %s, ino %lu type %s, nlink %u xcnt %u
xsz %u xnms %u size %llu, should be nlink %u xcnt %u xsz %u xnms %u size %llu\n"
 ap=ap at entry=0xbffff838,
mode_flags=mode_flags at entry=0) at vfprintf-internal.c:1544
#3 0x0f7e211c in __printf (format=<optimized out>) at printf.c:33
#4 0x1003da80 in print_problem (priv=0xbffff970, problem_type=<optimized out>,
problem=0x10060494 <problem_table+184>, c=0x1006d2e8 <info_>) at
ubifs-utils/fsck.ubifs/problem.c:236
#5 fix_problem (c=c at entry=0x1006d2e8 <info_>, 
problem_type=problem_type at entry=23,
priv=priv at entry=0xbffff9f0) at ubifs-utils/fsck.ubifs/problem.c:354
#6 0x1003f9dc in handle_invalid_file (priv=0x0, file=0x1011c890,
problem_type=23, c=0x1006d2e8 <info_>)
at ubifs-utils/fsck.ubifs/extract_files.c:844
#7 correct_file_info (file=0x1011c890, c=0x1006d2e8 <info_>)
at ubifs-utils/fsck.ubifs/extract_files.c:1496
#8 correct_file_info (c=0x1006d2e8 <info_>, file=0x1011c890)
at ubifs-utils/fsck.ubifs/extract_files.c:1473
#9 0x100439dc in check_and_correct_files (c=c at entry=0x1006d2e8 <info_>)
at ubifs-utils/fsck.ubifs/extract_files.c:1552
#10 0x10005f94 in do_fsck () at ubifs-utils/fsck.ubifs/fsck.ubifs.c:490
#11 main (argc=<optimized out>, argv=<optimized out>) at
ubifs-utils/fsck.ubifs/fsck.ubifs.c:622
(gdb)
```

There's a warning about the formatter used for ino_t, used formatter is %lu but
ino_t is long long unsigned int. 

Anyway, I split the logs into one call per value and ran it, got the following
(patched up the log into a single line again):

```
root at kmcent2:~# ./fsck.ubifs -y -g3 /dev/ubi1_0 
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Read superblock
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Read master & init lpt
<INFO> fsck.ubifs[182] (/dev/ubi1_0): ubifs_load_filesystem: recovery needed
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Replay journal
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Handle orphan nodes
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Recover isize
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Traverse TNC and construct files
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Check and handle invalid files
fsck.ubifs[182] (/dev/ubi1_0,danger mode): problem: File has no inode, ino 0
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Delete it? y

fsck.ubifs[182] (/dev/ubi1_0,danger mode): Check and handle unreachable files
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Check and correct files
fsck.ubifs[182] (/dev/ubi1_0,danger mode): problem: File is inconsistent ino
184322 type dir nlink 2 xcnt 0 xsz 0 xnms 0 size 472, should be nlink 2 xcnt 0
xsz 0 xnms 0 size 392
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Fix it? y

fsck.ubifs[182] (/dev/ubi1_0,danger mode): Check whether the TNC is empty
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Check and correct the space
statistics
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Commit problem fixing modifications
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Check and correct the index size
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Check and create root dir
fsck.ubifs[182] (/dev/ubi1_0,danger mode): Final committing
fsck.ubifs[182] (-): ********** Filesystem was modified **********
fsck.ubifs[182] (-): FSCK success!
root at kmcent2:~# 
```

Seems potentially the size of the node was wrong?
After the run, the fs is, as expected, not broken anymore.


PS: my email client might be omitting the in-reply-to headers, sorry about that

Best regards,
Tomas




More information about the linux-mtd mailing list