From: Hou Tao <houtao1@xxxxxxxxxx> For bpf map with dynptr key support, the userspace application will use bpf_dynptr_user to represent the bpf_dynptr in the map key and pass it to bpf syscall. The bpf syscall will copy from bpf_dynptr_user to construct a corresponding bpf_dynptr_kern object when the map key is an input argument, and copy to bpf_dynptr_user from a bpf_dynptr_kern object when the map key is an output argument. For now the size of bpf_dynptr_user must be the same as bpf_dynptr, but the last u32 field is not used, so make it a reserved field. Signed-off-by: Hou Tao <houtao1@xxxxxxxxxx> --- include/uapi/linux/bpf.h | 6 ++++++ tools/include/uapi/linux/bpf.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 2acf9b3363717..7d96685513c55 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -7335,6 +7335,12 @@ struct bpf_dynptr { __u64 __opaque[2]; } __attribute__((aligned(8))); +struct bpf_dynptr_user { + __bpf_md_ptr(void *, data); + __u32 size; + __u32 reserved; +} __attribute__((aligned(8))); + struct bpf_list_head { __u64 __opaque[2]; } __attribute__((aligned(8))); diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 2acf9b3363717..7d96685513c55 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -7335,6 +7335,12 @@ struct bpf_dynptr { __u64 __opaque[2]; } __attribute__((aligned(8))); +struct bpf_dynptr_user { + __bpf_md_ptr(void *, data); + __u32 size; + __u32 reserved; +} __attribute__((aligned(8))); + struct bpf_list_head { __u64 __opaque[2]; } __attribute__((aligned(8))); -- 2.29.2