On 2/16/23 8:42 AM, Kui-Feng Lee wrote:
@@ -638,6 +647,8 @@ static struct bpf_map *bpf_struct_ops_map_alloc(union
bpf_attr *attr)
set_vm_flush_reset_perms(st_map->image);
bpf_map_init_from_attr(map, attr);
+ map->map_flags |= attr->map_flags & BPF_F_LINK;
This should have already been done in bpf_map_init_from_attr().
bpf_map_init_from_attr() will filter out all flags except BPF_F_RDONLY &
BPF_F_WRONLY.
should be the opposite:
static u32 bpf_map_flags_retain_permanent(u32 flags)
{
/* Some map creation flags are not tied to the map object but
* rather to the map fd instead, so they have no meaning upon
* map object inspection since multiple file descriptors with
* different (access) properties can exist here. Thus, given
* this has zero meaning for the map itself, lets clear these
* from here.
*/
return flags & ~(BPF_F_RDONLY | BPF_F_WRONLY);
}