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 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDAB9C433E0 for ; Mon, 11 Jan 2021 12:43:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E0A08224B8 for ; Mon, 11 Jan 2021 12:43:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0A08224B8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 185C28D002B; Mon, 11 Jan 2021 07:43:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 136768D0020; Mon, 11 Jan 2021 07:43:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0261F8D002B; Mon, 11 Jan 2021 07:42:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0175.hostedemail.com [216.40.44.175]) by kanga.kvack.org (Postfix) with ESMTP id DABD58D0020 for ; Mon, 11 Jan 2021 07:42:59 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A1FCD180AD815 for ; Mon, 11 Jan 2021 12:42:59 +0000 (UTC) X-FDA: 77693458878.20.guide46_1a08eb92750c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 80C0E180C07A3 for ; Mon, 11 Jan 2021 12:42:59 +0000 (UTC) X-HE-Tag: guide46_1a08eb92750c X-Filterd-Recvd-Size: 3877 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Mon, 11 Jan 2021 12:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BBQOmCJkOwz3g6A4Xgk+pDH19o/4X63N5JIMJHIzi24=; b=sUFkVOASsTCJQEwFd5Kile9b6C Yij+FARxJ2qwdfeKCS6mrASDnvwLX5Wt31Ht1smD44R510/PDFzuQ2PC3gkEqWSWalGZsX2qAL8AI z/+Ver7KjNHGJPvaJtcdwMI/GXcBZ3hMWskaGnkPjd6T1N89xoNEpgHMr0l+rxQooGFPxcCXUy4rx RlJEDLNF+Sr/M2cVv6wNfayUt+ZdROXjC2T3B757FnYXagfqMWvdHor3Z0Tj+XKvJbfGLReaTASl4 cCUz/ncm4pkuTtTW5/vEpJxIx9wXcMkM5ZmZJxAaXtX/o094ov3n6oVoxasz2HcGfzQAQF6BFwQ+R 7Wdhat9w==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1kywWa-003DyG-Bb; Mon, 11 Jan 2021 12:42:24 +0000 Date: Mon, 11 Jan 2021 12:42:20 +0000 From: Matthew Wilcox To: John Hubbard Cc: Linus Torvalds , Andrea Arcangeli , Andrew Morton , Linux-MM , Linux Kernel Mailing List , Yu Zhao , Andy Lutomirski , Peter Xu , Pavel Emelyanov , Mike Kravetz , Mike Rapoport , Minchan Kim , Will Deacon , Peter Zijlstra , Hugh Dickins , "Kirill A. Shutemov" , Oleg Nesterov , Jann Horn , Kees Cook , Leon Romanovsky , Jason Gunthorpe , Jan Kara , Kirill Tkhai , Nadav Amit , Jens Axboe Subject: Re: [PATCH 0/1] mm: restore full accuracy in COW page reuse Message-ID: <20210111124220.GE35215@casper.infradead.org> References: <20210110004435.26382-1-aarcange@redhat.com> <45806a5a-65c2-67ce-fc92-dc8c2144d766@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45806a5a-65c2-67ce-fc92-dc8c2144d766@nvidia.com> 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 Sun, Jan 10, 2021 at 11:26:57PM -0800, John Hubbard wrote: > IMHO, a lot of the bits in page _refcount are still being wasted (even > after GUP_PIN_COUNTING_BIAS overloading), because it's unlikely that > there are many callers of gup/pup per page. If anyone points out that > that is wrong, then the rest of this falls apart, but...if we were to > make a rule that "only a very few FOLL_GET or FOLL_PIN pins are ever > simultaneously allowed on a given page", then several things become > possible: There's "the normal case" and then there's "the attacker case" where someone's deliberately trying to wrap page->_refcount. There are lots of interesting games people can play with an anon page, like stuffing it into (lots of) pipes, forking lots of children, starting lots of O_DIRECT I/O against it to a FUSE filesystem that's deliberately engineered to be slow. We have some protection against that, but I'm not 100% sure it's working, and making it easier to increase refcount in large chunks makes it more likely that we would defeat that protection.