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 DEE4EC77B75 for ; Mon, 15 May 2023 13:08:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9678A90000A; Mon, 15 May 2023 09:08:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 91772900002; Mon, 15 May 2023 09:08:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AF7590000A; Mon, 15 May 2023 09:08:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 42995900002 for ; Mon, 15 May 2023 09:08:03 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0EC6C16119A for ; Mon, 15 May 2023 13:08:03 +0000 (UTC) X-FDA: 80792517246.04.F85E6F8 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by imf16.hostedemail.com (Postfix) with ESMTP id 8201D180016 for ; Mon, 15 May 2023 13:08:00 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Fb4+g02Y; spf=pass (imf16.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684156080; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=I2gFAV1Bt11rr0HeGWTCJG9IDGxOMnHQHXHHbOCPYDo=; b=X8KzocoNNFoFZoAAU+6WvuwqSB2CqDTV9yvjRNDVSVw3cryWHLNog9X6PakeBGNb+m+nSu YIxXPnsZtDaiSZwF9JF7XPKIVyX5NRfmvqjR52gnO68ferMbeJpD5ujzgtwHYa+BA84c2z 7fPmQYiBjtKADnkfJzKbUh6N8lLmHJE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684156080; a=rsa-sha256; cv=none; b=H4K/hxfYE60h45u0Y/HMfesAWvy4pS0RcngPPpd6CV2ubO7BxFqDz8rLqWM5wkhJIMt+cJ n01awTAzQRVqJhEXIr6OpnqQeLnMdWQjLz9PV4cIZa9pO+X5zI3MctEVpDpec+qVqn8kwA eo1GzS2stYqOGXaCTuCT7ra4ZiCd0I8= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Fb4+g02Y; spf=pass (imf16.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-30786c87cdaso9955118f8f.2 for ; Mon, 15 May 2023 06:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684156079; x=1686748079; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=I2gFAV1Bt11rr0HeGWTCJG9IDGxOMnHQHXHHbOCPYDo=; b=Fb4+g02YBBu38SltuhS+IwpYVzoxe80rT1yHPlTht9o95uLaKhQM6L02U8FIQSzG0u F74fhxfxj9aXytF3FtFdEEivo2st0IMgxLRibmpbYacA0zZWuO4fj3Y/9A2Tn78oIvY0 C18Ml0c4V5ahXxqIhkCUiPcNutxniHakG8FQrBJdJLkk/GUk7OPBmr0muET13IO4vKdc v2E4936Adb3bkr5bfETRmIsjKU+IeoFpOqtNr3sLG0IJtBNMYIXtbopzPX+x1mhNuV0l 7s9GaeOiQuSZ54g+KUPd/b3efDKiKbFOuOxbTCZbYbh4sbs0SxUN3ALJYt6u0HfENSCo XHXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684156079; x=1686748079; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=I2gFAV1Bt11rr0HeGWTCJG9IDGxOMnHQHXHHbOCPYDo=; b=Kt+NcLsPLD7JSL82Dm1husGEmUrcAOI/pnbv6s7qRCUEsMBFP3xBr1W1UL+1Ctfxg7 t5Iix1Uywp0aoH7ki3mpyLjJ6iAkMh5lnmaG/qfuTDyBRCIeNw1UiU30DC2SY03nXXGC ltnpWccw4kf5yZh+Ot1gLf7lHoKDLwiHo8vlnIczufaiMYJCGV+vCGJvGZRcjqHP7rFm A0cs1w3KKVGSpiI3BWxw2YDhyDFlm5/kvrWs0DUfChf7FnPSasOISHtn9RgcStgpY0uy o3yGkZeCVGslksi/IylM8wCqBiYVQ90diAXU/9wTMPkPW6yod1KMa/smm31iK14bRU7l yWAQ== X-Gm-Message-State: AC+VfDy9OTqKBpnbu52j+0luV2+UEL5NWujQfCqa4ChithZkkqLKQTzM 5EA0qjzVIrmOn8ocABqXMzw= X-Google-Smtp-Source: ACHHUZ65cUXTV46JE+DSVeEZihKZOp7o4pCuhzCZeDl0jKBfbZDdPGdAnhGyJWS4kVWmFwZtM8978g== X-Received: by 2002:adf:cc90:0:b0:307:8718:7891 with SMTP id p16-20020adfcc90000000b0030787187891mr25640550wrj.54.1684156078532; Mon, 15 May 2023 06:07:58 -0700 (PDT) Received: from localhost ([2a00:23c5:dc8c:8701:1663:9a35:5a7b:1d76]) by smtp.gmail.com with ESMTPSA id e12-20020adfe7cc000000b002c54c9bd71fsm32604261wrn.93.2023.05.15.06.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 06:07:57 -0700 (PDT) Date: Mon, 15 May 2023 14:07:57 +0100 From: Lorenzo Stoakes To: Jason Gunthorpe Cc: "Kirill A . Shutemov" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Jens Axboe , Matthew Wilcox , Dennis Dalessandro , Leon Romanovsky , Christian Benvenuti , Nelson Escobar , Bernard Metzler , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Bjorn Topel , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christian Brauner , Richard Cochran , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , linux-fsdevel@vger.kernel.org, linux-perf-users@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Oleg Nesterov , John Hubbard , Jan Kara , Pavel Begunkov , Mika Penttila , David Hildenbrand , Dave Chinner , Theodore Ts'o , Peter Xu , Matthew Rosato , "Paul E . McKenney" , Christian Borntraeger Subject: Re: [PATCH v9 0/3] mm/gup: disallow GUP writing to file-backed mappings by default Message-ID: References: <20230515110315.uqifqgqkzcrrrubv@box.shutemov.name> <7f6dbe36-88f2-468e-83c1-c97e666d8317@lucifer.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 8201D180016 X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: yhzjiihehipsqgeswinhkwnypmk9jt6n X-HE-Tag: 1684156080-227735 X-HE-Meta: U2FsdGVkX1/89fqtt9gtNl8zBV5+L4LxRLVzJUSpopGpV8gKJn9/H3w5o8GaMBwEkCGaz9FmIHS/X9A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0xg8b4OcboN6dVzQ4ZPf7lU4zqfkWWKhKh7aCSekyhCpwVTUMP+A2SKnDIJ0nuf94n1kYkMzlVGqRBzEQq2zZI5ayedz7yJtNm8kZg/173o/DCNMPJQFrqz2bKdv6smNQvXnADTW9YU/If7X7zB+8YEaziltSFhXtJLK6dGGfJgKDHFpDZf+HKn9M+BYBo6KzenA5l2wXFH8VQWpvAGMKcNGTi0ex7mfLNCDtjRTkvUMaZpbTunFSyjILH4rPB2m5VrnvWa3OFV5C0scTppfRhWRt2UjGaADTIcEWE1HjDEwl21Y34zuUfWnzzGg== 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 Mon, May 15, 2023 at 09:12:49AM -0300, Jason Gunthorpe wrote: > On Mon, May 15, 2023 at 12:16:21PM +0100, Lorenzo Stoakes wrote: > > > One thing that came to mind is KVM with "qemu -object memory-backend-file,share=on..." > > > It is mostly used for pmem emulation. > > > > > > Do we have plan B? > > > > Yes, we can make it opt-in or opt-out via a FOLL_FLAG. This would be easy > > to implement in the event of any issues arising. > > I'm becoming less keen on the idea of a per-subsystem opt out. I think > we should make a kernel wide opt out. I like the idea of using lower > lockdown levels. Lots of things become unavaiable in the uAPI when the > lockdown level increases already. This would be the 'safest' in the sense that a user can't be surprised by higher lockdown = access modes disallowed, however we'd _definitely_ need to have an opt-in in that instance so io_uring can make use of this regardless. That's easy to add however. If we do go down that road, we can be even stricter/vary what we do at different levels right? > > > Jason will have some thoughts on this I'm sure. I guess the key question > > here is - is it actually feasible for this to work at all? Once we > > establish that, the rest are details :) > > Surely it is, but like Ted said, the FS folks are not interested and > they are at least half the solution.. :'( > > The FS also has to actively not write out the page while it cannot be > write protected unless it copies the data to a stable page. The block > stack needs the source data to be stable to do checksum/parity/etc > stuff. It is a complicated subject. Yes my sense was that being able to write arbitrarily to these pages _at all_ was a big issue, not only the dirty tracking aspect. I guess at some level letting filesystems have such total flexibility as to how they implement things leaves us in a difficult position. > > Jason