All of lore.kernel.org
 help / color / mirror / Atom feed
* Missing check for CAP_SYS_ADMIN in do_reconfigure_mnt()
@ 2021-05-31 14:59 tianyu zhou
  2021-05-31 16:40 ` Al Viro
  2021-05-31 17:07 ` Matthew Wilcox
  0 siblings, 2 replies; 5+ messages in thread
From: tianyu zhou @ 2021-05-31 14:59 UTC (permalink / raw)
  To: Alexander Viro, linux-fsdevel

Hi, function do_remount() in fs/namespace.c checks the CAP_SYS_ADMIN
before it calls set_mount_attributes().

--------------------
// fs/namespace.c
static int do_remount(struct path *path, int ms_flags, int sb_flags,
              int mnt_flags, void *data)
{
        ....
        if (ns_capable(sb->s_user_ns, CAP_SYS_ADMIN)) {
            err = reconfigure_super(fc);
            if (!err) {
                lock_mount_hash();
                set_mount_attributes(mnt, mnt_flags);       // <===
protected function
                unlock_mount_hash();
            }
        ...
}
--------------------

However, in another caller of set_mount_attributes(),
do_reconfigure_mnt(), I have not found any check for CAP_SYS_ADMIN.
So, is there a missing check bug inside do_reconfigure_mnt() ? (which
makes it possible for normal user to reach set_mount_attributes())

Thanks!

Best regards,
Tianyu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-01  8:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31 14:59 Missing check for CAP_SYS_ADMIN in do_reconfigure_mnt() tianyu zhou
2021-05-31 16:40 ` Al Viro
2021-05-31 17:07 ` Matthew Wilcox
2021-05-31 19:02   ` tianyu zhou
2021-06-01  8:45     ` Christian Brauner

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.