Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2711200rdb; Mon, 5 Feb 2024 15:36:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCzpJxgkFm/rI/3TWvhhE0szxG60oBq6ZRJLRZnyBv1ITUNyIrd8dyFxI5ZnvDJOeV6HOe X-Received: by 2002:a05:6122:2093:b0:4c0:328d:c4f9 with SMTP id i19-20020a056122209300b004c0328dc4f9mr1134056vkd.0.1707176212073; Mon, 05 Feb 2024 15:36:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707176212; cv=pass; d=google.com; s=arc-20160816; b=kHS21AiU4eanUvCCbo0KA+T7ItUY3YmbGMwoHvzq7/7wDFe/UoHUJ5Mj5XC45Q2GF2 /HzCpd6m4sTv4dpYWr37L2xjL9SiZl1D3Y7AG3zQkTj5aanm3o+hBV42c9w5b4lDV6TV gcr8XNgYT1AmwywFtIA0CsNW67H8uPIn3wBlkcq2na22BMBFthZs967z8dsA7oc79eL8 6v22L/n9DW8P1FGiVXJ8fNWugryyll/RgKAYqOkiRqq0LjSr+6HVkgN8prSYZlrkXp5t nymkY02ZwEqjb3RN+GrHgcCoj3xCPiJTogepkx0Xi2pVsDCqnUE/5TB/4yokKKz5AsRL tzmg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=gtL3jvJTvpjem+XLSIljDmdaRNW3JxGajKR4+xmGq/g=; fh=Qo5SZ8XDKxuXWU2H7IhgEQVHuD2nv9L/6qSxJ8hr++0=; b=VaAM+ImgJ5q9XrLYvvqNoHun+pZAuawVZ2Cn9iMVK+XbYLpYRgMd0PKzAO86l4TGbs Mfe/krFGS7SBg31nu9crKKkSFif2jhUdzERO947my5vEgtQ8KaDbR3uFOuFs07aI4ExC 8lAmOEhH90j9PLfiQsUakPZsr6YgdsLzg1PhA2C/9KsYP852Gl5J86HkzmsEFOddJ86c MuVVPXcT5x6b6v2tKNhm7xd+DlE5dIYIDa+ePnLI9MX3euLtwNvktuHl8ma7Av5X6plg C5492u3CoNmTUq0TBVoBVEWizYwMl6KksrFn2Tkd9Z9nOHxYTGvygdgPVzNklP2pPcRl dM8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=twsh112c; arc=pass (i=1 spf=pass spfdomain=fromorbit.com dkim=pass dkdomain=fromorbit-com.20230601.gappssmtp.com dmarc=pass fromdomain=fromorbit.com); spf=pass (google.com: domain of linux-kernel+bounces-54097-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54097-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com X-Forwarded-Encrypted: i=1; AJvYcCWSsZqI9oUq9epa/kcy3b4+Ynu18lqy/bKo5FvlmYrY+zdIgIMq8pqQMt9NJ5da3l1ZQxwYzKmj9okcg48MgpftpoSbwGW/fujRXRCApg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g12-20020a37e20c000000b00783e232e63esi953361qki.755.2024.02.05.15.36.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 15:36:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54097-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=twsh112c; arc=pass (i=1 spf=pass spfdomain=fromorbit.com dkim=pass dkdomain=fromorbit-com.20230601.gappssmtp.com dmarc=pass fromdomain=fromorbit.com); spf=pass (google.com: domain of linux-kernel+bounces-54097-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54097-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CE04F1C212A8 for ; Mon, 5 Feb 2024 23:36:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B0374D9E4; Mon, 5 Feb 2024 23:34:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b="twsh112c" Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20DC94A99C for ; Mon, 5 Feb 2024 23:34:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707176091; cv=none; b=i/9/ZFSY8V5zcwe+jVu3p1Ch/mFp7SBEnY/7E8r4lJVtWu/yZZVynsMrvTi0sMTAJHQcXg6//JTEnABY63cuQVOEBvHOq1EhGNXGWLana5SknHxV9BOMg+u2fmVRrmvdeCcJCz+FjIF+D4WzLV+kbUWXuP/udpaIkLbRuHlNRqw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707176091; c=relaxed/simple; bh=ldhxU/uh8jcnenclWs1IUZtu/99DL4r26fBNY3JoSIc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KVAtbjJzijQEokgaByVQmy1DAkOEw9PFd9Zfz45Qq18/2AtUWSlxFFF1Ocol/tossrlFFgJ+/KwWEECa0UYpd/zotTlHPYLlqxpnRYJ3n9XZo39axmgbBFCTBkay+hCxQnK4XNV8+gr2eQktq07MAP6OAs05kBm79PY4+402/Xk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com; spf=pass smtp.mailfrom=fromorbit.com; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b=twsh112c; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fromorbit.com Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso4154190a12.3 for ; Mon, 05 Feb 2024 15:34:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1707176089; x=1707780889; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=gtL3jvJTvpjem+XLSIljDmdaRNW3JxGajKR4+xmGq/g=; b=twsh112cxZ6tGm9NJIJXjjMfSrgSntwk7HW2VF7WtGsTm1E1pv+a7O+2Dw6DA0L/Rf TlUsUNFO+g+YVkfORlSH03dNpOOZZYRJMu0Hg96q/JU4qH0JF+vW7macCgsndF4WcJ8/ Y8+CwxIRzFuK7cHDdGgmJKoOYEIxkK1mlp2vkcb5y5uXyEHHCeOJLGWzwlAXfookLryw fNJoCpMOL8lUAmvV2vMGTxG9nFUlN9sKle3qCIlXb9a5u/bal9VdZ2OD4G+C5dcT2Rl0 BGE2YKYGVzX0pRAjiJoinYFuQgOLIKN0+NxzLCCg6rUUndVBr6neTo6y5/68T+gNBwhr UR6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707176089; x=1707780889; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gtL3jvJTvpjem+XLSIljDmdaRNW3JxGajKR4+xmGq/g=; b=k9RpmxAHZfFz1gYrGqeeAwQ2XdxpubvuCJ3AvAOWBY5hUHO7Okjh+5SvmQl+2Thpzz 9uNRgrU6vKewLv9dr2lFQIHiDDijzB1+ZRnzfgYFrSQkm9H/KyZ938nD7M1p6C92xOKL n9GUdRXBivPhio2LwRICRhhLaG33E1vFmu+KFiTyFk6IrUwnYieH5H8LFH0h9ng6xkPh UdQTcVwc9kVxc0UVWDVmSKr4G3juQ7swhmemlGrkTFdL15Xg+GoYUT68v2LcryKfhU3D INpQrbyZBo4ua9OxvM19AkmVsvyuu+B9nkQxpUbAGRcqdV/gNZStASuJ/Mb+RESVg5A3 QFtA== X-Gm-Message-State: AOJu0Yx/tmvWjojKCdZF6QsXV2tF6ewaKZ2J+jRQTg2CuZm8v6X5ebVg ICq0jKNWM5X3hDf30glMeg3Kl0lgxin9yYtufzlzsX1OZ30/+CNPMhPRY8q87mQ= X-Received: by 2002:a05:6a20:5a23:b0:19c:6994:8913 with SMTP id jz35-20020a056a205a2300b0019c69948913mr18604pzb.7.1707176089472; Mon, 05 Feb 2024 15:34:49 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCV0CEkV2IfB4OmDyzaC+v8m2BH8FR7RhAj08DN4ZCHOpokDj9NS3wCXNVRfk7DG1CgufYqK8wHCWHs/PTSMiUjOuQSYNN6ZB+aTscx7+cznoZDT8F2Z+x8Fq3mxFfB9Q2jg/LH2Xu5A+NenLIQoUHD99PduRSLqa/iSmtJqGUFocP6eazRhZvFPA9oDPPOrGfymNqdHw0h/nxszHDIMLLBz29NGLa3hIDKXa0S4z53eR2lqqcuHECKUht7VhUHfbFimSw7QRk7cn4BKB3os4xsrqwiVMkY7NRCwcGUSArF2DNAxABXpngViCgO/vzS6NOCH8aVzjxa+p7AcjKWz6oTuWjyOTrBZ8G63OPDI6g9B3Y9ih4iHTfBED1X+kcrAoyJpINXQ5q4bBt5dYYppH+8WNNuWMz2CNZCklGzQk9dJuoE2ItM4zSqmfovYw3ID101Lnd3kUjofr8ibkxgD8K3q6WDRUDbueTuqDCvzRQDSW98rcWllaXDIoFd2YDIC4WD/pL8BWmhBnN8pJ6k6aTgCMvz90BDChV469mYLup57WhnQyVmsE3Qc8hAeKEEGLeNjV2ax1UH2rK7sI8BbI4uqpLjJUj6kEP6G3Awmmm0ngNCcknaIUFOysIxxB9aT2a3JhYMHnRxYt1Ck/1I805Fl85lKwmRr4/1P9deiddme4xe2eCvJLYL3JVcbTYiI3Vs+wFW6KG3VQaHK+PxspiH1JWWW2QHFdaRaiqgAgi3xQs8I Received: from dread.disaster.area (pa49-181-38-249.pa.nsw.optusnet.com.au. [49.181.38.249]) by smtp.gmail.com with ESMTPSA id k18-20020a170902c41200b001d8f12b0009sm423859plk.293.2024.02.05.15.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 15:34:48 -0800 (PST) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1rX8UA-002agH-2H; Tue, 06 Feb 2024 10:34:46 +1100 Date: Tue, 6 Feb 2024 10:34:46 +1100 From: Dave Chinner To: James Gowans Cc: linux-kernel@vger.kernel.org, Eric Biederman , kexec@lists.infradead.org, Joerg Roedel , Will Deacon , iommu@lists.linux.dev, Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, Paolo Bonzini , Sean Christopherson , kvm@vger.kernel.org, Andrew Morton , linux-mm@kvack.org, Alexander Graf , David Woodhouse , "Jan H . Schoenherr" , Usama Arif , Anthony Yznaga , Stanislav Kinsburskii , madvenka@linux.microsoft.com, steven.sistare@oracle.com, yuleixzhang@tencent.com Subject: Re: [RFC 05/18] pkernfs: add file mmap callback Message-ID: References: <20240205120203.60312-1-jgowans@amazon.com> <20240205120203.60312-6-jgowans@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240205120203.60312-6-jgowans@amazon.com> On Mon, Feb 05, 2024 at 12:01:50PM +0000, James Gowans wrote: > Make the file data useable to userspace by adding mmap. That's all that > QEMU needs for guest RAM, so that's all be bother implementing for now. > > When mmaping the file the VMA is marked as PFNMAP to indicate that there > are no struct pages for the memory in this VMA. Remap_pfn_range() is > used to actually populate the page tables. All PTEs are pre-faulted into > the pgtables at mmap time so that the pgtables are useable when this > virtual address range is given to VFIO's MAP_DMA. And so what happens when this file is truncated whilst it is mmap()d by an application? Ain't that just a great big UAF waiting to be exploited? -Dave. -- Dave Chinner david@fromorbit.com