All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] ext4: the load command on an EXT4 partitition leads to errors due to unaligned buffers
@ 2021-01-12 22:56 Heinrich Schuchardt
  0 siblings, 0 replies; only message in thread
From: Heinrich Schuchardt @ 2021-01-12 22:56 UTC (permalink / raw)
  To: u-boot

When reading a file using the load command from a FAT file system this
works fine irrespective of the alignment.

When reading from an EXT4 partition raw sectors are read to unaligned
addresses which leads to a failure to load the file

=> echo $kernel_addr_r
0x40080000

=> load mmc 0:3 $kernel_addr_r helloworld.efi 10a1 1
fs/fs_internal.c(76) fs_devread: partition->start 0x400000, sector 0x2,
block_len 0x400, log2blksz 0x9, buffer 0x00000000b9f8ea40
fs/fs_internal.c(76) fs_devread: partition->start 0x400000, sector
0x42031, block_len 0xe00, log2blksz 0x9, buffer 0x00000000400801ff
** fs_devread read error - block
Failed to load 'helloworld.efi'

The problem is in fs_devread() in the part marked as

/* Get the read to the beginning of a partition */

Here the wrong assumption is made that variable buf is cache-aligned
after advancing it by an odd number of bytes.

Valerij first observed the problem when trying to read the EXT4
partition why the EFI_FILE_PROTOCOL on a Pine64 system. I was able to
reproduce it on the Pine64 A64 LTS.

Best regards

Heinrich

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-12 22:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 22:56 [BUG] ext4: the load command on an EXT4 partitition leads to errors due to unaligned buffers Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.