From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman)
To: joeyli <jlee-IBi9RG/b67k@public.gmane.org>
Cc: Stephen Rothwell <sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>,
Richard Weinberger <richard-/L3Ra7n9ekc@public.gmane.org>,
Linux Containers
<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>,
Jim Fehlig <jfehlig-IBi9RG/b67k@public.gmane.org>,
Cedric Bosdonnat <cbosdonnat-IBi9RG/b67k@public.gmane.org>
Subject: [CFT][PATCH] mnt: Implicitly add MNT_NODEV on remount when it was implicitly added by mount
Date: Sat, 29 Nov 2014 17:05:24 -0600 [thread overview]
Message-ID: <87egsllia3.fsf_-_@x220.int.ebiederm.org> (raw)
In-Reply-To: <87k32dlicc.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org> (Eric W. Biederman's message of "Sat, 29 Nov 2014 17:04:03 -0600")
Now that remount is properly enforcing the rule that you can't remove
nodev at least sandstorm.io is breaking when performing a remount.
It turns out that there is an easy intuitive solution implicitly
add nodev on remount when nodev was implicitly added on mount.
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
---
fs/namespace.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index 5b66b2b3624d..3a1a87dc33df 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2098,7 +2098,13 @@ static int do_remount(struct path *path, int flags, int mnt_flags,
}
if ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) &&
!(mnt_flags & MNT_NODEV)) {
- return -EPERM;
+ /* Was the nodev implicitly added in mount? */
+ if ((mnt->mnt_ns->user_ns != &init_user_ns) &&
+ !(sb->s_type->fs_flags & FS_USERNS_DEV_MOUNT)) {
+ mnt_flags |= MNT_NODEV;
+ } else {
+ return -EPERM;
+ }
}
if ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) &&
!(mnt_flags & MNT_NOSUID)) {
--
1.9.1
next prev parent reply other threads:[~2014-11-29 23:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20141127101105.GA30605@linux-rxt1.site>
[not found] ` <20141127101105.GA30605-empE8CJ7fzk2xCFIczX1Fw@public.gmane.org>
2014-11-29 23:04 ` What's the status of 87b47932 patch - mnt: Implicitly add MNT_NODEV on remount as we do on mount Eric W. Biederman
[not found] ` <87k32dlicc.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-11-29 23:05 ` Eric W. Biederman [this message]
[not found] ` <87egsllia3.fsf_-_-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-11-30 0:07 ` [CFT][PATCH] mnt: Implicitly add MNT_NODEV on remount when it was implicitly added by mount Andy Lutomirski
[not found] ` <CALCETrX=B+0PVe8fhvCEyqBGD-D1wLJPd6CrqPn6LCGYgzxPMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-30 18:46 ` Eric W. Biederman
2014-11-30 14:58 ` Richard Weinberger
[not found] ` <547B309E.9020706-/L3Ra7n9ekc@public.gmane.org>
2014-11-30 15:00 ` Andy Lutomirski
[not found] ` <CALCETrUZRi=Y=CDTpq5oO-tPOvMsZ+osKiydkCk-P0dn4DKJkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-30 15:16 ` Richard Weinberger
[not found] ` <547B34C6.6030709-/L3Ra7n9ekc@public.gmane.org>
2014-11-30 15:37 ` Andy Lutomirski
[not found] ` <CALCETrW6QRRB_DfHwYv+UVJ_8yF+8Db+UP+ezd4jG599b4dSiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-30 17:14 ` Richard Weinberger
[not found] ` <547B5066.4020509-/L3Ra7n9ekc@public.gmane.org>
2014-11-30 18:35 ` Eric W. Biederman
[not found] ` <871tokleo7.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-11-30 18:42 ` Richard Weinberger
[not found] ` <547B6531.40504-/L3Ra7n9ekc@public.gmane.org>
2014-12-01 1:29 ` Eric W. Biederman
[not found] ` <87k32ci2dx.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-12-02 8:26 ` Richard Weinberger
[not found] ` <547D77C8.7050100-/L3Ra7n9ekc@public.gmane.org>
2014-12-02 9:53 ` Eric W. Biederman
[not found] ` <87ppc22x9d.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-12-02 13:12 ` joeyli
2014-12-01 7:32 ` What's the status of 87b47932 patch - mnt: Implicitly add MNT_NODEV on remount as we do on mount joeyli
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=87egsllia3.fsf_-_@x220.int.ebiederm.org \
--to=ebiederm-as9lmozglivwk0htik3j/w@public.gmane.org \
--cc=cbosdonnat-IBi9RG/b67k@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=jfehlig-IBi9RG/b67k@public.gmane.org \
--cc=jlee-IBi9RG/b67k@public.gmane.org \
--cc=luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org \
--cc=richard-/L3Ra7n9ekc@public.gmane.org \
--cc=sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.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