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] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCx6QFZ1kiyB9ec0@infradead.org>
Date: Tue, 20 May 2025 05:49:04 -0700
From: "hch@...radead.org" <hch@...radead.org>
To: Christian Hesse <mail@...rm.de>
Cc: "Xu, Lizhi" <Lizhi.Xu@...driver.com>,
	"hch@...radead.org" <hch@...radead.org>,
	"axboe@...nel.dk" <axboe@...nel.dk>,
	"christian@...sel.eu" <christian@...sel.eu>,
	"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"ming.lei@...hat.com" <ming.lei@...hat.com>,
	"syzbot+6af973a3b8dfd2faefdc@...kaller.appspotmail.com" <syzbot+6af973a3b8dfd2faefdc@...kaller.appspotmail.com>,
	"syzkaller-bugs@...glegroups.com" <syzkaller-bugs@...glegroups.com>
Subject: Re: [PATCH V5] loop: Add sanity check for read/write_iter

On Tue, May 20, 2025 at 02:46:22PM +0200, Christian Hesse wrote:
> "Xu, Lizhi" <Lizhi.Xu@...driver.com> on Tue, 2025/05/20 12:27:
> > If it is a regular file, generic_ro_fops is used. In this case,
> > isofs supports read_iter. When a regular file has a writable attribute,
> 
> Just tested with an iso file where writable flag from loopback file inside
> was explicitly removed. No change.
> 
> > the problem will recur because isofs does not support write_iter.
> 
> We have two indications here that setup should happen in read-only mode:
> 
> * The underlaying filesystem is read-only
> * `losetup` is called with switch `--read-only`
> 
> I would expect both to make this happy.

Can you test this patch?

We historically allow a writable fd on block devices even when they
are read-only.  I suspect your use case is doing that and the new
check for write_iter is interfering with that:


diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index b8ba7de08753..e2b1f377f585 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -979,9 +979,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
 	if (!file)
 		return -EBADF;
 
-	if ((mode & BLK_OPEN_WRITE) && !file->f_op->write_iter)
-		return -EINVAL;
-
 	error = loop_check_backing_file(file);
 	if (error)
 		return error;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ