1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright (c) 2020 Facebook */ 3 /* "undefine" structs in vmlinux.h, because we "override" them below */ 4 #define bpf_iter_meta bpf_iter_meta___not_used 5 #define bpf_iter__bpf_map bpf_iter__bpf_map___not_used 6 #define bpf_iter__ipv6_route bpf_iter__ipv6_route___not_used 7 #define bpf_iter__netlink bpf_iter__netlink___not_used 8 #define bpf_iter__task bpf_iter__task___not_used 9 #define bpf_iter__task_file bpf_iter__task_file___not_used 10 #define bpf_iter__task_vma bpf_iter__task_vma___not_used 11 #define bpf_iter__tcp bpf_iter__tcp___not_used 12 #define tcp6_sock tcp6_sock___not_used 13 #define bpf_iter__udp bpf_iter__udp___not_used 14 #define udp6_sock udp6_sock___not_used 15 #define bpf_iter__unix bpf_iter__unix___not_used 16 #define bpf_iter__bpf_map_elem bpf_iter__bpf_map_elem___not_used 17 #define bpf_iter__bpf_sk_storage_map bpf_iter__bpf_sk_storage_map___not_used 18 #define bpf_iter__sockmap bpf_iter__sockmap___not_used 19 #define bpf_iter__bpf_link bpf_iter__bpf_link___not_used 20 #define bpf_iter__cgroup bpf_iter__cgroup___not_used 21 #define btf_ptr btf_ptr___not_used 22 #define BTF_F_COMPACT BTF_F_COMPACT___not_used 23 #define BTF_F_NONAME BTF_F_NONAME___not_used 24 #define BTF_F_PTR_RAW BTF_F_PTR_RAW___not_used 25 #define BTF_F_ZERO BTF_F_ZERO___not_used 26 #define bpf_iter__ksym bpf_iter__ksym___not_used 27 #include "vmlinux.h" 28 #undef bpf_iter_meta 29 #undef bpf_iter__bpf_map 30 #undef bpf_iter__ipv6_route 31 #undef bpf_iter__netlink 32 #undef bpf_iter__task 33 #undef bpf_iter__task_file 34 #undef bpf_iter__task_vma 35 #undef bpf_iter__tcp 36 #undef tcp6_sock 37 #undef bpf_iter__udp 38 #undef udp6_sock 39 #undef bpf_iter__unix 40 #undef bpf_iter__bpf_map_elem 41 #undef bpf_iter__bpf_sk_storage_map 42 #undef bpf_iter__sockmap 43 #undef bpf_iter__bpf_link 44 #undef bpf_iter__cgroup 45 #undef btf_ptr 46 #undef BTF_F_COMPACT 47 #undef BTF_F_NONAME 48 #undef BTF_F_PTR_RAW 49 #undef BTF_F_ZERO 50 #undef bpf_iter__ksym 51 52 struct bpf_iter_meta { 53 struct seq_file *seq; 54 __u64 session_id; 55 __u64 seq_num; 56 } __attribute__((preserve_access_index)); 57 58 struct bpf_iter__ipv6_route { 59 struct bpf_iter_meta *meta; 60 struct fib6_info *rt; 61 } __attribute__((preserve_access_index)); 62 63 struct bpf_iter__netlink { 64 struct bpf_iter_meta *meta; 65 struct netlink_sock *sk; 66 } __attribute__((preserve_access_index)); 67 68 struct bpf_iter__task { 69 struct bpf_iter_meta *meta; 70 struct task_struct *task; 71 } __attribute__((preserve_access_index)); 72 73 struct bpf_iter__task_file { 74 struct bpf_iter_meta *meta; 75 struct task_struct *task; 76 __u32 fd; 77 struct file *file; 78 } __attribute__((preserve_access_index)); 79 80 struct bpf_iter__task_vma { 81 struct bpf_iter_meta *meta; 82 struct task_struct *task; 83 struct vm_area_struct *vma; 84 } __attribute__((preserve_access_index)); 85 86 struct bpf_iter__bpf_map { 87 struct bpf_iter_meta *meta; 88 struct bpf_map *map; 89 } __attribute__((preserve_access_index)); 90 91 struct bpf_iter__tcp { 92 struct bpf_iter_meta *meta; 93 struct sock_common *sk_common; 94 uid_t uid; 95 } __attribute__((preserve_access_index)); 96 97 struct tcp6_sock { 98 struct tcp_sock tcp; 99 struct ipv6_pinfo inet6; 100 } __attribute__((preserve_access_index)); 101 102 struct bpf_iter__udp { 103 struct bpf_iter_meta *meta; 104 struct udp_sock *udp_sk; 105 uid_t uid __attribute__((aligned(8))); 106 int bucket __attribute__((aligned(8))); 107 } __attribute__((preserve_access_index)); 108 109 struct udp6_sock { 110 struct udp_sock udp; 111 struct ipv6_pinfo inet6; 112 } __attribute__((preserve_access_index)); 113 114 struct bpf_iter__unix { 115 struct bpf_iter_meta *meta; 116 struct unix_sock *unix_sk; 117 uid_t uid; 118 } __attribute__((preserve_access_index)); 119 120 struct bpf_iter__bpf_map_elem { 121 struct bpf_iter_meta *meta; 122 struct bpf_map *map; 123 void *key; 124 void *value; 125 }; 126 127 struct bpf_iter__bpf_sk_storage_map { 128 struct bpf_iter_meta *meta; 129 struct bpf_map *map; 130 struct sock *sk; 131 void *value; 132 }; 133 134 struct bpf_iter__sockmap { 135 struct bpf_iter_meta *meta; 136 struct bpf_map *map; 137 void *key; 138 struct sock *sk; 139 }; 140 141 struct bpf_iter__bpf_link { 142 struct bpf_iter_meta *meta; 143 struct bpf_link *link; 144 }; 145 146 struct bpf_iter__cgroup { 147 struct bpf_iter_meta *meta; 148 struct cgroup *cgroup; 149 } __attribute__((preserve_access_index)); 150 151 struct btf_ptr { 152 void *ptr; 153 __u32 type_id; 154 __u32 flags; 155 }; 156 157 enum { 158 BTF_F_COMPACT = (1ULL << 0), 159 BTF_F_NONAME = (1ULL << 1), 160 BTF_F_PTR_RAW = (1ULL << 2), 161 BTF_F_ZERO = (1ULL << 3), 162 }; 163 164 struct bpf_iter__ksym { 165 struct bpf_iter_meta *meta; 166 struct kallsym_iter *ksym; 167 }; 168