Subprogram name can be computed from function info and BTF, but it is convenient to have the name readily available for logging purposes. Update comment saying that bpf_subprog_info->start has to be the first field, this is no longer true, relevant sites access .start field by it's name.
Unified · Split
| @@ -664,7 +664,7 @@ enum priv_stack_mode { · 663 unmodified lines | |||
| 664 | }; | 664 | }; |
| 665 | 665 | ||
| 666 | struct bpf_subprog_info { | 666 | struct bpf_subprog_info { |
| 667 | /* 'start' has to be the first field otherwise find_subprog() won't work */ | 667 | const char *name; /* name extracted from BTF */ |
| 668 | u32 start; /* insn idx of function entry point */ | 668 | u32 start; /* insn idx of function entry point */ |
| 669 | u32 linfo_idx; /* The idx to the main_prog->aux->linfo */ | 669 | u32 linfo_idx; /* The idx to the main_prog->aux->linfo */ |
| 670 | u32 postorder_start; /* The idx to the env->cfg.insn_postorder */ | 670 | u32 postorder_start; /* The idx to the env->cfg.insn_postorder */ |
| @@ -19797,6 +19797,7 @@ static int check_btf_func(struct bpf_verifier_env *env, · 19796 unmodified lines | |||
| 19797 | goto err_free; | 19797 | goto err_free; |
| 19798 | } | 19798 | } |
| 19799 | 19799 | ||
| 19800 | env->subprog_info[i].name = btf_name_by_offset(btf, type->name_off); | ||
| 19800 | bpfptr_add(&urecord, urec_size); | 19801 | bpfptr_add(&urecord, urec_size); |
| 19801 | } | 19802 | } |
| 19802 | 19803 | ||