Fixed use-of-uninitialized-value inside ngx_epoll_test_rdhup.

Maxim Dounin mdounin at mdounin.ru
Thu Jun 18 14:43:35 UTC 2020


Hello!

On Wed, Jun 17, 2020 at 06:55:36PM -0700, Thibault Charbonnier wrote:

> # HG changeset patch
> # User Thibault Charbonnier <thibaultcha at me.com>
> # Date 1592445047 25200
> #      Wed Jun 17 18:50:47 2020 -0700
> # Node ID 3b1e0c7867c40fc82455b5c5dbf1d2e1521c1c8b
> # Parent  8cf31489b479b689b7ff4a9601ce24c914d0394c
> Fixed use-of-uninitialized-value inside ngx_epoll_test_rdhup.
> 
> An issue detected by Valgrind.
> 
> diff -r 8cf31489b479 -r 3b1e0c7867c4 src/event/modules/ngx_epoll_module.c
> --- a/src/event/modules/ngx_epoll_module.c      Mon Jun 15 17:35:26 2020 -0400
> +++ b/src/event/modules/ngx_epoll_module.c      Wed Jun 17 18:50:47 2020 -0700
> @@ -473,6 +473,8 @@
>          return;
>      }
>  
> +    ngx_memzero(&ee, sizeof(struct epoll_event));
> +
>      ee.events = EPOLLET|EPOLLIN|EPOLLRDHUP;
>  
>      if (epoll_ctl(ep, EPOLL_CTL_ADD, s[0], &ee) == -1) {

What makes you think that there is a use of uninitialized value 
here?

Note that Valgrind tends to complain about "use of ..." for each 
and every bit of uninitialized data passed to the kernel, even if 
the data is not used.  While there are no objections to adding 
ngx_memzero() to silence these Valgrind complaints, these changes 
are to be documented as fixing Valgrid complaints, not real 
problems, see 5245:711fa02afae8 and 5252:982678c5c270 for examples.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list