Util-Linux Archive mirror
 help / color / mirror / Atom feed
From: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"util-linux@vger.kernel.org" <util-linux@vger.kernel.org>
Cc: Damien Le Moal <Damien.LeMoal@wdc.com>,
	Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	Naohiro Aota <Naohiro.Aota@wdc.com>
Subject: btrfs mount failure with context option and latest mount command
Date: Mon, 16 Jan 2023 10:15:58 +0000	[thread overview]
Message-ID: <20230116101556.neld5ddm6brssy4n@shindev> (raw)

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?

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.

-- 
Shin'ichiro Kawasaki

             reply	other threads:[~2023-01-16 10:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 10:15 Shinichiro Kawasaki [this message]
2023-01-17 16:42 ` btrfs mount failure with context option and latest mount command Karel Zak
2023-01-19  6:13   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230116101556.neld5ddm6brssy4n@shindev \
    --to=shinichiro.kawasaki@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=Naohiro.Aota@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).