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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 C57ECC433ED for ; Mon, 10 May 2021 15:34:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 20CC96120D for ; Mon, 10 May 2021 15:34:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20CC96120D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 860D46B0072; Mon, 10 May 2021 11:34:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 837276B0073; Mon, 10 May 2021 11:34:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B0B76B0074; Mon, 10 May 2021 11:34:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id 506196B0072 for ; Mon, 10 May 2021 11:34:15 -0400 (EDT) Received: from smtpin39.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 09EAF9085 for ; Mon, 10 May 2021 15:34:15 +0000 (UTC) X-FDA: 78125717670.39.207C07C Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by imf01.hostedemail.com (Postfix) with ESMTP id 974EF500153E for ; Mon, 10 May 2021 15:34:11 +0000 (UTC) Received: by mail-qv1-f52.google.com with SMTP id u7so8506956qvv.12 for ; Mon, 10 May 2021 08:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Kbo2+rSch+wM5JArQf3gDIi84RZdBPSju4RgHGRm0v8=; b=jInoHJDR26ARTH6tGpwVeeJogGk+P6na2ViO2DUIC+bGbMTDUi+8QZzkitdl3HzqhO qhzxVKEpk3y84tIr+YEon8WcnwbvCYIcrIg25Aj/b7Aw/UGidjezNDFr5jegnVEzomGc 4efhSEvakB8sIdWnv6WdpTzrvm1E0Gx8lRr9GLBLLiIA4Ukwc+AzQ9ZD3NCYX5hM1Sd/ ccEc+Vt5pnW3H8LiiDb5+QVBE1suwmzlBV6rdcmBxTtb5gWnK/b/QGiuyH818XA3RJ/w eI2Btdv2pxaao9VxPBbC4GWZvh6jQaHr7aGphsI2afnyj+BjF4p6gyMYvMUkwP1w7Elb RnQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Kbo2+rSch+wM5JArQf3gDIi84RZdBPSju4RgHGRm0v8=; b=PON9DXJHXAAX4I8mexisd8/uDj4sZYbPAonIQJr2hdMN8UGQZuI89MxqzhXnRPVhg9 +CldtPxBA0JmaeOKQvKmu7NqMLb8dxAWhp1v5IDBjvshKN8I8kHrKQx6OfVkj2V21m9G et8CrCawFl6kel6jMz+liUfLDKoM9E8L5l4P+0eLV6xH+wZqGDtNC4++sRdSm3sPMANr KPIFRXZE1pXhLiQJK7Hk+RbC7FNOBq+ZULEB6T4Xnf9LmkAOiwVXCV6SBm5EONFB6qN3 mLFjt/Gsxk2FCc6ccdTkSNRR10nX/UKPK90Rf3XHSiZ2B5zLRUi1y98GmcynOg6NuiuP Ig/Q== X-Gm-Message-State: AOAM530kG0NbFc5uwhK07otX2uoPkVL6V5/J7WYH36CZ4DS/pN+vlkkL Y2E54no4pC1DBGi7rM8RN+VS7w== X-Google-Smtp-Source: ABdhPJyla2vALn9Ej+6umiMQDx3D5VWVB5hGHAU2fINWGaZnoagvIFv9v7XEtwXflVpOpTyJSRO84Q== X-Received: by 2002:a05:6214:9aa:: with SMTP id du10mr24525830qvb.37.1620660853797; Mon, 10 May 2021 08:34:13 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-47-55-113-94.dhcp-dynamic.fibreop.ns.bellaliant.net. [47.55.113.94]) by smtp.gmail.com with ESMTPSA id t128sm11479176qkh.50.2021.05.10.08.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 08:34:13 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lg7vA-004b0w-PZ; Mon, 10 May 2021 12:34:12 -0300 Date: Mon, 10 May 2021 12:34:12 -0300 From: Jason Gunthorpe To: Daniel Vetter Cc: Linus Torvalds , Tomasz Figa , Marek Szyprowski , Mauro Carvalho Chehab , DRI Development , LKML , Linux-MM , Linux ARM , Linux Media Mailing List , linux-samsung-soc Subject: Re: [PULL] topic/iomem-mmap-vs-gup Message-ID: <20210510153412.GG2047089@ziepe.ca> References: <20210510135031.GF2047089@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 974EF500153E X-Stat-Signature: 671fpjimbgcest4fpgp3h1tr7p86djx3 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=ziepe.ca header.s=google header.b=jInoHJDR; spf=pass (imf01.hostedemail.com: domain of jgg@ziepe.ca designates 209.85.219.52 as permitted sender) smtp.mailfrom=jgg@ziepe.ca; dmarc=none Received-SPF: none (ziepe.ca>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=mail-qv1-f52.google.com; client-ip=209.85.219.52 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620660851-974866 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, May 10, 2021 at 04:55:39PM +0200, Daniel Vetter wrote: > yeah vfio is still broken for the case I care about. I think there's > also some questions open still about whether kvm really uses > mmu_notifier in all cases correctly, IIRC kvm doesn't either. > > Daniel I suppose we missed this relation to follow_pte(), so I agree > > that keeping a unsafe_follow_pfn() around is not good. > > tbh I never really got the additional issue with the missing write > checks. That users of follow_pfn (or well follow_pte + immediate lock > dropping like vfio) don't subscribe to the pte updates in general is > the bug I'm seeing. That v4l also glosses over the read/write access > stuff is kinda just the icing on the cake :-) It's pretty well broken > even if it would check that. It is just severity. Exploiting the use after free bug is somewhat harder, exploiting the 'you can write to non-page write protected memory' bug is not so hard. Jason