Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Matt Zagrabelny <mzagrabe@d.umn.edu>,
	Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: subvolumes as partitions and mount options
Date: Mon, 27 Mar 2023 22:25:25 +0300	[thread overview]
Message-ID: <ffca26e0-88e8-1dc7-ce67-6235a94159e1@gmail.com> (raw)
In-Reply-To: <CAOLfK3WuXuVKxH4dsXGGynwkMAM7Gd14mmxiT2CFYEOFbVuCQw@mail.gmail.com>

On 27.03.2023 21:48, Matt Zagrabelny wrote:
> Greetings,
> 
> I have a root partition btrfs file system.
> 
> I need to have /tmp, /var, /var/tmp, /var/log, and other directories
> under separate partitions so that certain mount options can be set for
> those partitions/directories.
> 
> I'm testing out a subvolume mount with the subvolume /subv_content
> mounted at /subv_mnt.
> 
> For instance, the noexec mount option can be circumvented:

"exec/noexec" option applies to mount instance, it is not persistent 
property of underlying filesystem. It is not specific to btrfs at all.

bor@bor-Latitude-E5450:/tmp/tst$ ./bin/foo.sh
Hello, world!
bor@bor-Latitude-E5450:/tmp/tst$ mkdir exec noexec
bor@bor-Latitude-E5450:/tmp/tst$ sudo mount -o bind,exec bin exec
bor@bor-Latitude-E5450:/tmp/tst$ sudo mount -o bind,noexec bin noexec
bor@bor-Latitude-E5450:/tmp/tst$ ./exec/foo.sh
Hello, world!
bash: ./noexec/foo.sh: Permission denied
bor@bor-Latitude-E5450:/tmp/tst$




> root@ziti:/# findmnt --kernel /subv_mnt
> TARGET    SOURCE                                FSTYPE OPTIONS
> /subv_mnt /dev/nvme0n1p2[/@rootfs/subv_content] btrfs
> rw,nosuid,nodev,noexec,relatime,ssd,space_cache=v2,subvolid=257,subvol=/@rootfs/subv_content
> 
> root@ziti:/# echo '#!/usr/bin/bash' > /subv_mnt/foo ; echo 'echo foo'
>>> /subv_mnt/foo ; chmod 0755 /subv_mnt/foo
> root@ziti:/# /subv_mnt/foo
> bash: /subv_mnt/foo: Permission denied
> root@ziti:/# /subv_content/foo
> foo
> root@ziti:/#
> 
> Am I missing some mechanism to restrict subvolume with mount options
> that cannot be worked around by accessing the files in the subvolume
> as opposed to the mount point?
> 
> Thanks for any help!
> 
> -m


  reply	other threads:[~2023-03-27 19:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 18:48 subvolumes as partitions and mount options Matt Zagrabelny
2023-03-27 19:25 ` Andrei Borzenkov [this message]
2023-03-27 19:50   ` Matt Zagrabelny
2023-03-27 20:24     ` Graham Cobb
2023-03-27 20:31     ` Matthew Warren
2023-03-27 21:06       ` Matt Zagrabelny
2023-03-28  1:42         ` Matthew Warren
2023-03-28 19:45           ` Matt Zagrabelny
2023-03-29  4:04             ` Andrei Borzenkov

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=ffca26e0-88e8-1dc7-ce67-6235a94159e1@gmail.com \
    --to=arvidjaar@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=mzagrabe@d.umn.edu \
    /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