From: ebiggers3@gmail.com (Eric Biggers)
To: linux-security-module@vger.kernel.org
Subject: [PATCH] key: Convert big_key payload.data to struct
Date: Tue, 9 May 2017 14:45:26 -0700 [thread overview]
Message-ID: <20170509214526.GB87747@gmail.com> (raw)
In-Reply-To: <13867.1494314658@warthog.procyon.org.uk>
On Tue, May 09, 2017 at 08:24:18AM +0100, David Howells wrote:
> Eric Biggers <ebiggers3@gmail.com> wrote:
>
> > It probably would be easier to kmalloc() this struct and store a pointer to
> > it in key->payload.data[0]
>
> Yeah, but it's a waste of resources if you don't have to do it.
>
> David
Yes, but it seems very much like a micro-optimization, which isn't helpful when
the code contains undefined behavior and is creating problems. This is the
*big* key type, after all; shouldn't the amount of data in the key normally be
large enough to make a kmalloc() of 24 bytes insignificant?
And besides, I expect that most users don't even use the big_keys feature. If
we actually want to avoid wasting resources that aren't used, we shouldn't
allocate the crypto_rng and crypto_skcipher until someone tries to create a
big_key. (Currently they're allocated unconditionally in big_key_init().)
- Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers3@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: Kees Cook <keescook@chromium.org>,
James Morris <james.l.morris@oracle.com>,
"Serge E. Hallyn" <serge@hallyn.com>,
keyrings@vger.kernel.org, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] key: Convert big_key payload.data to struct
Date: Tue, 9 May 2017 14:45:26 -0700 [thread overview]
Message-ID: <20170509214526.GB87747@gmail.com> (raw)
In-Reply-To: <13867.1494314658@warthog.procyon.org.uk>
On Tue, May 09, 2017 at 08:24:18AM +0100, David Howells wrote:
> Eric Biggers <ebiggers3@gmail.com> wrote:
>
> > It probably would be easier to kmalloc() this struct and store a pointer to
> > it in key->payload.data[0]
>
> Yeah, but it's a waste of resources if you don't have to do it.
>
> David
Yes, but it seems very much like a micro-optimization, which isn't helpful when
the code contains undefined behavior and is creating problems. This is the
*big* key type, after all; shouldn't the amount of data in the key normally be
large enough to make a kmalloc() of 24 bytes insignificant?
And besides, I expect that most users don't even use the big_keys feature. If
we actually want to avoid wasting resources that aren't used, we shouldn't
allocate the crypto_rng and crypto_skcipher until someone tries to create a
big_key. (Currently they're allocated unconditionally in big_key_init().)
- Eric
next prev parent reply other threads:[~2017-05-09 21:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-08 21:43 [PATCH] key: Convert big_key payload.data to struct Kees Cook
2017-05-08 21:43 ` Kees Cook
2017-05-08 22:00 ` David Howells
2017-05-08 22:00 ` David Howells
2017-05-08 22:19 ` Eric Biggers
2017-05-08 22:19 ` Eric Biggers
2017-05-09 7:24 ` David Howells
2017-05-09 7:24 ` David Howells
2017-05-09 21:45 ` Eric Biggers [this message]
2017-05-09 21:45 ` Eric Biggers
2017-05-08 22:26 ` Kees Cook
2017-05-08 22:26 ` Kees Cook
2017-05-09 8:11 ` David Howells
2017-05-09 8:11 ` David Howells
2017-05-09 16:12 ` Kees Cook
2017-05-09 16:12 ` Kees Cook
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=20170509214526.GB87747@gmail.com \
--to=ebiggers3@gmail.com \
--cc=linux-security-module@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.