[uWSGI] [PATCH] give more room to socket name

Riccardo Magliocchetti riccardo.magliocchetti at gmail.com
Sun Nov 28 19:06:08 CET 2010


Hi,

valgrind reports that the socket name is read more than its size, it is 
right since it is 64 bytes but 102 are read.

It looks to me that the rest of the code assumes that 102 is the right 
size so use it in malloc() too.

The attached patch suffice to shut up valgrind.

Please review and give it some testing.

How to reproduce:

valgrind --tool=memcheck ./uwsgi --http 127.0.0.1:8000

==11685== Invalid read of size 4
==11685==    at 0x80533C5: bind_to_unix (socket.c:39)
==11685==    by 0x8058C7D: main (uwsgi.c:1014)
==11685==  Address 0x78cf10e is 62 bytes inside a block of size 64 alloc'd
==11685==    at 0x48DEF50: malloc (vg_replace_malloc.c:236)
==11685==    by 0x8059763: main (uwsgi.c:729)
==11685==
uwsgi socket 0 bound to UNIX address 1290963546_11682.sock fd 3
[uWSGI DEBUG] uwsgi socket 0 SO_RCVBUF size: 122880
[uWSGI DEBUG] uwsgi socket 0 SO_SNDBUF size: 122880
your server socket listen backlog is limited to 64 connections
*** Operational MODE: single process ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 11685, cores: 1)
==11682== Thread 2:
==11682== Invalid read of size 4
==11682==    at 0x805316E: connect_to_unix (socket.c:231)
==11682==    by 0x805CD8F: http_request (http.c:315)
==11682==    by 0x490E954: start_thread (pthread_create.c:300)
==11682==    by 0x703CE7D: clone (clone.S:130)
==11682==  Address 0x78cf110 is 0 bytes after a block of size 64 alloc'd
==11682==    at 0x48DEF50: malloc (vg_replace_malloc.c:236)
==11682==    by 0x8059763: main (uwsgi.c:729)
==11682==
==11682== Invalid read of size 2
==11682==    at 0x8053170: connect_to_unix (socket.c:231)
==11682==    by 0x805CD8F: http_request (http.c:315)
==11682==    by 0x490E954: start_thread (pthread_create.c:300)
==11682==    by 0x703CE7D: clone (clone.S:130)
==11682==  Address 0x78cf134 is 12 bytes before a block of size 256 alloc'd
==11682==    at 0x48DEF50: malloc (vg_replace_malloc.c:236)
==11682==    by 0x805C040: http_loop (http.c:117)
==11682==    by 0x8059B4E: main (uwsgi.c:747)

thanks,
riccardo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: give-more-room-for-socket-name.diff
Type: text/x-patch
Size: 658 bytes
Desc: not available
Url : http://lists.unbit.it/pipermail/uwsgi/attachments/20101128/5da56dfe/attachment.bin 


More information about the uWSGI mailing list