From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A2FFC433DF for ; Thu, 28 May 2020 08:50:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E436A2088E for ; Thu, 28 May 2020 08:50:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E436A2088E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5F6C28001A; Thu, 28 May 2020 04:50:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A70680010; Thu, 28 May 2020 04:50:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 495E88001A; Thu, 28 May 2020 04:50:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0224.hostedemail.com [216.40.44.224]) by kanga.kvack.org (Postfix) with ESMTP id 2F0BF80010 for ; Thu, 28 May 2020 04:50:56 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E400F6129 for ; Thu, 28 May 2020 08:50:55 +0000 (UTC) X-FDA: 76865507670.18.hot10_7c7316159685d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id C670B100ED0CD for ; Thu, 28 May 2020 08:50:55 +0000 (UTC) X-HE-Tag: hot10_7c7316159685d X-Filterd-Recvd-Size: 3027 Received: from huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 May 2020 08:50:55 +0000 (UTC) Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 7E43DB575D419CF2EC2B; Thu, 28 May 2020 16:50:51 +0800 (CST) Received: from [127.0.0.1] (10.67.102.197) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Thu, 28 May 2020 16:50:49 +0800 Subject: Re: [PATCH v2 1/1] userfaultfd/sysctl: add vm.unprivileged_userfaultfd To: Peter Xu CC: , , , , , , , , , , , , , , , , , , , References: <3b64de85-beb4-5a07-0093-cad6e8f2a8d8@huawei.com> <20200527142143.GC1194141@xz-x1> From: Xiaoming Ni Message-ID: Date: Thu, 28 May 2020 16:50:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <20200527142143.GC1194141@xz-x1> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.102.197] X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: C670B100ED0CD X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2020/5/27 22:21, Peter Xu wrote: > On Wed, May 27, 2020 at 02:54:13PM +0800, Xiaoming Ni wrote: >> >> 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. >> >> Hello > > Hi, Xiaoming, > >> I am a bit confused about this patch, can you help to answer it. >> >> Why the sysctl interface of fs/userfaultfd.c belongs to vm_table instead of >> fs_table ? >> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cefdca0a86be517bc390fc4541e3674b8e7803b0 > > Because I think it makes more sense to put the new key into where it suites > better, irrelevant to which directory the variable is declared. To me, > unprivileged_userfaultfd is definitely more suitable for vm rather than fs, > because userfaultfd is really about memory management rather than file system. > > Thanks, > Thank you for your answer Since userfaultfd and vm are more closely related, will there be consideration to move fs/userfaultfd.c to the mm directory in the future? Thanks Xiaoming Ni