lkml.org 
[lkml]   [2021]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] bpf: fix errno code for unsupported batch ops
On Sun, Apr 18, 2021 at 1:03 PM Pedro Tammela <pctammela@gmail.com> wrote:
>
> ENOTSUPP is not a valid userland errno[1], which is annoying for
> userland applications that implement a fallback to iterative, report
> errors via 'strerror()' or both.
>
> The batched ops return this errno whenever an operation
> is not implemented for kernels that implement batched ops.
>
> In older kernels, pre batched ops, it returns EINVAL as the arguments
> are not supported in the syscall.
>
> [1] https://lore.kernel.org/netdev/20200511165319.2251678-1-kuba@kernel.org/
>
> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
> ---
> kernel/bpf/syscall.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index fd495190115e..88fe19c0aeb1 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -3961,7 +3961,7 @@ static int bpf_task_fd_query(const union bpf_attr *attr,
> #define BPF_DO_BATCH(fn) \
> do { \
> if (!fn) { \
> - err = -ENOTSUPP; \
> + err = -EOPNOTSUPP; \

$ git grep EOPNOTSUPP kernel/bpf/|wc -l
11
$ git grep ENOTSUPP kernel/bpf/|wc -l
51

For new code EOPNOTSUPP is better, but I don't think changing all 51 case
is a good idea. Something might depend on it already.

\
 
 \ /
  Last update: 2021-04-19 00:56    [W:0.049 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site