lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250721170147.GT2672070@frogsfrogsfrogs>
Date: Mon, 21 Jul 2025 10:01:47 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: Theodore Ts'o <tytso@....edu>
Cc: Sam James <sam@...too.org>, linux-ext4@...r.kernel.org
Subject: Re: [PATCH 2/5] fuse2fs: stop aliasing stderr with ff->err_fp

On Mon, Jul 21, 2025 at 07:41:17AM -0400, Theodore Ts'o wrote:
> On Sun, Jul 20, 2025 at 10:42:34PM -0700, Darrick J. Wong wrote:
> > Oh wait no it turns out that libfuse obliterates std{in,out,err} in
> > fuse_daemonize() by opening /dev/null and using that exact trick.  So
> > the only reason why I was ever getting any FUSE2FS debug output
> > throughout *any* of the fuse+iomap development sprints was that glibc
> > lets you assign stdout/stderr directly.
> > 
> > freopen also won't work (at least on glibc) because its freopen
> > implementation uses the dup2 trick which will be undone by libfuse.
> > 
> > GREAT!  I only got to debug my program because OF A WEIRD GLIBC QUIRK!!
> 
> So either we need to find some way to inhibit fuse_daemonize() and
> then have fuse2fs handling doing the daemonization.  Or maybe we can
> arrange to have some kind callback to set up stdout/stderr after
> fuse_main() is called?  fuse_daemonize() is called from fuse_main(),
> right?

Right.  We could just set up the log file again in op_init, which will
fix the daemonize() problem; use dup2 to cover any libraries that output
directly to STDOUT/ERR_FILE; and use freopen on /dev/fd/XX which will
cover any other libraries that call printf or fprintf(stdout/err.

$ diffstat < patches-djwong-dev/019*
 fuse2fs.c |  141 +++++++++++++++++++++++++----
 1 file changed, 123 insertions(+), 18 deletions(-)

Yuuuuuck.

--D

> 						- Ted

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ