Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp827298ybm; Wed, 27 May 2020 08:57:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpB5Ek46UCPkY7YrZ/zMYcM/09zYY9iJ3YP0nfIwIz9F9M8S+VHRNiRkn5lFHRmYfJSH7W X-Received: by 2002:a17:906:5243:: with SMTP id y3mr7042336ejm.193.1590595043945; Wed, 27 May 2020 08:57:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590595043; cv=none; d=google.com; s=arc-20160816; b=J4xePYD64ecKEMyOywNulTEQKYw9lSnGdM4NIMvNdqg3Pfu1Sz7x/YV6n20aQ9KRz4 vuXP+rNz0nZaT0PYBUK1yX2HeqbyLJw+UJhjDqUDcMA4vfHr1RoaLyHERGHfzv4EyhuQ aGVjdStAs9XyhpDVGEtWLvHLWcJZjib+svhqo5xAaKza+S8udVe9KxedL87wgI3to8zv 2uRuLDCd9ot/xL0umFxN9HhL8JhiPQoRHQxG94K9VXVYWcHoIogMkgLM93k/arRa4AaN 1dVKzaf2PgOD2ZcszeCHHWpCiCsQaKiwf0m3V3QSoEMKMhoXeh4mbQExjBqYYssht2jz RWCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=+qKyyBRTH3XVnPxCnLL3xw/KfsJfCnDk6EWAHME3F1E=; b=SsK+CjokfXBmzc/NC14oUK/CdPJGBow9WRRwdQf1v2YJ2in9KOHfFxwuaE22f50fNi LdtZV11qYV3XxiX4CgRGyJsTu0kWQF3Ogz00zjdCvYKSi3lObM/oC0Ghh8k2nSk74UHf 9R9hlYhx/E5eHcsMiDKgJtJa7gz4YRu7lB47B8ZzLe0nRnETyOs4cBGQ2V/AVVLozNyR Xd6IOIlCSp0vBfDpubAhpKUGYh36hW1Cf+c+1t18HK6WXubguMklYyvBPc7jRRzh96rA Pi/dXfhG9n8kA8WfAPHGmbFBrm9cKzU9CKVB93iYchBcQVQSFIlIio1Rbw1UYZ1gNKXe 6O/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CN7jmiIU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r8si1934418edi.43.2020.05.27.08.57.00; Wed, 27 May 2020 08:57:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CN7jmiIU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389140AbgE0OVx (ORCPT + 99 others); Wed, 27 May 2020 10:21:53 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:34912 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389135AbgE0OVw (ORCPT ); Wed, 27 May 2020 10:21:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590589310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+qKyyBRTH3XVnPxCnLL3xw/KfsJfCnDk6EWAHME3F1E=; b=CN7jmiIUd2q9HmDO/it777cjDn083BHbK+gtcwYo5HKoR7S2DsNIRHUVLKeXz/WFBacgPy EsJwRCECuhCW1aI1OXdGu4W3pfCCkql8oYNyEge/5fvwW8WJYxXIvfY7Floml3EMlc25KI M0im/JY9kfaT0Wr6ewgRkW4fbXRc884= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-p--wzi_mP8Odmny0Lkzj_g-1; Wed, 27 May 2020 10:21:49 -0400 X-MC-Unique: p--wzi_mP8Odmny0Lkzj_g-1 Received: by mail-qv1-f71.google.com with SMTP id da20so13086691qvb.3 for ; Wed, 27 May 2020 07:21:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=+qKyyBRTH3XVnPxCnLL3xw/KfsJfCnDk6EWAHME3F1E=; b=BT9BwtZrif+9mSmg5cr7z0XwSqkMSifsGTTTn6LqD54WFkgbDrrLzeGbnjJNLpz/Vm Zkz4aDKR0suJvfpLGHAJ1FsGSSqz/rtataSrY+Mn+XQhzwnM1TNQJg0vgTp5kQK2N2Xf jwlGlLct8e2ZT+NVR/38zTQbqjYjmfneAEwLqJ+td3hiSJFeRqKCQI9JUsZou53haYj8 UgkYmT5Jd1As5wKXLHM43slnAs+UQKN2N6swuaef/eqqNQJLRxdqWWrVSgWN+SBBTyx6 oEn9hvXCRiZViuoqAx4IIVZzRL3Ly6K22D4Dyiw0W0P12YtHU7uUlFlZeuk7Oj8jpR1Y w04g== X-Gm-Message-State: AOAM530DRfYPSVwhznSoVX1oGgJ/d89LZTIZ2z/btxCtzgWpDy7wsA0s 4H/xI2Ziqp0fbBLURmLrY1ZkYVn8gtCfKr3O+53bqw+QirD+Gbry0ubOJvHl6JmogOt8s48mrX0 fy8UmuF4u1zDptYM4w27E/DED X-Received: by 2002:aed:3789:: with SMTP id j9mr4285362qtb.91.1590589308514; Wed, 27 May 2020 07:21:48 -0700 (PDT) X-Received: by 2002:aed:3789:: with SMTP id j9mr4285327qtb.91.1590589308223; Wed, 27 May 2020 07:21:48 -0700 (PDT) Received: from xz-x1 ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id 88sm2618476qth.9.2020.05.27.07.21.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 07:21:45 -0700 (PDT) Date: Wed, 27 May 2020 10:21:43 -0400 From: Peter Xu To: Xiaoming Ni Cc: aarcange@redhat.com, akpm@linux-foundation.org, cracauer@cons.org, dplotnikov@virtuozzo.com, gokhale2@llnl.gov, hannes@cmpxchg.org, hughd@google.com, jglisse@redhat.com, kirill@shutemov.name, linux-kernel@vger.kernel.org, linux-mm@kvack.org, maxime.coquelin@redhat.com, mcfadden8@llnl.gov, mcgrof@kernel.org, mgorman@suse.de, mike.kravetz@oracle.com, pbonzini@redhat.com, rppt@linux.vnet.ibm.com, xemul@virtuozzo.com, keescook@chromium.org Subject: Re: [PATCH v2 1/1] userfaultfd/sysctl: add vm.unprivileged_userfaultfd Message-ID: <20200527142143.GC1194141@xz-x1> References: <3b64de85-beb4-5a07-0093-cad6e8f2a8d8@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3b64de85-beb4-5a07-0093-cad6e8f2a8d8@huawei.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, -- Peter Xu