[noPoll] nopoll_conn_read_pending doesn't seem to be working

Francis Brosnan Blázquez francis.brosnan at aspl.es
Mon Sep 21 09:42:55 CEST 2020


Hello Bill,
Looking at the description, it looks like a segmentation fault because
of using memory that is not initialized, or pointing to memory that was
released (free) orpointing to memory that is not reserved for the
purpose needed by __nopoll_conn_receive.
If you look at __nopoll_conn_receive, it has the following signature:
int         __nopoll_conn_receive  (noPollConn * conn, char  * buffer,
int  maxlen)
So, the only way to produce a segmentation fault, is to pass a broken
pointer at *conn or at *buffer(released connection, not nullified or
release buffer, or a buffer that is smaller than the maxlen
indication..).
You will have to run your application under the supervision of valgrind
to see where the problemis (or some similar tool that can spot double
free, use of uninitialized memory, use of memory outside boundaries,
etc...).
>> libtool --mode=execute valgrind --leak-check=yes --error-limit=no
./aap_bin
Double check what you are doing with the buffer passed and the
connection to see if none of the indication above are happening.
Best Regards,
El mar, 15-09-2020 a las 03:30 +0000, Bill Goetz escribió:
> Hello Francis,
> 
> 
> 
> 
> 
> I have a hopefully quick question for you (or anyone else on
> this email thread if anyone is interested in replying).  I have an
> application running on an embedded Linux Access Point that is
> crashing inside of nopoll_read().  Once thing I found was that it is
>  always crashing at the SAME TIME that another Access Point has just
> SCP'ed a file to THIS Access Point using Dropbear.  Both this
> application as well as Dropbear are using OpenSSL library version
> 1.1.
> 
> 
> 
> 
> 
> Even though Dropbear and the AP's firmware are using completely
> different sockets and shouldn't interfere with one another, it seems
> that's what is happening.  BTW, the scp from the other AP DOES go
> through and Dropbear finishes completely.
> 
> 
> 
> 
> 
> ANY suggestions on how I should go about figuring out what's going
> on?
> 
> 
> 
> 
> 
> 
> 
> Sep 14 22:32:30 aap001067 authpriv.info dropbear[4802]: Child
> connection from 172.20.40.62:38430
> Sep 14 22:32:31 aap001067 local5.info aap[989]: Locally roaming tag
> records: 2
> Sep 14 22:32:35 aap001067 local5.info aap[989]: Locally roaming tag
> records: 2
> Sep 14 22:32:35 aap001067 authpriv.notice dropbear[4802]: Pubkey auth
> succeeded for 'root' with key md5
> b4:3b:c2:73:2c:dd:a4:cb:46:36:9c:9b:fc:ae:0f:95 from
> 172.20.40.62:38430
> Sep 14 22:32:36 aap001067 authpriv.info dropbear[4802]: Exit (root):
> Exited normally
> Sep 14 22:32:36 aap001067 user.warn kernel: Alignment trap: aap_bin
> (1037) PC=0x000446c4 Instr=0xe5823000 Address=0xfffffffe FSR 0x801
> Sep 14 22:32:36 aap001067 local5.notice aap[989]: Got signal 11
> Sep 14 22:32:36 aap001067 local5.notice aap[989]: [bt] Execution
> path:
> Sep 14 22:32:36 aap001067 local5.notice aap[989]: [bt]
> /lib/libc.so.6(__default_sa_restorer_v2+0) [0x40446610]
> Sep 14 22:32:36 aap001067 local5.notice aap[989]: [bt] ./aap_bin
> [0x446c4] - 0x0004457c                __nopoll_conn_receive
> Sep 14 22:32:36 aap001067 local5.notice aap[989]: [bt] ./aap_bin
> [0x46528] - 0x00046104                nopoll_conn_get_msg
> Sep 14 22:32:36 aap001067 local5.notice aap[989]: [bt] ./aap_bin
> [0x47540] - 0x000472cc                nopoll_conn_read
> Sep 14 22:32:36 aap001067 local5.notice aap[989]: [bt] ./aap_bin
> [0x1c3f8] - 0x0001c2c0              
>  ASG::ASGReadThread::ReadAll(unsigned char*, unsigned long, unsigned
> long*)
> Sep 14 22:32:36 aap001067 local5.notice aap[989]: [bt] ./aap_bin
> [0x1d930] - 0x0001d89c              
>  ASG::ASGReadThread::_threadFunc(void*)
> Sep 14 22:32:36 aap001067 local5.notice aap[989]: [bt]
> /lib/libpthread.so.0 [0x400fe5f4]
> Sep 14 22:32:36 aap001067 local5.notice aap[989]: [bt]
> /lib/libc.so.6(clone+0x88) [0x404de368]
> root at aap001067:~#
> 
> 
> 
> 
> 
> 
> Much thanks,
> 
> Bill
> 
> 
> 
> 
> 
> 
> 
> From: Francis Brosnan Blázquez <francis.brosnan at aspl.es>
> 
> Sent: Sunday, August 23, 2020 11:34 PM
> 
> To: Bill Goetz <bgoetz at store-intelligence.com>
> 
> Cc: nopoll at lists.aspl.es <nopoll at lists.aspl.es>
> 
> Subject: Re: [noPoll] nopoll_conn_read_pending doesn't seem to be
> working
>  
> 
> 
> Hello Bill,
> 
> 
> 
> Thanks for using noPoll. It is great to see it is useful.
> 
> 
> 
> About your question, we have to strengthen nopoll_conn_read_pending
> documentation to reflect
> how to use it (expected way of working).
> 
> 
> 
> It is a function designed to be used *after* you call to
> nopoll_conn_read so you can get quick
> indication if there are pending data that can be consumed,
> especially, when you are doing async I/O,
> so you can do another nopoll_conn_read without blocking and getting
> data.
> 
> 
> 
> Here you have an example of a library using nopoll_conn_read in
> combination with nopoll_conn_read_pending:
> 
> 
> 
> 
https://github.com/ASPLes/libvortex-1.1/blob/master/web-socket/vortex_websocket.c#L404
> 
> 
> 
> Best Regards,
> 
> 
> 
> El vie, 21-08-2020 a las 19:20 +0000, Bill Goetz escribió:
> > Hello,
> > 
> > 
> > 
> > 
> > 
> > So I'm using your nopoll WebSocket library, which I think is really
> > solid!
> > 
> > I am having a problem though with nopoll_conn_read_pending() not
> > returning anything > 0. 
> > 
> > 
> > 
> > 
> > 
> > Here's a small code snip-it.  It's never getting to either of the
> > printf's after the nopoll_conn_read_pending() call.
> > 
> > I also know that the server this code is connected to IS writing
> > data on this socket because if I comment out the call to
> > nopoll_conn_read_pending(),  data IS read during the
> > nopoll_conn_read() call.
> > 
> > 
> > 
> > 
> > 
> > ANY help would be greatly appreciated!
> > 
> > 
> > 
> > 
> > 
> > printf("before nopoll_conn_read_pending\n");
> > 
> > while ( 1 ) {
> >      // printf("inside while before nopoll_conn_read_pending\n");
> >      retStatus = nopoll_conn_read_pending (g_pWebConn);
> >      if (retStatus > 0) {
> >           printf("AHA! retStatus = %d\n", retStatus);
> >           break;
> >      }
> > }
> > 
> > 
> > 
> > printf("after nopoll_conn_read_pending retStatus = %d\n",
> > retStatus);
> > 
> > 
> > 
> > if ( retStatus > 0 ) {
> >      n_read_int = nopoll_conn_read (g_pWebConn, (char *)(buf +
> > n_read_sum), n_to_read, nopoll_false, 1000);
> > } else n_read_int = retStatus;
> > 
> > 
> > Regards,
> > 
> > Bill Goetz
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > noPoll mailing list
> > noPoll at lists.aspl.es
> > http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll
> > 
> > 
> 
> -- 
> Francis Brosnan Blázquez  -  ASPL
> https://asplhosting.com/https://myqtthub.comhttp://www.aspl.es/https://twitter.com/aspl_eshttps://twitter.com/asplhostinghttps://twitter.com/francisbrosnanbhttps://es.linkedin.com/in/francis-brosnan-blázquez-1353a218
> 91 134 14 22 - 91 134 14 45 - 91 116 07 57Av. Juan Carlos I 13, 2ºC,
> Torre Garena28806 - Alcalá de Henares (España)
> AVISO LEGAL En virtud de lo dispuesto en la Ley Orgánica 15/1999, de
> 13 dediciembre, de Protección de Datos de Carácter Personal, le
> informamos deque sus datos de carácter personal, recogidos de fuentes
> accesibles alpúblico o datos que usted nos ha facilitado previamente,
> proceden debases de datos propiedad de Advanced Software Production
> Line, S.L.(ASPL). ASPL garantiza que los datos serán tratados con la
> finalidad de mantenerlas oportunas relaciones comerciales o
> promocionales con usted o laentidad que usted representa. No
> obstante, usted puede ejercitar susderechos de acceso, rectificación,
> cancelación y oposición dispuestos enla 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
https://asplhosting.com/
https://myqtthub.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).


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.aspl.es/pipermail/nopoll/attachments/20200921/63ae7bd1/attachment.html>


More information about the noPoll mailing list