[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210226000157.yoe7hbzocavn5udk@kafai-mbp.dhcp.thefacebook.com>
Date: Thu, 25 Feb 2021 16:01:57 -0800
From: Martin KaFai Lau <kafai@...com>
To: Song Liu <songliubraving@...com>
CC: <bpf@...r.kernel.org>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <ast@...nel.org>,
<daniel@...earbox.net>, <kernel-team@...com>,
<peterz@...radead.org>
Subject: Re: [PATCH v6 bpf-next 2/6] bpf: prevent deadlock from recursive
bpf_task_storage_[get|delete]
On Thu, Feb 25, 2021 at 03:43:15PM -0800, Song Liu wrote:
> BPF helpers bpf_task_storage_[get|delete] could hold two locks:
> bpf_local_storage_map_bucket->lock and bpf_local_storage->lock. Calling
> these helpers from fentry/fexit programs on functions in bpf_*_storage.c
> may cause deadlock on either locks.
>
> Prevent such deadlock with a per cpu counter, bpf_task_storage_busy. We
> need this counter to be global, because the two locks here belong to two
> different objects: bpf_local_storage_map and bpf_local_storage. If we
> pick one of them as the owner of the counter, it is still possible to
> trigger deadlock on the other lock. For example, if bpf_local_storage_map
> owns the counters, it cannot prevent deadlock on bpf_local_storage->lock
> when two maps are used.
Acked-by: Martin KaFai Lau <kafai@...com>
Powered by blists - more mailing lists