Hello,
I discovered a bug in UUID detection of LUKS encrypted partitions. The
function volume_id_get_buffer() expects the number of bytes but the
number of sectors is passed (util-linux/volume_id/luks.c). Only 2 bytes
were read instead of the whole LUKS header. Patch is attached.
The second discovered issue is the overoptimistic approach used in UUID
detection on fat partitions. It fails on my 2 USB flash sticks (FAT32).
Both sticks seem to be ok for other utilities not based on busybox.
The problem was found at util-linux/volume_id/fatc:291
(volume_id_get_buffer()) where the offset off+next_off can point out of
the partition. It is caused either by the misinterpretation of the
cluster data or cluster corruption. As a result, the xlseek() function
at /util-linux/volume_id/util.c:237 exits the program.
BTW it is not good approach to exit the program because of the wrong
lseek parameter. Due to lack of time, it is not possible to investigate
this thing in detail. I just disabled UUID check on FAT partitions
(CONFIG_FEATURE_VOLUME_ID_FAT) as a hot fix. This works perfectly for my
purpose. Anyway, FAT32 UUID detection seems to be broken.
---
Michal Toman
diff -u -U 2 -r -N -d busybox-1.12.0/util-linux/volume_id/luks.c
busybox-1.12.0-fixed/util-linux/volume_id/luks.c
--- busybox-1.12.0/util-linux/volume_id/luks.c 2008-08-06 00:56:12.000000000
+0200
+++ busybox-1.12.0-fixed/util-linux/volume_id/luks.c 2008-10-10
02:30:24.000000000 +0200
@@ -20,9 +20,6 @@
#include "volume_id_internal.h"
-#define SECTOR_SHIFT 9
-#define SECTOR_SIZE (1 << SECTOR_SHIFT)
-
#define LUKS_CIPHERNAME_L 32
#define LUKS_CIPHERMODE_L 32
#define LUKS_HASHSPEC_L 32
@@ -32,7 +29,7 @@
static const uint8_t LUKS_MAGIC[] = { 'L','U','K','S', 0xba, 0xbe };
#define LUKS_MAGIC_L 6
-#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1)
+#define LUKS_PHDR_SIZE sizeof(struct luks_phdr)
#define UUID_STRING_L 40
struct luks_phdr {
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox