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.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 9B95CC433E0 for ; Fri, 8 Jan 2021 18:32:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47DEC23A7F for ; Fri, 8 Jan 2021 18:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728764AbhAHScU (ORCPT ); Fri, 8 Jan 2021 13:32:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:60036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727686AbhAHScT (ORCPT ); Fri, 8 Jan 2021 13:32:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7DE8523A84 for ; Fri, 8 Jan 2021 18:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610130698; bh=t+ayXSPKPyt+buzVfjSA06cJ/7ar6PMvS75DQsGw0Kg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=s0FkXM7O59c8DI4sRLKC0K73c/LR241Uv+fX/1eIDJw7A2dqncdnYqtBbCIC1pKw3 Sw+E4pHHuZ3zCstBYJzUv0uLLREzImZgdu46vUdvThKuVvNlVFYT/EowIbUy+smd1s 4aUaVJtwxphcsyrEWK2y79I2Q2kf7xzEFSt5DkhZP7NNt7SGCRiVbDhoeGUf5EI9o3 bnh7OqVxhqzDmtf3MuVMPLueZeSDKBHENAer8bFyQQ+XYCuwXT6S2gDtfnYDIsAjxB xpqrLmleOAFqNBFJd8TTJZpRCrr3t0gvFKrPRG918gCPH1spHfPJcKcuca8Ez2c/X6 G2ZX5BlWmTfIw== Received: by mail-ed1-f42.google.com with SMTP id c7so12142820edv.6 for ; Fri, 08 Jan 2021 10:31:38 -0800 (PST) X-Gm-Message-State: AOAM533n0SdSn78lgLjy/UEMm6POmGvvgXRxk8yd7EyN+CEBy7kgSXYQ 3SrbOla2c+ZdWLPdgweAeciHnIKy6lFQcuOxDDwKKA== X-Google-Smtp-Source: ABdhPJz9p5UU5fsa22GkI9tG2fSeZaCa/MH69wJBv3nUMa0ykh2+krPOCp9di9vj/dazafpbjhF5Ev3kroo7noGINQ8= X-Received: by 2002:aa7:c3cd:: with SMTP id l13mr6093359edr.97.1610130696959; Fri, 08 Jan 2021 10:31:36 -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: <20210108181945.GF504133@ziepe.ca> From: Andy Lutomirski Date: Fri, 8 Jan 2021 10:31:24 -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: Jason Gunthorpe Cc: Andrea Arcangeli , Linux-MM , LKML , Yu Zhao , Andy Lutomirski , 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 8, 2021 at 10:19 AM Jason Gunthorpe wrote: > > On Fri, Jan 08, 2021 at 12:00:36PM -0500, Andrea Arcangeli wrote: > > > The majority cannot be converted to notifiers because they are DMA > > > based. Every one of those is an ABI for something, and does not expect > > > extra privilege to function. It would be a major breaking change to > > > have pin_user_pages require some cap. > > > > ... what makes them safe is to be transient GUP pin and not long > > term. > > > > Please note the "long term" in the underlined line. > > Many of them are long term, though only 50 or so have been marked > specifically with FOLL_LONGTERM. I don't see how we can make such a > major ABI break. > > Looking at it, vmsplice() is simply wrong. A long term page pin must > use pin_user_pages(), and either FOLL_LONGTERM|FOLL_WRITE (write mode) > FOLL_LONGTERM|FOLL_FORCE|FOLL_WRITE (read mode) 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. --Andy