[noPoll] Buffer overflow

Francis Brosnan Blázquez francis.brosnan en aspl.es
Lun Ago 7 17:18:01 CEST 2017


Hi Miha,

Given your error, clearly it is a buffer overflow by exceeding
boundaries. I've updated nopoll_io_wait_select_add_to code to detect
these situations and refuse working instead of breaking:

https://github.com/ASPLes/nopoll/commit/ffc78bfe4a27106d88d65ae14c7f403e253568f0

Also, if you want to increase that limit, just add the following before
including nopoll.h header (needs recompilation):


        // define in your code new limit
        #define FD_SETSIZE 4096
        // then include nopoll.h  (you need to recompile noPoll)
        #include <nopoll.n>
        

More at:


http://www.aspl.es/nopoll/html/group__nopoll__decl__module_ga86c5dbf5a99358e288f573d6a1e0873f.html#ga86c5dbf5a99358e288f573d6a1e0873f

Best Regards,


        



El lun, 07-08-2017 a las 12:30 +0200, Miha Nedok escribió:
> Francis, thank you for responding.
> 
> 
> 
> I was searching a bit and found some info regarding FD_SET
> https://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select
> i then decided to log fds given into nopoll_io_wait_select_add_to
> and it logged 1024 as last before reporting buffer overflow.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Sun, Aug 6, 2017 at 6:25 PM, Francis Brosnan Blázquez
> <francis.brosnan en aspl.es> wrote:
> 
>         Hello Miha,
>         
>         Try to check if latest version from github.com fixes your
>         issue:
>         https://github.com/ASPLes/nopoll/archive/master.zip  
>         
>         If bug persists, build your solution with debug enabled
>         (without
>         stripping symbols as it seems to happen given the backtrace)
>         to get a
>         stack trace with line indications...otherwise, it will say you
>         it is
>         breaking/jumping at nopoll_io_wait_select_add_to but not
>         where...
>         
>         At the same time, reading the function where segfault is
>         happening:
>         
>         
>                         
>                         
>         
>         ..and the stack trace your are providing, it very likely the
>         failure is
>         happening at:
>         
>         /* set the value */
>         FD_SET (fds, &(select->set));
>         
>         ...and the only way for that to happen is that you are passing
>         a
>         "select->" reference that was deallocated or a reference
>         pointing to
>         nowhere. Obviously, this is a speculation without having the
>         right
>         trace (though I'll bet the error is likely to be there).
>         
>         Best Regards,
>         
>         
>         
>         
>         
>         El vie, 04-08-2017 a las 15:01 +0200, Miha Nedok escribió: 
>         
>         > With the version 0.4.4.b349
>         > I am getting:
>         > 
>         > 
>         > Aug  4 07:24:23 [73177]: *** buffer overflow detected
>         > ***: /usr/app/App terminated
>         > Aug  4 07:24:23 [73177]: ======= Backtrace: =========
>         > Aug  4 07:24:23
>         > [73177]: /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f1e282f57e5]
>         > Aug  4 07:24:23
>         > [73177]: /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail
>         > +0x5c)[0x7f1e2839711c]
>         > Aug  4 07:24:23
>         > [73177]: /lib/x86_64-linux-gnu/libc.so.6(+0x117120)[0x7f1e28395120]
>         > Aug  4 07:24:23
>         > [73177]: /lib/x86_64-linux-gnu/libc.so.6(+0x119067)[0x7f1e28397067]
>         > Aug  4 07:24:23
>         > [73177]: /usr/app/App(nopoll_io_wait_select_add_to
>         > +0x27)[0x4612f7]
>         > Aug  4 07:24:23 [73177]: /usr/app/App(nopoll_loop_register
>         > +0x3b)[0x460c2b]
>         > Aug  4 07:24:23
>         > [73177]: /usr/app/App(nopoll_ctx_foreach_conn
>         > +0x7d)[0x457f5d]
>         > Aug  4 07:24:23 [73177]: /usr/app/App(nopoll_loop_wait
>         > +0x74)[0x460f84]
>         > 
>         > 
>         > And i cannot reproduce this on test server even if i put it
>         > on a lot of pressure
>         > with multiple clients.
>         > 
>         > 
>         > How can I help to debug this?
>         > 
>         > 
>         > 
>         > 
>         > 
>         > _______________________________________________
>         > noPoll mailing list
>         > noPoll en lists.aspl.es
>         > http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll
>         
>         
>         -- 
>         Francis Brosnan Blázquez  -  ASPL
>         http://www.asplhosting.com/
>         http://www.aspl.es/
>         https://twitter.com/aspl_es
>         https://twitter.com/asplhosting
>         https://twitter.com/francisbrosnanb
>         https://es.linkedin.com/in/francis-brosnan-blázquez-1353a218
>         
>         91 134 14 22 - 91 134 14 45 - 91 116 07 57
>         Av. Juan Carlos I 13, 2ºC, Torre Garena
>         28806 - Alcalá de Henares (España)
>         
>         AVISO LEGAL
>          
>         En virtud de lo dispuesto en la Ley Orgánica 15/1999, de 13 de
>         diciembre, de Protección de Datos de Carácter Personal, le informamos de
>         que sus datos de carácter personal, recogidos de fuentes accesibles al
>         público o datos que usted nos ha facilitado previamente, proceden de
>         bases de datos propiedad de Advanced Software Production Line, S.L.
>         (ASPL).
>          
>         ASPL garantiza que los datos serán tratados con la finalidad de mantener
>         las oportunas relaciones comerciales o promocionales con usted o la
>         entidad que usted representa. No obstante, usted puede ejercitar sus
>         derechos de acceso, rectificación, cancelación y oposición dispuestos en
>         la mencionada Ley Orgánica, notificándolo por escrito a ASPL -
>         Protección Datos, Av. Juan Carlos I 13, 2ºC, Alcalá de Henares
>         (Madrid).
> 
> 
> 

-- 
Francis Brosnan Blázquez - ASPL
91 134 14 22 - 91 134 14 45 - 91 116 07 57


http://aspl.es
http://asplhosting.com
http://twitter.com/aspl_es
http://twitter.com/asplhosting


AVISO LEGAL


Este mensaje se dirige exclusivamente a su destinatario. Los datos
incluidos en el presente correo son confidenciales y sometidos a secreto
profesional, se prohíbe divulgarlos, en virtud de las leyes vigentes. Si
usted no lo es y lo ha recibido por error o tiene conocimiento del mismo
por cualquier motivo, le rogamos que nos lo comunique por este medio y
proceda a destruirlo o borrarlo.


En virtud de lo dispuesto en la Ley Orgánica 15/1999, de 13 de
diciembre, de Protección de Datos de Carácter Personal, le informamos de
que sus datos de carácter personal, recogidos de fuentes accesibles al
público o datos que usted nos ha facilitado previamente, proceden de
bases de datos propiedad de Advanced Software Production Line, S.L.
(ASPL). No obstante, usted puede ejercitar sus derechos de acceso,
rectificación, cancelación y oposición dispuestos en la mencionada Ley
Orgánica, notificándolo por escrito a:
ASPL - Protección Datos, C/Antonio Suárez 10 A-102, 28802, Alcalá de
Henares (Madrid).


------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://lists.aspl.es/pipermail/nopoll/attachments/20170807/0219f9d6/attachment-0001.html>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: unknown-B1GN4Y
Type: image/png
Size: 38526 bytes
Desc: no disponible
URL: <http://lists.aspl.es/pipermail/nopoll/attachments/20170807/0219f9d6/attachment-0001.png>


Más información sobre la lista de distribución noPoll