Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3379838imc; Wed, 13 Mar 2019 16:56:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjAIziqqsMwOpVh7D3QQkrU/o3GfNOedxoiZtKuHkfdx+b2//bq2AOOFpkXxIbzBnnRSTE X-Received: by 2002:a63:4e63:: with SMTP id o35mr3299406pgl.112.1552521400234; Wed, 13 Mar 2019 16:56:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552521400; cv=none; d=google.com; s=arc-20160816; b=B95AhDHHiFzCsRVeGi4ROsVejETcfh0py3+PXRPAiGElyxTimNdf8M5kvh1Qe1UamO UKD0tA7AXnB6hdatV035xXV75cwf/Sp54Rr7IUpe4y8161OJpO8utULdK5ekKcX4lSTp IUpuM7an22hzHQZHq0/733Nvq43BTlXgM+V/sI5MAgIRbgAXH+saFvmM/qIY6Ph2wa0X CU2GxOSLcXatF+j45WRvPE0VeGuzBdN5+ARc7So+ihfXyydSmO3TMCsAQcT3iXFBWTNq 1cOMhbK3QW2Mm3qtcBWGqLqqEBz8wt5afK6DLKrxpF9vPX8F1gXKUbmDEhc8FujOCEDy clRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=hOAXqP5LQkSbG+WT0L6GK0CduMk0ul92znI8AELgRHI=; b=KksNV1d2DvPwD2Jeq2JyYAPjmYMEyoQOGYraMjJ6P4eGKSDJ7U2CwWertov/HrLUF8 6B3D3hoRgk78CV6N6+uU+sx1qrAcAaRXgYAm0yRZav8KA+mQ/NRJJM2kWHv7yXss8i33 PsFmMoFtn7M3Vyes0PrqV/GQ9hA1fFM9wTls+fAVbQdJMHGGtw0sX1rMMCprnFnJFVvg KGdqICa7snTFnoApzCaHvMFn8cEU4a74y6Oad6lsTFA3Ul/kdxo52DG7sreXSZyke6JM jH8zrOXfxeqI+MuEL6tENfi5lBTkXY8FZFibE7hEOWoretiUIhMYWdJvGw1XXYAcpTXA Oing== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j187si11723654pfc.251.2019.03.13.16.56.22; Wed, 13 Mar 2019 16:56:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727296AbfCMXzl (ORCPT + 99 others); Wed, 13 Mar 2019 19:55:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46442 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbfCMXzk (ORCPT ); Wed, 13 Mar 2019 19:55:40 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 49E6730018EB; Wed, 13 Mar 2019 23:55:40 +0000 (UTC) Received: from sky.random (ovpn-121-1.rdu2.redhat.com [10.10.121.1]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8461F60F94; Wed, 13 Mar 2019 23:55:35 +0000 (UTC) Date: Wed, 13 Mar 2019 19:55:34 -0400 From: Andrea Arcangeli To: Mike Kravetz Cc: Paolo Bonzini , Peter Xu , 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 , Mike Rapoport , Kees Cook , Mel Gorman , "Kirill A . Shutemov" , linux-fsdevel@vger.kernel.org, "Dr . David Alan Gilbert" , Andrew Morton Subject: Re: [PATCH 0/3] userfaultfd: allow to forbid unprivileged users Message-ID: <20190313235534.GK25147@redhat.com> References: <20190311093701.15734-1-peterx@redhat.com> <58e63635-fc1b-cb53-a4d1-237e6b8b7236@oracle.com> <20190313060023.GD2433@xz-x1> <3714d120-64e3-702e-6eef-4ef253bdb66d@redhat.com> <20190313185230.GH25147@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 13 Mar 2019 23:55:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 13, 2019 at 01:01:40PM -0700, Mike Kravetz wrote: > On 3/13/19 11:52 AM, Andrea Arcangeli wrote: > > > > hugetlbfs is more complicated to detect, because even if you inherit > > it from fork(), the services that mounts the fs may be in a different > > container than the one that Oracle that uses userfaultfd later on down > > the road from a different context. And I don't think it would be ok to > > allow running userfaultfd just because you can open a file in an > > hugetlbfs file system. With /dev/kvm it's a bit different, that's > > chmod o-r by default.. no luser should be able to open it. > > > > Unless somebody suggests a consistent way to make hugetlbfs "just > > work" (like we could achieve clean with CRIU and KVM), I think Oracle > > will need a one liner change in the Oracle setup to echo into that > > file in addition of running the hugetlbfs mount. > > I think you are suggesting the DB setup process enable uffd for all users. > Correct? Yes. In addition of the hugetlbfs setup, various apps requires to also increase fs.inotify.max_user_watches or file-max and other tweaks, this would be one of those tweaks. > This may be too simple, and I don't really like group access, but how about > just defining a uffd group? If you are in the group you can make uffd > system calls. Everything is possible, I'm just afraid it gets too complex. So you suggest to echo a gid into the file?