[PATCH] Linux: Pass size argument of epoll_create to the kernel

Carlos O'Donell carlos@redhat.com
Thu Dec 22 16:08:06 GMT 2022


On 12/22/22 10:00, Florian Weimer wrote:
> The kernel actually verifies it, and a garbage value in the register
> causes improper system call failures.
> 
> Fixes commit c1c0dea38833751f36a145c32 ("Linux: Remove epoll_create,
> inotify_init from syscalls.list") and commit d1d23b134244d59c4d6ef2295
> ("Lninux: consolidate epoll_create implementation").
> 
> Tested on i686-linux-gnu, x86_64-linux-gnu.

LGTM.

Reviewed-by: Carlos O'Donell <carlos@redaht.com>

> 
> ---
>  sysdeps/unix/sysv/linux/epoll_create.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/epoll_create.c b/sysdeps/unix/sysv/linux/epoll_create.c
> index afb1921637..cb6a67e602 100644
> --- a/sysdeps/unix/sysv/linux/epoll_create.c
> +++ b/sysdeps/unix/sysv/linux/epoll_create.c
> @@ -25,7 +25,7 @@ int
>  epoll_create (int size)
>  {
>  #ifdef __NR_epoll_create
> -  return INLINE_SYSCALL_CALL (epoll_create);
> +  return INLINE_SYSCALL_CALL (epoll_create, size);

OK. This is correct, we need to pass 'size' and I missed this in the initial review of the refactor.

Kernel does the same size check that we do, but in the syscall itself:

2035 SYSCALL_DEFINE1(epoll_create, int, size)
2036 {
2037         if (size <= 0)

             ^^^^^^^^^^^^^^ - Must be a non-negative size.

2038                 return -EINVAL;
2039 
2040         return do_epoll_create(0);
2041 }

>  #else
>    if (size <= 0)
>      {
> 
> base-commit: e2b68828fab4fdfa5595fa89180230cdc4373ec1
> 

-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list