[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60ca8c81708a9_26dfd2081e@john-XPS-13-9370.notmuch>
Date: Wed, 16 Jun 2021 16:42:57 -0700
From: John Fastabend <john.fastabend@...il.com>
To: John Fastabend <john.fastabend@...il.com>,
maciej.fijalkowski@...el.com, ast@...nel.org, daniel@...earbox.net,
andriin@...com
Cc: john.fastabend@...il.com, netdev@...r.kernel.org,
netdev@...r.kernel.org
Subject: RE: [PATCH bpf v2 2/4] bpf: map_poke_descriptor is being called with
an unstable poke_tab[]
John Fastabend wrote:
> When populating poke_tab[] of a subprog we call map_poke_track() after
> doing bpf_jit_add_poke_descriptor(). But, bpf_jit_add_poke_descriptor()
> may, likely will, realloc the poke_tab[] structure and free the old
> one. So that prog->aux->poke_tab is not stable. However, the aux pointer
> is referenced from bpf_array_aux and poke_tab[] is used to 'track'
> prog<->map link. This way when progs are released the entry in the
> map is dropped and vice versa when the map is released we don't drop
> it too soon if a prog is in the process of calling it.
>
> I wasn't able to trigger any errors here, for example having map_poke_run
> run with a poke_tab[] pointer that was free'd from
> bpf_jit_add_poke_descriptor(), but it looks possible and at very least
> is very fragile.
>
> This patch moves poke_track call out of loop that is calling add_poke
> so that we only ever add stable aux->poke_tab pointers to the map's
> bpf_array_aux struct. Further, we need this in the next patch to fix
> a real bug where progs are not 'untracked'.
>
> Signed-off-by: John Fastabend <john.fastabend@...il.com>
> ---
Needs a fixes tag,
Fixes: a748c6975dea3 ("bpf: propagate poke descriptors to subprograms")
Powered by blists - more mailing lists