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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90242C433F5 for ; Wed, 13 Oct 2021 16:02:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3D9B361163 for ; Wed, 13 Oct 2021 16:02:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3D9B361163 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C8DB4900002; Wed, 13 Oct 2021 12:02:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C3D536B0073; Wed, 13 Oct 2021 12:02:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ADE65900002; Wed, 13 Oct 2021 12:02:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0237.hostedemail.com [216.40.44.237]) by kanga.kvack.org (Postfix) with ESMTP id 9F3976B006C for ; Wed, 13 Oct 2021 12:02:52 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 636518249980 for ; Wed, 13 Oct 2021 16:02:52 +0000 (UTC) X-FDA: 78691882584.25.4A99CE3 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf23.hostedemail.com (Postfix) with ESMTP id EAACA90000A0 for ; Wed, 13 Oct 2021 16:02:50 +0000 (UTC) Received: by mail-pf1-f173.google.com with SMTP id x130so2876544pfd.6 for ; Wed, 13 Oct 2021 09:02:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=55jBdElmI7vGZUDfiyYYs7/r8iE1Q78jQcOtXK2VrgE=; b=CLhkh67xp+nTgG3pyUWx/y3RsOIjiSOR4R19Y4NrjeOKcOHn1PlyHfsBSAmlABQrze U3zuAUyUCgd6BmYLB5CfNmibTRBt/AVzgbg/T1L2dMUv1dZratLvw/mHjT+sZhi4kUmu Nd0hb/SbN0Y3Ud14Nc6XtFL9FLmrGswLhGxWRGy982a45bCzfW6b7j6XyDBuD8lh7CHK lBLpdzwpouH1h+5FIj3zkHOYNxJuinFd2WlWRDbaAdz4yOURRABQz0Az5UE+ePVQ9Kbl YnsmEbPQIE9JHRQmb3B1j8hogmZYSc+j3W/kMC/kDCMguuYP/4GWTI3rqKwDG7yQPpRX ZLlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=55jBdElmI7vGZUDfiyYYs7/r8iE1Q78jQcOtXK2VrgE=; b=XDLGN52hdZS8Mf+/sW/OZtw8hA4j7pnGOWf6g7nwMPd1Vl+wbq05kLfvPvBlKWwPt+ AHkj8UaWy9dw7/jHZgFXYJ7//6ExC/YECdThZon7xLeG+cDP1dAV2Z3NoEvONdA0a70c IerAC8BXrIua7k7hN315z1Bq525gQofYSkW8dieHrV6NIWkL5lTU5wPO4tPiBZji7I1F WNKzcPJZlfrlKIXFHI0gdvIets1J5TgZwQaIEDIR7lkpuxda4rSFuyp38TvTUKHHbJnw vQWagF723XYTTfFaagD388ntwk9iX4Gi3PAS2nmVZy+iSecD6zsJMEQb/GFTRc0TkXDp bz+g== X-Gm-Message-State: AOAM532PdKetUVrbzBN4u+kcJouQd2znv3jgU0+8ilT883bid8E3Oc7G yKuHTwpJgw2Pqh+x8W8yPdY= X-Google-Smtp-Source: ABdhPJzt+IgPPj62sGtY+lv9g+211XJ1u0iikBxm0XqeSJ2iahmRZjBLd+muXKERM6AVZEnOYwa3Qw== X-Received: by 2002:a63:ed4a:: with SMTP id m10mr29005775pgk.448.1634140970820; Wed, 13 Oct 2021 09:02:50 -0700 (PDT) Received: from smtpclient.apple (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id p16sm12622116pfh.97.2021.10.13.09.02.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Oct 2021 09:02:50 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: [RFC PATCH] userfaultfd: support control over mm of remote PIDs From: Nadav Amit In-Reply-To: Date: Wed, 13 Oct 2021 09:02:48 -0700 Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrea Arcangeli , Mike Rapoport Content-Transfer-Encoding: quoted-printable Message-Id: <03C026D4-EBE8-4649-9C42-63F82941B781@gmail.com> References: <20210926170637.245699-1-namit@vmware.com> To: Peter Xu X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: EAACA90000A0 X-Stat-Signature: bpdrnixc87ywnr53pbfzwn8pqo6muj9q Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CLhkh67x; spf=pass (imf23.hostedemail.com: domain of nadav.amit@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=nadav.amit@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1634140970-258912 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 Oct 12, 2021, at 7:18 PM, Peter Xu wrote: >=20 > On Sun, Sep 26, 2021 at 10:06:37AM -0700, Nadav Amit wrote: >> From: Nadav Amit >>=20 >> Non-cooperative mode is useful but only for forked processes. >> Userfaultfd can be useful to monitor, debug and manage memory of = remote >> processes. >>=20 >> To support this mode, add a new flag, UFFD_REMOTE_PID, and an = optional >> second argument to the userfaultfd syscall. When the flag is set, the >> second argument is assumed to be the PID of the process that is to be >> monitored. Otherwise the flag is ignored. >>=20 >> The syscall enforces that the caller has CAP_SYS_PTRACE to prevent >> misuse of this feature. >>=20 >> Cc: Andrea Arcangeli >> Cc: Andrew Morton >> Cc: Mike Rapoport >> Cc: Peter Xu >> Signed-off-by: Nadav Amit >=20 > I think this patch from one pov looks just likes the other patch of = the > process_madvise on DONTNEED - the new interface definitely opens new = way to do > things, however IMHO it would be great to discuss some detailed = scenario that > we can do with it better than the existing facilities. >=20 > The thing is uffd already provides some mechanism for doing things = like > customized swapping, so that's not something new IMHO that this patch = brings > (neither is what the DONTNEED patch brings), just like when I raised = in the > other thread about umap. >=20 > So IMHO it'll be great if there can be some elaboration on how the = "remote" > capability could help us do things better (e.g., use cases that we may = not > solve with linking against another uffd-supported library, or we can't = do with > register uffd then fork()). >=20 > (I skipped the security side of things, as I replied in the other = thread that I > think I buy in your point on depending on PTRACE capability and also = the > examples you gave on ptrace() and process_vm_writev() are persuasive = to me, > but no expert on that..) Fair enough. Let me get back to you once I can provide more data. For now, I just ask you to have this patch in the back of your mind if = any other change to userfaultfd syscall is proposed to prevent a potential conflict.=