projects
/
wrapfs-3.2.y.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
24c290b
)
bpf/btf: Fix BTF verification of enum members in struct/union
author
Yoshiki Komachi
<komachi.yoshiki@gmail.com>
Tue, 10 Mar 2020 07:32:29 +0000
(16:32 +0900)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Thu, 2 Apr 2020 13:28:19 +0000
(15:28 +0200)
commit
da6c7faeb103c493e505e87643272f70be586635
upstream.
btf_enum_check_member() was currently sure to recognize the size of
"enum" type members in struct/union as the size of "int" even if
its size was packed.
This patch fixes BTF enum verification to use the correct size
of member in BPF programs.
Fixes: 179cde8cef7e ("bpf: btf: Check members of struct/union")
Signed-off-by: Yoshiki Komachi <komachi.yoshiki@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link:
https://lore.kernel.org/bpf/1583825550-18606-2-git-send-email-komachi.yoshiki@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/btf.c
patch
|
blob
|
history
diff --git
a/kernel/bpf/btf.c
b/kernel/bpf/btf.c
index 3e2413345e7187f1090d530d9858350c331405d9..86b915583571a2b7f35cb47ac63943d1143365ec 100644
(file)
--- a/
kernel/bpf/btf.c
+++ b/
kernel/bpf/btf.c
@@
-1763,7
+1763,7
@@
static int btf_enum_check_member(struct btf_verifier_env *env,
struct_size = struct_type->size;
bytes_offset = BITS_ROUNDDOWN_BYTES(struct_bits_off);
- if (struct_size - bytes_offset <
sizeof(int)
) {
+ if (struct_size - bytes_offset <
member_type->size
) {
btf_verifier_log_member(env, struct_type, member,
"Member exceeds struct_size");
return -EINVAL;