Skip to contentSkip to conversation

bpf map collision

DISCUSSION Rao Shoaib 2 participants 2 messages Jun 17, 2024 – Jun 25, 2024 BPF

lore
Share & tools
lore

Rao Shoaib

author
#0 lore raw

Hi,

Can someone please explain to me the magic that makes the map accessed in the program running in the kernel same as one created in the user program. What is the use of the map name? can there be collision if say two separate processes load the exact same program.

Thanks,

Shoaib

#1 lore raw
Quoted 7 lines · Rao Shoaib

Hi,

Can someone please explain to me the magic that makes the map accessed in the program running in the kernel same as one created in the user program. What is the use of the map name? can there be collision if say two separate processes load the exact same program.

It's not magic. Map name is just a hint and there is no uniqueness requirement (and also nothing in the kernel relies on map name). Everything is working based on file descriptors (FDs). When a BPF map is created, kernel returns FD to user space. User space uses that FD to identify the BPF map.

Quoted 6 lines

Thanks,

Shoaib