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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPKjtQz5lmUcWf5O@cern.ch>
Date: Fri, 17 Oct 2025 15:14:45 -0500
From: Dave Dykstra <dwd@...n.ch>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: linux-ext4@...r.kernel.org,
	Dave Dykstra <2129743+DrDaveD@...rs.noreply.github.com>
Subject: Re: [PATCH] fuse2fs: open read-only when ro option and image
 non-writable

On Fri, Oct 17, 2025 at 12:24:56PM -0700, Darrick J. Wong wrote:
> On Thu, Oct 16, 2025 at 03:02:06PM -0500, Dave Dykstra wrote:
...
> > diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
> > index cb5620c7..2ae2fc1a 100644
> > --- a/misc/fuse2fs.c
> > +++ b/misc/fuse2fs.c
> > @@ -4696,9 +4696,19 @@ int main(int argc, char *argv[])
> >  	err = ext2fs_open2(fctx.device, options, flags, 0, 0, unix_io_manager,
> >  			   &global_fs);
> >  	if (err) {
> > -		err_printf(&fctx, "%s.\n", error_message(err));
> > -		err_printf(&fctx, "%s\n", _("Please run e2fsck -fy."));
> > -		goto out;
> > +		if (((err == EACCES) || (err == EPERM)) && fctx.ro) {
> 
> This is not correct.  mount(8) for the kernel ext4 driver responds to
> the block device being readonly by retrying with an ro mount.  The user
> is not required to specify 'ro':
> 
> # blockdev --setro/ dev/sda
> # strace -e mount mount /dev/sda /mnt
> 40677<mount> 12:19:36 (+     0.000102) mount("/dev/sda", "/mnt", "ext4", 0, NULL) = -1 EACCES (Permission denied)
> 40677<mount> 12:19:36 (+     0.000285) mount("/dev/sda", "/mnt", "ext4", MS_RDONLY, NULL) = 0

Ok then, I'll change that.

...
> >  	fctx.fs = global_fs;
> >  	global_fs->priv_data = &fctx;
> > @@ -4741,6 +4751,8 @@ int main(int argc, char *argv[])
> >  		goto out;
> >  	}
> >  
> > +	ret = 4;
> 
> Why 4?  Is this an internal mount bug?

I was just guessing; I didn't know what the bits meant.  Where are they
documented?  All I knew was that it needed to not include the "& 1" bit
which was included with "ret = 3" because that printed an erroneous
error just after the "out" label.

Dave

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ