Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2342497rwr; Fri, 28 Apr 2023 09:06:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4wxd4TgmTpKiXltoqh6J9TnvQ+u6UcbCZyJh8yNddm1kJoJII5qo9haGG17276Qv7905th X-Received: by 2002:a05:6a00:ccc:b0:63f:125f:9595 with SMTP id b12-20020a056a000ccc00b0063f125f9595mr8891116pfv.9.1682697981871; Fri, 28 Apr 2023 09:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682697981; cv=none; d=google.com; s=arc-20160816; b=y9TcPTcIA7vlSdMmTIet7r2F4yTI8fNMCbxnR+qJPKVdErEiKvVNrasI71wAPu6e9U XXLtduyj9J5NXQoppoG+T7GvAqwVwJ2jcTdmiY8M57F5lLgOgC7YcjbrvW1eur1jdK7C G2yGfHc+epjvxArakYVNegUnT+bqEfO1pB0J7Y3ZqaltABwJEzwaX2utMQHpIKc0hnk/ DBPFSeKRsA6/QfMbgkoOvdWHeTPIdc4VxMKO8ib/PtAHBhKW49mkr5ubyCkXLXpZ2Cl3 cZEBNnlkWDtZ7Man+raSxk6hoPgIcDZr/6cD46CpOajuzCNdBiJH/8pb5w9w6SgycJoa GOdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :organization:from:references:cc:to:content-language:user-agent :mime-version:date:message-id:dkim-signature; bh=aTvTmC3w8cSoK1sZTIItrjPETSg3RyPhXAPGqmBpz9w=; b=MvD17+KfQfyVBZIzt/vLngzMjYm1tqSrzZC5iCUCIdkcsCzC9raI5pWXDCMwAMARkt dPsYJpax7EBJKUw2avHKhtLzzIr0u18X5JSGGrakgEmwHpoZwM0BzvEtY0Z9ZAmZtNz0 YYnegvT6iCETf0/V5U1lyqNXoniA3/LiOHWvkPRr9Xyd9XD3vV2IuFbCovLb1+XQvVqX 3910FBxvjrEwl2ZMtPAHBa1UpD7qKqvFtirgG6n29kM9Hi+ch7LiwFzZnZci1ZATpaqM aXQX6c4iPKqZuWXdX1pAEXbV3CajFymIcHtgofnr7ovQndrZ29bEBevqhdn7TkrEtGrY DOcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LmzXQ4ua; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y64-20020a638a43000000b005184398f8e0si22664962pgd.57.2023.04.28.09.06.05; Fri, 28 Apr 2023 09:06:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LmzXQ4ua; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229599AbjD1QBL (ORCPT + 99 others); Fri, 28 Apr 2023 12:01:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjD1QBK (ORCPT ); Fri, 28 Apr 2023 12:01:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 017F12D51 for ; Fri, 28 Apr 2023 09:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682697630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aTvTmC3w8cSoK1sZTIItrjPETSg3RyPhXAPGqmBpz9w=; b=LmzXQ4ualJrHt5+AZRrIEtd5fRIccmnjZCbeQNCsD9mb/G9dtJKFrvqqzXScr1tPu1CJqY UxGCb25tyBUktnBPdqS3d7GCjzzQPk9E+avUGbN0qQKOwL7xis3WT2XWfd/afKF8f63/ql x6b02MoWNQ+gEPq1Fy5SdzMYBDEpXr0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-465-N5x-K5JANMmlOGvVnY_QzA-1; Fri, 28 Apr 2023 12:00:28 -0400 X-MC-Unique: N5x-K5JANMmlOGvVnY_QzA-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3f3157128b4so43723955e9.0 for ; Fri, 28 Apr 2023 09:00:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682697627; x=1685289627; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aTvTmC3w8cSoK1sZTIItrjPETSg3RyPhXAPGqmBpz9w=; b=fGksDSGcT3vCh8qAoN/f+U9EKKKxc0yGRfjPiVQVZ6rBVpTDwPGeFcYyUXI/PQcPVW HLVnkZmhdlBWOzVPMVN0byb1I5fLibNOtuNiO3FwftdtmKPugRidRZWUgQ82GTqrCklb 0Xiv3NsBbtx+NHB7rTUIgJAGD9p9Y/S10tdQt9k19BtEQ4TlVt9sGbOnQOGxsz1TBXT+ +Vgq7PklblQnL9aedd5aTW/2gegN0F5b8wJVF1ct/BXngaJcJK2Wvvbu+xYVsp6MriuZ eljwbjInbm9hte/WTDp/tSvMOA4Wud4SEnaR+lOGv4jtxlAA6LliG86XiH1m6IgWBSl0 +FtQ== X-Gm-Message-State: AC+VfDyS5Lw11PpKS9HUjuexSlgwlvYa+SOVCCDuBVCphMJliojYUZbY x3M7IBx67GyqXcTOYJr1JBx+GP8Qc9WHP2a6E6kwKgB6V+7R3P5k2y8ihCwNFMAibjrfKooKd+3 0FD/3pPtFns0M13jP8c+1ivQm X-Received: by 2002:a05:600c:2046:b0:3ed:3268:5f35 with SMTP id p6-20020a05600c204600b003ed32685f35mr4408016wmg.18.1682697627085; Fri, 28 Apr 2023 09:00:27 -0700 (PDT) X-Received: by 2002:a05:600c:2046:b0:3ed:3268:5f35 with SMTP id p6-20020a05600c204600b003ed32685f35mr4407973wmg.18.1682697626733; Fri, 28 Apr 2023 09:00:26 -0700 (PDT) Received: from ?IPV6:2003:cb:c726:9300:1711:356:6550:7502? (p200300cbc72693001711035665507502.dip0.t-ipconnect.de. [2003:cb:c726:9300:1711:356:6550:7502]) by smtp.gmail.com with ESMTPSA id m9-20020a7bce09000000b003f049a42689sm24709589wmc.25.2023.04.28.09.00.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Apr 2023 09:00:25 -0700 (PDT) Message-ID: <620882a8-2b93-b709-1093-a323570f0fd2@redhat.com> Date: Fri, 28 Apr 2023 18:00:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US To: Lorenzo Stoakes Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Jason Gunthorpe , Jens Axboe , Matthew Wilcox , Dennis Dalessandro , Leon Romanovsky , Christian Benvenuti , Nelson Escobar , Bernard Metzler , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Bjorn Topel , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christian Brauner , Richard Cochran , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , linux-fsdevel@vger.kernel.org, linux-perf-users@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Oleg Nesterov , Jason Gunthorpe , John Hubbard , Jan Kara , "Kirill A . Shutemov" , Pavel Begunkov , Mika Penttila , David Howells , Christoph Hellwig References: <6b73e692c2929dc4613af711bdf92e2ec1956a66.1682638385.git.lstoakes@gmail.com> <49ebb100-afd2-4810-b901-1a0f51f45cfc@lucifer.local> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v5] mm/gup: disallow GUP writing to file-backed mappings by default In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [...] >>> >>> Personally I come at this from the 'I just want my vmas patch series' unblocked >>> perspective :) and feel there's a functional aspect here too. >> >> I know, it always gets messy when touching such sensible topics :P > > I feel that several people owe me drinks at LSF/MM :P > > To cut a long story short to your other points, I'm _really_ leaning > towards an opt-in variant of this change that we just hand to io_uring to > make everything simple with minimum risk (if Jens was also open to this > idea, it'd simply be deleting the open coded vma checks there and adding > FOLL_SAFE_FILE_WRITE). > > That way we can save the delightful back and forth for another time while > adding a useful feature and documenting the issue. Just for the records: I'm not opposed to disabling it system-wide, especially once this is an actual security issue and can bring down the machine easily (thanks to Jason for raising the security aspect). I just wanted to raise awareness that there might be users affected ... Sure, we could glue this to some system knob like Jason said, if we want to play safe. > > Altneratively I could try to adapt this to also do the GUP-fast check, > hoping that no FOLL_FAST_ONLY users would get nixed (I'd have to check who > uses that). The others should just get degraded to a standard GUP right? Yes. When you need the VMA to make a decision, fallback to standard GUP. The only problematic part is something like get_user_pages_fast_only(), that would observe a change. But KVM never passes FOLL_LONGTERM, so at least in that context the change should be fine I guess. The performance concern is the most problematic thing (how to identify shmem pages). > > I feel these various series have really helped beat out some details about > GUP, so as to your point on another thread (trying to reduce noise here > :P), I think discussion at LSF/MM is also a sensible idea, also you know, > if beers were bought too it could all work out nicely :] The issue is, that GUP is so complicated, that each and every MM developer familiar with GUP has something to add :P What stood out to me is that we disallow something for ordinary GUP but disallow it for GUP-fast, which looks very odd. So sorry again for jumping in late ... -- Thanks, David / dhildenb