* [LTP] [PATCH] epoll_ctl06: Fix BPF map on old kernels
@ 2026-09-29 14:15 Andrea Cervesato
2026-09-29 14:40 ` Cyril Hrubis
2026-09-29 17:49 ` [LTP] " linuxtestproject.agent
0 siblings, 2 replies; 8+ messages in thread
From: Andrea Cervesato @ 2026-09-29 14:15 UTC (permalink / raw)
To: Linux Test Project
From: Andrea Cervesato <andrea.cervesato@suse.com>
BPF map file descriptors gained a poll callback in upstream kernel
5.8. Without that callback, EPOLL_CTL_ADD fails with EPERM, while the
test expected it to succeed.
Detect BPF map poll support at runtime so that older kernels with
backported support are handled correctly as well.
Fixes: c4c0ca4c749e ("syscalls: Add epoll_ctl06")
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
tst_tmpdir.c:309: TINFO: Using /var/tmp/LTP_epoXsyHnT as tmpdir (btrfs filesystem)
tst_test.c:2067: TINFO: LTP version: 20260529
tst_test.c:2070: TINFO: Tested kernel: 4.4.140-491.1.TDC.gedc1884-default #1 SMP Wed Sep 23 11:06:41 UTC 2026 (edc1884) x86_64
tst_kconfig.c:90: TINFO: Parsing kernel config '/proc/config.gz'
tst_kconfig.c:760: TINFO: CONFIG_FAULT_INJECTION kernel option detected which might slow the execution
tst_test.c:1897: TINFO: Overall timeout per run is 0h 02m 00s
epoll_ctl06.c:57: TPASS: epoll_ctl() on file : EPERM (1)
epoll_ctl06.c:57: TPASS: epoll_ctl() on O_PATH file : EBADF (9)
epoll_ctl06.c:57: TPASS: epoll_ctl() on directory : EPERM (1)
epoll_ctl06.c:57: TPASS: epoll_ctl() on /dev/zero : EPERM (1)
epoll_ctl06.c:57: TPASS: epoll_ctl() on /proc/self/maps : EPERM (1)
epoll_ctl06.c:57: TPASS: epoll_ctl() on pipe read end passed
epoll_ctl06.c:57: TPASS: epoll_ctl() on pipe write end passed
epoll_ctl06.c:57: TPASS: epoll_ctl() on unix socket passed
epoll_ctl06.c:57: TPASS: epoll_ctl() on inet socket passed
epoll_ctl06.c:57: TPASS: epoll_ctl() on epoll passed
epoll_ctl06.c:57: TPASS: epoll_ctl() on eventfd passed
epoll_ctl06.c:57: TPASS: epoll_ctl() on signalfd passed
epoll_ctl06.c:57: TPASS: epoll_ctl() on timerfd passed
tst_fd.c:144: TCONF: pidfd_open(): ENOSYS (38)
epoll_ctl06.c:57: TPASS: epoll_ctl() on fanotify passed
epoll_ctl06.c:57: TPASS: epoll_ctl() on inotify passed
epoll_ctl06.c:57: TPASS: epoll_ctl() on userfaultfd passed
epoll_ctl06.c:57: TPASS: epoll_ctl() on perf event passed
tst_fd.c:200: TCONF: Skipping io uring: ENOSYS (38)
epoll_ctl06.c:57: TFAIL: epoll_ctl() on bpf map failed: EPERM (1)
tst_fd.c:225: TCONF: Skipping fsopen: ENOSYS (38)
tst_fd.c:234: TCONF: Skipping fspick: ENOSYS (38)
tst_fd.c:243: TCONF: Skipping open_tree: ENOSYS (38)
epoll_ctl06.c:57: TPASS: epoll_ctl() on memfd : EPERM (1)
tst_fd.c:261: TCONF: Skipping memfd secret: ENOSYS (38)
Summary:
passed 18
failed 1
broken 0
skipped 6
warnings 0
---
testcases/kernel/syscalls/epoll_ctl/epoll_ctl06.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl06.c b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl06.c
index 69321582f..e85e9e259 100644
--- a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl06.c
+++ b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl06.c
@@ -12,19 +12,23 @@
* poll file operation are expected to succeed. The rest must fail with:
*
* - EPERM for fds that are valid but lack poll support (regular files,
- * directories, /dev/zero, /proc files, memfd).
+ * directories, /dev/zero, /proc files, memfd and BPF maps on kernels
+ * without BPF map poll support).
* - EBADF for fds that are not usable for I/O (O_PATH, open_tree).
*/
+#include <poll.h>
#include <sys/epoll.h>
#include "tst_test.h"
#include "tst_epoll.h"
#include "tst_fd.h"
-static int exp_errno(enum tst_fd_type type)
+static int exp_errno(struct tst_fd *fd)
{
- switch (type) {
+ struct pollfd pfd = {.fd = fd->fd, .events = POLLIN};
+
+ switch (fd->type) {
case TST_FD_FILE:
case TST_FD_DIR:
case TST_FD_DEV_ZERO:
@@ -37,6 +41,13 @@ static int exp_errno(enum tst_fd_type type)
case TST_FD_PATH:
case TST_FD_OPEN_TREE:
return EBADF;
+ case TST_FD_BPF_MAP:
+ /*
+ * The BPF poll callback returns POLLERR for array maps. Without
+ * the callback, poll() returns the default readiness mask.
+ */
+ SAFE_POLL(&pfd, 1, 0);
+ return pfd.revents & POLLERR ? 0 : EPERM;
default:
return 0;
}
@@ -50,7 +61,7 @@ static void run(void)
TST_FD_FOREACH(fd) {
efd = SAFE_EPOLL_CREATE1(0);
ev.data.fd = fd.fd;
- err = exp_errno(fd.type);
+ err = exp_errno(&fd);
TST_EXP_PASS_OR_FAIL(epoll_ctl(efd, EPOLL_CTL_ADD,
fd.fd, &ev), err,
---
base-commit: 0596b09f22f449cb300e8ad2d08d8b186f551a05
change-id: 20260929-fix_epoll_bpf-5e472da8e63c
Best regards,
--
Andrea Cervesato <andrea.cervesato@suse.com>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] epoll_ctl06: Fix BPF map on old kernels
2026-09-29 14:15 [LTP] [PATCH] epoll_ctl06: Fix BPF map on old kernels Andrea Cervesato
@ 2026-09-29 14:40 ` Cyril Hrubis
2026-09-29 14:43 ` Andrea Cervesato via ltp
2026-09-29 17:49 ` [LTP] " linuxtestproject.agent
1 sibling, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2026-09-29 14:40 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: Linux Test Project
Hi!
> + case TST_FD_BPF_MAP:
> + /*
> + * The BPF poll callback returns POLLERR for array maps. Without
> + * the callback, poll() returns the default readiness mask.
> + */
> + SAFE_POLL(&pfd, 1, 0);
> + return pfd.revents & POLLERR ? 0 : EPERM;
Should't this be guarded with kernel version? I.e. only enabled for
kernels older than 5.8?
> default:
> return 0;
> }
> @@ -50,7 +61,7 @@ static void run(void)
> TST_FD_FOREACH(fd) {
> efd = SAFE_EPOLL_CREATE1(0);
> ev.data.fd = fd.fd;
> - err = exp_errno(fd.type);
> + err = exp_errno(&fd);
>
> TST_EXP_PASS_OR_FAIL(epoll_ctl(efd, EPOLL_CTL_ADD,
> fd.fd, &ev), err,
>
> ---
> base-commit: 0596b09f22f449cb300e8ad2d08d8b186f551a05
> change-id: 20260929-fix_epoll_bpf-5e472da8e63c
>
> Best regards,
> --
> Andrea Cervesato <andrea.cervesato@suse.com>
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] epoll_ctl06: Fix BPF map on old kernels
2026-09-29 14:40 ` Cyril Hrubis
@ 2026-09-29 14:43 ` Andrea Cervesato via ltp
2026-09-29 14:58 ` Petr Vorel
0 siblings, 1 reply; 8+ messages in thread
From: Andrea Cervesato via ltp @ 2026-09-29 14:43 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: Linux Test Project
Hi Cyril,
> Should't this be guarded with kernel version? I.e. only enabled for
> kernels older than 5.8?
At the beginning i did that, but then i thought that probably there are
kernels backporting this feature. i.e. REHL
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] epoll_ctl06: Fix BPF map on old kernels
2026-09-29 14:43 ` Andrea Cervesato via ltp
@ 2026-09-29 14:58 ` Petr Vorel
2026-09-29 15:29 ` Cyril Hrubis
0 siblings, 1 reply; 8+ messages in thread
From: Petr Vorel @ 2026-09-29 14:58 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: Linux Test Project
Hi Andrea, all,
[ Cc Red Hat folks ]
> Hi Cyril,
> > Should't this be guarded with kernel version? I.e. only enabled for
> > kernels older than 5.8?
> At the beginning i did that, but then i thought that probably there are
> kernels backporting this feature. i.e. REHL
I'd also skip it for older kernel unless somebody reports it's needed.
(Simplicity wins in the long term.)
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] epoll_ctl06: Fix BPF map on old kernels
2026-09-29 14:58 ` Petr Vorel
@ 2026-09-29 15:29 ` Cyril Hrubis
2026-09-29 15:53 ` Petr Vorel
2026-09-29 16:01 ` Martin Doucha
0 siblings, 2 replies; 8+ messages in thread
From: Cyril Hrubis @ 2026-09-29 15:29 UTC (permalink / raw)
To: Petr Vorel; +Cc: Linux Test Project
Hi!
> > > Should't this be guarded with kernel version? I.e. only enabled for
> > > kernels older than 5.8?
>
> > At the beginning i did that, but then i thought that probably there are
> > kernels backporting this feature. i.e. REHL
>
> I'd also skip it for older kernel unless somebody reports it's needed.
> (Simplicity wins in the long term.)
What i though is that the check should be skipped on kernel newers than
5.8 and we should just return 0 here unconditionally.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] epoll_ctl06: Fix BPF map on old kernels
2026-09-29 15:29 ` Cyril Hrubis
@ 2026-09-29 15:53 ` Petr Vorel
2026-09-29 16:01 ` Martin Doucha
1 sibling, 0 replies; 8+ messages in thread
From: Petr Vorel @ 2026-09-29 15:53 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: Linux Test Project
> Hi!
> > > > Should't this be guarded with kernel version? I.e. only enabled for
> > > > kernels older than 5.8?
> > > At the beginning i did that, but then i thought that probably there are
> > > kernels backporting this feature. i.e. REHL
> > I'd also skip it for older kernel unless somebody reports it's needed.
> > (Simplicity wins in the long term.)
> What i though is that the check should be skipped on kernel newers than
> 5.8 and we should just return 0 here unconditionally.
Ah, I overlooked "enabled for kernels *older* than 5.8". Sure, I also meant
guard only this single test with tst_kvercmp(). Simple, IMHO good enough.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] epoll_ctl06: Fix BPF map on old kernels
2026-09-29 15:29 ` Cyril Hrubis
2026-09-29 15:53 ` Petr Vorel
@ 2026-09-29 16:01 ` Martin Doucha
1 sibling, 0 replies; 8+ messages in thread
From: Martin Doucha @ 2026-09-29 16:01 UTC (permalink / raw)
To: Cyril Hrubis, Petr Vorel; +Cc: Linux Test Project
On 9/29/26 17:29, Cyril Hrubis wrote:
> What i though is that the check should be skipped on kernel newers than
> 5.8 and we should just return 0 here unconditionally.
Hi,
I agree with that. Andrea, please send v2.
--
Martin Doucha mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] epoll_ctl06: Fix BPF map on old kernels
2026-09-29 14:15 [LTP] [PATCH] epoll_ctl06: Fix BPF map on old kernels Andrea Cervesato
2026-09-29 14:40 ` Cyril Hrubis
@ 2026-09-29 17:49 ` linuxtestproject.agent
1 sibling, 0 replies; 8+ messages in thread
From: linuxtestproject.agent @ 2026-09-29 17:49 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi Andrea,
On Tue, 29 Sep 2026 16:15:01 +0200, Andrea Cervesato wrote:
> epoll_ctl06: Fix BPF map on old kernels
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-09-29 17:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29 14:15 [LTP] [PATCH] epoll_ctl06: Fix BPF map on old kernels Andrea Cervesato
2026-09-29 14:40 ` Cyril Hrubis
2026-09-29 14:43 ` Andrea Cervesato via ltp
2026-09-29 14:58 ` Petr Vorel
2026-09-29 15:29 ` Cyril Hrubis
2026-09-29 15:53 ` Petr Vorel
2026-09-29 16:01 ` Martin Doucha
2026-09-29 17:49 ` [LTP] " linuxtestproject.agent
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.