mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 22:02:28 +00:00
Merge branch 'inner_map_spin_lock-fix'
Yonghong Song says: ==================== The inner_map_meta->spin_lock_off is not set correctly during map creation for BPF_MAP_TYPE_ARRAY_OF_MAPS and BPF_MAP_TYPE_HASH_OF_MAPS. This may lead verifier error due to misinformation. This patch set fixed the issue with Patch #1 for the kernel change and Patch #2 for enhanced selftest test_maps. ==================== Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
commit
3bcd604445
@ -58,6 +58,7 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd)
|
||||
inner_map_meta->value_size = inner_map->value_size;
|
||||
inner_map_meta->map_flags = inner_map->map_flags;
|
||||
inner_map_meta->max_entries = inner_map->max_entries;
|
||||
inner_map_meta->spin_lock_off = inner_map->spin_lock_off;
|
||||
|
||||
/* Misc members not needed in bpf_map_meta_equal() check. */
|
||||
inner_map_meta->ops = inner_map->ops;
|
||||
|
@ -27,6 +27,7 @@ SEC("xdp_mimtest")
|
||||
int xdp_mimtest0(struct xdp_md *ctx)
|
||||
{
|
||||
int value = 123;
|
||||
int *value_p;
|
||||
int key = 0;
|
||||
void *map;
|
||||
|
||||
@ -35,6 +36,9 @@ int xdp_mimtest0(struct xdp_md *ctx)
|
||||
return XDP_DROP;
|
||||
|
||||
bpf_map_update_elem(map, &key, &value, 0);
|
||||
value_p = bpf_map_lookup_elem(map, &key);
|
||||
if (!value_p || *value_p != 123)
|
||||
return XDP_DROP;
|
||||
|
||||
map = bpf_map_lookup_elem(&mim_hash, &key);
|
||||
if (!map)
|
||||
|
Loading…
Reference in New Issue
Block a user