libblkid: udf superblock does not read correctly when blocksize < 2048

Bug #1164683 reported by Jim Trigg on 2013-04-04
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Util-Linux-ng
Fix Released
Unknown
util-linux (Ubuntu)
Medium
Jim Trigg
Precise
Undecided
Unassigned
Quantal
Undecided
Unassigned
Raring
Low
Unassigned
Saucy
Medium
Jim Trigg

Bug Description

[Impact]

 * udf filesystems with blocksize < 2048 will not automount at startup.
 * udf filesystems with blocksize < 2048 will not show or be mounted by volume label (vid).

[Test Case]

Install udftools and create udf file system with volume id and blocksize < 2048:

"sudo mkudffs -b 512 --vid=space /dev/sdb1"

Run blkid on device: "sudo blkid /dev/sdb1"

Without patch, output will be 'TYPE="udf"'. With patch, output will be 'TYPE="udf" LABEL="space"'.

Add /dev/sdb1 to /etc/fstab. Without patch, file system will fail to mount at boot; with patch, file system will mount at boot.

Add LABEL=space to /etc/fstab. Without patch, file system will fail to mount; with patch, file system will mount.

[Regression Potential]

* This issue has been identified upstream and a patch is available (git commit 5a45eb2d2c70dc7ea2ff4c7b56ab8dba2780f033 in karelzak/util-linux).

Related branches

Jim Trigg (jtrigg) wrote :
Download full text (3.4 KiB)

diff --git a/AUTHORS b/AUTHORS
index f29f9a3..54fe7ce 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -385,5 +385,6 @@ CONTRIBUTORS:
       Yoshihiro Takahashi <email address hidden>
       Yuri Chornoivan <email address hidden>
       Yu Zhiguo <email address hidden>
+ Zachary Catlin <email address hidden>
       Zdenek Behan <email address hidden>
       Zhi Li <email address hidden>
diff --git a/libblkid/src/superblocks/udf.c b/libblkid/src/superblocks/udf.c
index 2cb471d..c9fb022 100644
--- a/libblkid/src/superblocks/udf.c
+++ b/libblkid/src/superblocks/udf.c
@@ -64,17 +64,25 @@ static int probe_udf(blkid_probe pr,
        struct volume_descriptor *vd;
        struct volume_structure_descriptor *vsd;
        unsigned int bs;
+ unsigned int pbs[2];
        unsigned int b;
        unsigned int type;
        unsigned int count;
        unsigned int loc;
+ unsigned int i;

- /* search Volume Sequence Descriptor (VSD) to get the logical
- * block size of the volume */
- for (bs = 0x800; bs < 0x8000; bs += 0x800) {
+ /* The block size of a UDF filesystem is that of the underlying
+ * storage; we check later on for the special case of image files,
+ * which may have the 2048-byte block size of optical media. */
+ pbs[0] = blkid_probe_get_sectorsize(pr);
+ pbs[1] = 0x800;
+
+ /* check for a Volume Structure Descriptor (VSD); each is
+ * 2048 bytes long */
+ for (b = 0; b < 0x8000; b += 0x800) {
                vsd = (struct volume_structure_descriptor *)
                        blkid_probe_get_buffer(pr,
- UDF_VSD_OFFSET + bs,
+ UDF_VSD_OFFSET + b,
                                        sizeof(*vsd));
                if (!vsd)
                        return 1;
@@ -88,7 +96,7 @@ static int probe_udf(blkid_probe pr,
        for (b = 0; b < 64; b++) {
                vsd = (struct volume_structure_descriptor *)
                        blkid_probe_get_buffer(pr,
- UDF_VSD_OFFSET + ((blkid_loff_t) b * bs),
+ UDF_VSD_OFFSET + ((blkid_loff_t) b * 0x800),
                                        sizeof(*vsd));
                if (!vsd)
                        return -1;
@@ -102,17 +110,24 @@ static int probe_udf(blkid_probe pr,
        return -1;

 anchor:
- /* read Anchor Volume Descriptor (AVDP) */
- vd = (struct volume_descriptor *)
- blkid_probe_get_buffer(pr, 256 * bs, sizeof(*vd));
- if (!vd)
- return -1;
-
- type = le16_to_cpu(vd->tag.id);
- if (type != 2) /* TAG_ID_AVDP */
- return 0;
+ /* read Anchor Volume Descriptor (AVDP), checking block size */
+ for (i = 0; i < 2; i++) {
+ vd = (struct volume_descriptor *)
+ blkid_probe_get_buffer(pr, 256 * pbs[i], sizeof(*vd));
+ if (!vd)
+ return -1;
+
+ type = le16_to_cpu(vd->tag.id);
+ if (type == 2) /* TAG_ID_AVDP */
+ goto real_blksz;
+ }
+ return 0;
+
+real_blksz:
+ /* Use t...

Read more...

Jim Trigg (jtrigg) on 2013-04-16
Changed in util-linux (Ubuntu):
assignee: nobody → Jim Trigg (jtrigg)
status: New → Fix Committed
tags: added: precise quantal raring
Changed in util-linux (Ubuntu):
status: Fix Committed → Confirmed
importance: Undecided → Medium
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in util-linux (Ubuntu Precise):
status: New → Confirmed
Changed in util-linux (Ubuntu Quantal):
status: New → Confirmed
Changed in util-linux (Ubuntu Raring):
status: New → Confirmed
Michael Terry (mterry) wrote :

Uploaded patch to saucy, thanks Jim!

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package util-linux - 2.20.1-5.1ubuntu9

---------------
util-linux (2.20.1-5.1ubuntu9) saucy; urgency=low

  * Apply upstream patch for udf bug when blocksize < 2048 (LP: #1164683)
 -- Jim Trigg (jktrigg) <email address hidden> Thu, 04 Apr 2013 15:42:05 -0400

Changed in util-linux (Ubuntu Saucy):
status: Confirmed → Fix Released
description: updated
Changed in util-linux (Ubuntu Raring):
importance: Undecided → Low
status: Confirmed → In Progress

Hello Jim, or anyone else affected,

Accepted util-linux into raring-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/util-linux/2.20.1-5.1ubuntu8.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in util-linux (Ubuntu Raring):
status: In Progress → Fix Committed
Jim Trigg (jtrigg) wrote :

Since I provided the fix after testing it, testing it again myself seems rather redundant...

Scott Kitterman (kitterman) wrote :

Someone has to test it and you testing it again does verify the patch was applied correctly, the packages built correctly, etc.

The fix for this bug has been awaiting testing feedback in the -proposed repository for raring for more than 90 days. Please test this fix and update the bug appropriately with the results. In the event that the fix for this bug is still not verified 15 days from now, the package will be removed from the -proposed repository.

tags: added: removal-candidate
Pali (pali) wrote :

Can you backport this patch to lts precise release?

Changed in util-linux-ng:
status: Unknown → New
Pali (pali) wrote :

@Jim Trigg, @Brian Murray: BUMP, can you backport this patch to lts precise?

Changed in util-linux-ng:
status: New → Confirmed
Phillip Susi (psusi) wrote :

Raring is now eol.

Changed in util-linux (Ubuntu Raring):
status: Fix Committed → Won't Fix
Pali (pali) wrote :

@Phillip Susi: Any news for precise?

Pali (pali) wrote :

BUMP!

Pali (pali) wrote :
Marc Deslauriers (mdeslaur) wrote :

The merge request looks good. ACK. Uploaded for processing by the SRU team. Thanks!

Changed in util-linux (Ubuntu Quantal):
status: Confirmed → Won't Fix
Changed in util-linux (Ubuntu Precise):
status: Confirmed → In Progress
Pali (pali) wrote :

@Marc Deslauriers (mdeslaur): When will be package in precise archive?

Hello Jim, or anyone else affected,

Accepted util-linux into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/util-linux/2.20.1-1ubuntu3.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in util-linux (Ubuntu Precise):
status: In Progress → Fix Committed
Pali (pali) wrote :

Now I tested new version from ubuntu precise proposed repository and it fixing this bug.

UDF filesystem created by mkudffs -b 512 has correct LABEL in blkid output.

tags: added: verification-done
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package util-linux - 2.20.1-1ubuntu3.1

---------------
util-linux (2.20.1-1ubuntu3.1) precise; urgency=low

  * Correctly read udf label with blocksize < 2048 (LP: #1164683)
 -- Pali Rohar <email address hidden> Wed, 28 May 2014 15:06:34 +0200

Changed in util-linux (Ubuntu Precise):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for util-linux has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Changed in util-linux-ng:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.