Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp517738pxb; Fri, 8 Jan 2021 10:40:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJychkScZ7XKgxv2YpGL+Ny/vsOZ0oRn8Gd5PhcIyFFlA3qpfBfqdYcERhNR6N3RNRctGn2M X-Received: by 2002:a17:906:495b:: with SMTP id f27mr3549758ejt.338.1610131226736; Fri, 08 Jan 2021 10:40:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610131226; cv=none; d=google.com; s=arc-20160816; b=BljqtTtxBGEUtG8bL4/VpOSW67GqheZceGI9nP6J0OLmGUeAXYgpUBfX25G/lZDDDS +3V0d1JnwHO5dAP+bB4AfZQb1HI2eN+pELZLyBE6v9NCz0a8Hm3nrC03zVNGV5zE2rJa ZuEbPZkJHHBTrgtY5xXtliBT3h03i+5Fip30KmgKf8Gn+GHMoMRNfWAjw7s8F7036LBd 0+b9C1YlGn0SGjtxroS62b51m7TY0a60gXKj5BsE5kT7exDbxGL+4os62K5cT/WAtuiN jxzXmp/8AYYtDa1p8SN8/E97fiAbPkOWvc4zB9AvobCfrF6VoPeczuLn0Ts8gvccFlX8 lyuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ICXv7r9tS6OnWdFplsRRr1nw62sR7HCP2UfTw3I7zBA=; b=jE+wNeF54yGP6frYUmmAwf5WO+KxAQAtTSj9RK+64J5Bd+6HSHOOY7a4NGb3TilRyb LiSd91nwN62cQ0EaDN2oaq0RJudfkV5+6+oq9as6RFXiKG6a3q3Y2BQ4wY3rpA19ljkc B7pXBZzuzVRlrq/UsrCRoJD6gRw987ose9TGEDr72rGmkye+54oYdSc1ARP9H7vfm6GC 0RBqi//+WpdKXM2UCpGFiZj+QmZQKh4hWGtRsXl1x7EvVfo2BtKWLtostGK5F9VpIrmL tpU/nzK07S+AdQg1UlxhX9NBmeiWWgw2tmcVPTmh8OWlmYve51HcDAA78MS90/uIwX6F SLGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="dj/GGvKX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g13si3886475edk.250.2021.01.08.10.40.01; Fri, 08 Jan 2021 10:40:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="dj/GGvKX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728673AbhAHSjJ (ORCPT + 99 others); Fri, 8 Jan 2021 13:39:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727919AbhAHSjJ (ORCPT ); Fri, 8 Jan 2021 13:39:09 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA91CC061380 for ; Fri, 8 Jan 2021 10:38:28 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id s26so25176738lfc.8 for ; Fri, 08 Jan 2021 10:38: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=SLhDmizzz2J/WErUZFrfaAaeFsoyhvX7VG9CvQwnGfoRmAHPSI5us/CSpc7WdTdCTB jDg8cPExBj06Wiek9Zci/jhCPxy4OPhzMd6AIp/YHI8lXUk81OfuVOatv44NDmR0JtrM BNMt7Q8d5iQSwNOW36mbQjjQ5/VBetP1732B0nIQuwQIRNer0r9NVaDfOzJGHkoL8+P2 ToB/1MUAn6cyBr166IMyawIgBRWN206Ct23rFA8MpUWZBGXB8nPeLrBZS8CaNx6bgYcT Spwq7/fQNu+Eqrv5jr0fpFvGdSey7khKGrBOnfYvfSePaviWmU6QLaPfmCA+hOqWsRnb Nwaw== X-Gm-Message-State: AOAM532MF0bSeguqz+7yX9g4pnQEyfiVIqCB3W4DGGau9fv/eBcUUw0S GGJhiVGCCB3mfVq5SC+VotVW7mYH7mVrVA== X-Received: by 2002:a05:651c:211d:: with SMTP id a29mr2117228ljq.487.1610131107236; Fri, 08 Jan 2021 10:38:27 -0800 (PST) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com. [209.85.167.51]) by smtp.gmail.com with ESMTPSA id k8sm2106959lfk.187.2021.01.08.10.38.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Jan 2021 10:38:26 -0800 (PST) Received: by mail-lf1-f51.google.com with SMTP id m25so25100345lfc.11 for ; Fri, 08 Jan 2021 10:38: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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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