From: "Stephan Müller" <smueller@chronox.de>
To: "Stephan Müller" <smueller@chronox.de>
Cc: Herbert Xu <herbert@gondor.apana.org.au>, linux-crypto@vger.kernel.org
Subject: Re: [PATCH v5 1/2] crypto: skcipher AF_ALG - overhaul memory management
Date: Thu, 16 Mar 2017 13:20:10 +0100 [thread overview]
Message-ID: <74486084.680b3YGfiO@tauon.atsec.com> (raw)
In-Reply-To: <4808097.uXnqYIEybL@tauon.atsec.com>
Am Donnerstag, 16. März 2017, 11:18:33 CET schrieb Stephan Müller:
Hi Stephan,
> Am Donnerstag, 16. März 2017, 10:52:48 CET schrieb Herbert Xu:
>
> Hi Herbert,
>
> > First of all you're only limiting the amount of memory occupied
> > by the SG list which is not the same thing as the memory pinned
> > down by the actual recvmsg.
>
> I am fully aware of that. As this was present in the code, I thought I could
> reuse that approach.
>
> Are you saying that you want to stop this approach?
I would like to bring another point to the table for this discussion relating
to the maximum amount of memory to be used as well as for the size of the RX-
SGL: allow us please to consider skcipher_sendmsg (sendpage works conceptually
similar, so it should be covered with this discussion as well).
skcipher_alloc_sgl used in the sendmsg code path is conceptually identical to
the RX-SGL allocation that I propose here: it allocates a new SGL with
MAX_SGL_ENTS entries as long as the caller sends data. It limits the amount of
memory to be allocated based on the maximum size of the SG management data and
not the actual plaintext/ciphertext data sent by user space. I again was
therefore under the impression that my suggested approach in the recvmsg code
path regarding allocation of memory would be allowed.
Regarding the amount of data processed with the RX-SGL, I would like to
consider the size of the TX-SGL. In the skcipher case, the RX-SGL (or the
anticipated RX data to be processed) does not need to be larger than the TX-
SGL. Hence the currently existing while() loop of the upstream code that we
discuss here will only be executed as often to fulfill the available TX-SGL
data size. Given that both are limited on the sock_kmalloc memory limitation,
I would imply that using a conceptually identical allocation approach for the
TX SGL and RX SGL would be a sufficient replacement for the while-loop without
being visible to user space (i.e. without causing a limit that was not there
before).
Ciao
Stephan
next prev parent reply other threads:[~2017-03-16 12:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 22:31 [PATCH v5 0/2] crypto: AF_ALG memory management fix Stephan Müller
2017-02-17 22:31 ` [PATCH v5 1/2] crypto: skcipher AF_ALG - overhaul memory management Stephan Müller
2017-03-16 8:39 ` Herbert Xu
2017-03-16 8:55 ` Stephan Müller
2017-03-16 9:08 ` Herbert Xu
2017-03-16 9:23 ` Stephan Müller
2017-03-16 9:52 ` Herbert Xu
2017-03-16 10:18 ` Stephan Müller
2017-03-16 12:20 ` Stephan Müller [this message]
2017-03-31 10:33 ` Herbert Xu
2017-03-19 4:34 ` Stephan Müller
2017-03-30 13:59 ` Stephan Müller
2017-02-17 22:32 ` [PATCH v5 2/2] crypto: aead " Stephan Müller
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=74486084.680b3YGfiO@tauon.atsec.com \
--to=smueller@chronox.de \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@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 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.