[PATCH]Valgind: a complaint about uninitialized bytes in epoll_data_t

cubicdaiya cubicdaiya at gmail.com
Mon Jul 1 17:00:40 UTC 2013


Hello!

In Debian squeeze 32bit,
Valgrind outputs the following message to nginx.

==17124== Syscall param epoll_ctl(event) points to uninitialised byte(s)
==17124==    at 0x418F9CE: epoll_ctl (syscall-template.S:82)
==17124==    by 0x805FB35: ngx_event_process_init (ngx_event.c:853)
==17124==    by 0x8065A5B: ngx_worker_process_init (ngx_process_cycle.c:973)
==17124==    by 0x8065EB8: ngx_worker_process_cycle
(ngx_process_cycle.c:740)
==17124==    by 0x8064815: ngx_spawn_process (ngx_process.c:198)
==17124==    by 0x8065442: ngx_start_worker_processes
(ngx_process_cycle.c:364)
==17124==    by 0x80664A6: ngx_master_process_cycle
(ngx_process_cycle.c:136)
==17124==    by 0x804BA45: main (nginx.c:412)
==17124==  Address 0xbe995f6c is on thread 1's stack
==17124==
==17124== Syscall param epoll_ctl(event) points to uninitialised byte(s)
==17124==    at 0x418F9CE: epoll_ctl (syscall-template.S:82)
==17124==    by 0x8063810: ngx_add_channel_event (ngx_channel.c:240)
==17124==    by 0x8065B5D: ngx_worker_process_init
(ngx_process_cycle.c:1009)
==17124==    by 0x8065EB8: ngx_worker_process_cycle
(ngx_process_cycle.c:740)
==17124==    by 0x8064815: ngx_spawn_process (ngx_process.c:198)
==17124==    by 0x8065442: ngx_start_worker_processes
(ngx_process_cycle.c:364)
==17124==    by 0x80664A6: ngx_master_process_cycle
(ngx_process_cycle.c:136)
==17124==    by 0x804BA45: main (nginx.c:412)
==17124==  Address 0xbe99601c is on thread 1's stack

The following patch eliminates this warning. Could you take a look at it?

# HG changeset patch
# User Tatsuhiko Kubo <cubicdaiya at gmail.com>
# Date 1372689447 -32400
# Node ID cd8fd5cd74294554bb3777821e8703cf0fdf61d7
# Parent  b66ec10e901a6fa0fc19937ceeb52b5ea1fbb706
Valgrind: the complaint about uninitialized bytes in epoll_data_t.

diff -r b66ec10e901a -r cd8fd5cd7429 src/event/modules/ngx_epoll_module.c
--- a/src/event/modules/ngx_epoll_module.c Fri Jun 28 13:55:05 2013 +0400
+++ b/src/event/modules/ngx_epoll_module.c Mon Jul 01 23:37:27 2013 +0900
@@ -417,6 +417,9 @@
     }

     ee.events = events | (uint32_t) flags;
+
+    ngx_memzero(&ee.data, sizeof(epoll_data_t));
+
     ee.data.ptr = (void *) ((uintptr_t) c | ev->instance);

     ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0,

# environment

## uname -a

Linux squeeze32 2.6.32-5-686 #1 SMP Fri May 10 08:33:48 UTC 2013 i686
GNU/Linux

## nginx -V

nginx version: nginx/1.5.2
built by gcc 4.4.5 (Debian 4.4.5-8)
configure arguments: --with-pcre

-- 
Tatsuhiko Kubo

E-Mail : cubicdaiya at gmail.com
HP       : http://cccis.jp/index_en.html
Twitter : http://twitter.com/cubicdaiya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20130702/34595a56/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uninitialized-bytes-fix.patch
Type: application/octet-stream
Size: 725 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20130702/34595a56/attachment.obj>


More information about the nginx-devel mailing list