From: Jiri Olsa <jolsa@kernel.org>
Date: Wed, 25 Apr 2018 19:41:06 +0200
Subject: bpf: Add gpl_compatible flag to struct bpf_prog_info
Patch-mainline: v4.18-rc1
Git-commit: b85fab0e67b162014cd328cb4e2a8e8ae382cb8a
References: bsc#1109837
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 <jolsa@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
include/uapi/linux/bpf.h | 2 +-
kernel/bpf/syscall.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -1019,7 +1019,7 @@ struct bpf_prog_info {
__aligned_u64 map_ids;
char name[BPF_OBJ_NAME_LEN];
__u32 ifindex;
- __u32 :32;
+ __u32 gpl_compatible:1;
__u64 netns_dev;
__u64 netns_ino;
} __attribute__((aligned(8)));
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -1744,6 +1744,7 @@ static int bpf_prog_get_info_by_fd(struc
info.load_time = prog->aux->load_time;
info.created_by_uid = from_kuid_munged(current_user_ns(),
prog->aux->user->uid);
+ info.gpl_compatible = prog->gpl_compatible;
memcpy(info.tag, prog->tag, sizeof(prog->tag));
memcpy(info.name, prog->aux->name, sizeof(prog->aux->name));