[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5dc18ba56aec_48332abec96485b835@john-XPS-13-9370.notmuch>
Date: Tue, 05 Nov 2019 06:48:05 -0800
From: John Fastabend <john.fastabend@...il.com>
To: Jakub Kicinski <jakub.kicinski@...ronome.com>, davem@...emloft.net
Cc: netdev@...r.kernel.org, oss-drivers@...ronome.com,
borisp@...lanox.com, aviadye@...lanox.com,
john.fastabend@...il.com, daniel@...earbox.net,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
syzbot+f8495bff23a879a6d0bd@...kaller.appspotmail.com,
syzbot+6f50c99e8f6194bf363f@...kaller.appspotmail.com,
Eric Biggers <ebiggers@...nel.org>,
herbert@...dor.apana.org.au, glider@...gle.com,
linux-crypto@...r.kernel.org
Subject: RE: [PATCH net v2] net/tls: fix sk_msg trim on fallback to copy mode
Jakub Kicinski wrote:
> sk_msg_trim() tries to only update curr pointer if it falls into
> the trimmed region. The logic, however, does not take into the
> account pointer wrapping that sk_msg_iter_var_prev() does nor
> (as John points out) the fact that msg->sg is a ring buffer.
>
> This means that when the message was trimmed completely, the new
> curr pointer would have the value of MAX_MSG_FRAGS - 1, which is
> neither smaller than any other value, nor would it actually be
> correct.
>
> Special case the trimming to 0 length a little bit and rework
> the comparison between curr and end to take into account wrapping.
>
> This bug caused the TLS code to not copy all of the message, if
> zero copy filled in fewer sg entries than memcopy would need.
>
> Big thanks to Alexander Potapenko for the non-KMSAN reproducer.
>
> v2:
> - take into account that msg->sg is a ring buffer (John).
>
> Link: https://lore.kernel.org/netdev/20191030160542.30295-1-jakub.kicinski@netronome.com/ (v1)
>
> Fixes: d829e9c4112b ("tls: convert to generic sk_msg interface")
> Reported-by: syzbot+f8495bff23a879a6d0bd@...kaller.appspotmail.com
> Reported-by: syzbot+6f50c99e8f6194bf363f@...kaller.appspotmail.com
> Co-developed-by: John Fastabend <john.fastabend@...il.com>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
> ---
> CC: Eric Biggers <ebiggers@...nel.org>
> CC: herbert@...dor.apana.org.au
> CC: glider@...gle.com
> CC: linux-crypto@...r.kernel.org
> ---
I'll run it through our CI here when I get a chance but LGTM
thanks for sending this and tracking it down. Per process.rst
I guess we add Signed-off-by lines instead of acks from
co-developers. News to me.
Signed-off-by: John Fastabend <john.fastabend@...il.com>
Powered by blists - more mailing lists