bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: KP Singh <kpsingh@chromium.org>
To: Martin KaFai Lau <kafai@fb.com>
Cc: open list <linux-kernel@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>, Song Liu <songliubraving@fb.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Paul Turner <pjt@google.com>, Jann Horn <jannh@google.com>,
	Hao Luo <haoluo@google.com>
Subject: Re: [PATCH bpf-next v3 1/9] bpf: Implement task local storage
Date: Wed, 4 Nov 2020 23:54:09 +0100	[thread overview]
Message-ID: <CACYkzJ6t12AORyTzAP_P3bZG-_K_01h7DVaUmYTWCd-8U-8-bQ@mail.gmail.com> (raw)
In-Reply-To: <20201104221526.dv6qfpfp5lk2t7zw@kafai-mbp.dhcp.thefacebook.com>

> > +     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.
*/

  reply	other threads:[~2020-11-04 22:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 16:44 [PATCH bpf-next v3 0/9] Implement task_local_storage KP Singh
2020-11-04 16:44 ` [PATCH bpf-next v3 1/9] bpf: Implement task local storage KP Singh
2020-11-04 22:08   ` Martin KaFai Lau
2020-11-04 22:17     ` Martin KaFai Lau
2020-11-04 22:15   ` Martin KaFai Lau
2020-11-04 22:54     ` KP Singh [this message]
2020-11-04 16:44 ` [PATCH bpf-next v3 2/9] libbpf: Add support for " KP Singh
2020-11-04 22:20   ` Martin KaFai Lau
2020-11-04 16:44 ` [PATCH bpf-next v3 3/9] bpftool: " KP Singh
2020-11-04 16:44 ` [PATCH bpf-next v3 4/9] bpf: Implement get_current_task_btf and RET_PTR_TO_BTF_ID KP Singh
2020-11-04 16:44 ` [PATCH bpf-next v3 5/9] bpf: Allow LSM programs to use bpf spin locks KP Singh
2020-11-04 22:35   ` Martin KaFai Lau
2020-11-04 22:44     ` KP Singh
2020-11-04 16:44 ` [PATCH bpf-next v3 6/9] bpf: Fix tests for local_storage KP Singh
2020-11-04 16:44 ` [PATCH bpf-next v3 7/9] bpf: Update selftests for local_storage to use vmlinux.h KP Singh
2020-11-04 16:44 ` [PATCH bpf-next v3 8/9] bpf: Add tests for task_local_storage KP Singh
2020-11-04 16:44 ` [PATCH bpf-next v3 9/9] bpf: Exercise syscall operations for inode and sk storage KP Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACYkzJ6t12AORyTzAP_P3bZG-_K_01h7DVaUmYTWCd-8U-8-bQ@mail.gmail.com \
    --to=kpsingh@chromium.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=jannh@google.com \
    --cc=kafai@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pjt@google.com \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).