[PATCH 2/6] bpf: implement decoding of BPF_MAP_CREATE map_extra field
Dmitry V. Levin
ldv at altlinux.org
Wed Dec 29 23:27:24 UTC 2021
On Wed, Dec 29, 2021 at 07:25:00PM +0100, Paul Chaignon wrote:
[...]
> --- a/src/bpf_attr.h
> +++ b/src/bpf_attr.h
> @@ -50,11 +50,12 @@ struct BPF_MAP_CREATE_struct {
> uint32_t btf_key_type_id;
> uint32_t btf_value_type_id;
> uint32_t btf_vmlinux_value_type_id;
> + uint64_t map_extra;
> };
We always add ATTRIBUTE_ALIGNED(8) to uint64_t fields in src/bpf_attr.h
file, the reason is that kernel folks used to screw things up several
times in the past, so we would rather double check.
> # define BPF_MAP_CREATE_struct_size \
> sizeof(struct BPF_MAP_CREATE_struct)
> -# define expected_BPF_MAP_CREATE_struct_size 64
> +# define expected_BPF_MAP_CREATE_struct_size 72
>
> struct BPF_MAP_LOOKUP_ELEM_struct {
> uint32_t map_fd;
> @@ -310,11 +311,13 @@ struct bpf_map_info_struct {
> uint32_t btf_id;
> uint32_t btf_key_type_id;
> uint32_t btf_value_type_id;
> + uint32_t pad;
> + uint64_t map_extra;
> };
Likewise, please ATTRIBUTE_ALIGNED(8) to this new uint64_t field.
--
ldv
More information about the Strace-devel
mailing list