#1012298 linux-image-5.17.0-1-amd64: New partition doesn't appear in /dev anymore with kernel 5.17 (repro script included)

Package:
src:linux
Source:
linux
Submitter:
Michael Schaller
Date:
2022-06-06 20:30:08 UTC
Severity:
normal
Tags:
#1012298#5
Date:
2022-06-03 07:47:39 UTC
From:
To:
Dear Maintainer,

We're using an image build setup to create raw disk images that contain an EFI System Partition (ESP) with a small live Linux system.
The image build process started to fail after upgrading to kernel 5.17 as the newly created ESP (created with parted) doesn't appear automatically in /dev anymore.
We've added a partscan run to our image build setup but that didn't fix the issue. So far only downgrading to kernel 5.16 fixes the issue.

So we would kindly ask for help with troubleshooting this issue.
Please see the attached repro.sh for a minimal Bash script the reproduces the issue.

Best,

Michael Schaller


Reproduction instructions:
--------------------------
1) Install Debian testing (I did a fresh install in a VM)
2) apt install parted dosfstools
3) Edit /etc/apt/sources.list and add this new source to be able to install the last 5.16 kernel:
   deb [check-valid-until=no] https://snapshot.debian.org/archive/debian/20220407T025351Z/ testing main
4) apt install linux-image-5.16.0-6-amd64  (and headers if you need them on your system)
5) Reboot into the 5.16 and 5.17 kernel respectively and run repro.sh.


Results:
--------

Kernel 5.17:
------------

$ uname -r
5.17.0-1-amd64


$ sudo ./repro.sh
...
+ parted -s /dev/loop0 mklabel gpt
+ parted -s /dev/loop0 mkpart primary fat32 1MiB 100%
+ parted -s /dev/loop0 set 1 boot on
+ partprobe /dev/loop0
+ mkfs.vfat /dev/loop0p1
mkfs.fat 4.2 (2021-01-31)
mkfs.vfat: unable to open /dev/loop0p1: No such file or directory
...


Kernel 5.16:
------------

$ uname -r
5.16.0-6-amd64


$ sudo ./repro.sh
...
+ parted -s /dev/loop0 mklabel gpt
+ parted -s /dev/loop0 mkpart primary fat32 1MiB 100%
+ parted -s /dev/loop0 set 1 boot on
+ partprobe /dev/loop0
+ mkfs.vfat /dev/loop0p1
mkfs.fat 4.2 (2021-01-31)
...

#1012298#10
Date:
2022-06-03 07:53:41 UTC
From:
To:
Note that on kernel 5.17 we also see this error in the kernel log:
[   24.206158] I/O error, dev loop0, sector 32640 op 0x0:(READ) flags
0x80700 phys_seg 1 prio class 0

#1012298#15
Date:
2022-06-03 11:58:03 UTC
From:
To:
I've tested some vanilla stable kernels (without Debian patches) and
can confirm that 5.17.0 and 5.18.1 (latest) are affected. Kernel
5.16.18 isn't affected.

I then did a git bisect as outlined in
https://wiki.debian.org/DebianKernel/GitBisect and that pointed
towards this commit as the first bad commit:
https://github.com/torvalds/linux/commit/1ebe2e5f9d68e94c524aba876f27b945669a7879

#1012298#20
Date:
2022-06-03 12:52:23 UTC
From:
To:
#1012298#25
Date:
2022-06-03 13:02:00 UTC
From:
To:
Control: tag -1 upstream

https://lore.kernel.org/all/20211122130625.1136848-12-hch@lst.de/ is linked in
that commit and a recent reply points to sth similar as you see:
https://lore.kernel.org/all/Yo4+zEnrBTnoEMCz@T590/

If you agree, then it seems to me that the best course of action seems
to get involved in that discussion.

#1012298#32
Date:
2022-06-03 13:24:15 UTC
From:
To:
I agree. I've tested patch
https://lore.kernel.org/r/20220527055806.1972352-1-hch@lst.de and it
fixes the issue.
However the patch doesn't cleanly apply to 5.18.1 and so I've
requested a backport to 5.17 and 5.18.

#1012298#37
Date:
2022-06-03 15:34:39 UTC
From:
To:
Control: forwarded -1 https://lore.kernel.org/linux-block/CALt099JajMVCwHgdRdRSF1uhNC=EO+tTq4T4Bg8QDwUO3uX83w@mail.gmail.com/T/#u

I've made an attempt at backporting it to 5.18.1 and now 'debian/rules orig'
succeeds. I have not tried building a (Debian) kernel with it or verified that
it also fixes the issue with a 5.18.1 kernel.

#1012298#44
Date:
2022-06-03 17:25:47 UTC
From:
To:
This ought to use "--partscan".  Otherwise your device is not partioned.

Bastian

#1012298#51
Date:
2022-06-06 20:10:09 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
linux, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1012298@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Salvatore Bonaccorso <carnil@debian.org> (supplier of updated linux package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Mon, 06 Jun 2022 20:45:23 +0200
Source: linux
Architecture: source
Version: 5.18.2-1
Distribution: unstable
Urgency: medium
Maintainer: Debian Kernel Team <debian-kernel@lists.debian.org>
Changed-By: Salvatore Bonaccorso <carnil@debian.org>
Closes: 927252 1008933 1011168 1012298
Changes:
 linux (5.18.2-1) unstable; urgency=medium
 .
   * New upstream stable update:
https://www.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.18.1
https://www.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.18.2
     - netfilter: nf_tables: disallow non-stateful expression in sets earlier
       (CVE-2022-1966)
     - pipe: Fix missing lock in pipe_resize_ring() (ZDI-CAN-17291)
     - netfilter: nf_tables: sanitize nft_set_desc_concat_parse() (CVE-2022-1972)
     - [x86] fpu: KVM: Set the base guest FPU uABI size to sizeof(struct
       kvm_xsave) (Closes: #1011168)
     - KVM: x86: avoid calling x86 emulator without a decoded instruction
       (CVE-2022-1852)
 .
   [ Diederik de Haas ]
   * [arm64,armel.marvell] Remove duplicate MTD_SPI_NOR config option
   * [arm64] Remove duplicate CAN_MCP251X config option
   * drivers/net/can/spi: Enable CAN_HI311X as module (Closes: #927252)
 .
   [ Henning Schild ]
   * [x86] drivers/platform/x86: Enable SIEMENS_SIMATIC_IPC as module
   * [x86] drivers/leds: Enable LEDS_SIEMENS_SIMATIC_IPC as module
   * [x86] drivers/wdt: Enable SIEMENS_SIMATIC_IPC_WDT as module
 .
   [ Lubomir Rintel ]
   * [x86] Enable X86_ANDROID_TABLETS as a module
 .
   [ Michal Simek ]
   * [arm64] Enable Xilinx PHY driver and SI5341 clock driver
 .
   [ Zhang Ning ]
   * [arm64] Enable COMMON_CLK_PWM which is needed for some Amlogic SBCs
   * [arm64] Enable Khadas MCU and fan
   * [arm64] cpufreq: Enable SCPI cpufreq driver
   * [arm64] cpuidle: Enable CONFIG_ARM_PSCI_CPUIDLE
 .
   [ Ben Hutchings ]
   * drivers/firmware: Build ISCSI_IBFT as module on all architectures with
     ACPI. Thanks to Eric Mackay. (Closes: #1008933).
   * intel-iommu: Correct matching of the "intgpu_off" option value.
     Thanks to Markus Kolb.
   * random: Enable RANDOM_TRUST_BOOTLOADER. This can be reverted using the
     kernel parameter: random.trust_bootloader=off
 .
   [ Bastian Blank ]
   * [amd64] Enable X86_SGX.
 .
   [ Salvatore Bonaccorso ]
   * block, loop: support partitions without scanning (Closes: #1012298)
   * Set ABI to 1
Checksums-Sha1:
 bbc978531c7e2163a2289e3e0bc99e99839401a1 251540 linux_5.18.2-1.dsc
 a90a7730fbeee7e645054ece183fe17531c97120 131643692 linux_5.18.2.orig.tar.xz
 e0619b35776f131e195dac987f6b40cdd3444646 1309660 linux_5.18.2-1.debian.tar.xz
 65338b5ed8b7d44ad3a7ab4f0fb6e4cb319f9f67 6456 linux_5.18.2-1_source.buildinfo
Checksums-Sha256:
 fbff0455062e7392458992cbff2373f61b7c0073fb5ef4749c4b5ded3ae19cb8 251540 linux_5.18.2-1.dsc
 1f38e1d57100000738cefce48a6e0793f40ea3483673400b66a6608548813637 131643692 linux_5.18.2.orig.tar.xz
 42fadd9251319aa9be5970d2b1379406411672fba4f6d91fa493593a8a12fa2f 1309660 linux_5.18.2-1.debian.tar.xz
 b2653b3570fdda4bdff0138158a0e47449aba949a4089a31bc6342a280a13611 6456 linux_5.18.2-1_source.buildinfo
Files:
 74154bc9d12f3b4eb0c84e95f6a9fb6f 251540 kernel optional linux_5.18.2-1.dsc
 382bb41286c2d066099a85868ade9414 131643692 kernel optional linux_5.18.2.orig.tar.xz
 421f4510eb8c14390b1dfdf29134c435 1309660 kernel optional linux_5.18.2-1.debian.tar.xz
 2de951e2c66717a70faa5ee66660db8d 6456 kernel optional linux_5.18.2-1_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQKmBAEBCgCQFiEERkRAmAjBceBVMd3uBUy48xNDz0QFAmKeS+xfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDQ2
NDQ0MDk4MDhDMTcxRTA1NTMxRERFRTA1NENCOEYzMTM0M0NGNDQSHGNhcm5pbEBk
ZWJpYW4ub3JnAAoJEAVMuPMTQ89EaC0P/RG4h3wXhJLuHkx+lREXUpG7T4xcivco
rfxGqun9FJxVOEAnbkzdUH4aDvUNJ83/sH+1k1kUYpjyzp+6hiiPkRUd1WJYmlXf
sVvkWJIs25yxNtzCeLm419vPwS2gMCnLgg/WjsLr2Yl59ef/KIedxDDzdcdYBigG
D6yR7ecIRAq1Fuiuv1YcpEUb+TC1TwF1mjiOTOkyqCyR+4Bi9/Lg1GoTIzDfhqUe
K4As4o7XU85c/bACc/UoVrtOWLE+hQ7X9tZWOfr8CKLEOyy+pDO2GJPmUcLLpl0C
5qcz44+gQigWXMuZ1cG2cN8L8By5hJWKGBb9ny471ElPz4/x/GynHyRz6hVoaeet
1Pgyexi4Rcoc1CzLP+iDCMwowBP6PBSWFc/yj8/76wcgx1h6XlKJwNMMTOG0SCCO
WbijgEaTgSD3f/JpB7PK9i6lfnCk8PgQXsgP2Njq8ngnLBylqFZMfyX2Mu/BChzA
Nozi5zoVDqAmMvtyb5tywkdzXRYtrU8flMKCtxhi5KKmRJZYMGV4HB8nv6TY6f6f
lGLPIS4H7MQaoUiQOVfMGALEF1JKm7IHaNdVadGQNV5NBXr2ksUFv+jPqQVQE1WN
VtEtV1F63MlbLyh0ZTkF2LUHUCXS5pxhcuPYST4u4f2/mJvzzSo/syMf6xB7byxA
DMFKZchdKO03
=P5yF
-----END PGP SIGNATURE-----