The fd_array attribute of the BPF_PROG_LOAD syscall may contain a set of file descriptors: maps or btfs. This field was introduced as a sparse array. Introduce a new attribute, fd_array_cnt, which, if present, indicates that the fd_array is a continuous array of the corresponding length. If fd_array_cnt is non-zero, then every map in the fd_array will be bound to the program, as if it was used by the program. This functionality is similar to the BPF_PROG_BIND_MAP syscall, but such maps can be used by the verifier during the program load.
Showing the changes to tools/include/uapi/linux (1 of 4 files). Show all
Unified · Split
| @@ -1573,6 +1573,16 @@ union bpf_attr { · 1572 unmodified lines | ||
| 1573 | 1573 | * If provided, prog_flags should have BPF_F_TOKEN_FD flag set. |
| 1574 | 1574 | */ |
| 1575 | 1575 | __s32 prog_token_fd; |
| 1576 | + /* The fd_array_cnt can be used to pass the length of the | |
| 1577 | + * fd_array array. In this case all the [map] file descriptors | |
| 1578 | + * passed in this array will be bound to the program, even if | |
| 1579 | + * the maps are not referenced directly. The functionality is | |
| 1580 | + * similar to the BPF_PROG_BIND_MAP syscall, but maps can be | |
| 1581 | + * used by the verifier during the program load. If provided, | |
| 1582 | + * then the fd_array[0,...,fd_array_cnt-1] is expected to be | |
| 1583 | + * continuous. | |
| 1584 | + */ | |
| 1585 | + __u32 fd_array_cnt; | |
| 1576 | 1586 | }; |
| 1577 | 1587 | |
| 1578 | 1588 | struct { /* anonymous struct used by BPF_OBJ_* commands */ |