On Mon, Jul 10, 2006 at 01:22:12AM +1200, Michal Ludvig wrote:
> 
> padlock_cra_init() correctly says fallback TFM couldn't be allocated and 
> returns 1. However AH SA is created anyway and padlock-sha has one user. 
> setkey -F segfaults, because in cra_exit() I assume the fallback tfm was 
> not null and trying to free it. I never expected to get cra_exit() 
> called when cra_init() failed.

Are you sure your cra_init returned a non-zero error? The code in api.c
reads:

        if (alg->cra_init && (err = alg->cra_init(tfm))) {
                if (err == -EAGAIN)
                        crypto_shoot_alg(alg);
                goto cra_init_failed;
        }

        goto out;

cra_init_failed:
        crypto_exit_ops(tfm);

Which leads me to believe that in your case cra_init returned zero.
 
> BTW Before applying your two last patches from 06/07/03 I got the 
> attached attached Oops with setkey segfaulting. Then all subsequent 
> setkey processes stay in D state. Not sure if it was treated by one of 
> those patches.

Please see below.

> Test 2: Now some cryptomgr complaints (should go to its own thread but 
> /me is too lazy).
> 
> modprobe sha1 and the above setkey. lsmod shows 1 user of sha1. flushed 
> SA and modprobed padlock-sha. setkey that AH SA again - lsmod again 
> shows 1 user of sha1 and no users for padlock-sha! Strange...
> 
> It turns out that cryptomgr created hmac(sha1) from sha1-generic and 
> doesn't update list (or create another higher-prio entry) after 
> padlock-sha was inserted.
> 
> Another bug?

This is a valid complaint.  I'll need to think about this.

> Call Trace:
>  [<c01123a0>] default_wake_function+0x0/0x10
>  [<c012447b>] call_usermodehelper_keys+0x10b/0x120
>  [<c012447b>] call_usermodehelper_keys+0x10b/0x120
>  [<c01245c8>] request_module+0x48/0xe0
>  [<c0124490>] __call_usermodehelper+0x0/0x50
>  [<c01b66f2>] crypto_alg_mod_lookup+0x72/0x250
>  [<c01b690b>] crypto_alloc_tfm+0x1b/0x50
>  [<cd0b41a4>] padlock_cra_init+0x14/0x70 [padlock_sha]

Could you please print out what string padlock_cra_init passed to
crypto_alloc_tfm?

Cheers,
-- 
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-crypto" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to