Linux Device Mapper development
 help / color / mirror / Atom feed
From: Krzysztof Kolasa <kkolasa@winsoft.pl>
To: Milan Broz <gmazyland@gmail.com>, dm-devel@redhat.com
Cc: mpatocka@redhat.com, agk@redhat.com, snitzer@redhat.com
Subject: Re: [PATCH] dm-crypt: Fix per-bio data alignment
Date: Mon, 18 Aug 2014 21:32:13 +0200	[thread overview]
Message-ID: <53F254BD.5090806@winsoft.pl> (raw)
In-Reply-To: <1408386997-14690-1-git-send-email-gmazyland@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1629 bytes --]

On 18.08.2014 20:36, Milan Broz wrote:
> The commit
>    298a9fa08a1577211d42a75e8fc073baef61e0d9
>    dm crypt: use per-bio data
> causes OOPS on 32bit i686 architecture
>
>    BUG: unable to handle kernel paging request at 20000000
>    IP: [<e0fe2433>] clone_endio+0x13/0xe0 [dm_mod]
>    ...
>
>   [<c1257b61>] bio_endio+0x61/0x90
>   [<e142476c>] crypt_dec_pending+0x8c/0xd0 [dm_crypt]
>   [<e142666f>] kcryptd_crypt+0x4bf/0x4f0 [dm_crypt]
>
> This patch fixes the issue by aligning per-bio alocated structure size.
>
> Reported-by: Krzysztof Kolasa <kkolasa@winsoft.pl>
> Signed-off-by: Milan Broz <gmazyland@gmail.com>
> ---
>   drivers/md/dm-crypt.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
> index 2785007..33f26a2 100644
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -1735,9 +1735,10 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
>   		goto bad;
>   	}
>   
> -	cc->per_bio_data_size = ti->per_bio_data_size =
> -				sizeof(struct dm_crypt_io) + cc->dmreq_start +
> -				sizeof(struct dm_crypt_request) + cc->iv_size;
> +	cc->per_bio_data_size = ALIGN(sizeof(struct dm_crypt_io) + cc->dmreq_start +
> +				      sizeof(struct dm_crypt_request) + cc->iv_size,
> +				      ARCH_KMALLOC_MINALIGN);
> +	ti->per_bio_data_size = cc->per_bio_data_size;
>   
>   	cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0);
>   	if (!cc->page_pool) {

patch tested positive for x86 ( no oops ) and x86_64  ( continues to 
work OK ).

thanks


[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3662 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2014-08-18 19:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-17 18:43 commit 298a9fa dm crypt: use per-bio data hard crash kernel ( the system freezes ) Krzysztof Kolasa
2014-08-18 14:04 ` Ondrej Kozina
2014-08-18 15:15 ` Alasdair G Kergon
2014-08-18 15:37   ` Milan Broz
2014-08-18 17:33   ` Krzysztof Kolasa
2014-08-18 18:36     ` [PATCH] dm-crypt: Fix per-bio data alignment Milan Broz
2014-08-18 19:32       ` Krzysztof Kolasa [this message]
2014-08-19 18:37       ` Mikulas Patocka
2014-08-19 19:41         ` Milan Broz
2014-08-27 16:18           ` Mikulas Patocka

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=53F254BD.5090806@winsoft.pl \
    --to=kkolasa@winsoft.pl \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=gmazyland@gmail.com \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@redhat.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