From: no-reply@sashiko.virtuozzo.com
To: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>,
khorenko@virtuozzo.com, ptikhomirov@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH vz10 v2 1/3] fs: let the protection flags of a mount be locked from userspace
Date: Mon, 16 Nov 2026 06:24:13 +0000 [thread overview]
Message-ID: <010701a1e3070f59-4584ccc9-b63a-4f2a-b6a1-619766c32e57-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261116061256.54472-2-mirian.shilakadze@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] fs: mount_setattr() silently drops a VE lock request on an unset
protection
--
commit 4fe4ec6ec778b3296f2d3e5ddbb682f247213bc4
Author: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
fs: let the protection flags of a mount be locked from userspace
This adds mount_setattr() attributes MOUNT_ATTR_VE_LOCK_RDONLY, _NOSUID, _NODEV and _NOEXEC. They let a CAP_SYS_ADMIN caller in the initial user namespace raise the matching MNT_LOCK_* bits on one mount at a time.
> @@ -4915,6 +4931,15 @@ static unsigned int recalc_flags(struct mount_kattr *kattr, struct mount *mnt)
> flags &= ~kattr->attr_clr;
> /* flags to raise */
> flags |= kattr->attr_set;
> + /* a protection lock only stands where the protection is set */
> + if (!(flags & MNT_READONLY))
> + flags &= ~MNT_LOCK_READONLY;
> + if (!(flags & MNT_NOSUID))
> + flags &= ~MNT_LOCK_NOSUID;
> + if (!(flags & MNT_NODEV))
> + flags &= ~MNT_LOCK_NODEV;
> + if (!(flags & MNT_NOEXEC))
> + flags &= ~MNT_LOCK_NOEXEC;
>
> return flags;
> }
[ ... ]
> + kattr->lock_flags = (attr->attr_set | attr->attr_clr) &
> + MOUNT_SETATTR_LOCK_FLAGS;
> + if (kattr->lock_flags && !capable(CAP_SYS_ADMIN))
> + return -EPERM;
[Severity: Low]
Can mount_setattr() report success without locking anything here? If a caller passes, say, MOUNT_ATTR_VE_LOCK_RDONLY on a read-write mount without also setting MOUNT_ATTR_RDONLY, build_mount_kattr() accepts the request. recalc_flags() then strips MNT_LOCK_READONLY because MNT_READONLY is not set. The stripped value is committed and the call returns 0.
The host administrator gets no sign that the mount is still unprotected. This is a hardening interface, so would returning -EINVAL for a lock bit without its matching protection be safer? Setting the protection implicitly would also work.
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116061256.54472-1-mirian.shilakadze@virtuozzo.com?part=1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-16 6:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 6:12 [Devel] [PATCH vz10 v2 0/3] fs: let the host lock the protection flags of a mount Mirian Shilakadze
2026-11-16 6:12 ` [Devel] [PATCH vz10 v2 1/3] fs: let the protection flags of a mount be locked from userspace Mirian Shilakadze
2026-11-16 6:24 ` no-reply [this message]
2026-11-16 17:13 ` Konstantin Khorenko
2026-11-16 6:12 ` [Devel] [PATCH vz10 v2 2/3] fs: report the locks of a mount in statmount() Mirian Shilakadze
2026-11-16 6:17 ` no-reply
2026-11-16 17:13 ` Konstantin Khorenko
2026-11-16 6:12 ` [Devel] [PATCH vz10 v2 3/3] selftests/ve: test locking a mount from the host Mirian Shilakadze
2026-11-16 6:38 ` no-reply
2026-11-16 17:13 ` Konstantin Khorenko
2026-11-16 17:13 ` [Devel] [PATCH vz10 v2 0/3] fs: let the host lock the protection flags of a mount Konstantin Khorenko
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=010701a1e3070f59-4584ccc9-b63a-4f2a-b6a1-619766c32e57-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=mirian.shilakadze@virtuozzo.com \
--cc=ptikhomirov@virtuozzo.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.