Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at d986ba0329dcca102e227995371135c9bbcefb6b 687 lines 21 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* Copyright (c) 2018 Facebook */ 3 4#ifndef _LINUX_BTF_H 5#define _LINUX_BTF_H 1 6 7#include <linux/types.h> 8#include <linux/bpfptr.h> 9#include <linux/bsearch.h> 10#include <linux/btf_ids.h> 11#include <uapi/linux/btf.h> 12#include <uapi/linux/bpf.h> 13 14#define BTF_TYPE_EMIT(type) ((void)(type *)0) 15#define BTF_TYPE_EMIT_ENUM(enum_val) ((void)enum_val) 16 17/* These need to be macros, as the expressions are used in assembler input */ 18#define KF_ACQUIRE (1 << 0) /* kfunc is an acquire function */ 19#define KF_RELEASE (1 << 1) /* kfunc is a release function */ 20#define KF_RET_NULL (1 << 2) /* kfunc returns a pointer that may be NULL */ 21/* Trusted arguments are those which are guaranteed to be valid when passed to 22 * the kfunc. It is used to enforce that pointers obtained from either acquire 23 * kfuncs, or from the main kernel on a tracepoint or struct_ops callback 24 * invocation, remain unmodified when being passed to helpers taking trusted 25 * args. 26 * 27 * Consider, for example, the following new task tracepoint: 28 * 29 * SEC("tp_btf/task_newtask") 30 * int BPF_PROG(new_task_tp, struct task_struct *task, u64 clone_flags) 31 * { 32 * ... 33 * } 34 * 35 * And the following kfunc: 36 * 37 * BTF_ID_FLAGS(func, bpf_task_acquire, KF_ACQUIRE) 38 * 39 * All invocations to the kfunc must pass the unmodified, unwalked task: 40 * 41 * bpf_task_acquire(task); // Allowed 42 * bpf_task_acquire(task->last_wakee); // Rejected, walked task 43 * 44 * Programs may also pass referenced tasks directly to the kfunc: 45 * 46 * struct task_struct *acquired; 47 * 48 * acquired = bpf_task_acquire(task); // Allowed, same as above 49 * bpf_task_acquire(acquired); // Allowed 50 * bpf_task_acquire(task); // Allowed 51 * bpf_task_acquire(acquired->last_wakee); // Rejected, walked task 52 * 53 * Programs may _not_, however, pass a task from an arbitrary fentry/fexit, or 54 * kprobe/kretprobe to the kfunc, as BPF cannot guarantee that all of these 55 * pointers are guaranteed to be safe. For example, the following BPF program 56 * would be rejected: 57 * 58 * SEC("kretprobe/free_task") 59 * int BPF_PROG(free_task_probe, struct task_struct *tsk) 60 * { 61 * struct task_struct *acquired; 62 * 63 * acquired = bpf_task_acquire(acquired); // Rejected, not a trusted pointer 64 * bpf_task_release(acquired); 65 * 66 * return 0; 67 * } 68 */ 69#define KF_SLEEPABLE (1 << 5) /* kfunc may sleep */ 70#define KF_DESTRUCTIVE (1 << 6) /* kfunc performs destructive actions */ 71#define KF_RCU (1 << 7) /* kfunc takes either rcu or trusted pointer arguments */ 72/* only one of KF_ITER_{NEW,NEXT,DESTROY} could be specified per kfunc */ 73#define KF_ITER_NEW (1 << 8) /* kfunc implements BPF iter constructor */ 74#define KF_ITER_NEXT (1 << 9) /* kfunc implements BPF iter next method */ 75#define KF_ITER_DESTROY (1 << 10) /* kfunc implements BPF iter destructor */ 76#define KF_RCU_PROTECTED (1 << 11) /* kfunc should be protected by rcu cs when they are invoked */ 77#define KF_FASTCALL (1 << 12) /* kfunc supports bpf_fastcall protocol */ 78#define KF_ARENA_RET (1 << 13) /* kfunc returns an arena pointer */ 79#define KF_ARENA_ARG1 (1 << 14) /* kfunc takes an arena pointer as its first argument */ 80#define KF_ARENA_ARG2 (1 << 15) /* kfunc takes an arena pointer as its second argument */ 81#define KF_IMPLICIT_ARGS (1 << 16) /* kfunc has implicit arguments supplied by the verifier */ 82 83/* 84 * Tag marking a kernel function as a kfunc. This is meant to minimize the 85 * amount of copy-paste that kfunc authors have to include for correctness so 86 * as to avoid issues such as the compiler inlining or eliding either a static 87 * kfunc, or a global kfunc in an LTO build. 88 */ 89#define __bpf_kfunc __used __retain __noclone noinline 90 91#define __bpf_kfunc_start_defs() \ 92 __diag_push(); \ 93 __diag_ignore_all("-Wmissing-declarations", \ 94 "Global kfuncs as their definitions will be in BTF");\ 95 __diag_ignore_all("-Wmissing-prototypes", \ 96 "Global kfuncs as their definitions will be in BTF") 97 98#define __bpf_kfunc_end_defs() __diag_pop() 99#define __bpf_hook_start() __bpf_kfunc_start_defs() 100#define __bpf_hook_end() __bpf_kfunc_end_defs() 101 102/* 103 * Return the name of the passed struct, if exists, or halt the build if for 104 * example the structure gets renamed. In this way, developers have to revisit 105 * the code using that structure name, and update it accordingly. 106 */ 107#define stringify_struct(x) \ 108 ({ BUILD_BUG_ON(sizeof(struct x) < 0); \ 109 __stringify(x); }) 110 111struct btf; 112struct btf_member; 113struct btf_type; 114union bpf_attr; 115struct btf_show; 116struct btf_id_set; 117struct bpf_prog; 118 119typedef int (*btf_kfunc_filter_t)(const struct bpf_prog *prog, u32 kfunc_id); 120 121struct btf_kfunc_id_set { 122 struct module *owner; 123 struct btf_id_set8 *set; 124 btf_kfunc_filter_t filter; 125}; 126 127struct btf_id_dtor_kfunc { 128 u32 btf_id; 129 u32 kfunc_btf_id; 130}; 131 132struct btf_struct_meta { 133 u32 btf_id; 134 struct btf_record *record; 135}; 136 137struct btf_struct_metas { 138 u32 cnt; 139 struct btf_struct_meta types[]; 140}; 141 142extern const struct file_operations btf_fops; 143 144const char *btf_get_name(const struct btf *btf); 145void btf_get(struct btf *btf); 146void btf_put(struct btf *btf); 147const struct btf_header *btf_header(const struct btf *btf); 148int btf_new_fd(const union bpf_attr *attr, bpfptr_t uattr, u32 uattr_sz); 149struct btf *btf_get_by_fd(int fd); 150int btf_get_info_by_fd(const struct btf *btf, 151 const union bpf_attr *attr, 152 union bpf_attr __user *uattr); 153/* Figure out the size of a type_id. If type_id is a modifier 154 * (e.g. const), it will be resolved to find out the type with size. 155 * 156 * For example: 157 * In describing "const void *", type_id is "const" and "const" 158 * refers to "void *". The return type will be "void *". 159 * 160 * If type_id is a simple "int", then return type will be "int". 161 * 162 * @btf: struct btf object 163 * @type_id: Find out the size of type_id. The type_id of the return 164 * type is set to *type_id. 165 * @ret_size: It can be NULL. If not NULL, the size of the return 166 * type is set to *ret_size. 167 * Return: The btf_type (resolved to another type with size info if needed). 168 * NULL is returned if type_id itself does not have size info 169 * (e.g. void) or it cannot be resolved to another type that 170 * has size info. 171 * *type_id and *ret_size will not be changed in the 172 * NULL return case. 173 */ 174const struct btf_type *btf_type_id_size(const struct btf *btf, 175 u32 *type_id, 176 u32 *ret_size); 177 178/* 179 * Options to control show behaviour. 180 * - BTF_SHOW_COMPACT: no formatting around type information 181 * - BTF_SHOW_NONAME: no struct/union member names/types 182 * - BTF_SHOW_PTR_RAW: show raw (unobfuscated) pointer values; 183 * equivalent to %px. 184 * - BTF_SHOW_ZERO: show zero-valued struct/union members; they 185 * are not displayed by default 186 * - BTF_SHOW_UNSAFE: skip use of bpf_probe_read() to safely read 187 * data before displaying it. 188 */ 189#define BTF_SHOW_COMPACT BTF_F_COMPACT 190#define BTF_SHOW_NONAME BTF_F_NONAME 191#define BTF_SHOW_PTR_RAW BTF_F_PTR_RAW 192#define BTF_SHOW_ZERO BTF_F_ZERO 193#define BTF_SHOW_UNSAFE (1ULL << 4) 194 195void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj, 196 struct seq_file *m); 197int btf_type_seq_show_flags(const struct btf *btf, u32 type_id, void *obj, 198 struct seq_file *m, u64 flags); 199 200/* 201 * Copy len bytes of string representation of obj of BTF type_id into buf. 202 * 203 * @btf: struct btf object 204 * @type_id: type id of type obj points to 205 * @obj: pointer to typed data 206 * @buf: buffer to write to 207 * @len: maximum length to write to buf 208 * @flags: show options (see above) 209 * 210 * Return: length that would have been/was copied as per snprintf, or 211 * negative error. 212 */ 213int btf_type_snprintf_show(const struct btf *btf, u32 type_id, void *obj, 214 char *buf, int len, u64 flags); 215 216int btf_get_fd_by_id(u32 id); 217u32 btf_obj_id(const struct btf *btf); 218bool btf_is_kernel(const struct btf *btf); 219bool btf_is_module(const struct btf *btf); 220bool btf_is_vmlinux(const struct btf *btf); 221struct module *btf_try_get_module(const struct btf *btf); 222u32 btf_nr_types(const struct btf *btf); 223u32 btf_named_start_id(const struct btf *btf, bool own); 224struct btf *btf_base_btf(const struct btf *btf); 225bool btf_type_is_i32(const struct btf_type *t); 226bool btf_type_is_i64(const struct btf_type *t); 227bool btf_type_is_primitive(const struct btf_type *t); 228bool btf_member_is_reg_int(const struct btf *btf, const struct btf_type *s, 229 const struct btf_member *m, 230 u32 expected_offset, u32 expected_size); 231struct btf_record *btf_parse_fields(const struct btf *btf, const struct btf_type *t, 232 u32 field_mask, u32 value_size); 233int btf_check_and_fixup_fields(const struct btf *btf, struct btf_record *rec); 234bool btf_type_is_void(const struct btf_type *t); 235s32 btf_find_by_name_kind(const struct btf *btf, const char *name, u8 kind); 236s32 bpf_find_btf_id(const char *name, u32 kind, struct btf **btf_p); 237const struct btf_type *btf_type_skip_modifiers(const struct btf *btf, 238 u32 id, u32 *res_id); 239const struct btf_type *btf_type_resolve_ptr(const struct btf *btf, 240 u32 id, u32 *res_id); 241const struct btf_type *btf_type_resolve_func_ptr(const struct btf *btf, 242 u32 id, u32 *res_id); 243const struct btf_type * 244btf_resolve_size(const struct btf *btf, const struct btf_type *type, 245 u32 *type_size); 246const char *btf_type_str(const struct btf_type *t); 247 248#define for_each_member(i, struct_type, member) \ 249 for (i = 0, member = btf_type_member(struct_type); \ 250 i < btf_type_vlen(struct_type); \ 251 i++, member++) 252 253#define for_each_vsi(i, datasec_type, member) \ 254 for (i = 0, member = btf_type_var_secinfo(datasec_type); \ 255 i < btf_type_vlen(datasec_type); \ 256 i++, member++) 257 258static inline bool btf_type_is_ptr(const struct btf_type *t) 259{ 260 return BTF_INFO_KIND(t->info) == BTF_KIND_PTR; 261} 262 263static inline bool btf_type_is_int(const struct btf_type *t) 264{ 265 return BTF_INFO_KIND(t->info) == BTF_KIND_INT; 266} 267 268static inline bool btf_type_is_small_int(const struct btf_type *t) 269{ 270 return btf_type_is_int(t) && t->size <= sizeof(u64); 271} 272 273static inline u8 btf_int_encoding(const struct btf_type *t) 274{ 275 return BTF_INT_ENCODING(*(u32 *)(t + 1)); 276} 277 278static inline bool btf_type_is_signed_int(const struct btf_type *t) 279{ 280 return btf_type_is_int(t) && (btf_int_encoding(t) & BTF_INT_SIGNED); 281} 282 283static inline bool btf_type_is_enum(const struct btf_type *t) 284{ 285 return BTF_INFO_KIND(t->info) == BTF_KIND_ENUM; 286} 287 288static inline bool btf_is_any_enum(const struct btf_type *t) 289{ 290 return BTF_INFO_KIND(t->info) == BTF_KIND_ENUM || 291 BTF_INFO_KIND(t->info) == BTF_KIND_ENUM64; 292} 293 294static inline bool btf_kind_core_compat(const struct btf_type *t1, 295 const struct btf_type *t2) 296{ 297 return BTF_INFO_KIND(t1->info) == BTF_INFO_KIND(t2->info) || 298 (btf_is_any_enum(t1) && btf_is_any_enum(t2)); 299} 300 301static inline bool str_is_empty(const char *s) 302{ 303 return !s || !s[0]; 304} 305 306static inline u16 btf_kind(const struct btf_type *t) 307{ 308 return BTF_INFO_KIND(t->info); 309} 310 311static inline bool btf_is_enum(const struct btf_type *t) 312{ 313 return btf_kind(t) == BTF_KIND_ENUM; 314} 315 316static inline bool btf_is_enum64(const struct btf_type *t) 317{ 318 return btf_kind(t) == BTF_KIND_ENUM64; 319} 320 321static inline u64 btf_enum64_value(const struct btf_enum64 *e) 322{ 323 return ((u64)e->val_hi32 << 32) | e->val_lo32; 324} 325 326static inline bool btf_is_composite(const struct btf_type *t) 327{ 328 u16 kind = btf_kind(t); 329 330 return kind == BTF_KIND_STRUCT || kind == BTF_KIND_UNION; 331} 332 333static inline bool btf_is_array(const struct btf_type *t) 334{ 335 return btf_kind(t) == BTF_KIND_ARRAY; 336} 337 338static inline bool btf_is_int(const struct btf_type *t) 339{ 340 return btf_kind(t) == BTF_KIND_INT; 341} 342 343static inline bool btf_is_ptr(const struct btf_type *t) 344{ 345 return btf_kind(t) == BTF_KIND_PTR; 346} 347 348static inline u8 btf_int_offset(const struct btf_type *t) 349{ 350 return BTF_INT_OFFSET(*(u32 *)(t + 1)); 351} 352 353static inline __u8 btf_int_bits(const struct btf_type *t) 354{ 355 return BTF_INT_BITS(*(__u32 *)(t + 1)); 356} 357 358static inline bool btf_type_is_scalar(const struct btf_type *t) 359{ 360 return btf_type_is_int(t) || btf_type_is_enum(t); 361} 362 363static inline bool btf_type_is_fwd(const struct btf_type *t) 364{ 365 return BTF_INFO_KIND(t->info) == BTF_KIND_FWD; 366} 367 368static inline bool btf_type_is_typedef(const struct btf_type *t) 369{ 370 return BTF_INFO_KIND(t->info) == BTF_KIND_TYPEDEF; 371} 372 373static inline bool btf_type_is_volatile(const struct btf_type *t) 374{ 375 return BTF_INFO_KIND(t->info) == BTF_KIND_VOLATILE; 376} 377 378static inline bool btf_type_is_func(const struct btf_type *t) 379{ 380 return BTF_INFO_KIND(t->info) == BTF_KIND_FUNC; 381} 382 383static inline bool btf_type_is_func_proto(const struct btf_type *t) 384{ 385 return BTF_INFO_KIND(t->info) == BTF_KIND_FUNC_PROTO; 386} 387 388static inline bool btf_type_is_var(const struct btf_type *t) 389{ 390 return BTF_INFO_KIND(t->info) == BTF_KIND_VAR; 391} 392 393static inline bool btf_type_is_type_tag(const struct btf_type *t) 394{ 395 return BTF_INFO_KIND(t->info) == BTF_KIND_TYPE_TAG; 396} 397 398/* union is only a special case of struct: 399 * all its offsetof(member) == 0 400 */ 401static inline bool btf_type_is_struct(const struct btf_type *t) 402{ 403 u8 kind = BTF_INFO_KIND(t->info); 404 405 return kind == BTF_KIND_STRUCT || kind == BTF_KIND_UNION; 406} 407 408static inline bool __btf_type_is_struct(const struct btf_type *t) 409{ 410 return BTF_INFO_KIND(t->info) == BTF_KIND_STRUCT; 411} 412 413static inline bool btf_type_is_array(const struct btf_type *t) 414{ 415 return BTF_INFO_KIND(t->info) == BTF_KIND_ARRAY; 416} 417 418static inline u16 btf_type_vlen(const struct btf_type *t) 419{ 420 return BTF_INFO_VLEN(t->info); 421} 422 423static inline u16 btf_vlen(const struct btf_type *t) 424{ 425 return btf_type_vlen(t); 426} 427 428static inline u16 btf_func_linkage(const struct btf_type *t) 429{ 430 return BTF_INFO_VLEN(t->info); 431} 432 433static inline bool btf_type_kflag(const struct btf_type *t) 434{ 435 return BTF_INFO_KFLAG(t->info); 436} 437 438static inline u32 __btf_member_bit_offset(const struct btf_type *struct_type, 439 const struct btf_member *member) 440{ 441 return btf_type_kflag(struct_type) ? BTF_MEMBER_BIT_OFFSET(member->offset) 442 : member->offset; 443} 444 445static inline u32 __btf_member_bitfield_size(const struct btf_type *struct_type, 446 const struct btf_member *member) 447{ 448 return btf_type_kflag(struct_type) ? BTF_MEMBER_BITFIELD_SIZE(member->offset) 449 : 0; 450} 451 452static inline struct btf_member *btf_members(const struct btf_type *t) 453{ 454 return (struct btf_member *)(t + 1); 455} 456 457static inline u32 btf_member_bit_offset(const struct btf_type *t, u32 member_idx) 458{ 459 const struct btf_member *m = btf_members(t) + member_idx; 460 461 return __btf_member_bit_offset(t, m); 462} 463 464static inline u32 btf_member_bitfield_size(const struct btf_type *t, u32 member_idx) 465{ 466 const struct btf_member *m = btf_members(t) + member_idx; 467 468 return __btf_member_bitfield_size(t, m); 469} 470 471static inline const struct btf_member *btf_type_member(const struct btf_type *t) 472{ 473 return (const struct btf_member *)(t + 1); 474} 475 476static inline struct btf_array *btf_array(const struct btf_type *t) 477{ 478 return (struct btf_array *)(t + 1); 479} 480 481static inline struct btf_enum *btf_enum(const struct btf_type *t) 482{ 483 return (struct btf_enum *)(t + 1); 484} 485 486static inline struct btf_enum64 *btf_enum64(const struct btf_type *t) 487{ 488 return (struct btf_enum64 *)(t + 1); 489} 490 491static inline const struct btf_var_secinfo *btf_type_var_secinfo( 492 const struct btf_type *t) 493{ 494 return (const struct btf_var_secinfo *)(t + 1); 495} 496 497static inline struct btf_param *btf_params(const struct btf_type *t) 498{ 499 return (struct btf_param *)(t + 1); 500} 501 502static inline struct btf_decl_tag *btf_decl_tag(const struct btf_type *t) 503{ 504 return (struct btf_decl_tag *)(t + 1); 505} 506 507static inline int btf_id_cmp_func(const void *a, const void *b) 508{ 509 const int *pa = a, *pb = b; 510 511 return *pa - *pb; 512} 513 514static inline bool btf_id_set_contains(const struct btf_id_set *set, u32 id) 515{ 516 return bsearch(&id, set->ids, set->cnt, sizeof(u32), btf_id_cmp_func) != NULL; 517} 518 519static inline void *btf_id_set8_contains(const struct btf_id_set8 *set, u32 id) 520{ 521 return bsearch(&id, set->pairs, set->cnt, sizeof(set->pairs[0]), btf_id_cmp_func); 522} 523 524bool btf_param_match_suffix(const struct btf *btf, 525 const struct btf_param *arg, 526 const char *suffix); 527int btf_ctx_arg_offset(const struct btf *btf, const struct btf_type *func_proto, 528 u32 arg_no); 529u32 btf_ctx_arg_idx(struct btf *btf, const struct btf_type *func_proto, int off); 530 531struct bpf_verifier_log; 532 533#if defined(CONFIG_BPF_JIT) && defined(CONFIG_BPF_SYSCALL) 534struct bpf_struct_ops; 535int __register_bpf_struct_ops(struct bpf_struct_ops *st_ops); 536const struct bpf_struct_ops_desc *bpf_struct_ops_find_value(struct btf *btf, u32 value_id); 537const struct bpf_struct_ops_desc *bpf_struct_ops_find(struct btf *btf, u32 type_id); 538#else 539static inline const struct bpf_struct_ops_desc *bpf_struct_ops_find(struct btf *btf, u32 type_id) 540{ 541 return NULL; 542} 543#endif 544 545enum btf_field_iter_kind { 546 BTF_FIELD_ITER_IDS, 547 BTF_FIELD_ITER_STRS, 548}; 549 550struct btf_field_desc { 551 /* once-per-type offsets */ 552 int t_off_cnt, t_offs[2]; 553 /* member struct size, or zero, if no members */ 554 int m_sz; 555 /* repeated per-member offsets */ 556 int m_off_cnt, m_offs[1]; 557}; 558 559struct btf_field_iter { 560 struct btf_field_desc desc; 561 void *p; 562 int m_idx; 563 int off_idx; 564 int vlen; 565}; 566 567#ifdef CONFIG_BPF_SYSCALL 568const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id); 569void btf_set_base_btf(struct btf *btf, const struct btf *base_btf); 570int btf_relocate(struct btf *btf, const struct btf *base_btf, __u32 **map_ids); 571int btf_field_iter_init(struct btf_field_iter *it, struct btf_type *t, 572 enum btf_field_iter_kind iter_kind); 573__u32 *btf_field_iter_next(struct btf_field_iter *it); 574 575const char *btf_name_by_offset(const struct btf *btf, u32 offset); 576const char *btf_str_by_offset(const struct btf *btf, u32 offset); 577struct btf *btf_parse_vmlinux(void); 578struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog); 579u32 *btf_kfunc_flags(const struct btf *btf, u32 kfunc_btf_id, const struct bpf_prog *prog); 580bool btf_kfunc_is_allowed(const struct btf *btf, u32 kfunc_btf_id, const struct bpf_prog *prog); 581u32 *btf_kfunc_is_modify_return(const struct btf *btf, u32 kfunc_btf_id, 582 const struct bpf_prog *prog); 583int register_btf_kfunc_id_set(enum bpf_prog_type prog_type, 584 const struct btf_kfunc_id_set *s); 585int register_btf_fmodret_id_set(const struct btf_kfunc_id_set *kset); 586s32 btf_find_dtor_kfunc(struct btf *btf, u32 btf_id); 587int register_btf_id_dtor_kfuncs(const struct btf_id_dtor_kfunc *dtors, u32 add_cnt, 588 struct module *owner); 589struct btf_struct_meta *btf_find_struct_meta(const struct btf *btf, u32 btf_id); 590bool btf_is_projection_of(const char *pname, const char *tname); 591bool btf_is_prog_ctx_type(struct bpf_verifier_log *log, const struct btf *btf, 592 const struct btf_type *t, enum bpf_prog_type prog_type, 593 int arg); 594int get_kern_ctx_btf_id(struct bpf_verifier_log *log, enum bpf_prog_type prog_type); 595bool btf_types_are_same(const struct btf *btf1, u32 id1, 596 const struct btf *btf2, u32 id2); 597int btf_check_iter_arg(struct btf *btf, const struct btf_type *func, int arg_idx); 598 599static inline bool btf_type_is_struct_ptr(struct btf *btf, const struct btf_type *t) 600{ 601 if (!btf_type_is_ptr(t)) 602 return false; 603 604 t = btf_type_skip_modifiers(btf, t->type, NULL); 605 606 return btf_type_is_struct(t); 607} 608#else 609static inline const struct btf_type *btf_type_by_id(const struct btf *btf, 610 u32 type_id) 611{ 612 return NULL; 613} 614 615static inline void btf_set_base_btf(struct btf *btf, const struct btf *base_btf) 616{ 617} 618 619static inline int btf_relocate(void *log, struct btf *btf, const struct btf *base_btf, 620 __u32 **map_ids) 621{ 622 return -EOPNOTSUPP; 623} 624 625static inline int btf_field_iter_init(struct btf_field_iter *it, struct btf_type *t, 626 enum btf_field_iter_kind iter_kind) 627{ 628 return -EOPNOTSUPP; 629} 630 631static inline __u32 *btf_field_iter_next(struct btf_field_iter *it) 632{ 633 return NULL; 634} 635 636static inline const char *btf_name_by_offset(const struct btf *btf, 637 u32 offset) 638{ 639 return NULL; 640} 641static inline u32 *btf_kfunc_id_set_contains(const struct btf *btf, 642 u32 kfunc_btf_id, 643 struct bpf_prog *prog) 644 645{ 646 return NULL; 647} 648static inline int register_btf_kfunc_id_set(enum bpf_prog_type prog_type, 649 const struct btf_kfunc_id_set *s) 650{ 651 return 0; 652} 653static inline s32 btf_find_dtor_kfunc(struct btf *btf, u32 btf_id) 654{ 655 return -ENOENT; 656} 657static inline int register_btf_id_dtor_kfuncs(const struct btf_id_dtor_kfunc *dtors, 658 u32 add_cnt, struct module *owner) 659{ 660 return 0; 661} 662static inline struct btf_struct_meta *btf_find_struct_meta(const struct btf *btf, u32 btf_id) 663{ 664 return NULL; 665} 666static inline bool 667btf_is_prog_ctx_type(struct bpf_verifier_log *log, const struct btf *btf, 668 const struct btf_type *t, enum bpf_prog_type prog_type, 669 int arg) 670{ 671 return false; 672} 673static inline int get_kern_ctx_btf_id(struct bpf_verifier_log *log, 674 enum bpf_prog_type prog_type) { 675 return -EINVAL; 676} 677static inline bool btf_types_are_same(const struct btf *btf1, u32 id1, 678 const struct btf *btf2, u32 id2) 679{ 680 return false; 681} 682static inline int btf_check_iter_arg(struct btf *btf, const struct btf_type *func, int arg_idx) 683{ 684 return -EOPNOTSUPP; 685} 686#endif 687#endif