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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEFDAC43334 for ; Wed, 20 Jul 2022 02:32:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83F606B0072; Tue, 19 Jul 2022 22:32:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EE646B0073; Tue, 19 Jul 2022 22:32:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B6156B0074; Tue, 19 Jul 2022 22:32:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5BF946B0072 for ; Tue, 19 Jul 2022 22:32:38 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2F78C1A0409 for ; Wed, 20 Jul 2022 02:32:38 +0000 (UTC) X-FDA: 79705904796.01.BBDA02F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id C9E9D40016 for ; Wed, 20 Jul 2022 02:32:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658284357; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3uZbjgFMHeKFjmyd0QEm1xCO2NChsIABolYNiKdJ7Gg=; b=HkPLibzPCBQ+fJq6sDfax9IerMrZb1JozDhkcsNTe094WsqfceS29+1LXPUQOtTA8QIQn0 /I35Ng7abhzK+S4YvDf0KugAsiA4r11+VlSzb+9ugAzr4EAdtlj3R2pdenWrgSDoEYpl2A x7N0ly2GSSbK3r6UiXW0RX8N71inj+I= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-47-sFG-ui-PMbS2KUG2GI6oag-1; Tue, 19 Jul 2022 22:32:35 -0400 X-MC-Unique: sFG-ui-PMbS2KUG2GI6oag-1 Received: by mail-qk1-f198.google.com with SMTP id bm34-20020a05620a19a200b006b5f1d95ceeso4992548qkb.5 for ; Tue, 19 Jul 2022 19:32:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=3uZbjgFMHeKFjmyd0QEm1xCO2NChsIABolYNiKdJ7Gg=; b=pBKZ2GyU6JFwIyHfbJgieCxw6WjpvtVRq5XxJURtm4P9bNlYG2kS7u3uGpXdQeQ/RQ iogJcXfA4Y+ZH5u1tTZMWrGZxEA1hUHTphd7s86OsQn41+H9c8KZMyvhhA3u+ND6/2z/ C+RzjJhYMv77+5UMWxdMfbjzCxuDAlJ2NvFcl9JHCZrhYvuHPFX36l9tqjxcOsODPqzJ dg5QDG77vAZHZfKTlS9K7qkknNxxNNQDPCivVotumKX20i5UgFkB3reGs1O3cgwgRdub LLF3P1JdrUFK9AYMeyiYbnXBQAblxdODrngN4+c+itM+SvtKIJTMgeMcD4UFVwaM0b3O OrCA== X-Gm-Message-State: AJIora9CuqCp1/16OF0Kpa2J8Tr/pNbLqXMkQvZEdXp8MgDhcPCM83Y8 +fh8q2q2qtqAwJ9eAuYDF9HL4YUIl03QXo7H5EoLiFkWzaCHf9/5OM9hzYp57akG/GiiSE01XwK 1qVlX0ycJc+0= X-Received: by 2002:a05:6214:e41:b0:473:915c:3efe with SMTP id o1-20020a0562140e4100b00473915c3efemr27335411qvc.10.1658284355258; Tue, 19 Jul 2022 19:32:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sqsBhXFhvJemKV/jwgAt84OQwS2X59Z2eXZUwYSIfKumUaM4t252ZCPnvZ1VuTZhBaV0SNdQ== X-Received: by 2002:a05:6214:e41:b0:473:915c:3efe with SMTP id o1-20020a0562140e4100b00473915c3efemr27335384qvc.10.1658284354992; Tue, 19 Jul 2022 19:32:34 -0700 (PDT) Received: from xz-m1.local (bras-base-aurron9127w-grc-37-74-12-30-48.dsl.bell.ca. [74.12.30.48]) by smtp.gmail.com with ESMTPSA id s11-20020a05620a0bcb00b006b5c5987ff2sm14701779qki.96.2022.07.19.19.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 19:32:34 -0700 (PDT) Date: Tue, 19 Jul 2022 22:32:32 -0400 From: Peter Xu To: Nadav Amit Cc: Axel Rasmussen , Alexander Viro , Andrew Morton , Dave Hansen , "Dmitry V . Levin" , Gleb Fotengauer-Malinovskiy , Hugh Dickins , Jan Kara , Jonathan Corbet , Mel Gorman , Mike Kravetz , Mike Rapoport , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , zhangyi , "linux-doc@vger.kernel.org" , linux-fsdevel , LKML , Linux MM , "linux-kselftest@vger.kernel.org" Subject: Re: [PATCH v4 2/5] userfaultfd: add /dev/userfaultfd for fine grained access control Message-ID: References: <20220719195628.3415852-1-axelrasmussen@google.com> <20220719195628.3415852-3-axelrasmussen@google.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HkPLibzP; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf12.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658284357; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3uZbjgFMHeKFjmyd0QEm1xCO2NChsIABolYNiKdJ7Gg=; b=qnm+iq+vDs29fcosNxn9HP9P8XiAplT9slge3eRvS7pui05SW8JVogDUCk9Nhuf3JoBN6C Wa6SfEOAjbWZqA6Gis0zbqeS7eWE6PR+UCQH0OCWYRWmuqBR+WxwMqB2ySIiDjByyi1Su2 WY0jzixlZtp3ugv/ZqCxZtyE4/JEpnU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658284357; a=rsa-sha256; cv=none; b=1FKSf1YUr+FxzV6SO1r3j5LRaUXJnfk5FzY/L+MLOES/+YCmUnYhwPswWTMPC3yoYXM4s0 cVGcthzqkd0AJSCQwh8JHftSvIR2nRIML0mXuSm6z+hjYEhojVlRKGRagoBpL0LS6aLcd4 YtE2uGLMc87fDQEzDz83c/BleQkr/NU= X-Rspamd-Queue-Id: C9E9D40016 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HkPLibzP; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf12.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 5su8oprpay86qkbke1pkwnywzji458y3 X-HE-Tag: 1658284357-1028 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 Tue, Jul 19, 2022 at 11:55:21PM +0000, Nadav Amit wrote: > Anyhow, I do want to clarify a bit about the “cross-process support” > userfaultfd situation. Basically, you can already get cross-process support > today, by using calling userfaultfd() on the controlled process and calling > pidfd_open() from another process. It does work and I do not remember any > issues that it introduced (in contrast, for instance, to io-uring, that > would break if you use userfaultfd+iouring+fork today). Do you mean to base it on pidof_getfd()? Just want to mention that this will still need collaboration of the target process as userfaultfd needs to be created explicitly there. From that POV it's still more similar to general SCM_RIGHTS trick to pass over the fd but just to pass it in a different way. IMHO the core change about having /proc/pid/userfaultfd is skipping that only last step to create the handle. -- Peter Xu