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 17DE8C433EF for ; Thu, 14 Apr 2022 15:18:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9AA256B0071; Thu, 14 Apr 2022 11:18:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 95A8A6B0073; Thu, 14 Apr 2022 11:18:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 822B06B0074; Thu, 14 Apr 2022 11:18:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 7512A6B0071 for ; Thu, 14 Apr 2022 11:18:56 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 212B7A9448 for ; Thu, 14 Apr 2022 15:18:56 +0000 (UTC) X-FDA: 79355842272.27.8B2D374 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf03.hostedemail.com (Postfix) with ESMTP id 5B47020008 for ; Thu, 14 Apr 2022 15:18:55 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DD5611F748; Thu, 14 Apr 2022 15:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1649949533; h=from:from:reply-to: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=dkqemCFNSh+ZhebkGa09gVt5pLy70xI4ZccBTAffCZc=; b=DxIcnPfo0yw48SFmUwgjqknFyxwyu9/5UOHIYjR/u80AC8WwvWRGi19AYn+UYzYlcaoNFm CmQuiS7GljV5MGuYtMBDIvPfEBYHaazqJwzzLT7Wl43ZR5M2cXEu5m7luqUOjgoKzt5BeY +SPMS8Hzt2pXydg7/qwdO1v7ZXlbNBc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1649949533; h=from:from:reply-to: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=dkqemCFNSh+ZhebkGa09gVt5pLy70xI4ZccBTAffCZc=; b=6P/o1p51DiXtaKeb2Y1dqvIQdSv7sHqoEAyyddZ9KCmHveSbw389Nrh5g+x7lf3P2bOOQc xjqZhKB2ey364hCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8432C13A86; Thu, 14 Apr 2022 15:18:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VJi8H107WGJFbwAAMHmgww (envelope-from ); Thu, 14 Apr 2022 15:18:53 +0000 Message-ID: <08c355b4-fa21-8716-bf05-3331914f150e@suse.cz> Date: Thu, 14 Apr 2022 17:18:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v3 13/16] mm/gup: disallow follow_page(FOLL_PIN) Content-Language: en-US To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: Andrew Morton , Hugh Dickins , Linus Torvalds , David Rientjes , Shakeel Butt , John Hubbard , Jason Gunthorpe , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Matthew Wilcox , Jann Horn , Michal Hocko , Nadav Amit , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Jan Kara , Liang Zhang , Pedro Gomes , Oded Gabbay , linux-mm@kvack.org References: <20220329160440.193848-1-david@redhat.com> <20220329160440.193848-14-david@redhat.com> From: Vlastimil Babka In-Reply-To: <20220329160440.193848-14-david@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Stat-Signature: e8y3b99fxyifxzgwkgd9exdum9b8fynt Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=DxIcnPfo; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="6P/o1p51"; spf=pass (imf03.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5B47020008 X-HE-Tag: 1649949535-592103 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 3/29/22 18:04, David Hildenbrand wrote: > We want to change the way we handle R/O pins on anonymous pages that > might be shared: if we detect a possibly shared anonymous page -- > mapped R/O and not !PageAnonExclusive() -- we want to trigger unsharing > via a page fault, resulting in an exclusive anonymous page that can be > pinned reliably without getting replaced via COW on the next write > fault. > > However, the required page fault will be problematic for follow_page(): > in contrast to ordinary GUP, follow_page() doesn't trigger faults > internally. So we would have to end up failing a R/O pin via > follow_page(), although there is something mapped R/O into the page > table, which might be rather surprising. > > We don't seem to have follow_page(FOLL_PIN) users, and it's a purely > internal MM function. Let's just make our life easier and the semantics of > follow_page() clearer by just disallowing FOLL_PIN for follow_page() > completely. > > Signed-off-by: David Hildenbrand Acked-by: Vlastimil Babka