[U-Boot] ext4: crash when writing a file
Sébastien Szymanski
sebastien.szymanski at armadeus.com
Fri Jan 20 18:32:49 CET 2017
Hi,
sorry for the late answer.
> So to restate what you are doing:
>
> 1. You have a partitioned MMC, where the 2nd partition starts at block
> 264192/0x40800
> 2. You load a 93958144 byte (~90 MB) file via TFTP to ${loadaddr}
> 3. You write this partition image to 0x40800 using "mmc write"
> 4. You load another 5345128 byte (5 MB) file via TFTP to $loadaddr
> 5. You try to write this file to the 2nd partition, which now is ext4
> formatted, and already contains a file of the same name, i.e. boot/opos6ul-
> linux.bin
That's right.
>
>
> Actually, I can't reproduce the crash. Maybe you have corrupted part of the
> memory when loading the image, e.g. overwritten part of u-boot or its heap.
>
> Things you can try:
> a) reboot the system after loading/writing the partion image.
> b) checking the fs contents after the reboot, e.g "ls mmc 0:2 /boot"
No issue here.
> c) overwriting opos6ul-linux.bin with just a single byte, e.g "ext4write mmc
> 0:2 0x0 /boot/opos6ul-linux.bin 1"
It doesn't crash here. On the u-boot sandbox I can write up to 256Ko.
When I try 512Ko it crashes.
> d) transferring back the partition image to your host and running fschk on it
The partition is fine when transferred back to my host.
>
> You may also able to reproduce this using the u-boot sandbox.
I'm able to reproduce it using the u-boot sandbox.
I've created a disk image as explained in board/sandbox/README.sandbox
"Block Device Emulation":
Command (m for help): p
Disk /dev/loop0: 3 GiB, 3221225472 bytes, 6291456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd8192f55
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 2048 264191 262144 128M 83 Linux
/dev/loop0p2 264192 4458495 4194304 2G 83 Linux
Then I use dd to emulate the mmc write command since there is no host
write command:
dd if=/tftproot/opos6ul-rootfs.ext4 of=/dev/loop0p2
The partition seems to be fine according to fsck.ext4:
e2fsck 1.43.3 (04-Sep-2016)
"ROOTFS": clean, 3830/4312 files, 73797/88390 blocks
I can mount it and see its content.
Then under the sandbox I do the following:
U-Boot 2017.01-00002-g558e41e-dirty (Jan 20 2017 - 16:19:47 +0100)
DRAM: 256 MiB
MMC:
Using default environment
In: serial
Out: serial
Err: serial
SCSI: Net: No ethernet found.
IDE: Bus 0: not available
=> host bind 0 /tftproot/rootfs.raw
=> ls host 0:2
<DIR> 1024 .
<DIR> 1024 ..
<DIR> 16384 lost+found
<DIR> 1024 var
<DIR> 1024 run
<DIR> 1024 root
<DIR> 1024 media
<DIR> 1024 mnt
<DIR> 1024 tmp
<SYM> 3 lib32
<DIR> 1024 usr
<DIR> 1024 proc
<DIR> 1024 dev
<DIR> 1024 boot
<DIR> 1024 sys
<DIR> 3072 sbin
<DIR> 3072 bin
<SYM> 11 linuxrc
<DIR> 1024 etc
<DIR> 1024 opt
<DIR> 3072 lib
=> ls host 0:2 /boot
<DIR> 1024 .
<DIR> 1024 ..
26909 imx6ul-opos6uldev.dtb
<SYM> 1 dtbs
5359984 opos6ul-linux.bin
=> host load hostfs - 0 /tftproot/opos6ul-linux.bin
5359984 bytes read in 2 ms (2.5 GiB/s)
=> printenv filesize
filesize=51c970
=> ext4write host 0:2 0 /boot/opos6ul-linux.bin ${filesize}
File System is consistent
file found, deleting
update journal finished
File System is consistent
update journal finished
Segmentation fault
Regards,
>
> Kind regards,
>
> Stefan
Sébastien Szymanski
More information about the U-Boot
mailing list