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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18E51C77B7E for ; Fri, 28 Apr 2023 16:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229470AbjD1QBN (ORCPT ); Fri, 28 Apr 2023 12:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229748AbjD1QBL (ORCPT ); Fri, 28 Apr 2023 12:01:11 -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 76DF312B 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=1682697629; 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=WT3KXZq581F24+lwkrGs0LBtxqwM4WXx8hjNEtDYAgmQ9RHFIUMVQdwtQURIwhvQz1wJs5 5B7OFaIXWPr5yGYUEIkV+youqmdB4V3R/PXQftdFaAeRk1OXz4qUI/ZhQ4C6txVP563gzN kASIjuVve79LDb7aRDyoG2gdmrj0k3c= 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-595-INbXvCB2PlWrdFN0LwhI6g-1; Fri, 28 Apr 2023 12:00:28 -0400 X-MC-Unique: INbXvCB2PlWrdFN0LwhI6g-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3f315735edeso43643155e9.1 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=dPymLhtYEWaOSoQ/FToaOktG3wIBJyPjV+4atdA3IFu4wqbUtRTcZba4LAlMaollsz ByfoTvUDZWqMUGIwes1dvtKnphNFBcrFhiSG3hf9+5W7LX7wa+BfO3QQKyMY0spzutn9 1sWx2s2x+xdfGUdcTrfTDKk3jWcyWl3f8DAxkjlH85r0kwqBFKOKC+kuc/CIHJTqmlwL j3X51lHiPHFHI9YtraC+DAawM2rvYr7r9Cibg2URZlLRpJbz962cUBdZJsDvB6cQma4R ZggUy/2trlZyZ008x2O0/kh0SQ6vh7ykckjUSCN7R5GM/rcazXK58NPi4nP7OHuRd5HA kaYA== X-Gm-Message-State: AC+VfDyG3z9LB7Hq4ZdQk7Bewqvtieucpcvs+kkoYcEbPKOny3kpgTI7 MgBzQNI8f0gI+FUFzcSA6NP7yBEMbByidSrgXT4tMBOGUhK4zESM/jMHGANmNNARjA/YkatRGdt m670W1o5gOWiN X-Received: by 2002:a05:600c:2046:b0:3ed:3268:5f35 with SMTP id p6-20020a05600c204600b003ed32685f35mr4407996wmg.18.1682697627083; Fri, 28 Apr 2023 09:00:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4CuV5Y9R4xOZ0iO1MIIj9ynREbGl3f73GmNX7T5mCyhDkj53kzHkbrow+2KlrZE2FhtmwsQw== 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 Precedence: bulk List-ID: X-Mailing-List: bpf@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