lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 18 Apr 2021 17:02:49 -0300
From:   Pedro Tammela <pctammela@...il.com>
To:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>, netdev@...r.kernel.org,
        bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Pedro Tammela <pctammela@...atatu.com>
Subject: [PATCH] bpf: fix errno code for unsupported batch ops

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@...atatu.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;	\
 			goto err_put;		\
 		}				\
 		err = fn(map, attr, uattr);	\
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ