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=-6.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 03A2DC433E0 for ; Sat, 9 Jan 2021 19:04:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C17BA2399C for ; Sat, 9 Jan 2021 19:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726301AbhAITET (ORCPT ); Sat, 9 Jan 2021 14:04:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:48126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726001AbhAITES (ORCPT ); Sat, 9 Jan 2021 14:04:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 642B02399C for ; Sat, 9 Jan 2021 19:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610219017; bh=ffd/mc0gPcQXGXWeFlO/46TTv2fQp5rKnaxPu7uNZzk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=DPsiQFZx04z7n/fUiAdVs5KhMDbhVOH4AU4tC/3vuXSO+hjfEnW7/lffN2CQA/aj6 U2wrtDFiQYdBOR3VyxV2tEeweZOBAfLzb5uAAL0755E5snjwlUSfqz4WkH009jT03R oRkW3T1noC5SkFpd7X5wJXYUxErnc7H+PRF3IZoEN6rinqdqRXNMv6bhIQ3wPgdxo2 plXR1Bh2/9Z7hFu6dgBKOstb3DhlqRwvHPbNehNnSSnyitzausOUSvaYX+5IshHKvn 5+8PdmLz7IfLvNOpf+LBucWKSHLavrnLx3QPKmPMlST4n7klQekRENSn0fP6qeh2np m1U/Jax+O5f2w== Received: by mail-ed1-f50.google.com with SMTP id c7so14617552edv.6 for ; Sat, 09 Jan 2021 11:03:37 -0800 (PST) X-Gm-Message-State: AOAM530RS1gAYNJWmC7mjqdMcjjWbb/3FdePaOIUwD/sdbacL5JtElLV 3drxtIxBFIA6i902qh7M4YZRJfnRq/Vbo5V9i/82BA== X-Google-Smtp-Source: ABdhPJwsq6GDZo5Zn1wq6qDmwed3/Pt+DcGHGJDY8hq+M3V+c1E/x6HkYd9aroaG51NQeFJ9ynfeSSo4NPRGqloUweA= X-Received: by 2002:a05:6402:229b:: with SMTP id cw27mr9132586edb.23.1610219015935; Sat, 09 Jan 2021 11:03:35 -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: Andy Lutomirski Date: Sat, 9 Jan 2021 11:03:23 -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: Andrea Arcangeli Cc: Andy Lutomirski , Jason Gunthorpe , Linux-MM , LKML , Yu Zhao , Peter Xu , Pavel Emelyanov , Mike Kravetz , Mike Rapoport , Minchan Kim , Will Deacon , Peter Zijlstra , Linus Torvalds , 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" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jan 8, 2021, at 3:34 PM, Andrea Arcangeli wrote: > > =EF=BB=BFOn Fri, Jan 08, 2021 at 10:31:24AM -0800, 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. > > Sorry to ask but I'm curious, what also goes wrong if the user > modifies memory under GUP pin from vmsplice? That's not obvious to > see. It breaks the otherwise true rule that the data in pipe buffers is immutable. Even just quoting the manpage: SPLICE_F_GIFT The user pages are a gift to the kernel. The application = may not modify this memory ever, otherwise the page cache and = on- disk data may differ. That's no good. I can also imagine use cases in which modified vmsplice() pages that end up in various parts of the network stack could be problematic. For example, if you can arrange for TCP or, worse, TLS to transmit data and then retransmit modified data, you might get odd results. In the latter case, some security properties of TLS might be broken. --Andy