[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACYkzJ6t12AORyTzAP_P3bZG-_K_01h7DVaUmYTWCd-8U-8-bQ@mail.gmail.com>
Date: Wed, 4 Nov 2020 23:54:09 +0100
From: KP Singh <kpsingh@...omium.org>
To: Martin KaFai Lau <kafai@...com>
Cc: open list <linux-kernel@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, Song Liu <songliubraving@...com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Paul Turner <pjt@...gle.com>, Jann Horn <jannh@...gle.com>,
Hao Luo <haoluo@...gle.com>
Subject: Re: [PATCH bpf-next v3 1/9] bpf: Implement task local storage
> > + WARN_ON_ONCE(!rcu_read_lock_held());
> > + task = pid_task(pid, PIDTYPE_PID);
> > + if (!task) {
> > + err = -ENOENT;
> > + goto out;
> > + }
> > +
> > + sdata = bpf_local_storage_update(
> > + task, (struct bpf_local_storage_map *)map, value, map_flags);
> It seems the task is protected by rcu here and the task may be going away.
> Is it ok?
>
> or the following comment in the later "BPF_CALL_4(bpf_task_storage_get, ...)"
> is no longer valid?
> /* This helper must only called from where the task is guaranteed
> * to have a refcount and cannot be freed.
> */
I reworded this (and the other similar comment) as:
/* This helper must only be called from places where the lifetime of the task
* is guaranteed. Either by being refcounted or by being protected
* by an RCU read-side critical section.
*/
Powered by blists - more mailing lists