2009-04-08 19:35:26

by Maciej Rutecki

[permalink] [raw]
Subject: [2.6.30-rc1] device-mapper: table: 254:0: crypt: Error allocating crypto tfm

Kernel 2.6.30.1

I try mount encrypted partition:
[email protected]:/home/maciek# cryptsetup create secret /dev/sda6
Enter passphrase:
Command failed: device-mapper: reload ioctl failed: Zły argument

"Zły argument"="Bad argument"

Dmesg shows:
[ 193.421463] device-mapper: table: 254:0: crypt: Error allocating crypto tfm
[ 193.421471] device-mapper: ioctl: error adding target to table
[ 193.465318] device-mapper: ioctl: device doesn't appear to be in
the dev hash table

BUT, I try again:
[email protected]:/home/maciek# cryptsetup create secret /dev/sda6
Enter passphrase:
[email protected]:/home/maciek# mount /mnt/sec/
[email protected]:/home/maciek# df -h | grep sec
/dev/mapper/secret 89G 42G 43G 50% /mnt/sec

Then it works.

[email protected]:/home/maciek# cat /proc/crypto
name : cbc(aes)
driver : cbc(aes-asm)
module : kernel
priority : 200
refcnt : 2
selftest : passed
type : givcipher
async : yes
blocksize : 16
min keysize : 16
max keysize : 32
ivsize : 16
geniv : chainiv

name : cbc(aes)
driver : cbc(aes-asm)
module : cbc
priority : 200
refcnt : 2
selftest : passed
type : blkcipher
blocksize : 16
min keysize : 16
max keysize : 32
ivsize : 16
geniv : <default>

name : aes
driver : aes-asm
module : aes_i586
priority : 200
refcnt : 2
selftest : passed
type : cipher
blocksize : 16
min keysize : 16
max keysize : 32

name : aes
driver : aes-generic
module : aes_generic
priority : 100
refcnt : 1
selftest : passed
type : cipher
blocksize : 16
min keysize : 16
max keysize : 32

name : stdrng
driver : krng
module : kernel
priority : 200
refcnt : 2
selftest : passed
type : rng
seedsize : 0

name : md5
driver : md5-generic
module : kernel
priority : 0
refcnt : 1
selftest : passed
type : shash
blocksize : 64
digestsize : 16
descsize : 88

Any else information is needed?

Config:
http://unixy.pl/maciek/download/kernel/2.6.30-rc1/pc/config-2.6.30-rc1.txt

dmesg:
http://unixy.pl/maciek/download/kernel/2.6.30-rc1/pc/dmesg.txt
--
Maciej Rutecki
http://www.maciek.unixy.pl


2009-04-08 19:36:46

by Maciej Rutecki

[permalink] [raw]
Subject: Re: [2.6.30-rc1] device-mapper: table: 254:0: crypt: Error allocating crypto tfm

2009/4/8 Maciej Rutecki <[email protected]>:
> Kernel 2.6.30.1

s/2.6.30.1/2.6.30-rc1




--
Maciej Rutecki
http://www.maciek.unixy.pl

2009-04-09 02:18:22

by Herbert Xu

[permalink] [raw]
Subject: Re: [2.6.30-rc1] device-mapper: table: 254:0: crypt: Error allocating crypto tfm

On Wed, Apr 08, 2009 at 09:35:23PM +0200, Maciej Rutecki wrote:
> Kernel 2.6.30.1
>
> I try mount encrypted partition:
> [email protected]:/home/maciek# cryptsetup create secret /dev/sda6
> Enter passphrase:
> Command failed: device-mapper: reload ioctl failed: Zły argument
>
> "Zły argument"="Bad argument"

It looks like try_then_request_module has been broken such that it
returns without waiting for the module to complete loading. I'm
looking into it.

Thakns,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2009-04-09 02:35:47

by Herbert Xu

[permalink] [raw]
Subject: Re: [2.6.30-rc1] device-mapper: table: 254:0: crypt: Error allocating crypto tfm

On Thu, Apr 09, 2009 at 10:18:04AM +0800, Herbert Xu wrote:
>
> It looks like try_then_request_module has been broken such that it
> returns without waiting for the module to complete loading. I'm
> looking into it.

OK, it's caused by

commit acae05156551fd7528fbb616271e672789388e3c
Author: Arjan van de Ven <[email protected]>
Date: Sun Feb 8 10:42:01 2009 -0800

module: create a request_module_nowait()

This should fix it.

module: try_then_request_module must wait

Since the whole point of try_then_request_module is to retry
the operation after a module has been loaded, we must wait for
the module to fully load.

Otherwise all sort of things start breaking, e.g., you won't
be able to read your encrypted disks on the first attempt.

Signed-off-by: Herbert Xu <[email protected]>

diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index d5fa565..384ca8b 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -34,7 +34,7 @@ extern int __request_module(bool wait, const char *name, ...) \
#define request_module(mod...) __request_module(true, mod)
#define request_module_nowait(mod...) __request_module(false, mod)
#define try_then_request_module(x, mod...) \
- ((x) ?: (__request_module(false, mod), (x)))
+ ((x) ?: (__request_module(true, mod), (x)))
#else
static inline int request_module(const char *name, ...) { return -ENOSYS; }
static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; }

Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2009-04-09 12:46:33

by Maciej Rutecki

[permalink] [raw]
Subject: Re: [2.6.30-rc1] device-mapper: table: 254:0: crypt: Error allocating crypto tfm

2009/4/9 Herbert Xu <[email protected]>:
[...]

Yes, patch helps. Thanks

Tested-by Maciej Rutecki <maciej.rutec[email protected]>

> Signed-off-by: Herbert Xu <[email protected]>
>
> diff --git a/include/linux/kmod.h b/include/linux/kmod.h
> index d5fa565..384ca8b 100644
> --- a/include/linux/kmod.h
> +++ b/include/linux/kmod.h
> @@ -34,7 +34,7 @@ extern int __request_module(bool wait, const char *name, ...) \
>  #define request_module(mod...) __request_module(true, mod)
>  #define request_module_nowait(mod...) __request_module(false, mod)
>  #define try_then_request_module(x, mod...) \
> -       ((x) ?: (__request_module(false, mod), (x)))
> +       ((x) ?: (__request_module(true, mod), (x)))
>  #else
>  static inline int request_module(const char *name, ...) { return -ENOSYS; }
>  static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; }
>
> Thanks,
> --
> Visit Openswan at http://www.openswan.org/
> Email: Herbert Xu ~{PmV>HI~} <[email protected]>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

--
Maciej Rutecki
http://www.maciek.unixy.pl

2009-04-09 13:05:59

by Patrick McHardy

[permalink] [raw]
Subject: Re: [2.6.30-rc1] device-mapper: table: 254:0: crypt: Error allocating crypto tfm

Maciej Rutecki wrote:
> 2009/4/9 Herbert Xu <[email protected]>:
> [...]
>
> Yes, patch helps. Thanks

It also seems to fix a netfilter problem with modules not loaded
automatically anymore.

2009-04-09 13:14:35

by Maciej Rutecki

[permalink] [raw]
Subject: Re: [2.6.30-rc1] device-mapper: table: 254:0: crypt: Error allocating crypto tfm

2009/4/9 Patrick McHardy <[email protected]>:
> Maciej Rutecki wrote:
>>
>> 2009/4/9 Herbert Xu <[email protected]>:
>> [...]
>>
>> Yes, patch helps. Thanks
>
> It also seems to fix a netfilter problem with modules not loaded
> automatically anymore.
>

...and mount my usb disk :-)

--
Maciej Rutecki
http://www.maciek.unixy.pl

2009-04-09 13:18:18

by Herbert Xu

[permalink] [raw]
Subject: Re: [2.6.30-rc1] device-mapper: table: 254:0: crypt: Error allocating crypto tfm

On Thu, Apr 09, 2009 at 03:05:51PM +0200, Patrick McHardy wrote:
>
> It also seems to fix a netfilter problem with modules not loaded
> automatically anymore.

They should still autoload, but now you need to retry the operation
manually :)
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2009-04-09 13:22:53

by Patrick McHardy

[permalink] [raw]
Subject: Re: [2.6.30-rc1] device-mapper: table: 254:0: crypt: Error allocating crypto tfm

Herbert Xu wrote:
> On Thu, Apr 09, 2009 at 03:05:51PM +0200, Patrick McHardy wrote:
>> It also seems to fix a netfilter problem with modules not loaded
>> automatically anymore.
>
> They should still autoload, but now you need to retry the operation
> manually :)

Right, the second attempt succeeded :)