Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1687609

Re: [PATCH] ipv6: initialize treq->txhash in cookie_v6_check()

From Neal Cardwell <ncardwell@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH] ipv6: initialize treq->txhash in cookie_v6_check()
Date 2017-07-14 21:10 +0200
Message-ID <u3e8p-7II-7@gated-at.bofh.it> (permalink)
References <u3c6B-686-11@gated-at.bofh.it> <u3cgi-6qU-13@gated-at.bofh.it> <u3cJl-6Ez-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jul 14, 2017 at 1:35 PM, Alexander Potapenko <glider@google.com> wrote:
> On Fri, Jul 14, 2017 at 7:04 PM, Neal Cardwell <ncardwell@google.com> wrote:
>> On Fri, Jul 14, 2017 at 12:54 PM, Alexander Potapenko <glider@google.com> wrote:
>>> KMSAN reported use of uninitialized memory in skb_set_hash_from_sk(),
>>> which originated from the TCP request socket created in
>>> cookie_v6_check():
>> ...
>>> --- a/net/ipv6/syncookies.c
>>> +++ b/net/ipv6/syncookies.c
>>> @@ -216,6 +216,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
>>>         treq->rcv_isn = ntohl(th->seq) - 1;
>>>         treq->snt_isn = cookie;
>>>         treq->ts_off = 0;
>>> +       treq->txhash = 0;
>>>
>>>         /*
>>>          * We need to lookup the dst_entry to get the correct window size.
>>
>> I would have thought that the same fix is needed in the corresponding
>> line in cookie_v4_check() in net/ipv4/syncookies.c? (I do not see
>> txhash being initialized for the IPv4 side.) If it's not needed for
>> some reason, then it would be worth a comment in the commit
>> description to explain why not.
> Most certainly it is needed. I haven't seen reports for that in the
> wild and couldn't forge a repro triggering the bug in IPv4, but I'll
> give it another shot.

If you force syncookies to be used, with:

  sysctl -q net.ipv4.tcp_syncookies=2

then every passive IPv4 TCP connection that is accepted by a TCP
server app should be using that uninitialized memory, I would think
(and thus should be liable to fire the KMSAN use of uninitialized
memory warning).

Does that work?

neal

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] ipv6: initialize treq->txhash in cookie_v6_check() Alexander Potapenko <glider@google.com> - 2017-07-14 19:00 +0200
  Re: [PATCH] ipv6: initialize treq->txhash in cookie_v6_check() Neal Cardwell <ncardwell@google.com> - 2017-07-14 19:10 +0200
    Re: [PATCH] ipv6: initialize treq->txhash in cookie_v6_check() Alexander Potapenko <glider@google.com> - 2017-07-14 19:40 +0200
      Re: [PATCH] ipv6: initialize treq->txhash in cookie_v6_check() Neal Cardwell <ncardwell@google.com> - 2017-07-14 21:10 +0200
  Re: [PATCH] ipv6: initialize treq->txhash in cookie_v6_check() Eric Dumazet <eric.dumazet@gmail.com> - 2017-07-17 09:40 +0200
    Re: [PATCH] ipv6: initialize treq->txhash in cookie_v6_check() Eric Dumazet <eric.dumazet@gmail.com> - 2017-07-17 10:00 +0200

csiph-web