Is lock required for accessing map/program objects in hash maps? #707
-
For example, look at this function in
The hashtable implementation is lock free. And there is a separate lock |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
A lock is acquired in |
Beta Was this translation helpful? Give feedback.
A lock is acquired in
_delete_array_map_entry_with_reference()
so I think the lack of acquiring it in_delete_hash_map_entry_with_reference()
is probably a bug. If I remember right, the lock is trying to provide a guarantee against things like ID reuse where ebpf_object_reference_by_id() ends up referencing an object other than the one originally stored in the map. Though I think the ID generation algorithm uses a 2-byte counter per index so you can't get ID reuse unless you could do 2^16 deletion/additions in between snapshotting the entry value (ID) and taking the tracking list lock inside ebpf_object_reference_by_id(). If we think that is sufficient protection then a separate lock is n…