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 8F07FC77B61 for ; Fri, 28 Apr 2023 15:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345696AbjD1Pmn (ORCPT ); Fri, 28 Apr 2023 11:42:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345941AbjD1Pmh (ORCPT ); Fri, 28 Apr 2023 11:42:37 -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 08BEE1FEF for ; Fri, 28 Apr 2023 08:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682696515; 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=1H9pPvEM+Js8vhAavaMMOgoamiyAYwUIQKWzoU2WpOs=; b=QdvrQukFd2nbutkuEW5wi95d7t2JQJR9HuK2ST0RddbLkC/j9mi8V201ofTVKzWKypMWAK I0OYOJQZc9o0Nv0sVwsamB+9pI0J1VpUVKXR+rOCHKnz0Xo41csoIL333HlNPmdCrqhzyv 473rEWnG85W8hM260JdWSSZLIbtnKUw= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-247-nC1Ol8agPZyMEYMGPC_DrA-1; Fri, 28 Apr 2023 11:41:52 -0400 X-MC-Unique: nC1Ol8agPZyMEYMGPC_DrA-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3f080f534acso64723625e9.0 for ; Fri, 28 Apr 2023 08:41:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682696497; x=1685288497; 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=1H9pPvEM+Js8vhAavaMMOgoamiyAYwUIQKWzoU2WpOs=; b=fE77qgUJCK6u8/5ROnb/bxBl+uBl4Nr3UXSR8StfxIyNA6K6klXT0ax9CWM/syE/Rc NrYry2OPgqQrhsvCqGCBViALUAlLppU3xqhPO3JaSf4hsvhgxxGKLfRSkhvDAB9Nhjgd wjUPJGedHeLjZO9/u6OglPFWxr07vHk1z/bYYaovTqnRlJTICB9euy/3ZvU92GfbYBv0 vyEZ8W+2AwJgYPTPkQArrs3qABY4sZbdo5HA0Ku+SGJoG1DMM1ToRK6qvX6UTwhQSt+c Aj2KaOu2I9Etc3Yn8jPtegb0tMWrF3vXg/3NsWyGDAXY9shjvlYyu9wt54PJZgCwxW63 NTqg== X-Gm-Message-State: AC+VfDycoGiVx5auoQL7ispPF3FpGAPo2bW0EMPOSTI4+un2UD7YN1TV 2wwDSlXrORQDj/NnFuew0gYs09xEX5DLM3UiXsRF/5/ps8G+xG25m6nZol3Ds7OAIuzmFmNjWhH cnlOkX+lW9rE/at/iXJrGVNAjd47N2Q== X-Received: by 2002:a1c:ed0e:0:b0:3f2:5999:4f2b with SMTP id l14-20020a1ced0e000000b003f259994f2bmr4546893wmh.33.1682696497202; Fri, 28 Apr 2023 08:41:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7+nd0elYn4hmRLxdtWbwWjgrHCODyP2os9nbfNCf2KA/02ixLHWZjvg+Rr1dUNu/tXPRuH2w== X-Received: by 2002:a1c:ed0e:0:b0:3f2:5999:4f2b with SMTP id l14-20020a1ced0e000000b003f259994f2bmr4546874wmh.33.1682696496848; Fri, 28 Apr 2023 08:41:36 -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 r6-20020a05600c458600b003f195d540d9sm20569992wmo.14.2023.04.28.08.41.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Apr 2023 08:41:36 -0700 (PDT) Message-ID: <3f97c798-3598-1729-1981-ab8acb7b5663@redhat.com> Date: Fri, 28 Apr 2023 17:41:33 +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: Jason Gunthorpe Cc: Lorenzo Stoakes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , 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 , John Hubbard , Jan Kara , "Kirill A . Shutemov" , Pavel Begunkov , Mika Penttila , David Howells , Christoph Hellwig References: <6b73e692c2929dc4613af711bdf92e2ec1956a66.1682638385.git.lstoakes@gmail.com> <094d2074-5b69-5d61-07f7-9f962014fa68@redhat.com> 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: linux-perf-users@vger.kernel.org On 28.04.23 17:27, Jason Gunthorpe wrote: > On Fri, Apr 28, 2023 at 05:08:27PM +0200, David Hildenbrand wrote: > >>> I think this is broken today and we should block it. We know from >>> experiments with RDMA that doing exactly this triggers kernel oop's. >> >> I never saw similar reports in the wild (especially targeted at RHEL), so is >> this still a current issue that has not been mitigated? Or is it just so >> hard to actually trigger? > > People send RDMA related bug reports to us, and we tell them not to do > this stuff :) > >>> I'm skeptical that anyone can actually do this combination of things >>> successfully without getting kernel crashes or file data corruption - >>> ie there is no real user to break. >> >> I am pretty sure that there are such VM users, because on the libvirt level >> it's completely unclear which features trigger what behavior :/ > > IDK, why on earth would anyone want to do this? Using VFIO forces all > the memory to become resident so what was the point of making it file > backed in the first place? As I said, copy-and paste, incremental changes to domain XMLs. I've seen some crazy domain XMLs in bug reports. > > I'm skeptical there are real users even if it now requires special > steps to be crashy/corrupty. In any case, I think we should document the possible implications of this patch. I gave one use case that could be broken. > >>>> Sure, we could warn, or convert individual users using a flag (io_uring). >>>> But maybe we should invest more energy on a fix? >>> >>> It has been years now, I think we need to admit a fix is still years >>> away. Blocking the security problem may even motivate more people to >>> work on a fix. >> >> Maybe we should make this a topic this year at LSF/MM (again?). At least we >> learned a lot about GUP, what might work, what might not work, and got a >> depper understanding (+ motivation to fix? :) ) the issue at hand. > > We keep having the topic.. This is the old argument that the FS people > say the MM isn't following its inode and dirty lifetime rules and the > MM people say the FS isn't following its refcounting rules :/ so we have to discuss it ... again I guess. > >>> Security is the primary case where we have historically closed uAPI >>> items. >> >> As this patch >> >> 1) Does not tackle GUP-fast >> 2) Does not take care of !FOLL_LONGTERM >> >> I am not convinced by the security argument in regard to this patch. > > It is incremental and a temperature check to see what kind of real > users exist. We have no idea right now, just speculation. Right, but again, if we start talking about security it's a different thing IMHO. >> Everything else sounds like band-aids to me, is insufficient, and might >> cause more harm than actually help IMHO. Especially the gup-fast case is >> extremely easy to work-around in malicious user space. > > It is true this patch should probably block gup_fast when using > FOLL_LONGTERM as well, just like we used to do for the DAX check. Then we'd at least fix the security issue for all FOLL_LONGTERM completely. -- Thanks, David / dhildenb