* [bug report] btrfs mount failure with SELinux context option on kernel v6.6-rc5
@ 2023-10-10 5:22 Shinichiro Kawasaki
2023-10-10 5:41 ` Qu Wenruo
0 siblings, 1 reply; 3+ messages in thread
From: Shinichiro Kawasaki @ 2023-10-10 5:22 UTC (permalink / raw)
To: linux-btrfs; +Cc: Qu Wenruo
Hi all,
I found fstests runs for btrfs on my test systems fail with the kernel v6.6-rc5.
Mount commands for btrfs fail with this message:
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdc, missing codepage or helper program, or other error.
dmesg(1) may have more information after failed mount system call.
And kernel reported:
BTRFS error: unrecognized mount option 'context="system_u:object_r:root_t:s0"
My test system has Fedora which enables SELinux. Fstests adds SELinux security
context of the system to the mount command option list. Mount commands with the
added option fail:
$ sudo mount -o context=system_u:object_r:root_t:s0 /dev/sdX /mnt
With the kernel v6.6-rc4, the mount command succeeded. I bisected between rc4
and rc5 then found the trigger commit is 5f521494cc73 ("btrfs: reject unknown
mount options early"). When I revert the commit from v6.6-rc5, the mount command
succeeds.
Since the trigger is in the kernel, I guess a fix is required on the kernel side
rather than fstests or mount command. Actions for fix will be appreciated.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [bug report] btrfs mount failure with SELinux context option on kernel v6.6-rc5
2023-10-10 5:22 [bug report] btrfs mount failure with SELinux context option on kernel v6.6-rc5 Shinichiro Kawasaki
@ 2023-10-10 5:41 ` Qu Wenruo
2023-10-10 13:40 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2023-10-10 5:41 UTC (permalink / raw)
To: Shinichiro Kawasaki, linux-btrfs, David Sterba; +Cc: Qu Wenruo
On 2023/10/10 15:52, Shinichiro Kawasaki wrote:
> Hi all,
>
> I found fstests runs for btrfs on my test systems fail with the kernel v6.6-rc5.
> Mount commands for btrfs fail with this message:
>
> mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdc, missing codepage or helper program, or other error.
> dmesg(1) may have more information after failed mount system call.
>
> And kernel reported:
>
> BTRFS error: unrecognized mount option 'context="system_u:object_r:root_t:s0"
>
> My test system has Fedora which enables SELinux. Fstests adds SELinux security
> context of the system to the mount command option list. Mount commands with the
> added option fail:
>
> $ sudo mount -o context=system_u:object_r:root_t:s0 /dev/sdX /mnt
>
> With the kernel v6.6-rc4, the mount command succeeded. I bisected between rc4
> and rc5 then found the trigger commit is 5f521494cc73 ("btrfs: reject unknown
> mount options early"). When I revert the commit from v6.6-rc5, the mount command
> succeeds.
>
> Since the trigger is in the kernel, I guess a fix is required on the kernel side
> rather than fstests or mount command. Actions for fix will be appreciated.
OK, the problem is, the SELinux options are only handled later, in
btrfs_mount_root(), meanwhile btrfs_mount() is called earlier, thus the
SELinux options are rejected.
Unfortunately my environment doesn't utilize SELinux, thus it doesn't
get caught at all...
David, please revert the offending patch, a proper fix would be more
complex.
Thanks,
Qu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [bug report] btrfs mount failure with SELinux context option on kernel v6.6-rc5
2023-10-10 5:41 ` Qu Wenruo
@ 2023-10-10 13:40 ` David Sterba
0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2023-10-10 13:40 UTC (permalink / raw)
To: Qu Wenruo; +Cc: Shinichiro Kawasaki, linux-btrfs, David Sterba, Qu Wenruo
On Tue, Oct 10, 2023 at 04:11:41PM +1030, Qu Wenruo wrote:
>
>
> On 2023/10/10 15:52, Shinichiro Kawasaki wrote:
> > Hi all,
> >
> > I found fstests runs for btrfs on my test systems fail with the kernel v6.6-rc5.
> > Mount commands for btrfs fail with this message:
> >
> > mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdc, missing codepage or helper program, or other error.
> > dmesg(1) may have more information after failed mount system call.
> >
> > And kernel reported:
> >
> > BTRFS error: unrecognized mount option 'context="system_u:object_r:root_t:s0"
> >
> > My test system has Fedora which enables SELinux. Fstests adds SELinux security
> > context of the system to the mount command option list. Mount commands with the
> > added option fail:
> >
> > $ sudo mount -o context=system_u:object_r:root_t:s0 /dev/sdX /mnt
> >
> > With the kernel v6.6-rc4, the mount command succeeded. I bisected between rc4
> > and rc5 then found the trigger commit is 5f521494cc73 ("btrfs: reject unknown
> > mount options early"). When I revert the commit from v6.6-rc5, the mount command
> > succeeds.
> >
> > Since the trigger is in the kernel, I guess a fix is required on the kernel side
> > rather than fstests or mount command. Actions for fix will be appreciated.
>
> OK, the problem is, the SELinux options are only handled later, in
> btrfs_mount_root(), meanwhile btrfs_mount() is called earlier, thus the
> SELinux options are rejected.
>
> Unfortunately my environment doesn't utilize SELinux, thus it doesn't
> get caught at all...
>
> David, please revert the offending patch, a proper fix would be more
> complex.
Revert on the way, I'll send the pull request today.
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git/commit/?h=next-fixes&id=54f67decddeb47680f08c720c94b4d4f67181442
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-10 13:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-10 5:22 [bug report] btrfs mount failure with SELinux context option on kernel v6.6-rc5 Shinichiro Kawasaki
2023-10-10 5:41 ` Qu Wenruo
2023-10-10 13:40 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).