All of lore.kernel.org
 help / color / mirror / Atom feed
From: tianyu zhou <tyjoe.linux@gmail.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>, linux-fsdevel@vger.kernel.org
Subject: Missing check for CAP_SYS_ADMIN before calling reconfigure_super()
Date: Mon, 31 May 2021 23:17:34 +0800	[thread overview]
Message-ID: <CAM6ytZqioJ91r8Ax7KpNzkF0Ai9DSoU0oVt0VOT2Svv=zSGvRA@mail.gmail.com> (raw)

Hi, there exists a check for CAP_SYS_ADMIN in do_remount(),
do_umount() and vfs_fsconfig_locked() before they finally call
reconfigure_super().

---------------------
// fs/namespace.c
static int do_umount(struct mount *mnt, int flags)
{
        ...
        if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN))
            return -EPERM;
        return do_umount_root(sb);
        ...
}

static int do_umount_root(struct super_block *sb)
{
                ...
                ret = reconfigure_super(fc);
                ...
}
---------------------

However, for function do_emergency_remount_callback(), vfs_get_super()
and reconfigure_single() in fs/super.c, there is no such check for
CAP_SYS_ADMIN before calling reconfigure_super(), neither do their
callers.

Is this a missing check bug which may break the protection for superblock?

Thanks!

Best regards,
Tianyu

                 reply	other threads:[~2021-05-31 17:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAM6ytZqioJ91r8Ax7KpNzkF0Ai9DSoU0oVt0VOT2Svv=zSGvRA@mail.gmail.com' \
    --to=tyjoe.linux@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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.