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

ext4_readlink fails in some scenarios #39

Open
awana81 opened this issue Aug 1, 2018 · 2 comments
Open

ext4_readlink fails in some scenarios #39

awana81 opened this issue Aug 1, 2018 · 2 comments
Labels

Comments

@awana81
Copy link

awana81 commented Aug 1, 2018

The function calls ext4_fread that implements the special case for symlinks less than 60 bytes. However, this case incorrectly assumes that block count on the inode will be set to 0. In some cases, the blocks_count_lo appears to be non-zero, yet the symlink is still stored in the inode itself when the size is less than 60. Specific test case was the /etc/grub.conf file on a CentOs 5.3 installation where the block_count_lo was 8. I couldn't see any place in the EXT specification where block_count_lo has to be set to 0 for a symlink, so I removed the call to ext4_get_blocks_count in ext4_fread, but there may be other places where this is used as well.

@gkostka
Copy link
Owner

gkostka commented Sep 26, 2018

Is this fix: c5f8d13 solve the problem?

@gkostka gkostka added the bug label Sep 26, 2018
@awana81
Copy link
Author

awana81 commented Oct 4, 2018

No, that appears to be writing symlinks over 60 bytes. I was trying to read symlinks on an existing filesystem that were under 60 bytes, lwext4 was not used to create the symlink.

lwext4/src/ext4.c

Line 1722 in c5f8d13

if (softlink && file->fsize < sizeof(ref.inode->blocks)
checks that small links have no blocks associated with them via !ext4_inode_get_blocks_count(sb, ref.inode), but this check doesn't hold on some OSes, and I couldn't find where the EXT specification mandates it. I just removed that check to fix the specific problem I was seeing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants