public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: LABBE Corentin <clabbe@baylibre.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Ben Dooks <ben.dooks@codethink.co.uk>,
	herbert@gondor.apana.org.au, heiko@sntech.de,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, linux-sunxi@lists.linux.dev
Subject: Re: [RFC PATCH] crypto: flush poison data
Date: Tue, 5 Jul 2022 19:56:11 +0200	[thread overview]
Message-ID: <YsR7O4q4IRI14Wkc@Red> (raw)
In-Reply-To: <20220705164213.GA14484@lst.de>

Le Tue, Jul 05, 2022 at 06:42:13PM +0200, Christoph Hellwig a écrit :
> On Tue, Jul 05, 2022 at 10:21:13AM +0200, LABBE Corentin wrote:
> > 
> > I just copied what did drivers/crypto/xilinx/zynqmp-sha.c.
> > I tried to do flush_dcache_range() but it seems to not be implemented on riscV.
> 
> That driver is broken and should no have been merged in that form.
> 
> > And flush_dcache_page(virt_to_page(addr), len) produce a kernel panic.
> 
> And that's good so.  Drivers have no business doing their own cache
> flushing.  That is the job of the dma-mapping implementation, so I'd
> suggest to look for problems there.

I am sorry but this code is not in driver but in crypto API code.

It seems that I didnt explain well the problem.

The crypto API run a number of crypto operations against every driver that register crypto algos.
For each buffer given to the tested driver, crypto API setup a poison buffer contigous to this buffer.
The goal is to detect if driver do bad thing outside of buffer it got.

So the tested driver dont know existence of this poison buffer and so cannot not handle it.

My problem is that a dma_sync on the data buffer corrupt the poison buffer as collateral dommage.
Probably because the sync operate on a larger region than the requested dma_sync length.
So I try to flush poison data in the cryptoAPI.

Any hint on how to do it properly is welcome.

  reply	other threads:[~2022-07-05 17:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 13:27 [RFC PATCH] crypto: flush poison data Corentin Labbe
2022-07-01 13:35 ` Ben Dooks
2022-07-05  8:21   ` LABBE Corentin
2022-07-05 16:42     ` Christoph Hellwig
2022-07-05 17:56       ` LABBE Corentin [this message]
2022-07-05 17:58         ` Christoph Hellwig
2022-07-06  7:25           ` LABBE Corentin
2022-07-06  9:47       ` Ben Dooks
2022-07-06 11:58         ` Christoph Hellwig
2022-07-06 12:23           ` LABBE Corentin
2022-07-01 14:36 ` Andre Przywara
2022-07-01 14:55   ` LABBE Corentin

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=YsR7O4q4IRI14Wkc@Red \
    --to=clabbe@baylibre.com \
    --cc=ben.dooks@codethink.co.uk \
    --cc=hch@lst.de \
    --cc=heiko@sntech.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-sunxi@lists.linux.dev \
    /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