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 btf_ptr btf_ptr___not_used 21 #define BTF_F_COMPACT BTF_F_COMPACT___not_used 22 #define BTF_F_NONAME BTF_F_NONAME___not_used 23 #define BTF_F_PTR_RAW BTF_F_PTR_RAW___not_used 24 #define BTF_F_ZERO BTF_F_ZERO___not_used 25 #define bpf_iter__ksym bpf_iter__ksym___not_used 26 #include "vmlinux.h" 27 #undef bpf_iter_meta 28 #undef bpf_iter__bpf_map 29 #undef bpf_iter__ipv6_route 30 #undef bpf_iter__netlink 31 #undef bpf_iter__task 32 #undef bpf_iter__task_file 33 #undef bpf_iter__task_vma 34 #undef bpf_iter__tcp 35 #undef tcp6_sock 36 #undef bpf_iter__udp 37 #undef udp6_sock 38 #undef bpf_iter__unix 39 #undef bpf_iter__bpf_map_elem 40 #undef bpf_iter__bpf_sk_storage_map 41 #undef bpf_iter__sockmap 42 #undef bpf_iter__bpf_link 43 #undef btf_ptr 44 #undef BTF_F_COMPACT 45 #undef BTF_F_NONAME 46 #undef BTF_F_PTR_RAW 47 #undef BTF_F_ZERO 48 #undef bpf_iter__ksym 49 50 struct bpf_iter_meta { 51 struct seq_file *seq; 52 __u64 session_id; 53 __u64 seq_num; 54 } __attribute__((preserve_access_index)); 55 56 struct bpf_iter__ipv6_route { 57 struct bpf_iter_meta *meta; 58 struct fib6_info *rt; 59 } __attribute__((preserve_access_index)); 60 61 struct bpf_iter__netlink { 62 struct bpf_iter_meta *meta; 63 struct netlink_sock *sk; 64 } __attribute__((preserve_access_index)); 65 66 struct bpf_iter__task { 67 struct bpf_iter_meta *meta; 68 struct task_struct *task; 69 } __attribute__((preserve_access_index)); 70 71 struct bpf_iter__task_file { 72 struct bpf_iter_meta *meta; 73 struct task_struct *task; 74 __u32 fd; 75 struct file *file; 76 } __attribute__((preserve_access_index)); 77 78 struct bpf_iter__task_vma { 79 struct bpf_iter_meta *meta; 80 struct task_struct *task; 81 struct vm_area_struct *vma; 82 } __attribute__((preserve_access_index)); 83 84 struct bpf_iter__bpf_map { 85 struct bpf_iter_meta *meta; 86 struct bpf_map *map; 87 } __attribute__((preserve_access_index)); 88 89 struct bpf_iter__tcp { 90 struct bpf_iter_meta *meta; 91 struct sock_common *sk_common; 92 uid_t uid; 93 } __attribute__((preserve_access_index)); 94 95 struct tcp6_sock { 96 struct tcp_sock tcp; 97 struct ipv6_pinfo inet6; 98 } __attribute__((preserve_access_index)); 99 100 struct bpf_iter__udp { 101 struct bpf_iter_meta *meta; 102 struct udp_sock *udp_sk; 103 uid_t uid __attribute__((aligned(8))); 104 int bucket __attribute__((aligned(8))); 105 } __attribute__((preserve_access_index)); 106 107 struct udp6_sock { 108 struct udp_sock udp; 109 struct ipv6_pinfo inet6; 110 } __attribute__((preserve_access_index)); 111 112 struct bpf_iter__unix { 113 struct bpf_iter_meta *meta; 114 struct unix_sock *unix_sk; 115 uid_t uid; 116 } __attribute__((preserve_access_index)); 117 118 struct bpf_iter__bpf_map_elem { 119 struct bpf_iter_meta *meta; 120 struct bpf_map *map; 121 void *key; 122 void *value; 123 }; 124 125 struct bpf_iter__bpf_sk_storage_map { 126 struct bpf_iter_meta *meta; 127 struct bpf_map *map; 128 struct sock *sk; 129 void *value; 130 }; 131 132 struct bpf_iter__sockmap { 133 struct bpf_iter_meta *meta; 134 struct bpf_map *map; 135 void *key; 136 struct sock *sk; 137 }; 138 139 struct bpf_iter__bpf_link { 140 struct bpf_iter_meta *meta; 141 struct bpf_link *link; 142 }; 143 144 struct btf_ptr { 145 void *ptr; 146 __u32 type_id; 147 __u32 flags; 148 }; 149 150 enum { 151 BTF_F_COMPACT = (1ULL << 0), 152 BTF_F_NONAME = (1ULL << 1), 153 BTF_F_PTR_RAW = (1ULL << 2), 154 BTF_F_ZERO = (1ULL << 3), 155 }; 156 157 struct bpf_iter__ksym { 158 struct bpf_iter_meta *meta; 159 struct kallsym_iter *ksym; 160 }; 161