All of lore.kernel.org
 help / color / mirror / Atom feed
From: Horia Geanta <horia.geanta@nxp.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Roland Hieber <rhi@pengutronix.de>,
	Aymen Sghaier <aymen.sghaier@nxp.com>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	Jesper Nilsson <jesper.nilsson@axis.com>,
	Lars Persson <lars.persson@axis.com>,
	Christian Lamparter <chunkeey@gmail.com>,
	Roland Hieber <r.hieber@pengutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>
Subject: Re: [PATCH 2/2] crypto: caam - fix DMA mapping of stack memory
Date: Fri, 25 Jan 2019 14:26:27 +0000	[thread overview]
Message-ID: <VI1PR0402MB34859DF7A32E650C9E2E1A34989B0@VI1PR0402MB3485.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 20190125134756.5f5e2uxmwvtnc6bb@gondor.apana.org.au

On 1/25/2019 3:48 PM, Herbert Xu wrote:
> On Fri, Jan 25, 2019 at 12:43:21PM +0000, Horia Geanta wrote:
>>
>> Herbert, is there something we could do to avoid this?
> 
> Async crypto requests cannot be allocated off the stack.  So
> whoever is doing this needs to stop.
> 
IIUC, the crypto request is allocated in ima_calc_file_hash_atfm() using
ahash_request_alloc(), so this seems to be fine.

However, further below the req->result pointer is set to a location on stack:
out2:
	if (!rc) {
		ahash_request_set_crypt(req, NULL, hash->digest, 0);

More exactly, the call sequence is:
ima_collect_measurement() -> ima_calc_file_hash() -> ima_calc_file_ahash() ->
ima_calc_file_hash_atfm()
and "hash" is allocated on stack in ima_collect_measurement().

Thus, it seems the problem lies in the fact that ahash_request structure defines
the digest buffer as "u8 *result" - thus the memory area might not be DMAable.

Thanks,
Horia

  reply	other threads:[~2019-01-25 14:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 15:26 [PATCH 2/2] crypto: caam - fix DMA mapping of stack memory Roland Hieber
2019-01-25 12:43 ` Horia Geanta
2019-01-25 13:47   ` Herbert Xu
2019-01-25 14:26     ` Horia Geanta [this message]
2019-01-26  2:09       ` Herbert Xu
2019-01-26 18:02   ` [PATCH v2 " Horia Geantă
2019-01-28 19:00     ` Roland Hieber
2019-01-28 19:50       ` Horia Geanta
2019-02-01  6:51     ` Herbert Xu
2019-01-25 13:49 ` [PATCH " Herbert Xu

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=VI1PR0402MB34859DF7A32E650C9E2E1A34989B0@VI1PR0402MB3485.eurprd04.prod.outlook.com \
    --to=horia.geanta@nxp.com \
    --cc=aymen.sghaier@nxp.com \
    --cc=chunkeey@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jesper.nilsson@axis.com \
    --cc=kernel@pengutronix.de \
    --cc=lars.persson@axis.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=r.hieber@pengutronix.de \
    --cc=rhi@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.