github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/bpf.txt (about) 1 # Copyright 2015 syzkaller project authors. All rights reserved. 2 # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 # Note these sysctls have radical effect on code paths inside of kernel: 5 # net.core.bpf_jit_enable = { 0, 1, 2 } 6 # net.core.bpf_jit_harden = { 0, 1, 2 } 7 8 include <uapi/linux/bpf.h> 9 include <uapi/linux/btf.h> 10 include <uapi/linux/if_link.h> 11 include <uapi/linux/netfilter.h> 12 13 resource fd_bpf_map[fd]: BPF_PSEUDO_MAP_FD 14 resource fd_bpf_prog[fd] 15 resource fd_btf[fd] 16 resource bpf_prog_id[int32]: 0, -1 17 resource bpf_map_id[int32]: 0, -1 18 resource bpf_btf_id[int32]: 0, -1 19 resource bpf_link_id[int32]: 0, -1 20 resource fd_bpf_link[fd] 21 resource bpf_revision[int64] 22 resource fd_bpf_const_str_map[fd_bpf_map] 23 resource fd_bpf_const_str[fd_bpf_const_str_map] 24 resource bpf_frozen_const_str[fd_bpf_const_str] 25 resource tail_call_map_fd[fd_bpf_map] 26 resource tail_call_map[tail_call_map_fd] 27 resource ringbuf_map_fd[fd_bpf_map] 28 29 # NEED: this is a random index in btf_header:types. We can't express this, so we just use a small index. 30 type btf_type_id int32[1:5] 31 # NEED: opt modified on typedefs, this could be btf_type_id[opt] 32 type btf_opt_type_id int32[0:5] 33 34 # NEED: offset in bpf_btf_program:strings. We can't express this, so we just use a small index. 35 type btf_name_off int32[1:16] 36 type btf_opt_name_off int32[0:16] 37 38 # NEED: offset in bpf_prog_t:fd_array. We can't express this, so we just use a small index. 39 type map_fd_id int32[0:16] 40 41 bpf$MAP_CREATE(cmd const[BPF_MAP_CREATE], arg ptr[in, bpf_map_create_arg], size len[arg]) fd_bpf_map 42 bpf$MAP_CREATE_RINGBUF(cmd const[BPF_MAP_CREATE], arg ptr[in, bpf_map_create_arg_ringbuf], size len[arg]) ringbuf_map_fd 43 bpf$MAP_CREATE_CONST_STR(cmd const[BPF_MAP_CREATE], arg ptr[in, bpf_map_create_arg_const_str], size len[arg]) fd_bpf_const_str_map 44 bpf$MAP_CREATE_TAIL_CALL(cmd const[BPF_MAP_CREATE], arg ptr[in, bpf_map_create_arg_tail_call], size len[arg]) tail_call_map_fd 45 bpf$MAP_LOOKUP_ELEM(cmd const[BPF_MAP_LOOKUP_ELEM], arg ptr[in, bpf_map_lookup_arg], size len[arg]) 46 bpf$MAP_UPDATE_ELEM(cmd const[BPF_MAP_UPDATE_ELEM], arg ptr[in, bpf_map_update_arg], size len[arg]) 47 bpf$MAP_UPDATE_CONST_STR(cmd const[BPF_MAP_UPDATE_ELEM], arg ptr[inout, bpf_map_update_const_str_arg], size len[arg]) 48 bpf$MAP_UPDATE_ELEM_TAIL_CALL(cmd const[BPF_MAP_UPDATE_ELEM], arg ptr[inout, bpf_map_update_tail_call_arg], size len[arg]) 49 bpf$MAP_DELETE_ELEM(cmd const[BPF_MAP_DELETE_ELEM], arg ptr[in, bpf_map_delete_arg], size len[arg]) 50 bpf$MAP_GET_NEXT_KEY(cmd const[BPF_MAP_GET_NEXT_KEY], arg ptr[in, bpf_map_get_next_arg], size len[arg]) 51 bpf$PROG_LOAD(cmd const[BPF_PROG_LOAD], arg ptr[in, bpf_prog], size len[arg]) fd_bpf_prog 52 bpf$OBJ_PIN_MAP(cmd const[BPF_OBJ_PIN], arg ptr[in, bpf_obj_pin_map], size len[arg]) 53 bpf$OBJ_PIN_PROG(cmd const[BPF_OBJ_PIN], arg ptr[in, bpf_obj_pin_prog], size len[arg]) 54 bpf$OBJ_GET_MAP(cmd const[BPF_OBJ_GET], arg ptr[in, bpf_obj_get], size len[arg]) fd_bpf_map 55 bpf$OBJ_GET_PROG(cmd const[BPF_OBJ_GET], arg ptr[in, bpf_obj_get], size len[arg]) fd_bpf_prog 56 bpf$BPF_PROG_ATTACH(cmd const[BPF_PROG_ATTACH], arg ptr[in, bpf_attach_arg], size len[arg]) 57 bpf$BPF_PROG_DETACH(cmd const[BPF_PROG_DETACH], arg ptr[in, bpf_detach_arg], size len[arg]) 58 bpf$BPF_PROG_TEST_RUN(cmd const[BPF_PROG_TEST_RUN], arg ptr[in, bpf_test_prog_arg], size len[arg]) 59 bpf$BPF_PROG_GET_NEXT_ID(cmd const[BPF_PROG_GET_NEXT_ID], arg ptr[inout, bpf_prog_get_next_id_arg], size len[arg]) 60 bpf$BPF_MAP_GET_NEXT_ID(cmd const[BPF_MAP_GET_NEXT_ID], arg ptr[inout, bpf_map_get_next_id_arg], size len[arg]) 61 bpf$BPF_BTF_GET_NEXT_ID(cmd const[BPF_BTF_GET_NEXT_ID], arg ptr[inout, bpf_btf_get_next_id_arg], size len[arg]) 62 bpf$BPF_PROG_GET_FD_BY_ID(cmd const[BPF_PROG_GET_FD_BY_ID], arg ptr[in, bpf_prog_get_fd_by_id_arg], size len[arg]) fd_bpf_prog 63 bpf$BPF_MAP_GET_FD_BY_ID(cmd const[BPF_MAP_GET_FD_BY_ID], arg ptr[in, bpf_map_get_fd_by_id_arg], size len[arg]) fd_bpf_map 64 bpf$BPF_GET_PROG_INFO(cmd const[BPF_OBJ_GET_INFO_BY_FD], arg ptr[in, bpf_get_prog_info_arg], size len[arg]) 65 bpf$BPF_GET_MAP_INFO(cmd const[BPF_OBJ_GET_INFO_BY_FD], arg ptr[in, bpf_get_map_info_arg], size len[arg]) 66 bpf$BPF_GET_BTF_INFO(cmd const[BPF_OBJ_GET_INFO_BY_FD], arg ptr[in, bpf_get_btf_info_arg], size len[arg]) 67 bpf$BPF_PROG_QUERY(cmd const[BPF_PROG_QUERY], arg ptr[inout, bpf_prog_query], size len[arg]) 68 bpf$BPF_BTF_LOAD(cmd const[BPF_BTF_LOAD], arg ptr[in, bpf_btf_load], size len[arg]) fd_btf 69 bpf$BPF_BTF_GET_FD_BY_ID(cmd const[BPF_BTF_GET_FD_BY_ID], arg ptr[in, bpf_btf_id], size len[arg]) fd_btf 70 bpf$BPF_TASK_FD_QUERY(cmd const[BPF_TASK_FD_QUERY], arg ptr[inout, bpf_task_fd_query], size len[arg]) 71 bpf$BPF_MAP_LOOKUP_AND_DELETE_ELEM(cmd const[BPF_MAP_LOOKUP_AND_DELETE_ELEM], arg ptr[in, bpf_map_lookup_arg], size len[arg]) 72 bpf$BPF_MAP_FREEZE(cmd const[BPF_MAP_FREEZE], arg ptr[in, fd_bpf_map], size len[arg]) 73 bpf$BPF_MAP_CONST_STR_FREEZE(cmd const[BPF_MAP_FREEZE], arg ptr[inout, bpf_map_const_str_freeze], size len[arg]) 74 bpf$MAP_LOOKUP_BATCH(cmd const[BPF_MAP_LOOKUP_BATCH], arg ptr[in, bpf_map_batch_arg], size len[arg]) 75 bpf$MAP_UPDATE_BATCH(cmd const[BPF_MAP_UPDATE_BATCH], arg ptr[in, bpf_map_batch_arg], size len[arg]) 76 bpf$MAP_DELETE_BATCH(cmd const[BPF_MAP_DELETE_BATCH], arg ptr[in, bpf_map_batch_arg], size len[arg]) 77 bpf$BPF_MAP_LOOKUP_AND_DELETE_BATCH(cmd const[BPF_MAP_LOOKUP_AND_DELETE_BATCH], arg ptr[in, bpf_map_batch_arg], size len[arg]) 78 bpf$BPF_LINK_CREATE(cmd const[BPF_LINK_CREATE], arg ptr[in, bpf_link_create_arg], size len[arg]) fd_bpf_link 79 bpf$BPF_LINK_UPDATE(cmd const[BPF_LINK_UPDATE], arg ptr[in, bpf_link_update_arg], size len[arg]) 80 bpf$ENABLE_STATS(cmd const[BPF_ENABLE_STATS], arg ptr[in, bpf_enable_stats_arg], size len[arg]) 81 bpf$ITER_CREATE(cmd const[BPF_ITER_CREATE], arg ptr[in, bpf_iter_create_arg], size len[arg]) fd 82 bpf$LINK_GET_FD_BY_ID(cmd const[BPF_LINK_GET_FD_BY_ID], arg ptr[in, bpf_link_id], size len[arg]) fd_bpf_link 83 bpf$LINK_GET_NEXT_ID(cmd const[BPF_LINK_GET_NEXT_ID], arg ptr[inout, bpf_link_get_next_id_arg], size len[arg]) 84 bpf$LINK_DETACH(cmd const[BPF_LINK_DETACH], arg ptr[in, fd_bpf_link], size len[arg]) 85 bpf$PROG_BIND_MAP(cmd const[BPF_PROG_BIND_MAP], arg ptr[in, bpf_prog_bind_map_arg], size len[arg]) 86 87 resource fd_bpf_prog_xdp[fd_bpf_prog] 88 bpf$PROG_LOAD_XDP(cmd const[BPF_PROG_LOAD], arg ptr[in, bpf_prog_xdp], size len[arg]) fd_bpf_prog_xdp 89 bpf$BPF_LINK_CREATE_XDP(cmd const[BPF_LINK_CREATE], arg ptr[in, bpf_link_create_xdp], size len[arg]) fd_bpf_link 90 bpf$BPF_PROG_TEST_RUN_LIVE(cmd const[BPF_PROG_TEST_RUN], arg ptr[in, bpf_test_prog_live_arg], size len[arg]) 91 type bpf_prog_xdp bpf_prog_t[const[BPF_PROG_TYPE_XDP, int32], const[BPF_XDP, int32], const[0, int32], const[0, int32]] 92 type bpf_link_create_xdp bpf_link_create_arg_t[fd_bpf_prog_xdp, ifindex, const[BPF_XDP, int32], flags[xdp_flags, int32]] 93 xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST, XDP_FLAGS_SKB_MODE, XDP_FLAGS_DRV_MODE, XDP_FLAGS_HW_MODE, XDP_FLAGS_REPLACE 94 95 bpf_map_const_str_freeze { 96 in fd_bpf_const_str 97 out bpf_frozen_const_str (out_overlay) 98 } 99 100 bpf_map_create_arg [ 101 base bpf_map_create_arg_base 102 bloom_filter bpf_map_create_arg_bf 103 ] 104 105 type bpf_map_create_arg_t[TYPE, KSIZE, VSIZE, MAX, FLAGS, MAP_EXTRA] { 106 type TYPE 107 ksize KSIZE 108 vsize VSIZE 109 max MAX 110 flags FLAGS 111 inner fd_bpf_map[opt] 112 node int32 113 map_name array[const[0, int8], BPF_OBJ_NAME_LEN] 114 map_ifindex ifindex[opt] 115 btf_fd fd_btf[opt] 116 btf_key_type_id btf_opt_type_id 117 btf_value_type_id btf_opt_type_id 118 btf_vmlinux_type_id btf_opt_type_id 119 map_extra MAP_EXTRA 120 } 121 122 type bpf_map_create_arg_base bpf_map_create_arg_t[flags[bpf_map_type, int32], int32, int32, int32, flags[map_flags, int32], const[0, int64]] 123 type bpf_map_create_arg_bf bpf_map_create_arg_t[const[BPF_MAP_TYPE_BLOOM_FILTER, int32], int32, int32, int32, flags[map_flags, int32], int64[0:15]] 124 type bpf_map_create_arg_ringbuf bpf_map_create_arg_t[const[BPF_MAP_TYPE_RINGBUF, int32], const[0, int32], const[0, int32], int32, const[0, int32], const[0, int64]] 125 type bpf_map_create_arg_const_str bpf_map_create_arg_t[const[BPF_MAP_TYPE_ARRAY, int32], const[4, int32], const[8, int32], const[1, int32], const[BPF_F_RDONLY_PROG, int32], const[0, int64]] 126 type bpf_map_create_arg_tail_call bpf_map_create_arg_t[const[BPF_MAP_TYPE_PROG_ARRAY, int32], const[4, int32], const[4, int32], const[10, int32], const[0, int32], const[0, int64]] 127 128 bpf_map_get_fd_by_id_arg { 129 map_id bpf_map_id 130 next_id int32 131 open_flags flags[bpf_open_flags, int32] 132 } 133 134 bpf_map_lookup_arg { 135 map fd_bpf_map 136 key ptr64[in, array[int8]] 137 val ptr64[out, array[int8]] 138 flags flags[bpf_lookup_flags, int64] 139 } 140 141 bpf_map_update_val [ 142 buf array[int8] 143 udp sock_udp 144 udp6 sock_udp6 145 tcp sock_tcp 146 tcp6 sock_tcp6 147 ] [varlen] 148 149 bpf_map_update_arg { 150 map fd_bpf_map 151 key ptr64[in, array[int8]] 152 val ptr64[in, bpf_map_update_val] 153 flags flags[bpf_map_flags, int64] 154 } 155 156 map_bpf_const_str { 157 in fd_bpf_const_str_map 158 out fd_bpf_const_str (out_overlay) 159 } 160 161 bpf_printf_str = "%-010d ", "%pK ", "%+9llu ", "%pS ", "%ps ", "%pB ", "%pI4 ", "%pi6 ", "%-5lx " 162 163 bpf_map_update_const_str_arg { 164 map map_bpf_const_str 165 key ptr64[in, const[0, int32]] 166 val ptr64[in, string[bpf_printf_str]] 167 flags const[0, int64] 168 } 169 170 tail_call_map_update { 171 in tail_call_map_fd 172 out tail_call_map (out_overlay) 173 } 174 175 bpf_map_update_tail_call_arg { 176 map tail_call_map_update 177 key ptr64[in, const[0, int32]] 178 val ptr64[in, fd_bpf_prog] 179 flags const[0, int64] 180 } 181 182 bpf_map_delete_arg { 183 map fd_bpf_map 184 key ptr64[in, array[int8]] 185 value const[0, int64] 186 flags const[0, int64] 187 } 188 189 bpf_map_get_next_arg { 190 map fd_bpf_map 191 key ptr64[in, array[int8]] 192 next ptr64[out, array[int8]] 193 flags const[0, int64] 194 } 195 196 bpf_map_batch_arg { 197 in_batch ptr64[in, array[int8]] 198 out_batch ptr64[out, array[int8]] 199 key ptr64[in, array[int8]] 200 val ptr64[in, array[int8]] 201 count int32 202 map_fd fd_bpf_map 203 elem_flags flags[bpf_batch_flags, int64] 204 flags const[0, int64] 205 } 206 207 bpf_iter_link_cgroup { 208 order flags[bpf_cgroup_iter_order, int32] 209 cgroup_fd fd_cgroup 210 cgroup_id int64 211 } 212 213 bpf_iter_link_task { 214 tid pid 215 pid pid 216 pid_fd fd_pidfd 217 } 218 219 bpf_iter_link_info [ 220 map_fd fd_bpf_map 221 cgroup bpf_iter_link_cgroup 222 task bpf_iter_link_task 223 ] 224 225 link_create_iter { 226 iter_info ptr[in, bpf_iter_link_info] 227 iter_info_len bytesize[iter_info, int32] 228 } 229 230 link_create_perf_event { 231 bpf_cookie int64 232 } 233 234 link_create_kprobe_multi_addrs { 235 flags flags[bpf_link_create_kprobe_multi_flags, int32] 236 cnt len[addrs, int32] 237 syms const[0, int64] 238 addrs ptr64[in, array[int64]] 239 cookies int64 240 } 241 242 link_create_kprobe_multi_symbols { 243 flags flags[bpf_link_create_kprobe_multi_flags, int32] 244 cnt len[syms, int32] 245 syms ptr64[in, array[ptr[in, string]]] 246 addrs const[0, int64] 247 cookies int64 248 } 249 250 link_create_kprobe_multi [ 251 addrs link_create_kprobe_multi_addrs 252 syms link_create_kprobe_multi_symbols 253 ] 254 255 link_create_tracing { 256 target_btf_id bpf_btf_id 257 cookie int64 258 } 259 260 link_create_netfilter { 261 pf flags[nfproto, int32] 262 hooknum flags[nf_dev_hooks, int32] 263 priority int32 264 flags flags[bpf_link_create_netfilter_flags, int32] 265 } 266 267 link_create_tcx { 268 relative id_or_fd 269 exp_revision bpf_revision 270 } 271 272 link_create_uprobe_multi { 273 path ptr64[in, filename] 274 offsets ptr64[in, array[int64]] 275 ref_ctr_offsets ptr64[in, array[int64[0:5]], opt] 276 cookies int64 277 cnt len[offsets, int32] 278 flags flags[bpf_link_create_uprobe_multi_flags, int32] 279 pid pid 280 } 281 282 link_create_netkit { 283 relative id_or_fd 284 exp_revision bpf_revision 285 } 286 287 link_create_arg_extra [ 288 target_btf_id bpf_btf_id 289 iter link_create_iter 290 perf_event link_create_perf_event 291 kprobe_multi link_create_kprobe_multi 292 tracing link_create_tracing 293 netfilter link_create_netfilter 294 tcx link_create_tcx 295 uprobe_multi link_create_uprobe_multi 296 netkit link_create_netkit 297 ] 298 299 type bpf_link_create_arg_t[PROG_FD, TARGET_FD, ATTACH_TYPE, FLAGS] { 300 prog_fd PROG_FD 301 target_fd TARGET_FD 302 attach_type ATTACH_TYPE 303 flags FLAGS 304 extra optional[link_create_arg_extra] 305 } 306 307 type bpf_link_create_arg bpf_link_create_arg_t[fd_bpf_prog, fd_cgroup, flags[bpf_attach_types_link_create, int32], const[0, int32]] 308 309 bpf_link_update_arg { 310 link_fd fd_bpf_link 311 new_prog_fd fd_bpf_prog 312 flags flags[bpf_link_update_flags, int32] 313 old_prog_fd fd_bpf_prog 314 } 315 316 bpf_enable_stats_arg { 317 type flags[bpf_stat_types, int32] 318 } 319 320 bpf_iter_create_arg { 321 link_fd fd_bpf_link 322 flags const[0, int32] 323 } 324 325 bpf_batch_flags = BPF_F_LOCK 326 327 bpf_obj_pin_map [ 328 generic bpf_obj_pin_map_generic 329 o_path bpf_obj_pin_map_o_path 330 ] 331 332 bpf_obj_pin_prog [ 333 generic bpf_obj_pin_prog_generic 334 o_path bpf_obj_pin_prog_o_path 335 ] 336 337 bpf_obj_get [ 338 generic bpf_obj_get_generic 339 o_path bpf_obj_get_o_path 340 ] 341 342 # NEED: these filenames must be on bpf filesystem, can we do it somehow? 343 bpf_obj_pin_map_generic { 344 path ptr64[in, filename] 345 fd fd_bpf_map 346 flags const[0, int32] 347 path_fd const[0, int32] 348 } 349 350 bpf_obj_pin_prog_generic { 351 path ptr64[in, filename] 352 fd fd_bpf_prog 353 flags const[0, int32] 354 path_fd const[0, int32] 355 } 356 357 bpf_obj_get_generic { 358 path ptr64[in, filename] 359 fd const[0, int32] 360 file_flags flags[bpf_open_flags, int32] 361 path_fd const[0, int32] 362 } 363 364 # NEED: Specific type for O_PATH fds (for path_fd). 365 bpf_obj_pin_map_o_path { 366 path ptr64[in, filename] 367 fd fd_bpf_map 368 flags const[BPF_F_PATH_FD, int32] 369 path_fd fd 370 } 371 372 bpf_obj_pin_prog_o_path { 373 path ptr64[in, filename] 374 fd fd_bpf_prog 375 flags const[BPF_F_PATH_FD, int32] 376 path_fd fd 377 } 378 379 bpf_obj_get_o_path { 380 path ptr64[in, filename] 381 fd const[0, int32] 382 file_flags flags[bpf_obj_get_flags, int32] 383 path_fd fd 384 } 385 386 bpf_attach_targets [ 387 cgroup fd_cgroup[opt] 388 map fd_bpf_map[opt] 389 ifindex ifindex 390 ] 391 392 id_or_fd [ 393 link_fd fd_bpf_link 394 prog_fd fd_bpf_prog 395 link_id bpf_link_id 396 prog_id bpf_prog_id 397 ] 398 399 bpf_attach_arg { 400 target bpf_attach_targets 401 attach_bpf_fd fd_bpf_prog 402 type flags[bpf_attach_type, int32] 403 flags flags[bpf_attach_flags, int32] 404 replace_bpf_fd fd_bpf_prog 405 relative_obj id_or_fd 406 exp_revision bpf_revision 407 } 408 409 bpf_detach_arg { 410 target bpf_attach_targets 411 prog fd_bpf_prog 412 type flags[bpf_attach_type, int32] 413 flags flags[bpf_mprog_attach_flags, int32] 414 replace_bpf_fd const[0, int32] 415 relative_obj id_or_fd 416 exp_revision bpf_revision 417 } 418 419 bpf_test_prog_arg { 420 prog fd_bpf_prog 421 retval const[0, int32] 422 insizedata len[indata, int32] 423 outsizedata len[outdata, int32] 424 indata ptr64[in, array[int8]] 425 outdata ptr64[out, array[int8]] 426 repeat int32 427 dur const[0, int32] 428 insizectx len[inctx, int32] 429 outsizectx len[outctx, int32] 430 inctx ptr64[in, array[int8]] 431 outctx ptr64[in, array[int8]] 432 flags flags[bpf_prog_test_run_flags, int32] 433 cpu const[0, int32] 434 batch_size int32 435 } 436 437 bpf_test_prog_live_arg { 438 prog fd_bpf_prog_xdp 439 retval const[0, int32] 440 insizedata len[indata, int32] 441 outsizedata const[0, int32] 442 indata ptr64[in, array[int8]] 443 outdata const[0, int64] 444 repeat int32 445 dur const[0, int32] 446 insizectx len[inctx, int32] 447 outsizectx const[0, int32] 448 inctx ptr64[in, array[int8]] 449 outctx const[0, int64] 450 flags const[BPF_F_TEST_XDP_LIVE_FRAMES, int32] 451 cpu const[0, int32] 452 batch_size int32 453 } 454 455 bpf_prog_get_next_id_arg { 456 start int32 (in) 457 next_id bpf_prog_id (out) 458 } 459 460 bpf_map_get_next_id_arg { 461 start int32 (in) 462 next_id bpf_map_id (out) 463 } 464 465 bpf_btf_get_next_id_arg { 466 start int32 (in) 467 next_id bpf_btf_id (out) 468 } 469 470 bpf_link_get_next_id_arg { 471 start int32 (in) 472 next_id bpf_link_id (out) 473 } 474 475 bpf_prog_get_fd_by_id_arg { 476 prog bpf_prog_id 477 } 478 479 bpf_prog_bind_map_arg { 480 prog_fd fd_bpf_prog 481 map_fd fd_bpf_map 482 flags const[0, int32] 483 } 484 485 bpf_get_prog_info_arg { 486 prog fd_bpf_prog 487 len len[info, int32] 488 info ptr64[out, bpf_prog_info] 489 } 490 491 # These are defined in bpf/verifier.c. 492 define MIN_BPF_FUNCINFO_SIZE 8 493 define MAX_FUNCINFO_REC_SIZE 252 494 495 bpf_prog_info { 496 type int32 497 id bpf_prog_id 498 tag int64 499 jited_prog_len int32 500 xlated_prog_len int32 501 jited_prog_insns int64 502 xlated_prog_insns int64 503 load_time int64 504 created_by_uid int32 505 nr_map_ids len[map_ids, int32] (in) 506 # We could declare these as bpf_map_id, but this is not the best way to obtain these resources. 507 map_ids ptr64[out, array[int32]] 508 name array[int8, BPF_OBJ_NAME_LEN] 509 ifindex ifindex 510 gpl_compatible int32:1 511 netns_dev int64 512 netns_ino int64 513 nr_jited_ksyms len[jited_ksyms, int32] (in) 514 nr_jited_func_lens len[jited_func_lens, int32] (in) 515 jited_ksyms ptr64[out, array[int64]] 516 jited_func_lens ptr64[out, array[int32]] 517 btf_id bpf_btf_id 518 func_info_rec_size int32[MIN_BPF_FUNCINFO_SIZE:MAX_FUNCINFO_REC_SIZE] (in) 519 func_info ptr64[out, array[bpf_func_info]] 520 nr_func_info bytesize[func_info, int32] (in) 521 nr_line_info len[line_info, int32] (in) 522 line_info ptr64[out, bpf_line_info] 523 jited_line_info ptr64[out, int64] 524 nr_jited_line_info len[jited_line_info, int32] (in) 525 line_info_rec_size int32[MIN_BPF_FUNCINFO_SIZE:MAX_FUNCINFO_REC_SIZE] (in) 526 jited_line_info_rec_size const[8, int32] (in) 527 nr_prog_tags len[prog_tags, int32] (in) 528 prog_tags ptr64[out, int64] 529 run_time_ns int64 530 run_cnt int64 531 recursion_misses int64 532 verified_insns int32 533 } [align[8]] 534 535 bpf_get_map_info_arg { 536 prog fd_bpf_map 537 len len[info, int32] 538 info ptr64[out, bpf_map_info] 539 } 540 541 bpf_map_info { 542 type int32 543 id bpf_map_id 544 key_size int32 545 value_size int32 546 max_entries int32 547 map_flags int32 548 name array[int8, BPF_OBJ_NAME_LEN] 549 ifindex ifindex 550 btf_vmlinux_value_type_id int32 551 netns_dev int64 552 netns_ino int64 553 btf_id int32 554 btf_key_type_id int32 555 btf_value_type_id int32 556 map_extra align64[int64] 557 } [align[8]] 558 559 bpf_get_btf_info_arg { 560 btf fd_btf (in) 561 len len[info, int32] (in) 562 info ptr64[out, bpf_btf_info] 563 } 564 565 bpf_btf_info { 566 btf ptr64[out, array[int8]] 567 btf_size bytesize[btf, int32] (in) 568 id bpf_btf_id 569 name ptr64[out, array[int8]] 570 name_len bytesize[name, int32] 571 kernel_btf int32 572 } [align[8]] 573 574 bpf_prog_query { 575 target_fd bpf_attach_targets 576 attach_type flags[bpf_prog_query_attach_type, int32] 577 query_flags flags[bpf_prog_query_flags, int32] 578 attach_flags int32 579 prog_ids ptr64[out, array[int32]] 580 prog_cnt len[prog_ids, int32] 581 pad const[0, int32] 582 prog_attach_flags ptr64[out, array[int32]] 583 link_ids ptr64[out, array[int32]] 584 link_attach_flags ptr64[out, array[int32]] 585 revision bpf_revision (out) 586 } [align[8]] 587 588 bpf_btf_load { 589 btf ptr64[in, bpf_btf_program] 590 btf_log_buf ptr64[out, array[int8]] 591 btf_size bytesize[btf, int32] 592 btf_log_size bytesize[btf_log_buf, int32] 593 btf_log_level bool32 594 btf_log_true_size int32 595 } [align[8]] 596 597 bpf_btf_program { 598 header btf_header 599 strings bpf_btf_strings 600 } [packed] 601 602 btf_header { 603 magic const[BTF_MAGIC, int16] 604 version const[BTF_VERSION, int8] 605 flags const[0, int8] 606 hdr_len const[0x18, int32] 607 type_off const[0, int32] 608 type_len bytesize[types, int32] 609 str_off bytesize[types, int32] 610 str_len bytesize[bpf_btf_program:strings, int32] 611 types array[btf_type] 612 } [align[4]] 613 614 btf_type [ 615 int btf_type_int 616 ptr btf_type_ref_t[BTF_KIND_PTR] 617 array btf_type_array 618 struct btf_type_struct_t[BTF_KIND_STRUCT] 619 union btf_type_struct_t[BTF_KIND_UNION] 620 enum btf_type_enum 621 fwd btf_type_fwd 622 typedef btf_type_ref_t[BTF_KIND_TYPEDEF] 623 volatile btf_type_ref_t[BTF_KIND_VOLATILE] 624 const btf_type_ref_t[BTF_KIND_CONST] 625 restrict btf_type_ref_t[BTF_KIND_RESTRICT] 626 func btf_type_func 627 func_proto btf_type_func_proto 628 var btf_type_var 629 datasec btf_type_datasec 630 ] [varlen] 631 632 btf_type_int { 633 # Note: this is an offset in bpf_btf_program:strings 634 name_off btf_opt_name_off 635 info_vlen const[0, int16] 636 info_pad const[0, int8] 637 info_typ const[BTF_KIND_INT, int8] 638 size const[0, int32] 639 bits int8[0:128] 640 pad const[0, int8] 641 offset int8[0:128] 642 encoding flags[btf_type_int_encoding, int8] 643 } 644 645 btf_type_int_encoding = BTF_INT_SIGNED, BTF_INT_CHAR, BTF_INT_BOOL 646 647 type btf_type_ref_t[TYP] { 648 name_off btf_opt_name_off 649 info_vlen const[0, int16] 650 info_pad const[0, int8] 651 info_typ const[TYP, int8] 652 type btf_opt_type_id 653 } 654 655 btf_type_array { 656 name_off const[0, int32] 657 info_vlen const[0, int16] 658 info_pad const[0, int8] 659 info_typ const[BTF_KIND_ARRAY, int8] 660 size const[0, int32] 661 data btf_array 662 } 663 664 btf_array { 665 type btf_type_id 666 index_type btf_type_id 667 nelems int32 668 } 669 670 type btf_type_struct_t[TYP] { 671 name_off btf_opt_name_off 672 info_vlen len[fields, int16] 673 info_pad const[0, int8] 674 info_typ const[TYP, int8:7] 675 info_kflag int8:1 676 size int32 677 fields array[btf_member] 678 } 679 680 btf_member { 681 name_off btf_opt_name_off 682 type btf_opt_type_id 683 offset int32 684 } 685 686 btf_type_enum { 687 name_off btf_opt_name_off 688 info_vlen len[values, int16] 689 info_pad const[0, int8] 690 info_typ const[BTF_KIND_ENUM, int8] 691 size const[4, int32] 692 values array[btf_enum] 693 } 694 695 btf_enum { 696 name_off btf_opt_name_off 697 val int32 698 } 699 700 btf_type_fwd { 701 name_off btf_name_off 702 info_vlen const[0, int16] 703 info_pad const[0, int8] 704 info_typ const[BTF_KIND_FWD, int8] 705 size const[0, int32] 706 } 707 708 btf_type_func { 709 name_off btf_name_off 710 info_vlen const[0, int16] 711 info_pad const[0, int8] 712 info_typ const[BTF_KIND_FUNC, int8] 713 type btf_type_id 714 } 715 716 btf_type_func_proto { 717 name_off const[0, int32] 718 info_vlen len[params, int16] 719 info_pad const[0, int8] 720 info_typ const[BTF_KIND_FUNC_PROTO, int8] 721 size const[0, int32] 722 params array[btf_param] 723 } 724 725 btf_param { 726 name_off btf_opt_name_off 727 type btf_opt_type_id 728 } 729 730 btf_type_var { 731 name_off btf_name_off 732 info_vlen const[0, int16] 733 info_pad const[0, int8] 734 info_typ const[BTF_KIND_VAR, int8] 735 type btf_type_id 736 linkage bool32 737 } 738 739 btf_type_datasec { 740 name_off btf_name_off 741 info_vlen len[secinfo, int16] 742 info_pad const[0, int8] 743 info_typ const[BTF_KIND_DATASEC, int8] 744 size bytesize[data, int32] 745 secinfo array[btf_var_secinfo] 746 data array[int8, 1:3] 747 } [packed] 748 749 btf_var_secinfo { 750 type btf_type_id 751 # NEED: offset/size are for btf_type_datasec:data and must be increasing and within bounds (see btf_datasec_check_meta) 752 offset int32 753 size int32 754 } 755 756 bpf_btf_strings { 757 z0 const[0, int8] 758 data array[flags[bpf_btf_strings_elem, int8]] 759 z1 const[0, int8] 760 } [packed] 761 762 bpf_btf_strings_elem = 'a', '0', '_', '.', 0 763 764 bpf_task_fd_query { 765 pid pid (in) 766 fd fd_perf_base (in) 767 flags const[0, int32] (in) 768 buf_len bytesize[buf, int32] (in) 769 buf ptr64[in, string] (in) 770 prog_id bpf_prog_id (out) 771 fd_type int32 (out) 772 probe_offset int64 (out) 773 probe_addr int64 (out) 774 } 775 776 bpf_map_type = BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_ARRAY, BPF_MAP_TYPE_PROG_ARRAY, BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_MAP_TYPE_STACK_TRACE, BPF_MAP_TYPE_CGROUP_ARRAY, BPF_MAP_TYPE_PERCPU_HASH, BPF_MAP_TYPE_PERCPU_ARRAY, BPF_MAP_TYPE_LRU_HASH, BPF_MAP_TYPE_LRU_PERCPU_HASH, BPF_MAP_TYPE_LPM_TRIE, BPF_MAP_TYPE_ARRAY_OF_MAPS, BPF_MAP_TYPE_HASH_OF_MAPS, BPF_MAP_TYPE_DEVMAP, BPF_MAP_TYPE_SOCKMAP, BPF_MAP_TYPE_CPUMAP, BPF_MAP_TYPE_XSKMAP, BPF_MAP_TYPE_SOCKHASH, BPF_MAP_TYPE_CGROUP_STORAGE, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, BPF_MAP_TYPE_QUEUE, BPF_MAP_TYPE_STACK, BPF_MAP_TYPE_SK_STORAGE, BPF_MAP_TYPE_DEVMAP_HASH, BPF_MAP_TYPE_STRUCT_OPS, BPF_MAP_TYPE_RINGBUF, BPF_MAP_TYPE_INODE_STORAGE, BPF_MAP_TYPE_TASK_STORAGE, BPF_MAP_TYPE_BLOOM_FILTER, BPF_MAP_TYPE_CGRP_STORAGE, BPF_MAP_TYPE_USER_RINGBUF 777 bpf_map_flags = BPF_ANY, BPF_NOEXIST, BPF_EXIST, BPF_F_LOCK 778 bpf_lookup_flags = BPF_F_LOCK 779 bpf_prog_type = BPF_PROG_TYPE_SOCKET_FILTER, BPF_PROG_TYPE_KPROBE, BPF_PROG_TYPE_SCHED_CLS, BPF_PROG_TYPE_SCHED_ACT, BPF_PROG_TYPE_TRACEPOINT, BPF_PROG_TYPE_XDP, BPF_PROG_TYPE_PERF_EVENT, BPF_PROG_TYPE_CGROUP_SKB, BPF_PROG_TYPE_CGROUP_SOCK, BPF_PROG_TYPE_LWT_IN, BPF_PROG_TYPE_LWT_OUT, BPF_PROG_TYPE_LWT_XMIT, BPF_PROG_TYPE_SOCK_OPS, BPF_PROG_TYPE_SK_SKB, BPF_PROG_TYPE_CGROUP_DEVICE, BPF_PROG_TYPE_SK_MSG, BPF_PROG_TYPE_RAW_TRACEPOINT, BPF_PROG_TYPE_CGROUP_SOCK_ADDR, BPF_PROG_TYPE_LWT_SEG6LOCAL, BPF_PROG_TYPE_LIRC_MODE2, BPF_PROG_TYPE_SK_REUSEPORT, BPF_PROG_TYPE_FLOW_DISSECTOR, BPF_PROG_TYPE_CGROUP_SYSCTL, BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, BPF_PROG_TYPE_CGROUP_SOCKOPT, BPF_PROG_TYPE_TRACING, BPF_PROG_TYPE_EXT, BPF_PROG_TYPE_STRUCT_OPS, BPF_PROG_TYPE_LSM, BPF_PROG_TYPE_SK_LOOKUP, BPF_PROG_TYPE_SYSCALL, BPF_PROG_TYPE_NETFILTER 780 map_flags = BPF_F_NO_PREALLOC, BPF_F_NO_COMMON_LRU, BPF_F_NUMA_NODE, BPF_F_RDONLY, BPF_F_WRONLY, BPF_F_STACK_BUILD_ID, BPF_F_ZERO_SEED, BPF_F_RDONLY_PROG, BPF_F_WRONLY_PROG, BPF_F_CLONE, BPF_F_MMAPABLE, BPF_F_INNER_MAP, BPF_F_PRESERVE_ELEMS, BPF_F_LINK 781 bpf_attach_type = BPF_XDP_DEVMAP, BPF_XDP_CPUMAP, BPF_SK_REUSEPORT_SELECT, BPF_SK_REUSEPORT_SELECT_OR_MIGRATE, BPF_PERF_EVENT, BPF_TRACE_KPROBE_MULTI, BPF_STRUCT_OPS, BPF_NETFILTER, BPF_TRACE_UPROBE_MULTI, bpf_attach_types_link_create 782 bpf_attach_types_link_create = BPF_CGROUP_INET_INGRESS, BPF_CGROUP_INET_EGRESS, BPF_CGROUP_INET_SOCK_CREATE, BPF_CGROUP_INET4_POST_BIND, BPF_CGROUP_INET6_POST_BIND, BPF_CGROUP_INET4_BIND, BPF_CGROUP_INET6_BIND, BPF_CGROUP_INET4_CONNECT, BPF_CGROUP_INET6_CONNECT, BPF_CGROUP_UDP4_SENDMSG, BPF_CGROUP_UDP6_SENDMSG, BPF_CGROUP_UDP4_RECVMSG, BPF_CGROUP_UDP6_RECVMSG, BPF_CGROUP_SOCK_OPS, BPF_CGROUP_DEVICE, BPF_SK_MSG_VERDICT, BPF_SK_SKB_STREAM_PARSER, BPF_SK_SKB_STREAM_VERDICT, BPF_LIRC_MODE2, BPF_FLOW_DISSECTOR, BPF_CGROUP_SYSCTL, BPF_CGROUP_GETSOCKOPT, BPF_CGROUP_SETSOCKOPT, BPF_CGROUP_INET4_GETPEERNAME, BPF_CGROUP_INET4_GETSOCKNAME, BPF_CGROUP_INET6_GETPEERNAME, BPF_CGROUP_INET6_GETSOCKNAME, BPF_TRACE_ITER, BPF_CGROUP_INET_SOCK_RELEASE, BPF_SK_LOOKUP, BPF_XDP, BPF_SK_SKB_VERDICT, BPF_LSM_CGROUP, BPF_LSM_MAC, BPF_MODIFY_RETURN, BPF_TRACE_FENTRY, BPF_TRACE_FEXIT, BPF_TRACE_RAW_TP, BPF_TCX_EGRESS, BPF_TCX_INGRESS, BPF_NETKIT_PRIMARY, BPF_NETKIT_PEER, BPF_CGROUP_UNIX_CONNECT, BPF_CGROUP_UNIX_SENDMSG, BPF_CGROUP_UNIX_RECVMSG, BPF_CGROUP_UNIX_GETPEERNAME, BPF_CGROUP_UNIX_GETSOCKNAME 783 bpf_prog_load_flags = BPF_F_STRICT_ALIGNMENT, BPF_F_ANY_ALIGNMENT, BPF_F_TEST_RND_HI32, BPF_F_TEST_STATE_FREQ, BPF_F_SLEEPABLE, BPF_F_XDP_DEV_BOUND_ONLY, BPF_F_XDP_HAS_FRAGS 784 bpf_mprog_attach_flags = BPF_F_REPLACE, BPF_F_BEFORE, BPF_F_AFTER, BPF_F_ID, BPF_F_LINK 785 bpf_attach_flags = BPF_F_ALLOW_OVERRIDE, BPF_F_ALLOW_MULTI, bpf_mprog_attach_flags 786 bpf_link_update_flags = BPF_F_REPLACE 787 bpf_prog_query_flags = BPF_F_QUERY_EFFECTIVE 788 bpf_prog_test_run_flags = BPF_F_TEST_RUN_ON_CPU, BPF_F_TEST_XDP_LIVE_FRAMES 789 bpf_prog_query_attach_type = BPF_CGROUP_INET_INGRESS, BPF_CGROUP_INET_EGRESS, BPF_CGROUP_INET_SOCK_CREATE, BPF_CGROUP_SOCK_OPS, BPF_CGROUP_DEVICE, BPF_CGROUP_INET4_BIND, BPF_CGROUP_INET4_CONNECT, BPF_CGROUP_INET4_POST_BIND, BPF_CGROUP_INET6_BIND, BPF_CGROUP_INET6_CONNECT, BPF_CGROUP_INET6_POST_BIND, BPF_CGROUP_UDP4_SENDMSG, BPF_CGROUP_UDP6_SENDMSG, BPF_LIRC_MODE2, BPF_CGROUP_SYSCTL, BPF_FLOW_DISSECTOR, BPF_CGROUP_UDP4_RECVMSG, BPF_CGROUP_UDP6_RECVMSG, BPF_CGROUP_GETSOCKOPT, BPF_CGROUP_SETSOCKOPT, BPF_CGROUP_INET4_GETPEERNAME, BPF_CGROUP_INET4_GETSOCKNAME, BPF_CGROUP_INET6_GETPEERNAME, BPF_CGROUP_INET6_GETSOCKNAME, BPF_CGROUP_INET_SOCK_RELEASE, BPF_SK_LOOKUP, BPF_LSM_CGROUP, BPF_SK_MSG_VERDICT, BPF_SK_SKB_STREAM_PARSER, BPF_SK_SKB_STREAM_VERDICT, BPF_SK_SKB_VERDICT, BPF_TCX_INGRESS, BPF_TCX_EGRESS, BPF_NETKIT_PRIMARY, BPF_NETKIT_PEER, BPF_CGROUP_UNIX_CONNECT, BPF_CGROUP_UNIX_SENDMSG, BPF_CGROUP_UNIX_RECVMSG, BPF_CGROUP_UNIX_GETPEERNAME, BPF_CGROUP_UNIX_GETSOCKNAME 790 bpf_open_flags = BPF_F_RDONLY, BPF_F_WRONLY 791 bpf_stat_types = BPF_STATS_RUN_TIME 792 bpf_core_relo_kind = BPF_CORE_FIELD_BYTE_OFFSET, BPF_CORE_FIELD_BYTE_SIZE, BPF_CORE_FIELD_EXISTS, BPF_CORE_FIELD_SIGNED, BPF_CORE_FIELD_LSHIFT_U64, BPF_CORE_FIELD_RSHIFT_U64, BPF_CORE_TYPE_ID_LOCAL, BPF_CORE_TYPE_ID_TARGET, BPF_CORE_TYPE_EXISTS, BPF_CORE_TYPE_SIZE, BPF_CORE_ENUMVAL_EXISTS, BPF_CORE_ENUMVAL_VALUE, BPF_CORE_TYPE_MATCHES 793 bpf_obj_get_flags = BPF_F_PATH_FD, BPF_F_RDONLY, BPF_F_WRONLY 794 bpf_cgroup_iter_order = BPF_CGROUP_ITER_SELF_ONLY, BPF_CGROUP_ITER_DESCENDANTS_PRE, BPF_CGROUP_ITER_DESCENDANTS_POST, BPF_CGROUP_ITER_ANCESTORS_UP 795 bpf_link_create_kprobe_multi_flags = BPF_F_KPROBE_MULTI_RETURN 796 nf_dev_hooks = NF_NETDEV_INGRESS, NF_NETDEV_EGRESS 797 bpf_link_create_netfilter_flags = BPF_F_NETFILTER_IP_DEFRAG 798 bpf_link_create_uprobe_multi_flags = BPF_F_UPROBE_MULTI_RETURN