Re: [PATCH bpf 0/3] bpf: avoid using/returning file descriptor value zero

Alexei Starovoitov
2020-06-09T01:34:17Z

On Mon, Jun 08, 2020 at 06:51:12PM +0200, Jesper Dangaard Brouer wrote:
> Make it easier to handle UAPI/kABI extensions by avoid BPF using/returning
> file descriptor value zero. Use this in recent devmap extension to keep
> older applications compatible with newer kernels.
>
> For special type maps (e.g. devmap and cpumap) the map-value data-layout is
> a configuration interface. This is a kernel Application Binary Interface
> (kABI) that can only be tail extended. Thus, new members (and thus features)
> can only be added to the end of this structure, and the kernel uses the
> map->value_size from userspace to determine feature set 'version'.

please drop these kabi references. As far as I know kabi is a redhat invention
and I'm not even sure what exactly it means.
'struct bpf_devmap_val' is uapi. No need to invent new names for existing concept.

> The recent extension of devmap with a bpf_prog.fd requires end-user to
> supply the file-descriptor value minus-1 to communicate that the features
> isn't used. This isn't compatible with the described kABI extension model.

non-zero prog_fd requirement exists already in bpf syscall. It's not recent.
So I don't think patch 1 is appropriate at this point. Certainly not
for bpf tree. We can argue about it usefulness when bpf-next reopens.
For now I think patches 2 and 3 are good to go.
Don't delete 'enum sk_action' in patch 2 though.
The rest looks good to me.
Thanks!