Skip to content
Commit 362b2db3 authored by Mike Fleetwood's avatar Mike Fleetwood Committed by Curtis Gedak
Browse files

Check disks named on the command line are safe to use too (#755495)

When probing for disk devices GParted ensures that libparted is capable
of handling the sector size safely and that it is a real disk before it
is shown in the UI.  However when disk devices are named on the command
line none of these checks are performed.

Libparted versions before v2.2 can only safely handle a sector size of
512 bytes.  Therefore on old distributions with libparted < v2.2 GParted
allows unsafe editing of disk devices with larger sector sizes when they
are named on the command line.  Known to affect these distributions:
    RedHat/CentOS 5   (parted 1.8.1)
    RedHat/CentOS 6   (parted 2.1)

For example (on CentOS 6.5) large sector disk device is ignored when
probing:

    # modprobe scsi_debug dev_size_mb=128 sector_size=4096
    # fgrep scsi_debug /sys/block/*/device/model
    /sys/block/sdd/device/model:scsi_debug

    # gparted
    ======================
    libparted : 2.1
    ======================
    Device /dev/sdd has a logical sector size of 4096.  Not all parts of
    GNU Parted support this at the moment, and the working code is
    HIGHLY EXPERIMENTAL.

    Ignoring device /dev/sdd with logical sector size of 4096 bytes.
    GParted requires libparted version 2.2 or higher to support devices
    with sector sizes larger than 512 bytes.

However when the device is named it is not ignored and can be edited:

    # gparted /dev/sdd
    ======================
    libparted : 2.1
    ======================
    Device /dev/sdd has a logical sector size of 4096.  Not all parts of
    GNU Parted support this at the moment, and the working code is
    HIGHLY EXPERIMENTAL.

    /dev/sdd: unrecognised disk label

Apply the same validity checks to disk devices named on the command line
as to probed ones.

Bug 755495 - GParted allowing partitioning of large sector devices
             specified on the command line, when built with old
             libparted which doesn't support it
parent 037020b1
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment