Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "failed to read inode: EOF" on small size filesystem #15

Open
mappu opened this issue Jun 5, 2024 · 1 comment
Open

Error "failed to read inode: EOF" on small size filesystem #15

mappu opened this issue Jun 5, 2024 · 1 comment
Assignees

Comments

@mappu
Copy link

mappu commented Jun 5, 2024

Hi, thanks for this project.

I have a small size ext4 filesystem image:
volume.ext4.zip

It was created simply by mkfs -t ext4 with default options on a 128MB loopback device. It has the 64-bit feature flag.

When listing files, this library gives EOF looking for the inode (same as #5):

  • failed to list file infos: failed to get directory entries: failed to get root inode: failed to read inode: EOF

This same filesystem image can be loaded successfully with the https://github.com/dsoprea/go-ext4/ library.

Somehow the GetInodeTableLoc() returned a too high value, i'll compare it further.

@mappu
Copy link
Author

mappu commented Jun 5, 2024

I think the ext4.GroupDescriptor is parsed wrongly for this filesystem.

masahiro331/go-ext4-filesystem
In getInode() function

inodeAddress=2
bgd=ext4.GroupDescriptor{
  GroupDescriptor32:ext4.GroupDescriptor32{
    BlockBitmapLo:0x8000,
    InodeBitmapLo:0x20000,
    InodeTableLo:0x1999,
    FreeBlocksCountLo:0x90f1,
    FreeInodesCountLo:0x1,
    UsedDirsCountLo:0x7fea,
    Flags:0x0,
    ExcludeBitmapLo:0x1,
    BlockBitmapCsumLo:0x0,
    InodeBitmapCsumLo:0x0,
    ItableUnusedLo:0x0,
    Checksum:0x0
  },
  BlockBitmapHi:0x2000,
  InodeBitmapHi:0x2000,
  InodeTableHi:0x800,
  FreeBlocksCountHi:0x2458, 
  FreeInodesCountHi:0x6582, 
  UsedDirsCountHi:0x2459, 
  ItableUnusedHi:0x6582, 
  ExcludeBitmapHi:0xffff0001, 
  BlockBitmapCsumHi:0xef53, 
  InodeBitmapCsumHi:0x1, 
  Reserved:0x1
}

dsoprea/go-ext4
GetWithAbsoluteInode(InodeRootDirectory)
Dump()

BgBlockBitmapHi: (0)
BgBlockBitmapLo: (259)
BgChecksum: [d0d4]
BgFlags: (0)
BgFreeBlocksCountHi: (0)
BgFreeBlocksCountLo: (202)
BgFreeInodesCountHi: (0)
BgFreeInodesCountLo: (2027)
BgInodeBitmapHi: (0)
BgInodeBitmapLo: (275)
BgInodeTableHi: (0)
BgInodeTableLo: (291)
BgItableUnusedHi: (0)
BgItableUnusedLo: (2027)
BgUsedDirsCountHi: (0)
BgUsedDirsCountLo: (7)
BgExcludeBitmapHi: (0)
BgBlockBitmapCsumHi: (56393)
BgInodeBitmapCsumHi: (31456)

@masahiro331 masahiro331 self-assigned this Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants