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 F37E1C433EF for ; Thu, 23 Dec 2021 12:54:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 51B416B0072; Thu, 23 Dec 2021 07:54:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4CA2A6B0073; Thu, 23 Dec 2021 07:54:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 391D26B0074; Thu, 23 Dec 2021 07:54:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id 25FCC6B0072 for ; Thu, 23 Dec 2021 07:54:44 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BD45B2DEA3 for ; Thu, 23 Dec 2021 12:54:43 +0000 (UTC) X-FDA: 78949053246.29.5BBF872 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf04.hostedemail.com (Postfix) with ESMTP id 2C74240032 for ; Thu, 23 Dec 2021 12:54:43 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id BBDCD2114D; Thu, 23 Dec 2021 12:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1640264081; h=from:from:reply-to: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=eU2dAFM5zS+uVh2lRvtlyJRj9FfYeVDEc6APBTOIi+o=; b=bCQMozAdvCr14vBZ9lXLSa8xR5buQDoDBI9oaKvlTwfdb2iMVpph9yXb1olv9eksvk0AUU Cr99QXR6rG9rOYwRgBemO5gY4yDF9XJ79mZ8c3NEQ4/dF3wok3+KD5VU6pKHsdLVYl2Aog uxcb8ZEb4yEafRQoVNHRL2NJ1BuDLe8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1640264081; h=from:from:reply-to: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=eU2dAFM5zS+uVh2lRvtlyJRj9FfYeVDEc6APBTOIi+o=; b=Y9YrTEVlw4eC4XT5Oi7tGfIe3kKOT3/KSPvS7/ewQsFVhP9vKduTwgXODNn0ggjpqJakdD aMcp/6+MWIp0qmAA== Received: from quack2.suse.cz (unknown [10.163.28.18]) by relay2.suse.de (Postfix) with ESMTP id 9D1CAA3B84; Thu, 23 Dec 2021 12:54:40 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 0D2CE1E1328; Thu, 23 Dec 2021 13:54:38 +0100 (CET) Date: Thu, 23 Dec 2021 13:54:38 +0100 From: Jan Kara To: Linus Torvalds Cc: Jan Kara , David Hildenbrand , Jason Gunthorpe , Nadav Amit , Linux Kernel Mailing List , Andrew Morton , Hugh Dickins , David Rientjes , Shakeel Butt , John Hubbard , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Matthew Wilcox , Vlastimil Babka , Jann Horn , Michal Hocko , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Linux-MM , "open list:KERNEL SELFTEST FRAMEWORK" , "open list:DOCUMENTATION" Subject: Re: [PATCH v1 06/11] mm: support GUP-triggered unsharing via FAULT_FLAG_UNSHARE (!hugetlb) Message-ID: <20211223125438.GA19129@quack2.suse.cz> References: <900b7d4a-a5dc-5c7b-a374-c4a8cc149232@redhat.com> <20211221190706.GG1432915@nvidia.com> <3e0868e6-c714-1bf8-163f-389989bf5189@redhat.com> <20211222124141.GA685@quack2.suse.cz> <4a28e8a0-2efa-8b5e-10b5-38f1fc143a98@redhat.com> <20211222144255.GE685@quack2.suse.cz> <505d3d0f-23ee-0eec-0571-8058b8eedb97@redhat.com> <20211222160846.GH685@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=bCQMozAd; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=Y9YrTEVl; dmarc=none; spf=pass (imf04.hostedemail.com: domain of jack@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=jack@suse.cz X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2C74240032 X-Stat-Signature: 9ahx8pjqq3r9r84m4yebyzgnij7oey9t X-HE-Tag: 1640264083-356419 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 Wed 22-12-21 10:40:18, Linus Torvalds wrote: > On Wed, Dec 22, 2021 at 8:08 AM Jan Kara wrote: > > > > Well, but O_DIRECT reads must use FOLL_PIN in any case because they modify > > page data (and so we need to detect them both for COW and filesystem needs). > > Well, O_DIRECT reads do, but not necessarily writes. I agree. > And hey, even reads have been dodgy in the past when we didn't really > have the pinning logic - there's been a lot of users that just wanted > it to work for their particular use-case rather than in general and in > all situations.. Yes, but currently a malicious user can take the system down (BUG_ON) or cause DIF/DIX failures if he is nasty and tries hard enough with O_DIRECT reads (practically, the window is small so I haven't really seen a report that I could trace to O_DIRECT reads but in principle the problem is the same as with pinning & dirtying done e.g. by video capture drivers and there we've seen these problem happen). So forcing pinning for O_DIRECT reads is IMO mandatory. Honza -- Jan Kara SUSE Labs, CR