• Martin KaFai Lau's avatar
    bpf: Add name, load_time, uid and map_ids to bpf_prog_info · cb4d2b3f
    Martin KaFai Lau authored
    The patch adds name and load_time to struct bpf_prog_aux.  They
    are also exported to bpf_prog_info.
    
    The bpf_prog's name is passed by userspace during BPF_PROG_LOAD.
    The kernel only stores the first (BPF_PROG_NAME_LEN - 1) bytes
    and the name stored in the kernel is always \0 terminated.
    
    The kernel will reject name that contains characters other than
    isalnum() and '_'.  It will also reject name that is not null
    terminated.
    
    The existing 'user->uid' of the bpf_prog_aux is also exported to
    the bpf_prog_info as created_by_uid.
    
    The existing 'used_maps' of the bpf_prog_aux is exported to
    the newly added members 'nr_map_ids' and 'map_ids' of
    the bpf_prog_info.  On the input, nr_map_ids tells how
    big the userspace's map_ids buffer is.  On the output,
    nr_map_ids tells the exact user_map_cnt and it will only
    copy up to the userspace's map_ids buffer is allowed.
    Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Acked-by: default avatarAlexei Starovoitov <ast@fb.com>
    Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    cb4d2b3f
bpf.h 26.4 KB