diff options
| author | Jiri Olsa <jolsa@kernel.org> | 2018-04-25 13:41:06 -0400 |
|---|---|---|
| committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-04-26 16:36:11 -0400 |
| commit | b85fab0e67b162014cd328cb4e2a8e8ae382cb8a (patch) | |
| tree | 2a743c24543f955aab3c03370e779646c74fd95f | |
| parent | af487c5777709d4b7f874fe1a33f9289d51b9adc (diff) | |
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 <jolsa@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
| -rw-r--r-- | include/uapi/linux/bpf.h | 1 | ||||
| -rw-r--r-- | kernel/bpf/syscall.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index e6679393b687..da8801860c7d 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h | |||
| @@ -1060,6 +1060,7 @@ struct bpf_prog_info { | |||
| 1060 | __aligned_u64 map_ids; | 1060 | __aligned_u64 map_ids; |
| 1061 | char name[BPF_OBJ_NAME_LEN]; | 1061 | char name[BPF_OBJ_NAME_LEN]; |
| 1062 | __u32 ifindex; | 1062 | __u32 ifindex; |
| 1063 | __u32 gpl_compatible:1; | ||
| 1063 | __u64 netns_dev; | 1064 | __u64 netns_dev; |
| 1064 | __u64 netns_ino; | 1065 | __u64 netns_ino; |
| 1065 | } __attribute__((aligned(8))); | 1066 | } __attribute__((aligned(8))); |
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index fe23dc5a3ec4..7bb4ff1c770a 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
| @@ -1914,6 +1914,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, | |||
| 1914 | info.load_time = prog->aux->load_time; | 1914 | info.load_time = prog->aux->load_time; |
| 1915 | info.created_by_uid = from_kuid_munged(current_user_ns(), | 1915 | info.created_by_uid = from_kuid_munged(current_user_ns(), |
| 1916 | prog->aux->user->uid); | 1916 | prog->aux->user->uid); |
| 1917 | info.gpl_compatible = prog->gpl_compatible; | ||
| 1917 | 1918 | ||
| 1918 | memcpy(info.tag, prog->tag, sizeof(prog->tag)); | 1919 | memcpy(info.tag, prog->tag, sizeof(prog->tag)); |
| 1919 | memcpy(info.name, prog->aux->name, sizeof(prog->aux->name)); | 1920 | memcpy(info.name, prog->aux->name, sizeof(prog->aux->name)); |
