Skip to content
Snippets Groups Projects
  1. Dec 21, 2023
  2. Dec 13, 2023
  3. Nov 29, 2023
  4. Nov 16, 2023
  5. Oct 30, 2023
  6. Oct 18, 2023
  7. Sep 24, 2023
  8. Sep 14, 2023
  9. Aug 25, 2023
  10. Aug 19, 2023
  11. Aug 14, 2023
  12. Aug 08, 2023
  13. Aug 07, 2023
  14. Aug 03, 2023
  15. Jul 17, 2023
  16. Jul 16, 2023
  17. Jul 14, 2023
  18. Jun 12, 2023
  19. Jun 06, 2023
    • Ben Dooks's avatar
      ubifs: allow loading to above 4GiB · b46cec41
      Ben Dooks authored and Heiko Schocher's avatar Heiko Schocher committed
      
      The ubifsload command is truncating any address above 4GiB as it casts
      this address to an u32, instead of using an unsigned long which most of
      the other load commands do. Change this to an unsigned long to allow
      loading into high memory for boards which use these areas.
      
      Fixes the following error:
      
      => ubifsload 0x2100000000 /boot/Image.lzma
      Loading file '/boot/Image.lzma' to addr 0x00000000...
      Unhandled exception: Store/AMO access fault
      
      Signed-off-by: default avatarBen Dooks <ben.dooks@sifive.com>
      Signed-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
      b46cec41
  20. May 31, 2023
  21. May 08, 2023
    • Dominique Martinet's avatar
      btrfs: fix offset when reading compressed extents · b1d3013d
      Dominique Martinet authored and Tom Rini's avatar Tom Rini committed
      
      btrfs_read_extent_reg correctly computed the extent offset in the
      BTRFS_COMPRESS_NONE case, but did not account for the 'offset - key.offset'
      part correctly in the compressed case, making the function read
      incorrect data.
      
      In the case I examined, the last 4k of a file was corrupted and
      contained data from a few blocks prior, e.g. reading a 10k file with a
      single extent:
      btrfs_file_read()
       -> btrfs_read_extent_reg
          (aligned part loop, until 8k)
       -> read_and_truncate_page
         -> btrfs_read_extent_reg
            (re-reads the last extent from 8k to the end,
            incorrectly reading the first 2k of data)
      
      This can be reproduced as follow:
      $ truncate -s 200M btr
      $ mount btr -o compress /mnt
      $ pat() { dd if=/dev/zero bs=1M count=$1 iflag=count_bytes status=none | tr '\0' "\\$2"; }
      $ { pat 4K 1; pat 4K 2; pat 2K 3; }  > /mnt/file
      $ sync
      $ filefrag -v /mnt/file
      File size of /mnt/file is 10240 (3 blocks of 4096 bytes)
       ext:     logical_offset:        physical_offset: length:   expected: flags:
         0:        0..       2:       3328..      3330:      3:             last,encoded,eof
      $ umount /mnt
      
      Then in u-boot:
      => load scsi 0 2000000 file
      10240 bytes read in 3 ms (3.3 MiB/s)
      => md 2001ff0
      02001ff0: 02020202 02020202 02020202 02020202  ................
      02002000: 01010101 01010101 01010101 01010101  ................
      02002010: 01010101 01010101 01010101 01010101  ................
      
      (02002000 onwards should contain '03' pattern but went back to 01,
      start of the extent)
      
      After patch, data is read properly:
      => md 2001ff0
      02001ff0: 02020202 02020202 02020202 02020202  ................
      02002000: 03030303 03030303 03030303 03030303  ................
      02002010: 03030303 03030303 03030303 03030303  ................
      
      Note that the code previously (before commit e3427184 ("fs: btrfs:
      Implement btrfs_file_read()")) did not split that read in two, so
      this is a regression even if the previous code might not have been
      handling offsets correctly either (something that booted now fails to
      boot)
      
      Fixes: a26a6bed ("fs: btrfs: Introduce btrfs_read_extent_inline() and btrfs_read_extent_reg()")
      Signed-off-by: default avatarDominique Martinet <dominique.martinet@atmark-techno.com>
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      b1d3013d
  22. Apr 25, 2023
  23. Mar 30, 2023
  24. Mar 22, 2023
  25. Feb 23, 2023
    • Qu Wenruo's avatar
      fs: btrfs: limit the mapped length to the original length · 511a1303
      Qu Wenruo authored and Tom Rini's avatar Tom Rini committed
      
      [BUG]
      There is a bug report that btrfs driver caused hang during file read:
      
        This breaks btrfs on the HiFive Unmatched.
      
        => pci enum
        PCIE-0: Link up (Gen1-x8, Bus0)
        => nvme scan
        => load nvme 0:2 0x8c000000 /boot/dtb/sifive/hifive-unmatched-a00.dtb
        [hangs]
      
      [CAUSE]
      The reporter provided some debug output:
      
        read_extent_data: cur=615817216, orig_len=16384, cur_len=16384
        read_extent_data: btrfs_map_block: cur_len=479944704; ret=0
        read_extent_data: ret=0
        read_extent_data: cur=615833600, orig_len=4096, cur_len=4096
        read_extent_data: btrfs_map_block: cur_len=479928320; ret=0
      
      Note the second and the last line, the @cur_len is 450+MiB, which is
      almost a chunk size.
      
      And inside __btrfs_map_block(), we limits the returned value to stripe
      length, but that's depending on the chunk type:
      
      	if (map->type & (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 |
      			 BTRFS_BLOCK_GROUP_RAID1C3 | BTRFS_BLOCK_GROUP_RAID1C4 |
      			 BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 |
      			 BTRFS_BLOCK_GROUP_RAID10 |
      			 BTRFS_BLOCK_GROUP_DUP)) {
      		/* we limit the length of each bio to what fits in a stripe */
      		*length = min_t(u64, ce->size - offset,
      			      map->stripe_len - stripe_offset);
      	} else {
      		*length = ce->size - offset;
      	}
      
      This means, if the chunk is SINGLE profile, then we don't limit the
      returned length at all, and even for other profiles, we can still return
      a length much larger than the requested one.
      
      [FIX]
      Properly clamp the returned length, preventing it from returning a much
      larger range than expected.
      
      Reported-by: default avatarAndreas Schwab <schwab@linux-m68k.org>
      Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
      511a1303
Loading