Message ID | 20230420032735.27760-2-zhoufeng.zf@bytedance.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 2569c7b8726fc06d946a4f999fb1be15b68f3f3c |
Headers | show |
Series | Access variable length array relaxed for integer type | expand |
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 027f9f8a3551..a0887ee44e89 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -6157,11 +6157,13 @@ static int btf_struct_walk(struct bpf_verifier_log *log, const struct btf *btf, if (off < moff) goto error; - /* Only allow structure for now, can be relaxed for - * other types later. - */ + /* allow structure and integer */ t = btf_type_skip_modifiers(btf, array_elem->type, NULL); + + if (btf_type_is_int(t)) + return WALK_SCALAR; + if (!btf_type_is_struct(t)) goto error;