[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJuTq36KMf1madQH08g6K0a-Uj-PDH80ao9zuEw+WNcZg@mail.gmail.com>
Date: Tue, 18 Jun 2019 02:39:04 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Ard Biesheuvel <ard.biesheuvel@...aro.org>
Cc: netdev <netdev@...r.kernel.org>,
Eric Biggers <ebiggers@...nel.org>,
linux-crypto@...r.kernel.org,
Herbert Xu <herbert@...dor.apana.org.au>,
David Miller <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Jason Baron <jbaron@...mai.com>,
Christoph Paasch <cpaasch@...le.com>,
David Laight <David.Laight@...lab.com>,
Yuchung Cheng <ycheng@...gle.com>
Subject: Re: [PATCH 1/2] net: fastopen: make key handling more robust against
future changes
On Tue, Jun 18, 2019 at 2:32 AM Ard Biesheuvel
<ard.biesheuvel@...aro.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 ?
Powered by blists - more mailing lists