[PATCH bpf-next v2 4/4] selftests/bpf: corner case for typedefs handling in btf_dump

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This corner case stood out while testing:

  typedef struct foo foo_alias;

  struct foo {};

  struct root {
	foo_alias *a;
	foo_alias b;
  };

btf_dump_order_type() visits root->a first and root->b next.
If 'foo_alias' is marked as ORDERED when visiting root->a
type 'foo' will only have a forward declaration.

Signed-off-by: Eduard Zingerman <eddyz87@xxxxxxxxx>
---
 .../selftests/bpf/progs/btf_dump_test_case_ordering.c  | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/testing/selftests/bpf/progs/btf_dump_test_case_ordering.c b/tools/testing/selftests/bpf/progs/btf_dump_test_case_ordering.c
index 7c95702ee4cb..e542cb8fb3f4 100644
--- a/tools/testing/selftests/bpf/progs/btf_dump_test_case_ordering.c
+++ b/tools/testing/selftests/bpf/progs/btf_dump_test_case_ordering.c
@@ -47,12 +47,22 @@ struct callback_head {
 	void (*func)(struct callback_head *);
 };
 
+typedef struct foo foo_alias;
+
+struct foo {};
+
+struct typedef_ptr_and_full {
+	foo_alias *a;
+	foo_alias b;
+};
+
 struct root_struct {
 	struct s4 s4;
 	struct list_head l;
 	struct hlist_node n;
 	struct hlist_head h;
 	struct callback_head cb;
+	struct typedef_ptr_and_full td;
 };
 
 /*------ END-EXPECTED-OUTPUT ------ */
-- 
2.34.1





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux