public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Salvatore Bonaccorso <carnil@debian.org>
To: Roland Clobus <rclobus@rclobus.nl>,
	Lizhi Xu <lizhi.xu@windriver.com>, Christoph Hellwig <hch@lst.de>,
	Jens Axboe <axboe@kernel.dk>
Cc: 1106070@bugs.debian.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	regressions@lists.linux.dev
Subject: [6.12.y regression] loosetup: failed to set up loop device: Invalid argument after 184b147b9f7f ("loop: Add sanity check for read/write_iter")
Date: Tue, 20 May 2025 07:57:31 +0200	[thread overview]
Message-ID: <aCwZy6leWNvr7EMd@eldamar.lan> (raw)
In-Reply-To: <3a333f27-6810-4313-8910-485df652e897@rclobus.nl>

Hi

In Debian Roland Clobus reported a regression with setting up loop
devices from a backing squashfs file lying on read-only mounted target
directory from a iso.

The original report is at:
https://bugs.debian.org/1106070

Quoting the report:

On Mon, May 19, 2025 at 12:15:10PM +0200, Roland Clobus wrote:
> Package: linux-image-6.12.29-amd64
> Version: 6.12.29-1
> Severity: important
> X-Debbugs-Cc: debian-amd64@lists.debian.org
> User: debian-amd64@lists.debian.org
> Usertags: amd64
> X-Debbugs-Cc: phil@hands.com
> User: debian-qa@lists.debian.org
> Usertags: openqa
> X-Debbugs-Cc: debian-boot
> 
> Hello maintainers of the kernel,
> 
> The new kernel (6.12.29) has a modified behaviour (compared to 6.12.27) for
> the loop device.
> 
> This causes the Debian live images (for sid) to fail to boot.
> 
> The change happened between 20250518T201633Z and 20250519T021902Z, which
> matches the upload of 6.12.29 (https://tracker.debian.org/news/1646619/accepted-linux-signed-amd64-612291-source-into-unstable/)
> at 20250518T230426Z.
> 
> To reproduce:
> * Download the daily live image from https://openqa.debian.net/tests/396941/asset/iso/smallest-build_sid_20250519T021902Z.iso
> * Boot into the live image (the first boot option)
> * Result: an initramfs shell (instead of a live system) -> FAIL
> * Try: `losetup -r /dev/loop1 /run/live/medium/live/filesystem.squashfs`
> * Result: `failed to set up loop device: invalid argument` -> FAIL
> * Try: `cp /run/live/medium/live/filesystem.squashfs /`
> * Try: `losetup -r /dev/loop2 /filesystem.squashfs`
> * Result: `loop2: detected capacity change from 0 to 1460312` -> PASS
> 
> It appears that the loopback device cannot be used any more with the mount
> /run/live/medium (which is on /dev/sr0).
> 
> I've verified: the md5sum of the squashfs file is OK.
> 
> The newer kernel is not in trixie yet.
> 
> With kind regards,
> Roland Clobus

A short reproducer is as follows:

iso="netinst.iso"
url="https://openqa.debian.net/tests/396941/asset/iso/smallest-build_sid_20250519T021902Z.iso"
if [ ! -e "${iso}" ]; then
        wget "${url}" -O "${iso}"
fi
mountdir="$(mktemp -d)"
mount -v "./${iso}" "${mountdir}"
losetup -v -r -f "${mountdir}/live/filesystem.squashfs"
loosetup -l

resulting in:

mount: /tmp/tmp.HgbNe7ek3h: WARNING: source write-protected, mounted read-only.
mount: /dev/loop0 mounted on /tmp/tmp.HgbNe7ek3h.
losetup: /tmp/tmp.HgbNe7ek3h/live/filesystem.squashfs: failed to set up loop device: Invalid argument
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE         DIO LOG-SEC
/dev/loop0         0      0         1  0 /root/netinst.iso   0     512

Reverting 184b147b9f7f ("loop: Add sanity check for read/write_iter")
on top of 6.12.29 fixes the issue:

mount: /tmp/tmp.ACkkdCdYvB: WARNING: source write-protected, mounted read-only.
mount: /dev/loop0 mounted on /tmp/tmp.ACkkdCdYvB.
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                                    DIO LOG-SEC
/dev/loop1         0      0         0  1 /tmp/tmp.ACkkdCdYvB/live/filesystem.squashfs   0     512
/dev/loop0         0      0         1  0 /root/netinst.iso                              0     512

For completeness, netinst.iso is a iso9660 fstype with mount options
"ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8".

#regzbot introduced: 184b147b9f7f
#regzbot link: https://bugs.debian.org/1106070

Regards,
Salvatore

       reply	other threads:[~2025-05-20  6:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3a333f27-6810-4313-8910-485df652e897@rclobus.nl>
2025-05-20  5:57 ` Salvatore Bonaccorso [this message]
2025-05-20  6:10   ` [6.12.y regression] loosetup: failed to set up loop device: Invalid argument after 184b147b9f7f ("loop: Add sanity check for read/write_iter") Salvatore Bonaccorso
2025-05-20  6:34   ` Christian Hesse
2025-05-20  7:16     ` Salvatore Bonaccorso
2025-05-20 15:23   ` Jens Axboe

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=aCwZy6leWNvr7EMd@eldamar.lan \
    --to=carnil@debian.org \
    --cc=1106070@bugs.debian.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhi.xu@windriver.com \
    --cc=rclobus@rclobus.nl \
    --cc=regressions@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    /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