Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8493333ybi; Thu, 6 Jun 2019 13:20:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4l9eBKGf2VVr1WqAgBry5ECahFR/Eubda4Yroa+Gc80VZ17huRyqnL4FpQQPxqIG/1qUx X-Received: by 2002:a17:902:d88e:: with SMTP id b14mr1193862plz.153.1559852416999; Thu, 06 Jun 2019 13:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559852416; cv=none; d=google.com; s=arc-20160816; b=rmTqI0bv2SBBodQL0SB8qTCYmKSdETTNTHurToCX73YA6Z5Mz1EvnEOT1QSQo0iF8U AOyhr8Z5sRlP4V8g4+KXUdikKBV/F5nsUs/OOLB7Uj8U+fy5C9J/9NVvKeVVStIAo6bj S+ZfPZCTmslePLvFjBjtNqnkS5DwKrxDzfO+PnJduxSlqzRcGstKjCZiG2JUxtIpUCS0 XxRi4405UCoZUltMFtELNftrR4g/AoFSijDzKZUUz1qWvnNEW4vtjHJGdznezuRLNNs0 jw248EAF7TAcsVPlM3KtZ6kQaymeWOsOidas2/h30lzqB7pP10R8XM0ROYkiOQRsZcSc 9bTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=IvTnvBTI1JmTy7AQHD6svkkSc7l+jax3kDLfWwL5ox0=; b=qwG+amUc/u9O2THm3DdNzV+AixS2m1Bdu7sUrM2rRPPziNO6WEQU1NdXdhJzzRwcrb 9SzoGe8PTHBViGfveH9VFKHKmNX4uH9YAFOHyIaxGc9S4m+CY+/I2LsnooTrwvlHIFw2 ecsOidpAmgJ7v1LhP7WeRTaYFyaZBHVrcP+w0suAUT6hW/TogjwduEaxo6jnRiKD+fe+ q2PoAChBYoMZiN4Ajbfju2f22a4a3sD+lT3dw5zpkbvh7c24ZHELFCApWHEE/N3Q2T+c iKg0MlxypiBCh3LNhpAuBeOeztqlhLeM+bH8x56v6wgcnRa087mNG/1mIRz9gNz8ioDo uMow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z75si62282pgz.114.2019.06.06.13.20.00; Thu, 06 Jun 2019 13:20:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726855AbfFFTnK (ORCPT + 99 others); Thu, 6 Jun 2019 15:43:10 -0400 Received: from www62.your-server.de ([213.133.104.62]:48902 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726697AbfFFTnK (ORCPT ); Thu, 6 Jun 2019 15:43:10 -0400 Received: from [78.46.172.3] (helo=sslproxy06.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1hYyEa-0002Jo-GE; Thu, 06 Jun 2019 21:39:36 +0200 Received: from [178.197.249.21] (helo=linux.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1hYyEa-000LVN-A7; Thu, 06 Jun 2019 21:39:36 +0200 Subject: Re: [PATCH bpf-next] bpf: allow CGROUP_SKB programs to use bpf_get_current_cgroup_id() helper To: Roman Gushchin , Alexei Starovoitov , "bpf@vger.kernel.org" Cc: Kernel Team , "linux-kernel@vger.kernel.org" , Yonghong Song References: <20190606185911.4089151-1-guro@fb.com> <20190606190752.GA28743@tower.DHCP.thefacebook.com> From: Daniel Borkmann Message-ID: Date: Thu, 6 Jun 2019 21:39:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20190606190752.GA28743@tower.DHCP.thefacebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.3/25472/Thu Jun 6 10:09:59 2019) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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