mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Roman Gushchin <guro@fb.com>, Alexei Starovoitov <ast@kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>
Cc: Kernel Team <Kernel-team@fb.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Yonghong Song <yhs@fb.com>
Subject: Re: [PATCH bpf-next] bpf: allow CGROUP_SKB programs to use bpf_get_current_cgroup_id() helper
Date: Thu, 6 Jun 2019 21:39:35 +0200	[thread overview]
Message-ID: <a604b9eb-4e39-c4ec-0868-bac360bc2fb4@iogearbox.net> (raw)
In-Reply-To: <20190606190752.GA28743@tower.DHCP.thefacebook.com>

On 06/06/2019 09:08 PM, Roman Gushchin wrote:
> On Thu, Jun 06, 2019 at 11:59:11AM -0700, Roman Gushchin wrote:
>> Currently bpf_get_current_cgroup_id() is not supported for
>> CGROUP_SKB programs. An attempt to load such a program generates an
>> error like this:
>>     libbpf:
>>     0: (b7) r6 = 0
>>     ...
>>     8: (63) *(u32 *)(r10 -28) = r6
>>     9: (85) call bpf_get_current_cgroup_id#80
>>     unknown func bpf_get_current_cgroup_id#80
>>
>> There are no particular reasons for denying it,
>> and we have some use cases where it might be useful.
> 
> Ah, sorry, it's not so simple, as we probably need to take
> the cgroup pointer from the socket, not from current.
> 
> So the implementation of the helper should be different
> for this type of programs.
> 
> So I wonder if it's better to introduce a new helper
> bpf_get_sock_cgroup_id()?
> 
> What do you think?

We do have bpf_skb_cgroup_id(), did you give that a try?

Thanks,
Daniel

  reply	other threads:[~2019-06-06 19:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06 18:59 Roman Gushchin
2019-06-06 19:08 ` Roman Gushchin
2019-06-06 19:39   ` Daniel Borkmann [this message]
2019-06-06 19:53     ` Roman Gushchin
2019-06-06 19:59       ` Daniel Borkmann

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=a604b9eb-4e39-c4ec-0868-bac360bc2fb4@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=Kernel-team@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=guro@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yhs@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

all inboxes | Powered by JetHome®