[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190319180729.GA27618@redhat.com>
Date: Tue, 19 Mar 2019 14:07:29 -0400
From: Andrea Arcangeli <aarcange@...hat.com>
To: Mike Rapoport <rppt@...ux.ibm.com>
Cc: Peter Xu <peterx@...hat.com>, linux-kernel@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Hugh Dickins <hughd@...gle.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Maxime Coquelin <maxime.coquelin@...hat.com>,
Maya Gokhale <gokhale2@...l.gov>,
Jerome Glisse <jglisse@...hat.com>,
Pavel Emelyanov <xemul@...tuozzo.com>,
Johannes Weiner <hannes@...xchg.org>,
Martin Cracauer <cracauer@...s.org>,
Denis Plotnikov <dplotnikov@...tuozzo.com>, linux-mm@...ck.org,
Marty McFadden <mcfadden8@...l.gov>,
Mike Kravetz <mike.kravetz@...cle.com>,
Mike Rapoport <rppt@...ux.vnet.ibm.com>,
Kees Cook <keescook@...omium.org>,
Mel Gorman <mgorman@...e.de>,
"Kirill A . Shutemov" <kirill@...temov.name>,
linux-api@...r.kernel.org, linux-fsdevel@...r.kernel.org,
"Dr . David Alan Gilbert" <dgilbert@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v2 1/1] userfaultfd/sysctl: add
vm.unprivileged_userfaultfd
Hello,
On Tue, Mar 19, 2019 at 09:11:04AM +0200, Mike Rapoport wrote:
> Hi Peter,
>
> On Tue, Mar 19, 2019 at 11:07:22AM +0800, Peter Xu wrote:
> > Add a global sysctl knob "vm.unprivileged_userfaultfd" to control
> > whether userfaultfd is allowed by unprivileged users. When this is
> > set to zero, only privileged users (root user, or users with the
> > CAP_SYS_PTRACE capability) will be able to use the userfaultfd
> > syscalls.
> >
> > Suggested-by: Andrea Arcangeli <aarcange@...hat.com>
> > Suggested-by: Mike Rapoport <rppt@...ux.vnet.ibm.com>
> > Signed-off-by: Peter Xu <peterx@...hat.com>
>
> Reviewed-by: Mike Rapoport <rppt@...ux.ibm.com>
>
> Just one minor note below
This looks fine with me too.
> > + if (!sysctl_unprivileged_userfaultfd && !capable(CAP_SYS_PTRACE))
> > + return -EPERM;
The only difference between the bpf sysctl and the userfaultfd sysctl
this way is that the bpf sysctl adds the CAP_SYS_ADMIN capability
requirement, while userfaultfd adds the CAP_SYS_PTRACE requirement,
because the userfaultfd monitor is more likely to need CAP_SYS_PTRACE
already if it's doing other kind of tracking on processes runtime, in
addition of userfaultfd. In other words both syscalls works only for
root, when the two sysctl are opt-in set to 1.
Reviewed-by: Andrea Arcangeli <aarcange@...hat.com>
Powered by blists - more mailing lists