netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Eric Dumazet <edumazet@google.com>
Cc: netdev <netdev@vger.kernel.org>,
	Eric Biggers <ebiggers@kernel.org>,
	"open list:HARDWARE RANDOM NUMBER GENERATOR CORE" 
	<linux-crypto@vger.kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	David Miller <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Jason Baron <jbaron@akamai.com>,
	Christoph Paasch <cpaasch@apple.com>,
	David Laight <David.Laight@aculab.com>,
	Yuchung Cheng <ycheng@google.com>
Subject: Re: [PATCH 1/2] net: fastopen: make key handling more robust against future changes
Date: Tue, 18 Jun 2019 11:41:35 +0200	[thread overview]
Message-ID: <CAKv+Gu894bEEzpKNDTaNiiNJTFoUTYQuFjBBm-ezdkrzW5fyNQ@mail.gmail.com> (raw)
In-Reply-To: <CANn89iJuTq36KMf1madQH08g6K0a-Uj-PDH80ao9zuEw+WNcZg@mail.gmail.com>

On Tue, 18 Jun 2019 at 11:39, Eric Dumazet <edumazet@google.com> wrote:
>
> On Tue, Jun 18, 2019 at 2:32 AM Ard Biesheuvel
> <ard.biesheuvel@linaro.org> wrote:
> >
> > Some changes to the TCP fastopen code to make it more robust
> > against future changes in the choice of key/cookie size, etc.
> >
> > - Instead of keeping the SipHash key in an untyped u8[] buffer
> >   and casting it to the right type upon use, use the correct
> >   siphash_key_t type directly. This ensures that the key will
> >   appear at the correct alignment if we ever change the way
> >   these data structures are allocated. (Currently, they are
> >   only allocated via kmalloc so they always appear at the
> >   correct alignment)
> >
> > - Use DIV_ROUND_UP when sizing the u64[] array to hold the
> >   cookie, so it is always of sufficient size, even when
> >   TCP_FASTOPEN_COOKIE_MAX is no longer a multiple of 8.
> >
> > - Add a key length check to tcp_fastopen_reset_cipher(). No
> >   callers exist currently that fail this check (they all pass
> >   compile constant values that equal TCP_FASTOPEN_KEY_LENGTH),
> >   but future changes might create problems, e.g., by leaving part
> >   of the key uninitialized, or overflowing the key buffers.
> >
> > Note that none of these are functional changes wrt the current
> > state of the code.
> >
> ...
>
> > -       memcpy(ctx->key[0], primary_key, len);
> > +       if (unlikely(len != TCP_FASTOPEN_KEY_LENGTH)) {
> > +               pr_err("TCP: TFO key length %u invalid\n", len);
> > +               err = -EINVAL;
> > +               goto out;
> > +       }
>
>
> Why a pr_err() is there ?
>
> Can unpriv users flood the syslog ?

They can if they could do so before: there was a call to
crypto_cipher_setkey() in the original pre-SipHash code which would
also result in a pr_err() on an invalid key length. That call got
removed along with the AES cipher handling, and this basically
reinstates it, as suggested by EricB.

  reply	other threads:[~2019-06-18  9:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18  9:32 [PATCH 0/2] net: fastopen: follow-up tweaks for SipHash switch Ard Biesheuvel
2019-06-18  9:32 ` [PATCH 1/2] net: fastopen: make key handling more robust against future changes Ard Biesheuvel
2019-06-18  9:39   ` Eric Dumazet
2019-06-18  9:41     ` Ard Biesheuvel [this message]
2019-06-18  9:53       ` Eric Dumazet
2019-06-18 10:02         ` Ard Biesheuvel
2019-06-18 18:18         ` Eric Biggers
2019-06-18 18:19           ` Eric Dumazet
2019-06-18  9:32 ` [PATCH 2/2] net: fastopen: use endianness agnostic representation of the cookie Ard Biesheuvel
2019-06-18 18:22   ` Eric Biggers
2019-06-18 18:40     ` Ard Biesheuvel
2019-06-18 22:40       ` David Miller
2019-06-18  9:37 ` [PATCH 0/2] net: fastopen: follow-up tweaks for SipHash switch Eric Dumazet
2019-06-18  9:38   ` Ard Biesheuvel

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=CAKv+Gu894bEEzpKNDTaNiiNJTFoUTYQuFjBBm-ezdkrzW5fyNQ@mail.gmail.com \
    --to=ard.biesheuvel@linaro.org \
    --cc=David.Laight@aculab.com \
    --cc=cpaasch@apple.com \
    --cc=davem@davemloft.net \
    --cc=ebiggers@kernel.org \
    --cc=edumazet@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jbaron@akamai.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-crypto@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ycheng@google.com \
    --cc=yoshfuji@linux-ipv6.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;
as well as URLs for NNTP newsgroup(s).