Skip to content

Adding support for privilege delegation using BPF Token #1921

@anryko

Description

@anryko

I'm trying to load ebpf program in unprivileged container with bpffs privilege delegation enabled. It works with bpftool but fails while using cilium/ebpf. Is this functionality supported?

BPFFS mount:

none on /sys/fs/bpf type bpf (rw,relatime,delegate_cmds=any,delegate_maps=any,delegate_progs=any,delegate_attachs=any)

Successful map creation while using bpftool:

bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_ARRAY, key_size=4, value_size=860, max_entries=1, map_flags=BPF_F_RDONLY_PROG|0x10000, inner_map_fd=0, map_name="", map_ifindex=0, btf_fd=3, btf_key_type_id=0, btf_value_type_id=0, btf_vmlinux_value_type_id=0, map_extra=0, ...}, 92) = 13

Failure loading the same object file using cilium/ebpf:

bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_ARRAY, key_size=4, value_size=860, max_entries=1, map_flags=BPF_F_RDONLY_PROG, inner_map_fd=0, map_name="", map_ifindex=0, btf_fd=0, btf_key_type_id=0, btf_value_type_id=0, btf_vmlinux_value_type_id=0, map_extra=0}, 80) = -1 EPERM (Operation not permitted)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions