RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2120697 - ATA Secure Erase option of the Format() method requested on a partition performs erase on whole drive
Summary: ATA Secure Erase option of the Format() method requested on a partition perfo...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: udisks2
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Tomáš Bžatek
QA Contact: guazhang@redhat.com
URL:
Whiteboard:
Depends On: 2120329
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-23 14:48 UTC by Tomáš Bžatek
Modified: 2023-05-16 08:53 UTC (History)
1 user (show)

Fixed In Version: udisks2-2.9.0-11.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 2120329
Environment:
Last Closed: 2023-05-16 08:16:20 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-132001 0 None None None 2022-08-23 14:50:20 UTC
Red Hat Product Errata RHBA-2023:2754 0 None None None 2023-05-16 08:16:26 UTC

Description Tomáš Bžatek 2022-08-23 14:48:00 UTC
+++ This bug was initially created as a clone of Bug #2120329 +++

Upstream issue: https://github.com/storaged-project/udisks/issues/977

Description of problem:
ATA Secure Erase option of the Format() method requested on a partition performs erase on whole drive. The missing check causes data loss of all other partitions without warning.

Version-Release number of selected component (if applicable):
all


Steps to Reproduce:
1. Find a drive that supports ATA Secure Erase - verify e.g. by `hdparm -I /dev/sdX` and look for 
>  supported: enhanced erase
>  324min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.

2. Create several partitions on the drive + mkfs on some
3. Mount one of them
4. Use UDisks to format some other one:
> # gdbus call --system --dest org.freedesktop.UDisks2 --object-path /org/freedesktop/UDisks2/block_devices/sdf2 --method org.freedesktop.UDisks2.Block.Format -- ext4 '{"label":<"XXX">, "erase":<"ata-secure-erase-enhanced">}'
> Error: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error erasing device: Error opening device file /dev/sdf for secure erase: Device or resource busy
5. Unmount that one
6. Try again ... BOOM

Actual results:
> # gdbus call --system --dest org.freedesktop.UDisks2 --object-path /org/freedesktop/UDisks2/block_devices/sdf2 --method org.freedesktop.UDisks2.Block.Format -- ext4 '{"label":<"XXX">, "erase":<"ata-secure-erase-enhanced">}'
> Error: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error creating file system: Command-line `mkfs.ext4 -F -L 'XXX'  '/dev/sdf2'' exited with non-zero exit status 1: mke2fs 1.46.5 (30-Dec-2021)
> The file /dev/sdf2 does not exist and no size was specified.

Observe that all the data are erased and no partition table nor any partitions exist on the device.


Expected results:
An error message when ATA Secure Erase is requested on a partition, preventing loss of data. No error when requested on a whole block device.

Tested with the upstream fix applied:

> # gdbus call --system --dest org.freedesktop.UDisks2 --object-path /org/freedesktop/UDisks2/block_devices/sdf2 --method org.freedesktop.UDisks2.Block.Format -- ext4 '{"label":<"BOOM">, "erase":<"ata-secure-erase-enhanced">}'
> Error: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error erasing device: ATA secure erase needs to be performed on a whole block device

> # gdbus call --system --dest org.freedesktop.UDisks2 --object-path /org/freedesktop/UDisks2/block_devices/sdf --method org.freedesktop.UDisks2.Block.Format -- ext4 '{"label":<"BOOM">, "erase":<"ata-secure-erase-enhanced">}'
> ()
> # blkid /dev/sdf
> /dev/sdf: LABEL="BOOM" UUID="3434cdc4-7cce-4bd2-b8f0-410eaa8b3c45" BLOCK_SIZE="4096" TYPE="ext4"

Comment 3 guazhang@redhat.com 2022-09-27 00:49:33 UTC
No new issue found for the fixed package, so move to verified.

Comment 5 errata-xmlrpc 2023-05-16 08:16:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (udisks2 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2754


Note You need to log in before you can comment on or make changes to this bug.