linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Tirumala Reddy Marri <tmarri@amcc.com>
Cc: "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>
Subject: Re: bug in asyn_xor() function
Date: Sun, 28 Jun 2009 09:50:36 -0700	[thread overview]
Message-ID: <4A479F5C.10208@intel.com> (raw)
In-Reply-To: <AC5E1C3367E37D44970B81A6ADD1DA2C0534ABEC@SDCEXCHANGE01.ad.amcc.com>

Tirumala Reddy Marri wrote:
>  
> Looks like there is bug in the do_async_xor() function where" dma_addr_t 
> *dma_src = (dma_addr_t *) src_list;" causing corrupting source 
> addresses.  And dma_src is being modified in the for loop. This should 
> be something like dma_addr_t dma_src[src_cnt].

As you can see from the comment to async_xor:

"@src_list: array of source pages (if the dest is also a source it must 
be at index zero).  The contents of this array may be overwritten."

...and the comment in async_xor_init:
/* To conserve stack space the input src_list (array of page pointers)
  * is reused to hold the array of dma addresses passed to the driver.
  * This conversion is only possible when dma_addr_t is less than the
  * the size of a pointer.  HIGHMEM64G is known to violate this
  * assumption.
  */

...this is deliberate, not ideal, but deliberate.  The reasoning is to 
avoid stack overflows for arbitrarily large arrays, so we reuse the 
input source list to perform address conversions.  This also happens in 
the non-accelerated case to perform page_address() conversions.  As a 
part of the raid6 work [1] this will be changed to a preallocated 
'scribble' buffer to preserve in the input parameters.

--
Dan

[1] git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx.git raid6

I just noticed the documentation in 
Documentation/crypto/async-tx-api.txt does not reflect this 
constraint... will fix.


       reply	other threads:[~2009-06-28 16:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AC5E1C3367E37D44970B81A6ADD1DA2C0534ABEC@SDCEXCHANGE01.ad.amcc.com>
2009-06-28 16:50 ` Dan Williams [this message]
2009-06-29  6:51   ` bug in asyn_xor() function Tirumala Reddy Marri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A479F5C.10208@intel.com \
    --to=dan.j.williams@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=tmarri@amcc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).