Skip to content

Commit

Permalink
Error out on unusual inode types
Browse files Browse the repository at this point in the history
The dom0-provided kernel module directory should not contain anything
that is not a regular file, directory, or symbolic link.  If one does
exist, it is a bug in the build process, so error out.
  • Loading branch information
DemiMarie committed Dec 28, 2021
1 parent 98e1e79 commit 4bb18b4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions genfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ static int real_main(const char *const filesystem, const char *const uname) {
inode.i_mode = ((ino == fs->super->s_lpf_ino) ? 0700 : 0755) | (inode.i_mode & ~0777);
else if (LINUX_S_ISREG(inode.i_mode) || LINUX_S_ISLNK(inode.i_mode))
inode.i_mode |= 0644;
else
errx(1, "Inode %" PRIu32 " is neither a regular file, "
"directory, or symbolic link (mode 0%06o)", ino, (int)inode.i_mode);
if (mark_immutable && LINUX_S_ISREG(inode.i_mode))
inode.i_flags |= EXT2_IMMUTABLE_FL;
set_label(fs, "", ino, 0, "", label_modules_object);
Expand Down

0 comments on commit 4bb18b4

Please sign in to comment.