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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 9CDBCC433DB for ; Fri, 8 Jan 2021 18:44:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0645723A5A for ; Fri, 8 Jan 2021 18:44:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0645723A5A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5A4FE8D0197; Fri, 8 Jan 2021 13:44:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 57C5D8D0156; Fri, 8 Jan 2021 13:44:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 491558D0197; Fri, 8 Jan 2021 13:44:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 3288F8D0156 for ; Fri, 8 Jan 2021 13:44:29 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E9F92180AD802 for ; Fri, 8 Jan 2021 18:44:28 +0000 (UTC) X-FDA: 77683483416.18.band20_2c11ba6274f5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id CAF41100EC692 for ; Fri, 8 Jan 2021 18:44:28 +0000 (UTC) X-HE-Tag: band20_2c11ba6274f5 X-Filterd-Recvd-Size: 5576 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 Jan 2021 18:44:28 +0000 (UTC) Received: by mail-ej1-f54.google.com with SMTP id g20so15911025ejb.1 for ; Fri, 08 Jan 2021 10:44:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ICXv7r9tS6OnWdFplsRRr1nw62sR7HCP2UfTw3I7zBA=; b=dj/GGvKX+wRhXGlTXy+NoQVbe9htPaa32IMewc/zw2qddtEmoc+ptGXxaxA4nADn10 4958RF03MOEVqneSyMQcauJTehztktCIWwuw2XG26sQYjPOVT0Y14YmuED9xIx3vvIty FFlQQqbhp2rFxeTzU14Rb155846i72ENdlln4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ICXv7r9tS6OnWdFplsRRr1nw62sR7HCP2UfTw3I7zBA=; b=fouqzI/XZ4JOUlpgJzfBawi3n4L35GUiEsGZmHAjlp5Z9hu9OpBhv1AiDHfONzD19s qF1fJMxV2m79bt6IQS7bWasAxmtzxQrSDmj3DcbKYOyOFpPIyBF2bTbh2TXAHCkPYJhf 5jjTfbDEmh8Kn81QwPxLS+F90dZITQ5mlPV2vZmHvANHFs7E4oYQmtsLxuuY6QNnGqee ImqvQl1/PVM7gLRAU8Kc84KUTvgMWPzTyXShUz8DmV/fF78+g3Wb1wqM/UuInRR4ZGsS TERtnMcAz6JTpQDBalmoYcGQabcufjRSvduqPpFwZJvZEHLdn+eJkDFVSp1KTLKF3Zxu ruag== X-Gm-Message-State: AOAM5329aGRX+pCiMdcgHsYbPaf19G/2kQ8flfrvoHU80YdOhILlY0XC apY4+Cn5bBrfzbvH/PjPn2SF1alR60pKeQ== X-Google-Smtp-Source: ABdhPJxFZf+mV3/w9cfuytiCVc0zVTfcXOXmfq1tHUDD8XrqFnItEPtUbd/U9yFJx3watyX2tt82qA== X-Received: by 2002:a17:906:a008:: with SMTP id p8mr3573684ejy.117.1610131466595; Fri, 08 Jan 2021 10:44:26 -0800 (PST) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com. [209.85.221.41]) by smtp.gmail.com with ESMTPSA id p3sm4096987edh.50.2021.01.08.10.44.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Jan 2021 10:44:26 -0800 (PST) Received: by mail-wr1-f41.google.com with SMTP id c5so9928385wrp.6 for ; Fri, 08 Jan 2021 10:44:26 -0800 (PST) X-Received: by 2002:a05:6512:338f:: with SMTP id h15mr2009336lfg.40.1610131106007; Fri, 08 Jan 2021 10:38:26 -0800 (PST) MIME-Version: 1.0 References: <20210107200402.31095-1-aarcange@redhat.com> <20210107202525.GD504133@ziepe.ca> <20210108133649.GE504133@ziepe.ca> <20210108181945.GF504133@ziepe.ca> In-Reply-To: From: Linus Torvalds Date: Fri, 8 Jan 2021 10:38:09 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/2] page_count can't be used to decide when wp_page_copy To: Andy Lutomirski Cc: Jason Gunthorpe , Andrea Arcangeli , Linux-MM , LKML , Yu Zhao , Peter Xu , Pavel Emelyanov , Mike Kravetz , Mike Rapoport , Minchan Kim , Will Deacon , Peter Zijlstra , Hugh Dickins , "Kirill A. Shutemov" , Matthew Wilcox , Oleg Nesterov , Jann Horn , Kees Cook , John Hubbard , Leon Romanovsky , Jan Kara , Kirill Tkhai Content-Type: text/plain; charset="UTF-8" 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 Fri, Jan 8, 2021 at 10:31 AM Andy Lutomirski wrote: > > Can we just remove vmsplice() support? We could make it do a normal > copy, thereby getting rid of a fair amount of nastiness and potential > attacks. Even ignoring issues relating to the length of time that the > vmsplice reference is alive, we also have whatever problems could be > caused by a malicious or misguided user vmsplice()ing some memory and > then modifying it. Well, that "misguided user" is kind of the point, originally. That's what zero-copying is all about. But we could certainly remove it in favor of copying, because zero-copy has seldom really been a huge advantage in practice outside of benchmarks. That said, I continue to not buy into Andrea's argument that page_count() is wrong. Instead, the argument is: (1) COW can never happen "too much": the definition of a private mapping is that you have your own copy of the data. (2) the one counter case I feel is valid is page pinning when used for a special "pseudo-shared memory" thing and that's basically what FOLL_GUP does. So _regardless_ of any vmsplice issues, I actually think that those two basic rules should be our guiding principle. And the corollary to (2) is that COW must absolutely NEVER re-use too little. And that _was_ the bug with vmsplice, in that it allowed re-use that it shouldn't have. Linus