Re: [PATCH] selftests/seccomp: fix check of fds being assigned

From: Christian Brauner
Date: Tue Nov 16 2021 - 04:33:22 EST


On Mon, Nov 15, 2021 at 05:52:27PM +0100, Andrea Righi wrote:
> There might be an arbitrary free open fd slot when we run the addfd
> sub-test, so checking for progressive numbers of file descriptors
> starting from memfd is not always a reliable check and we could get the
> following failure:
>
> # RUN global.user_notification_addfd ...
> # seccomp_bpf.c:3989:user_notification_addfd:Expected listener (18) == nextfd++ (9)
> # user_notification_addfd: Test terminated by assertion
>
> Simply check if memfd and listener are valid file descriptors and start
> counting for progressive file checking with the listener fd.
>
> Fixes: 93e720d710df ("selftests/seccomp: More closely track fds being assigned")
> Signed-off-by: Andrea Righi <andrea.righi@xxxxxxxxxxxxx>
> ---

Thanks!
Acked-by: Christian Brauner <christian.brauner@xxxxxxxxxx>