FILESYSTEM IN USERSPACE (FUSE) development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: bernd@bsbernd.com
Cc: fuse-devel@lists.linux.dev
Subject: Re: [PATCH 03/10] mount_service: refuse OPEN after the MNTPT request
Date: Fri, 25 Sep 2026 15:07:14 -0700	[thread overview]
Message-ID: <20260925220714.GS6253@frogsfrogsfrogs> (raw)
In-Reply-To: <20260925-mount-service-bound-open-v1-3-bbf1a84c7995@bsbernd.com>

On Fri, Sep 25, 2026 at 12:23:31AM +0200, Bernd Schubert via B4 Relay wrote:
> From: Bernd Schubert <bernd@bsbernd.com>
> 
> The fuse server sends fuservicemount3 a series of requests: OPEN for
> its backing file, MNTPT to name the mount point, then MOUNT. The server
> chooses the order. For a directory mount point, attach_to_mountpoint()
> changes the working directory of the helper to the mount point. The
> helper then mounts on ".", so a rename of the path cannot redirect the
> mount.
> 
> A relative path in an OPEN request after MNTPT resolved inside the
> mount point. For "fuservicemount3 disk.img /mnt -t fuse.service_ll",
> an OPEN of "disk.img" matched the command line argument, but the helper
> opened /mnt/disk.img, not disk.img in the user's working directory. The
> helper now refuses OPEN once the mount point is set. No in-tree server
> sends OPEN after MNTPT.

How about absolute paths?  The resolution of those remain the same after
the cwd changes.

--D

> 
> Assisted-by: LLM
> Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
> ---
>  doc/fuservicemount3.8  | 1 +
>  include/fuse_service.h | 3 ++-
>  util/mount_service.c   | 7 +++++++
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/fuservicemount3.8 b/doc/fuservicemount3.8
> index 06755d7c3c4e..9b8c752b3bb9 100644
> --- a/doc/fuservicemount3.8
> +++ b/doc/fuservicemount3.8
> @@ -22,6 +22,7 @@ framework.
>  The FUSE server may ask fuservicemount3 to open files on its behalf.
>  fuservicemount3 opens only paths that appear verbatim on its command line
>  and refuses any other request with EPERM.
> +Requests after the server has sent the mount point are refused as well.
>  
>  The second form checks if there is a FUSE service available for the given
>  filesystem type.
> diff --git a/include/fuse_service.h b/include/fuse_service.h
> index 3954f62aa2b8..56f40a44b670 100644
> --- a/include/fuse_service.h
> +++ b/include/fuse_service.h
> @@ -139,7 +139,8 @@ int fuse_service_parse_cmdline_opts(struct fuse_args *args,
>  
>  /**
>   * Ask the mount.service helper to open a file on behalf of the fuse server.
> - * The helper refuses a path that is not verbatim on the mount command line;
> + * The helper refuses a path that is not verbatim on the mount command line,
> + * and any request made after the mount point was sent;
>   * fuse_service_receive_file() then reports -EPERM.
>   *
>   * @param sf service context
> diff --git a/util/mount_service.c b/util/mount_service.c
> index 835d3d94aa4a..1f25dcde0349 100644
> --- a/util/mount_service.c
> +++ b/util/mount_service.c
> @@ -801,6 +801,13 @@ static int mount_service_open_path(const struct mount_service *mo,
>  		return mount_service_send_file_error(mo, EINVAL, oc->path);
>  	}
>  
> +	/* After fchdir to the mountpoint, a relative path resolves there */
> +	if (mo->mountpoint) {
> +		fprintf(stderr, "%s: %s: files must be requested before the mount point\n",
> +			mo->msgtag, oc->path);
> +		return mount_service_send_file_error(mo, EPERM, oc->path);
> +	}
> +
>  	/*
>  	 * The file is opened outside the service sandbox, so only hand out
>  	 * what the user named.
> 
> -- 
> 2.53.0
> 
> 
> 

  reply	other threads:[~2026-09-25 22:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 22:23 [PATCH 00/10] libfuse: Add mount service safety checks and tests Bernd Schubert via B4 Relay
2026-09-24 22:23 ` [PATCH 01/10] mount_service: move the command line check into arg_in_cmdline() Bernd Schubert via B4 Relay
2026-09-25 21:40   ` Darrick J. Wong
2026-09-24 22:23 ` [PATCH 02/10] mount_service: open only paths named on the command line Bernd Schubert via B4 Relay
2026-09-25 22:05   ` Darrick J. Wong
2026-09-28  9:19     ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 03/10] mount_service: refuse OPEN after the MNTPT request Bernd Schubert via B4 Relay
2026-09-25 22:07   ` Darrick J. Wong [this message]
2026-09-28  9:21     ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 04/10] util: give fuservicemount3 an absolute build-tree runpath Bernd Schubert via B4 Relay
2026-09-25 22:09   ` Darrick J. Wong
2026-09-24 22:23 ` [PATCH 05/10] mount.fuse: free the options on the service mount return path Bernd Schubert via B4 Relay
2026-09-25 22:10   ` Darrick J. Wong
2026-09-24 22:23 ` [PATCH 06/10] example/single_file: take no sector size from a regular backing file Bernd Schubert via B4 Relay
2026-09-25 22:13   ` Darrick J. Wong
2026-09-24 22:23 ` [PATCH 07/10] test: check which files fuservicemount3 opens for the server Bernd Schubert via B4 Relay
2026-09-24 22:23 ` [PATCH 08/10] test: check what fuservicemount3 refuses Bernd Schubert via B4 Relay
2026-09-24 22:23 ` [PATCH 09/10] test: mount the service examples through fuservicemount3 Bernd Schubert via B4 Relay
2026-09-25 22:25   ` Darrick J. Wong
2026-09-28  9:27     ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 10/10] test: run mkfs.ext4 through the service examples Bernd Schubert via B4 Relay
2026-09-25 22:27   ` Darrick J. Wong
2026-09-28  9:30     ` Bernd Schubert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260925220714.GS6253@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=bernd@bsbernd.com \
    --cc=fuse-devel@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox