diff options
| author | Yonghong Song <[email protected]> | 2019-02-27 21:22:56 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2019-02-28 01:03:13 +0000 |
| commit | a115d0ed7201a5904c084ae6f07913fe2b9396a6 (patch) | |
| tree | 95fefb6e10dc05e5c1114ff4c7e5b4f9ee2e903a /tools/bpf/bpftool/prog.c | |
| parent | samples: bpf: fix: broken sample regarding removed function (diff) | |
| download | kernel-a115d0ed7201a5904c084ae6f07913fe2b9396a6.tar.gz kernel-a115d0ed7201a5904c084ae6f07913fe2b9396a6.zip | |
bpf: set inner_map_meta->spin_lock_off correctly
Commit d83525ca62cf ("bpf: introduce bpf_spin_lock")
introduced bpf_spin_lock and the field spin_lock_off
in kernel internal structure bpf_map has the following
meaning:
>=0 valid offset, <0 error
For every map created, the kernel will ensure
spin_lock_off has correct value.
Currently, bpf_map->spin_lock_off is not copied
from the inner map to the map_in_map inner_map_meta
during a map_in_map type map creation, so
inner_map_meta->spin_lock_off = 0.
This will give verifier wrong information that
inner_map has bpf_spin_lock and the bpf_spin_lock
is defined at offset 0. An access to offset 0
of a value pointer will trigger the following error:
bpf_spin_lock cannot be accessed directly by load/store
This patch fixed the issue by copy inner map's spin_lock_off
value to inner_map_meta->spin_lock_off.
Fixes: d83525ca62cf ("bpf: introduce bpf_spin_lock")
Signed-off-by: Yonghong Song <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/bpf/bpftool/prog.c')
0 files changed, 0 insertions, 0 deletions
