Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp183990rwn; Fri, 16 Sep 2022 18:04:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tCR9AA1AbPaV1a0bkFpIa52lFxqAa6JtsEoWlkO7O/m4oLmnH9PyvdiMBHj+LVeBqOavP X-Received: by 2002:a17:906:9b8f:b0:77b:2b61:ae2d with SMTP id dd15-20020a1709069b8f00b0077b2b61ae2dmr5108974ejc.50.1663376640537; Fri, 16 Sep 2022 18:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663376640; cv=none; d=google.com; s=arc-20160816; b=V6v+jz8eAEL1LXaNltYfA1PHPhNovN6pCvz4uVhIGb32ksrk2t2KXHJMrHnBgSFLvH /+a0OKi5NYCxDJwqpBeu/biDFr+tZqCPVm2/XPR2qxPrhWgyF1/cpj+BXot1HcQXbRcX /7PJWOvtBihXpdaBiG+jSsq17aB0Xu+gHlF2j8xnwt1RXx4kSwmMyzC2eQ08J2lnnUxT am8yPJH3UsAr5vninQpstU2zvBU1u6YUPihc4mM4pVSA4JJpQWnaVnV3QTZbPH6ebfUu Ej00miKql9NeXw2YJpyh0Ody148hUabc64gvTaJx1MKlt966wdQ4JS/sJkZyCgBco4g8 lk+g== 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=tR6wInvPk183+mhIgKv2vbvtJK2JcPDWX8U0jw/KuDY=; b=VQ7Gi0uj3m0rD5PnDQKFHfD+2C5ZtO6MGaL7OtgfVEHwV2bfdGzISgCkLHp6CzND0x tTRsshqvYIj0Scc0UmwOlKhPx01z0yzuRoLKdFuoTIk0BwdQrhUapioTUL2yPKUlmYxC YyCSWoBDhQ7EeZmA79J9SjLzEPy1Qg7a0lE/ZvVQOs/QeaxAjwElWc36riXGKx0Cs2Yz JviLgzmQHKDoRuJFqAvRN2eMd1bM7/pLBdkGzPNsGOKGmffVf2RDTVmZtkx6MIPfK9Zr 02MKnRtcCBliWFLksO2erpVdyW7n5mGxLYHEOzZxSODpvMX77scR4J/WhOg1oB6Hdtfz lmDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=brd1JeiP; 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 20-20020a170906311400b0073150f3dbbfsi16609303ejx.950.2022.09.16.18.03.35; Fri, 16 Sep 2022 18:04:00 -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=brd1JeiP; 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 S229711AbiIQADz (ORCPT + 99 others); Fri, 16 Sep 2022 20:03:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbiIQADy (ORCPT ); Fri, 16 Sep 2022 20:03:54 -0400 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACE9BB56F9; Fri, 16 Sep 2022 17:03:50 -0700 (PDT) Message-ID: <9b66564e-2582-03b2-56f1-8037f8aca886@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1663373028; 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=tR6wInvPk183+mhIgKv2vbvtJK2JcPDWX8U0jw/KuDY=; b=brd1JeiPc8ULUl92liskHob9EBfIf0fFcYBqorqjM1XzyiVFcAYi4sDl/MRvK6/uJAEzzj ENfbnXUe1oDN+nAcer4/AolUh2hQ+CgKmzS3uL9FAn954Xm2BSUYbRCUbAn0nREP4uGIjJ 3S4PDzHhTv1JVwLtkH8ZtyymOGQpHaw= Date: Fri, 16 Sep 2022 17:03:42 -0700 MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v3 1/2] bpf, cgroup: Don't populate prog_attach_flags array when effective query Content-Language: en-US To: Pu Lehui , Stanislav Fomichev Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Quentin Monnet , Song Liu , Yonghong Song , John Fastabend , KP Singh , Hao Luo , Jiri Olsa , Pu Lehui , bpf@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220914161742.3180731-1-pulehui@huaweicloud.com> <20220914161742.3180731-2-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: <20220914161742.3180731-2-pulehui@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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/14/22 9:17 AM, Pu Lehui wrote: > From: Pu Lehui > > Attach flags is only valid for attached progs of this layer cgroup, > but not for effective progs. For querying with EFFECTIVE flags, > exporting attach flags does not make sense. so we don't need to > populate prog_attach_flags array when effective query. prog_attach_flags has been added to 6.0 which is in rc5. It is still doable (and cleaner) to reject prog_attach_flags when it is an effective_query. This should be done regardless of 'type == BPF_LSM_CGROUP' or not. Something like: if (effective_query && prog_attach_flags) return -EINVAL; Otherwise, the whole prog_attach_flags needs to be set to 0 during effective_query. Please target the change to the bpf tree instead of bpf-next such that this uapi bit can be fixed before 6.0. Also, the effective_query issue is not limited to the prog_attach_flags? For the older uattr->query.attach_flags, it should be set to 0 also when it is an effective_query, right?