On Mon, Jan 16, 2023 at 10:15:58AM +0000, Shinichiro Kawasaki wrote: > I observe mount command with -o context option fails for btrfs, using mount > command built from the latest util-linux master branch code (git hash > dbf77f7a1). > > $ sudo mount -o context="system_u:object_r:root_t:s0" /dev/nullb1 /mnt > mount: /mnt: wrong fs type, bad option, bad superblock on /dev/nullb1, missing codepage or helper program, or other error. > dmesg(1) may have more information after failed mount system call. > > Kernel reports an SELinux error message: > > [565959.593054][T12131] SELinux: mount invalid. Same superblock, different security settings for (dev nullb1, type btrfs) > > Is this a known issue? Not for me. > Details: > > - Mount succeeds without the -o context option. > - Ext4 succeeds to mount with the option. > - Mount succeeds rolling back util-linux code to older git hash 8241fb005, > which was committed on January 3rd. After this commit, a number of commits > were merged to util-linux to use fsconfig syscall for mount in place of > mount syscall. > > Then the new fsconfig syscall looks the trigger of the failure. I took a look in > the code of mount path and saw that btrfs is not modified to use struct > fs_context for the fsconfig syscall. The -o context option is parsed and kept in > security field of fs_context, but it is not passed to btrfs_mount. It's a serious issue if btrfs is not ready for the new kernel fsconfig interface. I guess libmount cannot do anything else in this case (well, we can switch back to classic mount(2), but it sounds as a wrong solution). Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com