From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796320503; b=mIr6tWlHdIAe5lnR68FrKAlPILMM1HWVtCxbhRiX6VxWP6l/aMKxZblItYBwwvBadDB0 fpimIaQ4PxZEF2tpJlN5O/wlI6rOSsPq0PEYzMtiR3ihcb+I5Wq3ZF5SBTA7kkpUCh8J2 kSf5I0AiUHmcj4iHLV8dK6X9xzARazaQwJmAd0H+syHC/mCbmckS4bTdCuOsYWHg1pi88 PGUB8vy8KKwcAlnEGmVOY1qACnovl8vo+dQg70sl25V49Ri5n9tLBO/sbpMT9NbpxsMK2 yoY6dWcZwxOYpSuAyPGwU4juMrV+uDEnMqX//FtVV10H8j50nRcmhiGt0mQdmBCS37A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796320503; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=uw4ZcTsYhhutPqZ9dofdhAUmVzrPvY63dVnZAUQ/GN0=; b=1rkBfKHmk21MdkdroXo3p+ZvnujmzStokY9AeEXRtXDjW7/hHmBvL92MUCMpjLpRoCVi Oib4iJUkE/0ejH3M9YbpwbRnVFYQ/2g4i2QVDYag2uJ1BHZFY/XaM6/xAyvA0BeL0YQK9 BfhDzbsaLVQwzlYDKFExL4uPyHCQWI2FntdhVCzC2tZRsC0n/34ZxTrR0E+hnJWzN8PgN v2/fVaJKfLfl3yejh9eeFdQ2Q3WDJVp5JXj5S0mkO/UoKABe7WXC0wCk4tuwTKGWpLu/E +ZOPDw2oWtXJwpf/ab5MezFTPAYxqzATbdu0qImViEbCxEQcG4snsZjoCEZlnbz6msg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=nYrtULoo; arc=none smtp.remote-ip=209.85.218.45 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D2E0606A322 for ; Thu, 3 Dec 2026 17:55:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8D2E0606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=nYrtULoo Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-c5235be7be9so19130366b.2 for ; Thu, 03 Dec 2026 09:55:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796320502; x=1796925302; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=uw4ZcTsYhhutPqZ9dofdhAUmVzrPvY63dVnZAUQ/GN0=; b=nYrtULooNxVCAR7Ut1z2/LF8u9aN+9dhbPvi34tG1Lve7+M4ntyJiuv600/P4zCNFx ilHtFFjDDqksTp64xW7lyD5heevBGRcf9mDyZxi+18LpEw9k13Lq7C0JcmDUK6yYxFU6 dciy5m0GYr0u5UsujVeoewchjRbN5z+sgSnHumu7lsC2qA6iXWSGPRCOXwqMKUEfd7lu 1rKbiPw3GZM8sHiTQEJQqK8lcHhIWe6mxqp1HDqZqDMxK7FJl5qwUCUN3OUgk5yij2rJ pbHea/RYJBWBL7HVlJAX7DuIfegJ8rjoLF5OM36+dWoDXzNye12dtnP9n6m40c7W/GMS XB3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796320502; x=1796925302; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=uw4ZcTsYhhutPqZ9dofdhAUmVzrPvY63dVnZAUQ/GN0=; b=uWOP5jWaZ1C/ZFit3HwhMHlore2kqScZICcQVCPj2IyjoNbHNVIoaI+yE5pS18pBgq zNiLwayUhfHy8MiLB7A1EMHDTF7iv5rgeLv1BjAWZ4FV4bWzZ4nkXozsLVX9XkZUrhPe YpRPRVJWm62FdMXAV6ac5XPMyFRtRSigCqxz+rE8hrtwyQ7nNG1Xx0dRmFQQ2NiBmsfx SMF/2ZWc2R68v6nZtD6R+u5dhv9vVDZ2TaZhcMAuhowf4kRBD+uDamZ7Yfp/s+ke4iwX XcpBzdR9wXcu1iSGhXrBTPeQRedpBURMYvWA/nbCTz6ZeoBbFN3TNZ6QkT5kkGlbANnR wfVg== X-Forwarded-Encrypted: i=1; AL+hErG4a1gwolHFhuU9gxgprT4h06DpXqk5mot6uy786GPiYoiNuDoqXYHIGicNQ7v7oiGwrnAPhb5ucO0C4Z1/@vger.kernel.org X-Gm-Message-State: APuU4Z/5NHKwkBYbPRqWKR2O91E70iCxdXjeqJ0X39J8Ahz4KxAWU2Lu PmZ7jk6Ay7rM1AB7FPPrwatsrBHiTe98GWne518vvDL4a1mxkU/asLP15i0NIAnb X-Gm-Gg: AZFdTZfQjwYs6j0P5SPhSu8HtCxkgTwpcSdZ9cDM8QUPZjxXap3S6jWnQkFpeZuzTyp liw6KNg38LGboSgB6KqyhIqYe5JlTdlegQG36Y5BOiU1ZLAZe8AQR3oE5RRC/HLjYcRuqiRrbtH DZsHUsQ+xG+Lf1sXg5PTdsV670E/cpod/qZvBU6wtBYDz5UywZYrSWCwg0/9n+hbBpHE2kAgH+q wcSFEFPUjjn4mOO1Qb9O3jtj+lPab0abx4YvrYoZXtzxgzlqFrBOhZnHAExMZj3CaYN1/p0XnKs zWehraheUutRXhWAQAeOPvLUwaHvxpUORhtR6ZKiv4gFjr3cuGZyzVJXhmZWUEOQmJZXSbHFq7+ FtmOMfYc6A135GgdACN2Ukvg7Z46WzuYrUtMJQX77qeswG4IE7/iiNq+IO1f/zTgo9l3BqmLEVk NaLmP1TI9mng5yF3dhi121CP1mqf5I5NVExyA6ovTbwzIEaJ0WUz779dzukn7mdHuHfBYT+tEr4 5F1a13GnUJghf9kOk9hqW9cuOjSJGlW3vXsnuC5f1+i4O5VvnKCNrcrxXpcxKbckx3YQ3OiH0bS sCa4VwAF+jspwD4uDixcZmtjI+1t/CXLfGQqzGunlUqLRvQG2pT+fcBCmiXWlcPHTZo88x5EDpD mSw8z16aO+lU= X-Received: by 2002:a17:907:3f96:b0:c50:4a70:b7f5 with SMTP id a640c23a62f3a-c51961803f5mr2492376766b.17.1796320501946; Thu, 03 Dec 2026 09:55:01 -0800 (PST) Received: from localhost (178-84-201-199.dynamic.upc.nl. [178.84.201.199]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c525b42fe31sm7967266b.60.2026.12.03.09.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 09:55:01 -0800 (PST) From: Amir Goldstein To: Miklos Szeredi Cc: Christian Brauner , fuse-devel@lists.linux.dev, linux-fsdevel@vger.kernel.org, Lorenzo Stoakes , David Hildenbrand , Dominik Maier Subject: [PATCH] fuse: refuse kernel-internal files as passthrough backing files Date: Thu, 3 Dec 2026 18:55:00 +0100 Message-ID: <20261203175501.288404-1-amir73il@gmail.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The fuse server can register a regular file on a filesystem that only the kernel mounts, such as a memfd, as a backing file. Such files were never meant to be passthrough backing files, and some come with semantics of their own, such as memfd seals, which passthrough does not respect. Refuse files on filesystems mounted with SB_KERNMOUNT, as is done for files on pseudo filesystems. A fuse server that wants to keep the data of its backing files in memory can create them with O_TMPFILE on a tmpfs that it mounts. Such files cannot be sealed. Reported-by: Dominik Maier Closes: https://lore.kernel.org/linux-fsdevel/20261203020416.3569911-1-dmnk@google.com/ Fixes: 44350256ab94 ("fuse: implement ioctls to manage backing files") Cc: stable@vger.kernel.org Signed-off-by: Amir Goldstein --- Miklos, FYI, Christian has already queued a similar patch for banning pseudo fs passthrough files [1]. Note that I intentionally placed the gate outside the S_IFMT switch to future-proof non-regular passthrough file types. Thanks, Amir. [1] https://lore.kernel.org/linux-fsdevel/20261110-work-loop-pseudo-v1-38-4c998976c6c7@kernel.org/ fs/fuse/backing.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c index 4e4fb810ddaa8..287a4b6e18526 100644 --- a/fs/fuse/backing.c +++ b/fs/fuse/backing.c @@ -138,6 +138,9 @@ static int fuse_backing_open_file(struct fuse_conn *fc, struct fuse_backing *fb, struct dax_device *daxdev; int err; + if (inode->i_sb->s_flags & SB_KERNMOUNT) + return -EINVAL; + switch (inode->i_mode & S_IFMT) { case S_IFREG: /* TODO: relax CAP_SYS_ADMIN once backing files are visible to lsof */