Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1037047rwn; Thu, 8 Sep 2022 12:20:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR7lBjO9mvSvNjlWHRmI9Kk/ecH7MaAcj2FaVCc7/CGnDleqKfukT9FH0qy/rvSjPQSQdw8K X-Received: by 2002:a17:902:e94f:b0:16d:847b:3343 with SMTP id b15-20020a170902e94f00b0016d847b3343mr10132575pll.103.1662664852786; Thu, 08 Sep 2022 12:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662664852; cv=none; d=google.com; s=arc-20160816; b=K16EEYgFwK4AWjLtB565vbTgwHl+eKoT2KtoWddKYDpTxvCMyBKaKar9CxPvYHJx0J as6FvgbcEVdZPu0HcXXSJJbdJRVQdnXEB6qUds5auIdIFgJaockKiw8GiRejeh82uTx7 RLnQ5Ys7iuNg+afiamz/ADjV7DoS9xMm4Mk0ucR/cPngG5yew2reZhcbfsRIN6+OYxwr rcmZf74D4HKbG/nqCu5CjQEzqBeQ4Ghct3lmwGibnKDbqMY+aDrHtJEnkhVbEeA+IjDp qi/qX/1JUmoiRdZAHmN81+rTxRcNAvVVQ4lV2iAJLZu3FVor5BSBsQ0aYvIyVVBDnBVl lDPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=Fcjsre31INBVp/IVj9TsfTLSl4EYVGMrSoczkfDg8/g=; b=SHLVN+yItMEKuhuXHLD0SFy9/fSB5nL4591tVEAT46m9nN2AQ1bsjnMg6vJir4eWSP 7uQ2w7sJQR4EIufP9qGUgU23SJbZMzWGGdplvB2wrufUMSDP2YQ/U3BUlA92ZYVuMrGz DGf4pKOsifviKwGB2g4lYg011FUMqsRyUg+m51rK3aMf8vxQa9KjR9iqmsgXIEWFckkH OUW8sf1k7rnJ9Re0AUvLzcz83kU2FspiqNQaleGiA8m512r2Dg/+3wvLSglGw/Rl/KsX J/eb4mY9b1fJBSnwohL9uorsQ1W1IKa0lxHvbY3Kz/CgyT38WSg7zrhObxlKcKUVPeSM SOMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=RQMBYV6P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r6-20020a654986000000b0043560d14c72si3571419pgs.105.2022.09.08.12.20.40; Thu, 08 Sep 2022 12:20:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=RQMBYV6P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230481AbiIHTOA (ORCPT + 99 others); Thu, 8 Sep 2022 15:14:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229938AbiIHTN5 (ORCPT ); Thu, 8 Sep 2022 15:13:57 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B26FEE51E; Thu, 8 Sep 2022 12:13:55 -0700 (PDT) Message-ID: <30cd1aa2-4dcf-d181-30d8-678377bf96c5@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1662664433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fcjsre31INBVp/IVj9TsfTLSl4EYVGMrSoczkfDg8/g=; b=RQMBYV6PzyyXv9pu7VQxhNKE4Brl0Wi3VVhhghI9ubjd0G/twMX2U7Yuglf4hsS1h9Yj0J GMdNBmEHq6aNj3v9hRSbGdND0ikx2bRb5X+pJytfK1RJwmWC6Mr2UYNwrbD5bJK46baFuz hK9MO7BaDpctVRhfitPRPlDGaIxzD64= Date: Thu, 8 Sep 2022 12:13:50 -0700 MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v2 0/2] Fix cgroup attach flags being assigned to effective progs Content-Language: en-US To: sdf@google.com, Pu Lehui Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Quentin Monnet , Song Liu , Yonghong Song , John Fastabend , KP Singh , Hao Luo , Jiri Olsa , Pu Lehui References: <20220908145304.3436139-1-pulehui@huaweicloud.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/8/22 10:28 AM, sdf@google.com wrote: > On 09/08, Pu Lehui wrote: >> From: Pu Lehui > >> When root-cgroup attach multi progs and sub-cgroup attach a >> override prog, bpftool will display incorrectly for the attach >> flags of the sub-cgroup’s effective progs: > >> $ bpftool cgroup tree /sys/fs/cgroup effective >> CgroupPath >> ID       AttachType      AttachFlags     Name >> /sys/fs/cgroup >> 6        cgroup_sysctl   multi           sysctl_tcp_mem >> 13       cgroup_sysctl   multi           sysctl_tcp_mem >> /sys/fs/cgroup/cg1 >> 20       cgroup_sysctl   override        sysctl_tcp_mem >> 6        cgroup_sysctl   override        sysctl_tcp_mem <- wrong >> 13       cgroup_sysctl   override        sysctl_tcp_mem <- wrong >> /sys/fs/cgroup/cg1/cg2 >> 20       cgroup_sysctl                   sysctl_tcp_mem >> 6        cgroup_sysctl                   sysctl_tcp_mem >> 13       cgroup_sysctl                   sysctl_tcp_mem > >> For cg1, obviously, the attach flags of prog6 and prog13 can not be >> OVERRIDE, and the attach flags of prog6 and prog13 is meaningless for >> cg1. We only need to care the attach flags of prog which attached to >> cg1, other progs attach flags should be omit. After these patches, >> the above situation will show as bellow: > >> $ bpftool cgroup tree /sys/fs/cgroup effective >> CgroupPath >> ID       AttachType      AttachFlags     Name >> /sys/fs/cgroup >> 6        cgroup_sysctl   multi           sysctl_tcp_mem >> 13       cgroup_sysctl   multi           sysctl_tcp_mem >> /sys/fs/cgroup/cg1 >> 20       cgroup_sysctl   override        sysctl_tcp_mem >> 6        cgroup_sysctl                   sysctl_tcp_mem >> 13       cgroup_sysctl                   sysctl_tcp_mem >> /sys/fs/cgroup/cg1/cg2 >> 20       cgroup_sysctl                   sysctl_tcp_mem >> 6        cgroup_sysctl                   sysctl_tcp_mem >> 13       cgroup_sysctl                   sysctl_tcp_mem > >> v2: >> - Limit prog_cnt to avoid overflow. (John) >> - Add more detail message. > > John also raised a good question in v1: the flags don't seem to > make sense when requesting effective list. So maybe not export them > at all? +1. not exporting them for 'effective' listing makes sense. This seems to be the day one behavior instead of the recent prog_attach_flags changes? so bpf-next makes sense also.