Merge branch 'fix resolving VAR after DATASEC'
Lorenz Bauer says: ==================== See the first patch for a detailed explanation. v2: - Move RESOLVE_TBD assignment out of the loop (Martin) ==================== Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
This commit is contained in:
commit
32dfc59e43
|
@ -4569,6 +4569,7 @@ static int btf_datasec_resolve(struct btf_verifier_env *env,
|
|||
struct btf *btf = env->btf;
|
||||
u16 i;
|
||||
|
||||
env->resolve_mode = RESOLVE_TBD;
|
||||
for_each_vsi_from(i, v->next_member, v->t, vsi) {
|
||||
u32 var_type_id = vsi->type, type_id, type_size = 0;
|
||||
const struct btf_type *var_type = btf_type_by_id(env->btf,
|
||||
|
|
|
@ -879,6 +879,34 @@ static struct btf_raw_test raw_tests[] = {
|
|||
.btf_load_err = true,
|
||||
.err_str = "Invalid elem",
|
||||
},
|
||||
{
|
||||
.descr = "var after datasec, ptr followed by modifier",
|
||||
.raw_types = {
|
||||
/* .bss section */ /* [1] */
|
||||
BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 2),
|
||||
sizeof(void*)+4),
|
||||
BTF_VAR_SECINFO_ENC(4, 0, sizeof(void*)),
|
||||
BTF_VAR_SECINFO_ENC(6, sizeof(void*), 4),
|
||||
/* int */ /* [2] */
|
||||
BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
|
||||
/* int* */ /* [3] */
|
||||
BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 2),
|
||||
BTF_VAR_ENC(NAME_TBD, 3, 0), /* [4] */
|
||||
/* const int */ /* [5] */
|
||||
BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_CONST, 0, 0), 2),
|
||||
BTF_VAR_ENC(NAME_TBD, 5, 0), /* [6] */
|
||||
BTF_END_RAW,
|
||||
},
|
||||
.str_sec = "\0a\0b\0c\0",
|
||||
.str_sec_size = sizeof("\0a\0b\0c\0"),
|
||||
.map_type = BPF_MAP_TYPE_ARRAY,
|
||||
.map_name = ".bss",
|
||||
.key_size = sizeof(int),
|
||||
.value_size = sizeof(void*)+4,
|
||||
.key_type_id = 0,
|
||||
.value_type_id = 1,
|
||||
.max_entries = 1,
|
||||
},
|
||||
/* Test member exceeds the size of struct.
|
||||
*
|
||||
* struct A {
|
||||
|
|
Loading…
Reference in New Issue