Hi again,

Yashpal, thank you for your reply. I could not find any relation to the patch 
you mention with my problem. Maybe I am missing something, but I think that the 
crash you mention is different than mine. However, I think that I found a 
solution/workaround concerning that issue. Whenever cryptodev_hash_final is 
called the ctx_req->src is set to NULL using ahash_request_set_crypt. In 
talitos and in function ahash_process_req there are sometimes we have:
   index = req_ctx->count & (blocksize - 1); = 0x0 
and therefore
    req_ctx->psrc = areq->src; = NULL
So when mapping the scatterlist in DMA using  dma_map_sg it crashes due to NULL 
pointer.

I am not pretty sure of the index variable's functionality (any explanation 
would be really helpful), so I cannot really get to the real source of the 
problem. However by changing the if case in function ahash_process_req:
    if (index) {
    /* partial block from previous update; chain it in. */
to
    if (index || nbytes == 0) {
    /* partial block from previous update; chain it in. */
in order to indicate that in case of final function to use bufsl I see that it 
works fine.

If you have any notes to make, or to point the real (?) source of the problem, 
I would be glad to read some replies.

Thank you in advance.
 
Kind Regards/Με ευχές
Nikolaos Tsakalakis


>________________________________
> Απο: Dutta Yashpal-B05456 <b05...@freescale.com>
>Προς: Nikolaos Tsakalakis <ntsakala...@yahoo.co.uk>; Nikos Mavrogiannopoulos 
><n...@gnutls.org> 
>Κοιν.: "cryptodev-linux-devel@gna.org" <cryptodev-linux-devel@gna.org> 
>Στάλθηκε: 8:18 μ.μ. Παρασκευή, 30 Νοεμβρίου 2012
>Θέμα: RE: [Cryptodev-linux-devel] Σχετ:  cryptodev-talitos crash (using hash)
> 
>
> 
>Hi,
> 
>Please check if following patch fixes the issue:
> 
>http://www.spinics.net/lists/linux-crypto/msg07948.html
> 
>IIUC, SG table is generated in Cryptodev-linux and user-space pages carrying 
>SRC/DST data 
>are pinned by cryptodev to avoid copy buffers from user-to-kernel space. Now 
>these pages being HIGHMEM_ZONE pages, 
>requires kmap before Kernel (in this case talitos driver) can read/write on 
>them otherwise virtual address correspond to 
>these pages in kernel would be NULL resulting in such crashes.
> 
>I have not tried the fix on Talitos but wherever an access to user-space 
>supplied pages via cryptodev is made in such drivers, it 
>should be preceded by kmap.
> 
>Regards
>Yashpal
> 
> 
>From:cryptodev-linux-devel-boun...@gna.org 
>[mailto:cryptodev-linux-devel-boun...@gna.org] On Behalf Of Nikolaos Tsakalakis
>Sent: Friday, November 30, 2012 9:49 PM
>To: Nikos Mavrogiannopoulos
>Cc: cryptodev-linux-devel@gna.org
>Subject: [Cryptodev-linux-devel] Σχετ: cryptodev-talitos crash (using hash)
> 
>Hi Niko,
> 
> - I use cryptodev 1.5.
> - You are right, I missed that point in the code, it comes from 
>cryptodev_hash_final, so areq->src should be NULL. Now my questions come to 
>why talitos chooses areq->src for psrc (depends on req_ctx->count). I will 
>check it out and I will come back to you, if necessary, next week.
> 
>Thank you for your immediate reply.
> 
>Kind Regards/Με ευχές
>Nikolaos Tsakalakis
>
>________________________________
> 
>Απο:Nikos Mavrogiannopoulos <n...@gnutls.org>
>Προς: Nikolaos Tsakalakis <ntsakala...@yahoo.co.uk> 
>Κοιν.: "cryptodev-linux-devel@gna.org" <cryptodev-linux-devel@gna.org> 
>Στάλθηκε: 12:47 μ.μ. Παρασκευή, 30 Νοεμβρίου 2012
>Θεμα: Re: [Cryptodev-linux-devel] cryptodev-talitos crash (using hash)
>
>On 11/30/2012 11:33 AM, Nikolaos Tsakalakis wrote:
>
>> Hello all,
>> 
>> I have an issue concerning cryptodev and talitos use. I use kernel 
>> 2.6.32-13, however I use the talitos version of 2.6.35 backported. I have 
>> several times a crash like the one below.
>[...]
>
>>
>
>> I attach the objdump. Having a close look I can see that the scatterlist 
>> pointer is NULL (req_ctx->psrc = NULL => areq->src = NULL => data coming 
>> from the user space application, patched openssl).
>
>> Do you have any hint concerning that issue?
>
>Unfortunately not. Is it the latest version of cryptodev-linux? I cannot
>check it now, but is the NULL you see in the scaterlist because of
>cryptodev_hash_final() using ahash_request_set_crypt or because of the
>data in cryptodev_hash_update()?
>
>Could you make this issue reproducible with some minimal code?
>
>regards,
>Nikos
>
>
>
>
_______________________________________________
Cryptodev-linux-devel mailing list
Cryptodev-linux-devel@gna.org
https://mail.gna.org/listinfo/cryptodev-linux-devel

Reply via email to