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