Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2117478pxa; Mon, 24 Aug 2020 05:49:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwATK8MphkMOHUrT9CKqjjJ5vTaSXihopm1Zih/yKbX6TIpc6HDM/0sLA/reUiF6N9ojyAI X-Received: by 2002:a17:907:270d:: with SMTP id w13mr5212962ejk.191.1598273387205; Mon, 24 Aug 2020 05:49:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598273387; cv=none; d=google.com; s=arc-20160816; b=Cyk8qd6f9Rquyhptqnye+DeR3eNYBQcWyRKmNXwsFZrJ3JDyk0OG6xND1oKZB0isET 0wDgAHvOPlG5u6H6QeqgkF1Trp1PDBNV/XPuKh4s4m/S2ERBMuC58xEGnokkJjqvkUSW UbbqJTNK4IuDhxMDZqo7l6xk5oScNQlSUo0EScNk46cO6En5kQd/cPZZEK/z7iqcCah8 JosBav2At0718xaaU6BcfgXWcG7eTOsLojPou5i9xrTw7X1EGkNy6/NRy/URd70kIsdZ TFz5VwdcBQPQ3GYxFpQZcku85igpozodH//up0696HGGVrq1LMLc28JyEchJxzgujaZr gIuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=S2IPXzmn+OKMcrQgf/hKHvn8I9Z5eUqBH1sKWLhEHkw=; b=Qc/GEwjo92AtEzz/5Wv6pg7K+NbESDt3YaJepweWUi0AVA+kiwl8NH3ZBpMb/RJwBU Z5IRRlGhPX1pnunCRia8TpJHZMEFk2ry6Rp6MS8ABgWkkxYW0IEwBX0+rk4Fr1XKnSho YEb3S8iB1W0wOMjQEw3je4TUNjhdbknFc481bl/k4QVprLQHzvHobJr0K/ikksz1Zssr APhTkPqda0ErNQtwUNHgE5zIvfvL7pGuLvzCJMtgvlBtRmf0UStGJ2VF/30OtZrZDxd7 ucWbtjrN7dOFbwThvnZ66YE+MnAHr6B9wru/i2w6qmNN9JyrNAl8SOED2fZ5hiw6EZm7 hVgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=BfRVfTBX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b19si7009952ejd.405.2020.08.24.05.49.23; Mon, 24 Aug 2020 05:49:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=BfRVfTBX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726365AbgHXMsR (ORCPT + 99 others); Mon, 24 Aug 2020 08:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbgHXMsO (ORCPT ); Mon, 24 Aug 2020 08:48:14 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97BB7C061573 for ; Mon, 24 Aug 2020 05:48:13 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id d11so11518486ejt.13 for ; Mon, 24 Aug 2020 05:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S2IPXzmn+OKMcrQgf/hKHvn8I9Z5eUqBH1sKWLhEHkw=; b=BfRVfTBXcVbti1Hpi5XfJ9bPtCpd/H+Yoa8sWOaAvxUonJ76O0Lea7kGjVAGJmOCJ5 Jtzcdpw5goa/kbBky0td2syRYGONm0uqruHTKboQap+xTpY+GFD2x+Dni+qkmvc+Wwsm 4pkeX4wFxnnIeItQwxZPhFji88v7JFVl0CoGU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S2IPXzmn+OKMcrQgf/hKHvn8I9Z5eUqBH1sKWLhEHkw=; b=nYRBON3Kdkw7GSASHGXiGZMGH0DD1ffcaY5TYZqSwqOYhnOEGb8JGZ9vjvLm2sneRr IZeYWVMqoEFXzy+zh80naeoM7Wt4QGBX5BKDsgYQwpQzJo91YBNOEtVAlkjezM7ZLvfr x8h2TIaIM9cphlKfQxSUDQpkrQvHqymnkC6wozzZB0XKrF+sDEZt7IEnNFwHPLlohYH5 NHsXxS+DYHP+8e5z4/5INPdgwq4V4+Z2eP0O7B0Zv38RVnrg26I3Q+YA5EcntWv6SQUH evxL8l94Q6oGTyvR4sj2g6VTufOeUQHhqvp9QnYmT/wEbU2YhH91NVmM17/tL/g/IazN GXeg== X-Gm-Message-State: AOAM532ZnbP6t2nnNTun4B4bv/x/+/Re6xuMZ8aM7QU9rtkr6V7xRh6/ Yvb2efKGvwMHXlJCp4LK609j23Ffs5ZUI+9hEfccaA== X-Received: by 2002:a17:907:94ca:: with SMTP id dn10mr5328702ejc.110.1598273292348; Mon, 24 Aug 2020 05:48:12 -0700 (PDT) MIME-Version: 1.0 References: <20200812161452.3086303-1-balsini@android.com> <20200813132809.GA3414542@google.com> <20200818135313.GA3074431@google.com> <877dtvb2db.fsf@vostro.rath.org> In-Reply-To: From: Miklos Szeredi Date: Mon, 24 Aug 2020 14:48:01 +0200 Message-ID: Subject: Re: [PATCH v6] fuse: Add support for passthrough read/write To: Amir Goldstein Cc: Alessio Balsini , Jann Horn , Jens Axboe , Nikhilesh Reddy , Akilesh Kailash , David Anderson , Eric Yan , Martijn Coenen , Palmer Dabbelt , Paul Lawrence , Stefano Duo , Zimuzo Ezeozue , kernel-team , linux-fsdevel , kernel list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 19, 2020 at 11:25 AM Amir Goldstein wrote: > > What I have in mind is things like not coupling the setup of the > > passthrough fds to open(), but having a separate notification message for > > this (like what we use for invalidation of cache), and adding not just > > an "fd" field but also "offset" and "length" fields (which would > > currently be required to be both zero to get the "full file" semantics). > > > > You mean like this? > > https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git/commit/?h=fuse2 Look specifically at fuse_file_map_iter(): https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git/tree/fs/fuse2/file.c?h=fuse2#n582 and fudev_map_ioctl(): https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git/tree/fs/fuse2/fudev.c?h=fuse2#n601 This avoids the security issue Jann mentioned as well as allowing arbitrary mapping of file ranges. E.g. it could also be used by a block based filesystem to map I/O directly into the block device. What the implementation lacks is any kind of caching. Since your usecase involves just one map extent per file, special casing that would be trivial. We can revisit general caching later. Thanks, Miklos