Skip to content

Commit b85fab0

Browse files
olsajiriborkmann
authored andcommitted
bpf: Add gpl_compatible flag to struct bpf_prog_info
Adding gpl_compatible flag to struct bpf_prog_info so it can be dumped via bpf_prog_get_info_by_fd and displayed via bpftool progs dump. Alexei noticed 4-byte hole in struct bpf_prog_info, so we put the u32 flags field in there, and we can keep adding bit fields in there without breaking user space. Signed-off-by: Jiri Olsa <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent af487c5 commit b85fab0

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

include/uapi/linux/bpf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,7 @@ struct bpf_prog_info {
10601060
__aligned_u64 map_ids;
10611061
char name[BPF_OBJ_NAME_LEN];
10621062
__u32 ifindex;
1063+
__u32 gpl_compatible:1;
10631064
__u64 netns_dev;
10641065
__u64 netns_ino;
10651066
} __attribute__((aligned(8)));

kernel/bpf/syscall.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,6 +1914,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
19141914
info.load_time = prog->aux->load_time;
19151915
info.created_by_uid = from_kuid_munged(current_user_ns(),
19161916
prog->aux->user->uid);
1917+
info.gpl_compatible = prog->gpl_compatible;
19171918

19181919
memcpy(info.tag, prog->tag, sizeof(prog->tag));
19191920
memcpy(info.name, prog->aux->name, sizeof(prog->aux->name));

0 commit comments

Comments
 (0)