From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 0/3] userfaultfd: allow to forbid unprivileged users Date: Wed, 13 Mar 2019 09:22:31 +0100 Message-ID: <3714d120-64e3-702e-6eef-4ef253bdb66d@redhat.com> References: <20190311093701.15734-1-peterx@redhat.com> <58e63635-fc1b-cb53-a4d1-237e6b8b7236@oracle.com> <20190313060023.GD2433@xz-x1> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: linux-kernel@vger.kernel.org, Hugh Dickins , Luis Chamberlain , Maxime Coquelin , kvm@vger.kernel.org, Jerome Glisse , Pavel Emelyanov , Johannes Weiner , Martin Cracauer , Denis Plotnikov , linux-mm@kvack.org, Marty McFadden , Maya Gokhale , Andrea Arcangeli , Mike Rapoport , Kees Cook , Mel Gorman , "Kirill A . Shutemov" , linux-fsdevel@vger.kernel.org, "Dr . David Alan Gilbert" , Andrew Morton , Mike Kravetz Return-path: In-Reply-To: <20190313060023.GD2433@xz-x1> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 13/03/19 07:00, Peter Xu wrote: >> However, I can imagine more special cases being added for other users. And, >> once you have more than one special case then you may want to combine them. >> For example, kvm and hugetlbfs together. > It looks fine to me if we're using MMF_USERFAULTFD_ALLOW flag upon > mm_struct, since that seems to be a very general flag that can be used > by anything we want to grant privilege for, not only KVM? Perhaps you can remove the fork() limitation, and add a new suboption to prctl(PR_SET_MM) that sets/resets MMF_USERFAULTFD_ALLOW. If somebody wants to forbid unprivileged userfaultfd and use KVM, they'll have to use libvirt or some other privileged management tool. We could also add support for this prctl to systemd, and then one could do "systemd-run -pAllowUserfaultfd=yes COMMAND". Paolo