[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzagW8GFfybMf10yorwTA+fpiuZHqT41Uu-vAsRHnZqKRw@mail.gmail.com>
Date: Mon, 8 Jun 2020 11:36:33 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Jesper Dangaard Brouer <brouer@...hat.com>
Cc: David Ahern <dsahern@...il.com>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Networking <netdev@...r.kernel.org>,
Daniel Borkmann <borkmann@...earbox.net>,
Lorenzo Bianconi <lorenzo@...nel.org>
Subject: Re: [PATCH bpf 1/3] bpf: syscall to start at file-descriptor 1
On Mon, Jun 8, 2020 at 9:51 AM Jesper Dangaard Brouer <brouer@...hat.com> wrote:
>
> This patch change BPF syscall to avoid returning file descriptor value zero.
>
> As mentioned in cover letter, it is very impractical when extending kABI
> that the file-descriptor value 'zero' is valid, as this requires new fields
> must be initialised as minus-1. First step is to change the kernel such that
> BPF-syscall simply doesn't return value zero as a FD number.
>
> This patch achieves this by similar code to anon_inode_getfd(), with the
> exception of getting unused FD starting from 1. The kernel already supports
> starting from a specific FD value, as this is used by f_dupfd(). It seems
> simpler to replicate part of anon_inode_getfd() code and use this start from
> offset feature, instead of using f_dupfd() handling afterwards.
Wouldn't it be better to just handle that on libbpf side? That way it
works on all kernels and doesn't require this duplication of logic
inside kernel?
>
> Signed-off-by: Jesper Dangaard Brouer <brouer@...hat.com>
> ---
> fs/file.c | 2 +-
> include/linux/file.h | 1 +
> kernel/bpf/syscall.c | 38 ++++++++++++++++++++++++++++++++------
> 3 files changed, 34 insertions(+), 7 deletions(-)
>
[...]
Powered by blists - more mailing lists