note: this is a temporary commit to allow testing of CHECK_ATTR_FIXED and can safely be ignored. These changes will not appear in any final versions of this patchset.
In order to be able to check/test the changes made to CHECK_ATTR, some blank space is required beyond the end of the last struct member. CHECK_ATTR then checks if this space is zero'd.
The BPF_PROG_LOAD struct is the largest struct in the bpf_attr union, and so does not have any space beyond the last member. Since this RFC only implements handling for BPF_PROG_LOAD, add some temporary padding to verify changes to CHECK_ATTR with an LTP test created for this RFC.
Once other syscall options/bpf_attr structs are supported we can use the smaller structs with natural gaps off end for any tests we might want to add for this.
Signed-off-by: Zachary Leaf zachary.leaf@arm.com --- include/uapi/linux/bpf.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 752a520e1481..b22e42b1e2f7 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -1305,6 +1305,7 @@ union compat_bpf_attr { __aligned_u64 fd_array; /* array of FDs */ __aligned_u64 core_relos; __u32 core_relo_rec_size; /* sizeof(struct bpf_core_relo) */ + __u64 pad[2]; }; } __attribute__((aligned(8)));
@@ -1401,6 +1402,7 @@ union bpf_attr { __kernel_aligned_uintptr_t fd_array; /* array of FDs */ __kernel_aligned_uintptr_t core_relos; __u32 core_relo_rec_size; /* sizeof(struct bpf_core_relo) */ + __u64 pad[2]; };
struct { /* anonymous struct used by BPF_OBJ_* commands */