[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#403426: linux-image-2.6.18-3-ixp4xx: kernel corrupts LUKS partition header on arm NSLU2



Package: linux-image-2.6.18-3-ixp4xx
Version: 2.6.18-8
Severity: critical
Justification: causes serious data loss


This is on an NSLU2, I wanted to use it to access some disks that I
had used previously on another system that had encrypted partitons.
However, when I tried cryptsetup luksOpen, I got a automatic header
conversion from 0.99 to 0.991 triggered message, and then an infinite
loop. Trying the same partition on the other system, now I get the
same thing - its header is corrupted. Luckily, I'm paranoid and had a
backup of the LUKS header! If I didn't have this, the whole
partition's data would probably be lost.

Here's the result of some tests - and its stranger than you think...

Used cryptsetup luksFormat on another system to set up a partition..

LKG8A754B:~# uname -a
Linux LKG8A754B 2.6.18-3-ixp4xx #1 Mon Dec 11 17:20:00 UTC 2006 armv5tel GNU/Linux

!!! ... after some experiments corrupting it... now I restore it again
and decide to strace things... !!!

LKG8A754B:~# dd < sde4-luks-header-backup  > /dev/sde4
150+0 records in
150+0 records out
76800 bytes (77 kB) copied, 0.0148216 seconds, 5.2 MB/s
LKG8A754B:~# strace 2>trace cryptsetup luksOpen /dev/sde4 sde4
Enter LUKS passphrase: 
key slot 0 unlocked.

!!! Hey, that just worked !!!

LKG8A754B:~# ls -l /dev/mapper/sde4
brw-rw---- 1 root disk 254, 0 Dec 17 02:00 /dev/mapper/sde4
LKG8A754B:~# cmp -l /dev/sde4 sde4-luks-header-backup 
cmp: EOF on sde4-luks-header-backup

!!! But: !!!

LKG8A754B:~# cryptsetup remove sde4
!!! no strace !!!
LKG8A754B:~# cryptsetup luksOpen /dev/sde4 sde4
Enter LUKS passphrase: 
automatic header conversion from 0.99 to 0.991 triggered
<ctrl-c>
LKG8A754B:~# cmp -l /dev/sde4 sde4-luks-header-backup        
  168   0  12
  513 114   0
  514 125   0
  515 113   0
  516 123   0
  517 272   0
  518 276   0
  520   1   0
  521 141   0
  522 145   0
  523 163   0
  539   0   3
  540   0  10
  543   0  17
  544   0 240
  553 143   0
  554 142   0
  555 143   0
  556  55   0
  557 145   0
  558 163   0
  559 163   0
  560 151   0
  561 166   0
  562  72   0
  563 163   0
  564 150   0
  565 141   0
  566  62   0
  567  65   0
  568  66   0
  585 163   0
  586 150   0
  587 141   3
  588  61 210
  591   0  17
  592   0 240
cmp: EOF on sde4-luks-header-backup
LKG8A754B:~# 

!!!

Its done something like overwrite the second sector of the header with
the first one. I had a look at the cryptsetup code, and the conversion
message is triggered by it finding the wrong state code for the
passphrase slot - so the data has been overwritten by the time its got
there.

This is reliable - it always seems to corrupt it without strace,
always works with!???

Err....


-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: arm (armv5tel)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.18-3-ixp4xx
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages linux-image-2.6.18-3-ixp4xx depends on:
ii  coreutils                     5.97-5     The GNU core utilities
ii  debconf [debconf-2.0]         1.5.8      Debian configuration management sy
ii  initramfs-tools [linux-initra 0.85c      tools for generating an initramfs
ii  module-init-tools             3.3-pre3-1 tools for managing Linux kernel mo

linux-image-2.6.18-3-ixp4xx recommends no packages.

-- debconf information:
  linux-image-2.6.18-3-ixp4xx/preinst/failed-to-move-modules-2.6.18-3-ixp4xx:
  linux-image-2.6.18-3-ixp4xx/preinst/overwriting-modules-2.6.18-3-ixp4xx: true
  shared/kernel-image/really-run-bootloader: true
  linux-image-2.6.18-3-ixp4xx/postinst/kimage-is-a-directory:
  linux-image-2.6.18-3-ixp4xx/preinst/lilo-has-ramdisk:
  linux-image-2.6.18-3-ixp4xx/preinst/lilo-initrd-2.6.18-3-ixp4xx: true
  linux-image-2.6.18-3-ixp4xx/preinst/elilo-initrd-2.6.18-3-ixp4xx: true
  linux-image-2.6.18-3-ixp4xx/preinst/initrd-2.6.18-3-ixp4xx:
  linux-image-2.6.18-3-ixp4xx/preinst/bootloader-initrd-2.6.18-3-ixp4xx: true
  linux-image-2.6.18-3-ixp4xx/postinst/old-initrd-link-2.6.18-3-ixp4xx: true
  linux-image-2.6.18-3-ixp4xx/preinst/abort-install-2.6.18-3-ixp4xx:
  linux-image-2.6.18-3-ixp4xx/postinst/old-system-map-link-2.6.18-3-ixp4xx: true
  linux-image-2.6.18-3-ixp4xx/postinst/old-dir-initrd-link-2.6.18-3-ixp4xx: true
* linux-image-2.6.18-3-ixp4xx/preinst/already-running-this-2.6.18-3-ixp4xx:
  linux-image-2.6.18-3-ixp4xx/postinst/bootloader-error-2.6.18-3-ixp4xx:
  linux-image-2.6.18-3-ixp4xx/postinst/depmod-error-2.6.18-3-ixp4xx: false
  linux-image-2.6.18-3-ixp4xx/prerm/would-invalidate-boot-loader-2.6.18-3-ixp4xx: true
  linux-image-2.6.18-3-ixp4xx/prerm/removing-running-kernel-2.6.18-3-ixp4xx: true
  linux-image-2.6.18-3-ixp4xx/postinst/bootloader-test-error-2.6.18-3-ixp4xx:
  linux-image-2.6.18-3-ixp4xx/preinst/abort-overwrite-2.6.18-3-ixp4xx:
  linux-image-2.6.18-3-ixp4xx/postinst/depmod-error-initrd-2.6.18-3-ixp4xx: false
  linux-image-2.6.18-3-ixp4xx/postinst/create-kimage-link-2.6.18-3-ixp4xx: true



Reply to: