Message ID | 20240914133703.1920767-1-houtao@huaweicloud.com (mailing list archive) |
---|---|
Headers | show
Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11F361993B0 for <bpf@vger.kernel.org>; Sat, 14 Sep 2024 13:37:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726321026; cv=none; b=Ub8wowuz8WNs/h+hLPnvZ5y9L3/X20nVfWRl8n2U3BLQOyOoqr7mSJYbTcEDhUPtJuX2JJMa2AXBfFxh4ilSK8ZhLfeE+uWZ/ZMvIPy/ssGCJ7548eUefO1X8lYmYdH/oR5361mh5J+A1cxiVTmEWq2nfJwLhvwRye+OGvl0DpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726321026; c=relaxed/simple; bh=3dSIdK5seyPK72CLXSK5qfh+89ibrollUZuYT54QfVw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=rF/YrkJj1SEIwWxqYUzgwibL+uzziVdXmXws5HlDliYyWPo0XQ9iH7eEPgXRg01lVj98kX4mwhwHyci2GuuC1DcTYnebgWSoTXsZvslBXBhUKcc12nMnIW6/41NynvC+QBEWu5EibLFsfyQJp6d6zRFIIRGxX4Z41FqoAc9X84I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4X5XJq5kYrz4f3jXc for <bpf@vger.kernel.org>; Sat, 14 Sep 2024 21:36:43 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 6696E1A018D for <bpf@vger.kernel.org>; Sat, 14 Sep 2024 21:36:59 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgDHR8R3keVmnUI4BQ--.14337S4; Sat, 14 Sep 2024 21:36:57 +0800 (CST) From: Hou Tao <houtao@huaweicloud.com> To: bpf@vger.kernel.org Cc: Martin KaFai Lau <martin.lau@linux.dev>, Alexei Starovoitov <alexei.starovoitov@gmail.com>, Andrii Nakryiko <andrii@kernel.org>, Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>, Hao Luo <haoluo@google.com>, Yonghong Song <yonghong.song@linux.dev>, Daniel Borkmann <daniel@iogearbox.net>, KP Singh <kpsingh@kernel.org>, Stanislav Fomichev <sdf@fomichev.me>, Jiri Olsa <jolsa@kernel.org>, John Fastabend <john.fastabend@gmail.com>, Amery Hung <amery.hung@bytedance.com>, Dave Marchevsky <davemarchevsky@fb.com>, houtao1@huawei.com, xukuohai@huawei.com Subject: [PATCH bpf v2 0/2] Check the remaining info_cnt before repeating btf fields Date: Sat, 14 Sep 2024 21:37:01 +0800 Message-Id: <20240914133703.1920767-1-houtao@huaweicloud.com> X-Mailer: git-send-email 2.29.2 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: <bpf.vger.kernel.org> List-Subscribe: <mailto:bpf+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:bpf+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgDHR8R3keVmnUI4BQ--.14337S4 X-Coremail-Antispam: 1UD129KBjvdXoW7GF1kXFyrKw4ktw17CFy8Krg_yoWkArXE9F WFkr95WF48Z3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repeating btf fields
|
expand
|
From: Hou Tao <houtao1@huawei.com> Hi, The patch set adds the missed check again info_cnt when flattening the array of nested struct. The problem was spotted when developing dynptr key support for hash map. Patch #1 adds the missed check and patch #2 adds three success test cases and one failure test case for the problem. Comments are always welcome. Change Log: v2: * patch #1: check info_cnt in btf_repeat_fields() * patch #2: use a hard-coded number instead of BTF_FIELDS_MAX, because BTF_FIELDS_MAX is not always available in vmlinux.h (e.g., for llvm 17/18) v1: https://lore.kernel.org/bpf/20240911110557.2759801-1-houtao@huaweicloud.com/T/#t Hou Tao (2): bpf: Check the remaining info_cnt before repeating btf fields selftests/bpf: Add more test case for field flattening kernel/bpf/btf.c | 14 +++- .../selftests/bpf/prog_tests/cpumask.c | 1 + .../selftests/bpf/progs/cpumask_common.h | 5 ++ .../selftests/bpf/progs/cpumask_failure.c | 35 +++++++++ .../selftests/bpf/progs/cpumask_success.c | 78 ++++++++++++++++++- 5 files changed, 127 insertions(+), 6 deletions(-)