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 2C698C7EE21 for ; Fri, 28 Apr 2023 15:42:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345860AbjD1Pmn (ORCPT ); Fri, 28 Apr 2023 11:42:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345991AbjD1Pmi (ORCPT ); Fri, 28 Apr 2023 11:42:38 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A1EB199B for ; Fri, 28 Apr 2023 08:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682696510; 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=f9V0s2wIJHILSoT9QN5rRx7H0KXrhg3+xqJDFMWuE67MzUUt1BINMHoX9yRIBlqBwprEMo 87/n1UomNsBc7vdyfRarzTjU6TUd1171jwrJXiiZM5H1Pysffpw/50ccHB2XDkDWPOt4Iv j335hh7R8PsFXuPlY5TZySvh+Fzlsv0= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-478-N7uOWfazObC6wXMSUzd78w-1; Fri, 28 Apr 2023 11:41:49 -0400 X-MC-Unique: N7uOWfazObC6wXMSUzd78w-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f173bd0d1bso64519625e9.3 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=PsxzjyJNXbl1mLRCKbpQ1jE4Do2DxOXEdH7JIENRjLBNF2Qp7IOZ5FxnvA1BcADPBM xW+lQ6Xhh7zdBEHuZ5j17uDkZlHnOgP2QlnPu4Z7T44/0+JKfRJh1kShbXeYItokW/K5 1n0v1YSRK885BdHPzoMArUZPAmrmS6zDHZTuxQqFS7+4Am3XwbcXM6NykT+zSRTM9nzC UKqlJ7RRG/SBtrL/YibErMhevlKMOY6WBPwfEctx6q1gCzR023uB/yECsPWoocwI9eej pDQMwj+7i+M59KxG/JoglKszi+wVeQizUMv0w36k3yPBPERtK7OBj+l2cZoR05yNsIJ2 HanQ== X-Gm-Message-State: AC+VfDzsPsiXJ9y0NBTFa9Dy1bZr05Knsf14IBtsLXUisDidl6F2ViAX fUcyRNSBfgTAt/e6gmiWijXDMqcRWgxW+AouY/qyQRCo0Dqp3x1HZOSrYOYPKfWaq2ugmCVQvQr 8ZjtLIySoQlPz X-Received: by 2002:a1c:ed0e:0:b0:3f2:5999:4f2b with SMTP id l14-20020a1ced0e000000b003f259994f2bmr4546931wmh.33.1682696497206; 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: bpf@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