-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable BPF programs to declare arrays of kptr, bpf_rb_root, and bpf_list_head. #6996
Conversation
Upstream branch: 7e2c7a3 |
606f72a
to
041b1be
Compare
Upstream branch: e612b5c |
e2c134c
to
e68ca8e
Compare
041b1be
to
63334d2
Compare
Upstream branch: 911edc6 |
e68ca8e
to
3285974
Compare
63334d2
to
2a4c29b
Compare
Upstream branch: 0093670 |
3285974
to
7a158a5
Compare
2a4c29b
to
9fdc018
Compare
Upstream branch: cbe35ad |
7a158a5
to
56f977e
Compare
9fdc018
to
0ce10a8
Compare
Upstream branch: 0d03a4d |
56f977e
to
d8940a7
Compare
0ce10a8
to
e20303c
Compare
Upstream branch: fcd1ed8 |
d8940a7
to
d4c02e6
Compare
Upstream branch: fcd1ed8 |
d4c02e6
to
e3aaec5
Compare
e20303c
to
cd94b05
Compare
Upstream branch: 531876c |
c0d1e31
to
2af3f26
Compare
c939103
to
bb7890b
Compare
Upstream branch: 96a27ee |
2af3f26
to
edf27d6
Compare
bb7890b
to
b0f7439
Compare
Upstream branch: ce5249b |
edf27d6
to
859ca14
Compare
b0f7439
to
f23cdc2
Compare
Upstream branch: ec1249d |
859ca14
to
f86131c
Compare
f23cdc2
to
5580482
Compare
reg_find_field_offset() always return a btf_field with a matching offset value. Checking the offset of the returned btf_field is unnecessary. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
field->size has been initialized by bpf_parse_fields() with the value returned by btf_field_type_size(). Use it instead of calling btf_field_type_size() again. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Move common code of the two functions to btf_find_field_one(). Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
The verifier uses field information for certain special types, such as kptr, rbtree root, and list head. These types are treated differently. However, we did not previously support these types in arrays. This update examines arrays and duplicates field information the same number of times as the length of the array if the element type is one of the special types. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
The verifier has field information for specific special types, such as kptr, rbtree root, and list head. These types are handled differently. However, we did not previously examine the types of fields of a struct type variable. Field information records were not generated for the kptrs, rbtree roots, and linked_list heads that are not located at the outermost struct type of a variable. For example, struct A { struct task_struct __kptr * task; }; struct B { struct A mem_a; } struct B var_b; It did not examine "struct A" so as not to generate field information for the kptr in "struct A" for "var_b". This patch enables BPF programs to define fields of these special types in a struct type other than the direct type of a variable or in a struct type that is the type of a field in the value type of a map. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Limit the number of levels looking into struct types to avoid running out of stack space. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Make sure that BPF programs can declare global kptr arrays and kptr fields in struct types that is the type of a global variable or the type of a nested descendant field in a global variable. An array with only one element is special case, that it treats the element like a non-array kptr field. Nested arrays are also tested to ensure they are handled properly. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Upstream branch: 49784c7 |
…ruct types. Make sure global arrays of bpf_rb_root and fields of bpf_rb_root in nested struct types work correctly. Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Make sure global arrays of bpf_list_heads and fields of bpf_list_heads in nested struct types work correctly. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
f86131c
to
1b2b0e9
Compare
5580482
to
8d70356
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=855436 irrelevant now. Closing PR. |
Pull request for series with
subject: Enable BPF programs to declare arrays of kptr, bpf_rb_root, and bpf_list_head.
version: 4
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=851439