Skip to content

Commit 85824f3

Browse files
sinkapqmonnet
authored andcommitted
bpf: Return hashes of maps in BPF_OBJ_GET_INFO_BY_FD
Currently only array maps are supported, but the implementation can be extended for other maps and objects. The hash is memoized only for exclusive and frozen maps as their content is stable until the exclusive program modifies the map. This is required for BPF signing, enabling a trusted loader program to verify a map's integrity. The loader retrieves the map's runtime hash from the kernel and compares it against an expected hash computed at build time. Signed-off-by: KP Singh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 811baf1 commit 85824f3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/uapi/linux/bpf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6672,6 +6672,8 @@ struct bpf_map_info {
66726672
__u32 btf_value_type_id;
66736673
__u32 btf_vmlinux_id;
66746674
__u64 map_extra;
6675+
__aligned_u64 hash;
6676+
__u32 hash_size;
66756677
} __attribute__((aligned(8)));
66766678

66776679
struct bpf_btf_info {

0 commit comments

Comments
 (0)