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 05/10] mount.fuse: free the options on the service mount return path
Date: Fri, 25 Sep 2026 15:10:13 -0700	[thread overview]
Message-ID: <20260925221013.GU6253@frogsfrogsfrogs> (raw)
In-Reply-To: <20260925-mount-service-bound-open-v1-5-bbf1a84c7995@bsbernd.com>

On Fri, Sep 25, 2026 at 12:23:33AM +0200, Bernd Schubert via B4 Relay wrote:
> From: Bernd Schubert <bernd@bsbernd.com>
> 
> These leaks were detected by the new tests.
> 
> Assisted-by: LLM
> Signed-off-by: Bernd Schubert <bernd@bsbernd.com>

Looks fine, though those leaks won't live for long...
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  util/mount.fuse.c | 42 ++++++++++++++++++++++++++----------------
>  1 file changed, 26 insertions(+), 16 deletions(-)
> 
> diff --git a/util/mount.fuse.c b/util/mount.fuse.c
> index c67a0c2b7f2f..1414265fd274 100644
> --- a/util/mount.fuse.c
> +++ b/util/mount.fuse.c
> @@ -56,9 +56,7 @@
>  #endif
>  
>  #include "fuse.h"
> -#ifdef HAVE_SERVICEMOUNT
> -# include "mount_service.h"
> -#endif
> +#include "mount_service.h"
>  
>  static char *progname;
>  
> @@ -396,6 +394,18 @@ out:
>  	fuse_opt_free_args(&args);
>  	return ret;
>  }
> +#else
> +static int try_service_main(const char *argv0, const char *fstype,
> +			    const char *source, const char *mountpoint,
> +			    const char *options)
> +{
> +	(void)argv0;
> +	(void)fstype;
> +	(void)source;
> +	(void)mountpoint;
> +	(void)options;
> +	return MOUNT_SERVICE_FALLBACK_NEEDED;
> +}
>  #endif
>  
>  int main(int argc, char *argv[])
> @@ -415,6 +425,7 @@ int main(int argc, char *argv[])
>  	int fuse_fd = 0;
>  	int drop_privileges = 0;
>  	char *dev_fd_mountpoint = NULL;
> +	int ret;
>  
>  	progname = argv[0];
>  	basename = strrchr(argv[0], '/');
> @@ -608,19 +619,17 @@ int main(int argc, char *argv[])
>  	}
>  #endif
>  
> -#ifdef HAVE_SERVICEMOUNT
>  	/*
>  	 * Now that we know the desired filesystem type, see if we can find
>  	 * a socket service implementing that, if we haven't selected any weird
>  	 * options that would prevent that.
>  	 */
>  	if (!pass_fuse_fd && !(setuid_name && setuid_name[0])) {
> -		int ret = try_service_main(argv[0], type, source, mountpoint,
> -					   options);
> +		ret = try_service_main(argv[0], type, source, mountpoint,
> +				       options);
>  		if (ret != MOUNT_SERVICE_FALLBACK_NEEDED)
> -			return ret;
> +			goto out;
>  	}
> -#endif
>  
>  	add_arg(&command, type);
>  	if (source)
> @@ -631,17 +640,18 @@ int main(int argc, char *argv[])
>  		add_arg(&command, options);
>  	}
>  
> +	execl("/bin/sh", "/bin/sh", "-c", command, NULL);
> +	fprintf(stderr, "%s: failed to execute /bin/sh: %s\n", progname,
> +		strerror(errno));
> +	ret = 1;
> +
> +out:
> +	if (pass_fuse_fd)
> +		close(fuse_fd);
>  	free(options);
>  	free(dev_fd_mountpoint);
>  	free(dup_source);
>  	free(setuid_name);
> -
> -	execl("/bin/sh", "/bin/sh", "-c", command, NULL);
> -	fprintf(stderr, "%s: failed to execute /bin/sh: %s\n", progname,
> -		strerror(errno));
> -	
> -	if (pass_fuse_fd)
> -		close(fuse_fd);
>  	free(command);
> -	return 1;
> +	return ret;
>  }
> 
> -- 
> 2.53.0
> 
> 
> 

  reply	other threads:[~2026-09-25 22:10 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
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 [this message]
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=20260925221013.GU6253@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