The later patch will introduce "struct bpf_line_info" which has member "line_off" and "file_off" referring back to the string section in btf. The line_"off" and file_"off" are more consistent to the naming convention in btf.h that means "offset" (e.g. name_off in "struct btf_type"). The to-be-added "struct bpf_line_info" also has another member, "insn_off" which is the same as the "insn_offset" in "struct bpf_func_info". Hence, this patch renames "insn_offset" to "insn_off" for "struct bpf_func_info".
Unified · Split
| @@ -2991,7 +2991,7 @@ struct bpf_flow_keys { · 2990 unmodified lines | |||
| 2991 | }; | 2991 | }; |
| 2992 | 2992 | ||
| 2993 | struct bpf_func_info { | 2993 | struct bpf_func_info { |
| 2994 | __u32 insn_offset; | 2994 | __u32 insn_off; |
| 2995 | __u32 type_id; | 2995 | __u32 type_id; |
| 2996 | }; | 2996 | }; |
| 2997 | 2997 | ||
| @@ -4707,24 +4707,24 @@ static int check_btf_func(struct bpf_prog *prog, struct bpf_verifier_env *env, · 4706 unmodified lines | |||
| 4707 | goto free_btf; | 4707 | goto free_btf; |
| 4708 | } | 4708 | } |
| 4709 | 4709 | ||
| 4710 | /* check insn_offset */ | 4710 | /* check insn_off */ |
| 4711 | if (i == 0) { | 4711 | if (i == 0) { |
| 4712 | if (krecord[i].insn_offset) { | 4712 | if (krecord[i].insn_off) { |
| 4713 | verbose(env, | 4713 | verbose(env, |
| 4714 | "nonzero insn_offset %u for the first func info record", | 4714 | "nonzero insn_off %u for the first func info record", |
| 4715 | krecord[i].insn_offset); | 4715 | krecord[i].insn_off); |
| 4716 | ret = -EINVAL; | 4716 | ret = -EINVAL; |
| 4717 | goto free_btf; | 4717 | goto free_btf; |
| 4718 | } | 4718 | } |
| 4719 | } else if (krecord[i].insn_offset <= prev_offset) { | 4719 | } else if (krecord[i].insn_off <= prev_offset) { |
| 4720 | verbose(env, | 4720 | verbose(env, |
| 4721 | "same or smaller insn offset (%u) than previous func info record (%u)", | 4721 | "same or smaller insn offset (%u) than previous func info record (%u)", |
| 4722 | krecord[i].insn_offset, prev_offset); | 4722 | krecord[i].insn_off, prev_offset); |
| 4723 | ret = -EINVAL; | 4723 | ret = -EINVAL; |
| 4724 | goto free_btf; | 4724 | goto free_btf; |
| 4725 | } | 4725 | } |
| 4726 | 4726 | ||
| 4727 | if (env->subprog_info[i].start != krecord[i].insn_offset) { | 4727 | if (env->subprog_info[i].start != krecord[i].insn_off) { |
| 4728 | verbose(env, "func_info BTF section doesn't match subprog layout in BPF program\n"); | 4728 | verbose(env, "func_info BTF section doesn't match subprog layout in BPF program\n"); |
| 4729 | ret = -EINVAL; | 4729 | ret = -EINVAL; |
| 4730 | goto free_btf; | 4730 | goto free_btf; |
| @@ -4739,7 +4739,7 @@ static int check_btf_func(struct bpf_prog *prog, struct bpf_verifier_env *env, · 8 unmodified lines | |||
| 4739 | goto free_btf; | 4739 | goto free_btf; |
| 4740 | } | 4740 | } |
| 4741 | 4741 | ||
| 4742 | prev_offset = krecord[i].insn_offset; | 4742 | prev_offset = krecord[i].insn_off; |
| 4743 | urecord += urec_size; | 4743 | urecord += urec_size; |
| 4744 | } | 4744 | } |
| 4745 | 4745 | ||
| @@ -4762,7 +4762,7 @@ static void adjust_btf_func(struct bpf_verifier_env *env) · 16 unmodified lines | |||
| 4762 | return; | 4762 | return; |
| 4763 | 4763 | ||
| 4764 | for (i = 0; i < env->subprog_cnt; i++) | 4764 | for (i = 0; i < env->subprog_cnt; i++) |
| 4765 | env->prog->aux->func_info[i].insn_offset = env->subprog_info[i].start; | 4765 | env->prog->aux->func_info[i].insn_off = env->subprog_info[i].start; |
| 4766 | } | 4766 | } |
| 4767 | 4767 | ||
| 4768 | /* check %cur's range satisfies %old's */ | 4768 | /* check %cur's range satisfies %old's */ |