You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function simplefs_create() miss check whether eblock->nr_files bigger than SIMPLEFS_MAX_SUBFILES
so when eblock->nr_files is large, eblock->extents[ei].ee_start will cause array out of bounds problem
staticintsimplefs_create(structinode*dir,
structdentry*dentry,
umode_tmode,
boolexcl)
{
ci_dir=SIMPLEFS_INODE(dir);
sb=dir->i_sb;
bh=sb_bread(sb, ci_dir->ei_block);
eblock= (structsimplefs_file_ei_block*)bh->b_data;
if (eblock->nr_files==SIMPLEFS_MAX_SUBFILES) { //nr_files may be very largeret=-EMLINK;
goto end;
}
...;
ei=eblock->nr_files / SIMPLEFS_FILES_PER_EXT; //ei may be very largebi=eblock->nr_files % SIMPLEFS_FILES_PER_EXT / SIMPLEFS_FILES_PER_BLOCK;
fi=eblock->nr_files % SIMPLEFS_FILES_PER_BLOCK;
if (!eblock->extents[ei].ee_start) { //out of bound read
...;
}
...;
}
To get a PoC, change function write_data_blocks() in mkfs.c like that,
nr_files of root dir will be very large
function simplefs_create() miss check whether eblock->nr_files bigger than SIMPLEFS_MAX_SUBFILES
so when eblock->nr_files is large,
eblock->extents[ei].ee_start
will cause array out of bounds problemTo get a PoC, change function write_data_blocks() in mkfs.c like that,
nr_files of root dir will be very large
mount this disk image created by
mkfs.simplefs
and then try to create file in root dir, you will get a crashThe text was updated successfully, but these errors were encountered: