mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christophe Saout <christophe@saout.de>
To: James Morris <jmorris@intercode.com.au>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: cryptoapi highmem bug
Date: Tue, 24 Feb 2004 21:49:14 +0100	[thread overview]
Message-ID: <1077655754.14858.0.camel@leto.cs.pocnet.net> (raw)

Hi,

someone noticed strange corruptions with dm-crypt and highmem. After I
found out that I could force my machine to use highmem even though it
only has 256MB, I finally found the problem after some debugging:

The problem is in cbc_process (well, partly):

>      const int need_stack = (src == dst);
>      u8 stack[need_stack ? crypto_tfm_alg_blocksize(tfm) : 0];
>      u8 *buf = need_stack ? stack : dst;

src == dst fails if the page was in highmem because crypto_kmap will
assign two different virtual addresses for the same page.

The result is data corruption.

How could this be fixed?

scapperwalk_map could check if this page was already mapped (walk_in)
and reuse the virtual address if so. So a single page is only mapped
once and the check in cbc_process will work.

I can really use the src == dst case because I would need to allocate
unnecessary buffers (at least 512 bytes at a time and per cpu).

(I just hacked dm-crypt to allocate 512 bytes on the stack and use it
temporarily and kmap around myself to copy it back and the problem is
gone. Ugly.)



             reply	other threads:[~2004-02-24 20:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-24 20:49 Christophe Saout [this message]
2004-02-24 22:34 ` Jean-Luc Cooke
2004-02-24 23:01   ` Christophe Saout
2004-02-25  4:32     ` Jean-Luc Cooke
2004-02-25  6:00       ` Andrew Morton
2004-02-25 13:27         ` James Morris
2004-02-25 15:17           ` Jean-Luc Cooke
2004-02-25 19:50           ` Andrew Morton
2004-02-25 21:27             ` Christophe Saout
2004-02-25 21:41               ` Jean-Luc Cooke
2004-02-25 22:55             ` [PATCH 1/2] move scatterwalk functions to own file Christophe Saout
2004-02-25 22:55             ` [PATCH 2/2] fix in-place de/encryption bug with highmem Christophe Saout
2004-02-26  4:13               ` James Morris
2004-02-26 11:03                 ` Christophe Saout
2004-02-25 15:31         ` cryptoapi highmem bug Christophe Saout
2004-02-25 15:51           ` Christophe Saout
2004-02-25 15:44             ` Jean-Luc Cooke
2004-02-25 16:13               ` Christophe Saout
2004-02-25 16:09                 ` Jean-Luc Cooke
2004-02-25 18:11                   ` cryptoapi OMAC (was: cryptoapi highmem bug) Christophe Saout
2004-02-25 20:59                     ` Jean-Luc Cooke
2004-02-25 21:44                       ` Christophe Saout
2004-02-25 18:15               ` cryptoapi highmem bug Christophe Saout
2004-02-25 20:12                 ` Jean-Luc Cooke
2004-02-25 20:39                   ` Christophe Saout
2004-02-25 20:46                     ` Jean-Luc Cooke
2004-02-25 21:36                       ` Christophe Saout
2004-02-25 21:52                         ` Jean-Luc Cooke

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=1077655754.14858.0.camel@leto.cs.pocnet.net \
    --to=christophe@saout.de \
    --cc=jmorris@intercode.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®