[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ae371400-e37f-bbac-691e-cc50235f1ee0@iogearbox.net>
Date: Sat, 28 Mar 2020 18:14:25 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: Magnus Karlsson <magnus.karlsson@...il.com>,
Fletcher Dunn <fletcherd@...vesoftware.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
Brandon Gilmore <bgilmore@...vesoftware.com>,
Steven Noonan <steven@...vesoftware.com>
Subject: Re: [PATCH bpf-next] xsk: Init all ring members in xsk_umem__create
and xsk_socket__create
On 3/28/20 10:18 AM, Magnus Karlsson wrote:
> On Fri, Mar 27, 2020 at 4:40 AM Fletcher Dunn
> <fletcherd@...vesoftware.com> wrote:
>>
>> Fix a sharp edge in xsk_umem__create and xsk_socket__create. Almost all of
>> the members of the ring buffer structs are initialized, but the "cached_xxx"
>> variables are not all initialized. The caller is required to zero them.
>> This is needlessly dangerous. The results if you don't do it can be very bad.
>> For example, they can cause xsk_prod_nb_free and xsk_cons_nb_avail to return
>> values greater than the size of the queue. xsk_ring_cons__peek can return an
>> index that does not refer to an item that has been queued.
>>
>> I have confirmed that without this change, my program misbehaves unless I
>> memset the ring buffers to zero before calling the function. Afterwards,
>> my program works without (or with) the memset.
>
> Thank you Flecther for catching this. Appreciated.
>
> /Magnus
>
> Acked-by: Magnus Karlsson <magnus.karlsson@...el.com>
Applied, thanks!
Powered by blists - more mailing lists