Package: partman-auto
Version: 179

Dear maintainers,

Commit 7dfd6208 ("don't hide /dev/md* arrays if they are provisioned on whole-disk devices - in that case the md array itself is partitionable, e.g. for md-fakeraid like imsm (Intel Matrix raid). (Closes: #699431)") was intended to enable automatic partitioning on Intel Matrix fakeRAID and keep disabling it on standard Linux md RAID. But it actually allows almost any md RAID array.

[1] <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699431>
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699430>

The main logic is implemented in the following function:

is_wholedisk_mdraid () {
        local device="`echo $1 | sed -e 's!/\([0-9]*\)$!\1!'`"
        local mddisk=${device#/dev/}
        local ret=0
        local d

        [ -d /sys/block/$mddisk/md ] || return 1

        for d in /sys/block/$mddisk/slaves/*; do
                case "$d" in
                        dm-*|md*)
                                ;;
                        *p[0-9]|*p[0-9][0-9])
                                ret=1
                                break
                                ;;
                esac
        done

        return $ret
}

1) `/sys/block/$mddisk/slaves/*` cannot match `dm-*|md*`. Besidses IIUC it would allow RAID over RAID, LVM or dm-crypt devices, so what is the point of this check ?

2) `*p[0-9]|*p[0-9][0-9]` is intended to match partitions, but it actually matches only partitions on devices whose node names end with a digit (e.g. nvme or mmcblk) and have 'p' before the partition number. So it does not match on SCSI-like (ATA, USB) drives.

3) RAID members not being partitions does not even guarantee that the array is fakeRAID. Standard Linux md RAID can use whole unpartitioned drives as members too. Automatic partitioning on such layout may result in an unbootable system for both EFI (UEFI firmware cannot read the EFI partition on Linux md RAID) and BIOS (GRUB may fail to install).

AFAIK d-i no longer supports fakeRAID with dm-raid and supports only Intel Matrix RAID (IMSM) with md-raid. Is Intel Matrix RAID still used and should it be supported by d-i ?

If yes, is_wholedisk_mdraid() should be replaced with a proper detection of IMSM RAID arrays.

If no, either the above commit should be reverted in order to skip any md RAID array, or any md RAID array should be allowed under the user's responsibility (possibly resulting in an unbootable system).

Opinions ?

Reply via email to