[pkg-cryptsetup-devel] Bug#624828: cryptsetup ignores --size option

RW Penney rwpenney at users.sourceforge.net
Sun May 1 21:38:59 UTC 2011


Package: cryptsetup
Version: 2:1.2.0-2
Severity: normal

The '--size' option to cryptsetup is supposed to allow one to choose
a subset of a block device when configuring an encrypted device-mapper target.
Although this option has behaved sensibly in Debian releases up to
6.0 ("squeeze"), the latest 'testing' version of cryptsetup appears
to ignore this option, and create a device-mapper target that is as large
as the underlying block device.

The attached script shows that attempting to select a 4MB subset of
a 16MB block device produces a device below /dev/mapper which has 16MB.
This script produces the expected 4MB size when run under 'squeeze'
and 'lenny'. Similar operations with cryptsetup have worked as expected
with previous releases of Debian and a wide range of other flavours of Linux.

Perhaps someone could advise why the '--size' option now seems to behave
so differently?

Thanks.

-- Package-specific info:
-- /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-2.6.38-2-686 root=UUID=a4f8be97-3463-4d2b-9109-0e363ddc9be4 ro quiet

-- /etc/crypttab
# <target name>	<source device>		<key file>	<options>

-- /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/hda1       /               ext3    defaults,errors=remount-ro 0       1
UUID=a4f8be97-3463-4d2b-9109-0e363ddc9be4       /               ext3    defaults,errors=remount-ro 0       1
# /dev/hda8       /home           ext3    defaults        0       2
UUID=8a24e9da-0621-433a-a364-5d5b6d8f0468       /home           ext3    defaults        0       2
# /dev/hda6       /usr            ext3    defaults        0       2
UUID=3a1170f4-1fb5-4c05-a7af-b73b20c13710       /usr            ext3    defaults        0       2
# /dev/hda7       /var            ext3    defaults        0       2
UUID=2a6847a1-668b-462b-a75b-99fbb6f05112       /var            ext3    defaults        0       2
# /dev/hda5       none            swap    sw              0       0
UUID=5a84def4-b9f8-4c84-a07b-844439faac9b       none            swap    sw              0       0
# /dev/hdc        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/cdrom1        /media/cdrom0   udf,iso9660 user,noauto     0       0

-- lsmod
Module                  Size  Used by
twofish_generic        16529  0 
twofish_i586           12453  0 
twofish_common         20528  2 twofish_generic,twofish_i586
cbc                    12659  0 
loop                   17805  0 
dm_crypt               17809  0 
i2c_piix4              12480  0 
snd_pcm                52774  0 
i2c_core               18989  1 i2c_piix4
processor              26983  0 
thermal_sys            17667  1 processor
parport_pc             21895  0 
tpm_tis                12949  0 
parport                27018  1 parport_pc
tpm                    17454  1 tpm_tis
tpm_bios               12799  1 tpm
snd_timer              22171  1 snd_pcm
psmouse                45863  0 
snd                    38153  2 snd_pcm,snd_timer
serio_raw              12758  0 
evdev                  13084  5 
soundcore              12878  1 snd
snd_page_alloc         12841  1 snd_pcm
pcspkr                 12515  0 
button                 12866  0 
ext3                   98001  4 
jbd                    40818  1 ext3
mbcache                12810  1 ext3
dm_mod                 56394  1 dm_crypt
sg                     21385  0 
sd_mod                 34941  6 
sr_mod                 17418  0 
cdrom                  34631  1 sr_mod
crc_t10dif             12332  1 sd_mod
ata_generic            12439  0 
ata_piix               21079  5 
uhci_hcd               21850  0 
ehci_hcd               34889  0 
libata                131904  2 ata_generic,ata_piix
usbcore                99058  3 uhci_hcd,ehci_hcd
scsi_mod              134369  4 sg,sr_mod,sd_mod,libata
floppy                 47893  0 
e1000                  84011  0 
nls_base               12649  1 usbcore


-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.38-2-686 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages cryptsetup depends on:
ii  dmsetup                      2:1.02.63-3 The Linux Kernel Device Mapper use
ii  libc6                        2.11.2-11   Embedded GNU C Library: Shared lib
ii  libcryptsetup1               2:1.2.0-2   libcryptsetup shared library
ii  libpopt0                     1.16-1      lib for parsing cmdline parameters

cryptsetup recommends no packages.

Versions of packages cryptsetup suggests:
ii  busybox                      1:1.17.1-10 Tiny utilities for small and embed
pn  dosfstools                   <none>      (no description available)
ii  initramfs-tools [linux-initr 0.98.8      tools for generating an initramfs
ii  udev                         167-3       /dev/ and hotplug management daemo

-- no debconf information

-------------- next part --------------
#!/bin/sh
# Script for checking cryptsetup filesystem-size correctness
# RW Penney, May 2011

TMPFILE=/tmp/cs-bug.fs
LOOPDEV=/dev/loop0
KEYFILE=/tmp/cs-keyfile

# Create loopback filesystem of 16MiB:
dd if=/dev/zero of=${TMPFILE} bs=1b count=32768
losetup ${LOOPDEV} ${TMPFILE}

# Create cryptsetup target, requesting size of 4MiB:
dd if=/dev/urandom of=${KEYFILE} bs=32c count=1 2>/dev/null
cryptsetup --cipher twofish --key-file ${KEYFILE} --size 8192 create cs-test ${LOOPDEV}

# Measure size of cryptsetup device:
dd if=/dev/mapper/cs-test of=/dev/null bs=1b

# Tidy up:
cryptsetup remove cs-test
rm ${KEYFILE}
losetup -d ${LOOPDEV}
rm ${TMPFILE}

exit 0


More information about the pkg-cryptsetup-devel mailing list