All of lore.kernel.org
 help / color / mirror / Atom feed
From: Song Liu <song@kernel.org>
To: KP Singh <kpsingh@chromium.org>
Cc: open list <linux-kernel@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <kafai@fb.com>, Paul Turner <pjt@google.com>,
	Jann Horn <jannh@google.com>, Hao Luo <haoluo@google.com>
Subject: Re: [PATCH bpf-next 1/5] bpf: Implement task local storage
Date: Fri, 30 Oct 2020 17:02:41 -0700	[thread overview]
Message-ID: <CAPhsuW4z4b83AeTB_MUWzVWcZxvQ+hdbN9riL77t4j9uBfDdGA@mail.gmail.com> (raw)
In-Reply-To: <CACYkzJ7kbq0Nq71fJCkHSwEmJfKFKOsvRZos_tT64N1f-aT4-A@mail.gmail.com>

On Fri, Oct 30, 2020 at 4:07 AM KP Singh <kpsingh@chromium.org> wrote:
>
> "
>
> On Fri, Oct 30, 2020 at 12:28 AM Song Liu <song@kernel.org> wrote:
> >
> > On Wed, Oct 28, 2020 at 9:17 AM KP Singh <kpsingh@chromium.org> wrote:
> > >
> > > From: KP Singh <kpsingh@google.com>
> > >
> > > Similar to bpf_local_storage for sockets and inodes add local storage
> > > for task_struct.
> > >
> > > The life-cycle of storage is managed with the life-cycle of the
> > > task_struct.  i.e. the storage is destroyed along with the owning task
> > > with a callback to the bpf_task_storage_free from the task_free LSM
> > > hook.
> >
> > It looks like task local storage is tightly coupled to LSM. As we discussed,
> > it will be great to use task local storage in tracing programs. Would you
> > like to enable it from the beginning? Alternatively, I guess we can also do
> > follow-up patches.
> >
>
> I would prefer if we do it in follow-up patches.
>
> > >
> > > The BPF LSM allocates an __rcu pointer to the bpf_local_storage in
> > > the security blob which are now stackable and can co-exist with other
> > > LSMs.
> > >
> > > The userspace map operations can be done by using a pid fd as a key
> > > passed to the lookup, update and delete operations.
> >
> > While testing task local storage, I noticed a limitation of pid fd:
> >
> > /* Currently, the process identified by
> >  * @pid must be a thread-group leader. This restriction currently exists
> >  * for all aspects of pidfds including pidfd creation (CLONE_PIDFD cannot
> >  * be used with CLONE_THREAD) and pidfd polling (only supports thread group
> >  * leaders).
> >  */
> >
> > This could be a problem for some use cases. How about we try to remove
> > this restriction (maybe with a new flag to pidfd_open) as part of this set?
>
> I would appreciate it if we could also do this in a follow-up patch.
>
> I do see that there is a comment in fork.c:
>
>     "CLONE_THREAD is blocked until someone really needs it."
>
> But I don't understand the requirements well enough and would thus prefer
> to do this in a follow-up series.

Sounds good. Let's work on these in follow-up patches.

Thanks,
Song

  reply	other threads:[~2020-10-31  0:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 17:03 [PATCH bpf-next 0/5] Implement task_local_storage KP Singh
2020-10-27 17:03 ` [PATCH bpf-next 1/5] bpf: Implement task local storage KP Singh
2020-10-28  1:13   ` Martin KaFai Lau
2020-10-30 10:53     ` KP Singh
2020-11-03 14:46       ` KP Singh
2020-10-28  1:22   ` Martin KaFai Lau
2020-11-03 14:52     ` KP Singh
2020-10-29 23:12   ` Andrii Nakryiko
2020-10-30 11:02     ` KP Singh
2020-10-29 23:27   ` Song Liu
2020-10-30 11:07     ` KP Singh
2020-10-31  0:02       ` Song Liu [this message]
2020-10-27 17:03 ` [PATCH bpf-next 2/5] bpf: Implement get_current_task_btf and RET_PTR_TO_BTF_ID KP Singh
2020-10-28  1:27   ` Martin KaFai Lau
2020-10-31 18:45   ` kernel test robot
2020-10-31 18:45     ` kernel test robot
2020-10-31 18:45   ` [RFC PATCH] bpf: bpf_get_current_task_btf_proto can be static kernel test robot
2020-10-31 18:45     ` kernel test robot
2020-10-27 17:03 ` [PATCH bpf-next 3/5] bpf: Fix tests for local_storage KP Singh
2020-10-27 17:03 ` [PATCH bpf-next 4/5] bpf: Update selftests for local_storage to use vmlinux.h KP Singh
2020-10-27 17:03 ` [PATCH bpf-next 5/5] bpf: Add tests for task_local_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=CAPhsuW4z4b83AeTB_MUWzVWcZxvQ+hdbN9riL77t4j9uBfDdGA@mail.gmail.com \
    --to=song@kernel.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=kpsingh@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pjt@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.