On Tue, Sep 15, 2020 at 11:46 AM John McDowall <jmcdowall@xxxxxxxxxxxxxxxxxxxx> wrote: > > Hi everyone, > > This may be a dumb question, I have set up a simple test environment > with multiple network namespaces running on a ubuntu 20.04 vagrant > box, with the latest github libbpf. > > I want to use a pinned map, I can make /sys/fs/bpf shared by: > > $ mount mount --make-shared /sys/fs/bpf > $ mount --bind /sys/fs/bpf /sys/fs/bpf Similar commands `mount --bind /sys/fs/bpf /sys/fs/bpf1` in the same namespace works fine. Maybe there are restrictions related to namespace? Maybe it becomes readonly? Could you print out the error code below? > > but when I try access the maps from a C program running in a namespace > using bpf I get > > Access to /sys/fs/bpf/lwtconfig map failed obj_pin errno: No such > file or directory > > The code snippet is: > > mapfd = bpf_obj_pin(pin_fd,CONFIG_MAP_PATH); > if (mapfd < 0) { > jed_info(jed_logfile,"Access to %s map failed obj_pin ", > CONFIG_MAP_PATH); > pin_fd = bpf_obj_get(CONFIG_MAP_PATH); > if (pin_fd < 0){ > jed_error(jed_logfile,"Access to %s map failed with > obj_get ", CONFIG_MAP_PATH); > } > } > > Is this possible, and if so what am I missing? > > Regards > > John