[Bug 1831] New: Incorrect label/uuid may be returned for swap partitions

bugzilla at busybox.net bugzilla at busybox.net
Mon May 24 13:37:49 UTC 2010


           Summary: Incorrect label/uuid may be returned for swap
           Product: Busybox
           Version: 1.16.x
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: fktpa813 at gmail.com
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0

Created attachment 1771
  --> https://bugs.busybox.net/attachment.cgi?id=1771
Suggested patch

Function volume_id_probe_all() may return incorrect label/uuid for a swap
partition if that partition was previously formatted as vfat (and possibly as
xfs and mac partition as well - but I tested it with vfat only).
This affects all applets using resolve_mount_spec() - blkid, swapon, mount etc.

To reproduce the issue, format partition as vfat, give it a label, and then
convert it to a swap partition using Busybox' mkswap applet with -L option to
assign a different label. Run "blkid" and notice that the old label from vfat
partition is displayed, along with the old uuid.

This happens because mkswap does not zero out the first 1024 bytes of partition
header, leaving information from the previous partition. But
volume_id_probe_all() probes for fat, xfs, and mac partition first - before
trying swap header - and picks up the wrong label/uuid.

The easiest way to fix it is to combine fs1 and fs2 arrays in volume_id.c into
a single array (as in the attached patch) making sure the
volume_id_probe_linux_swap() is called first. However, that removes the small
memory usage optimization from volume_id_probe_all() - possibly you can come up
with a better alternative.

Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the busybox-cvs mailing list