[Serdev] Problem accessing object in memory
Cesc
cesc.santa at gmail.com
Thu Mar 3 16:04:43 UTC 2005
Hi,
Sorry if the email is messy, but it is just the way my ideas on this
problem are at the moment :)
I am working on the TCP code and i am having some problems while
trying to use an external library (openssl).
Let's say we have a TLS listener socket, gets an incoming connection,
and the TCP socket is created (accept) and the wrapping "struct
tcp_connection *c" (with shm_malloc).
So, when i try to init the overlay SSL on this socket, i need to
create an (SSL * ssl), this in function tcpconn_new (tcp_main.c), and
as i need this for later, i store the "ssl" object in c->extra_data
(don't know if it was meant for that, but it was an unused void
pointer ... ). Note that "ssl" is created with openssl's own malloc
... that is, if i am not wrong, the "normal" malloc.
So far so good ... SSL handshake succeeds.
Now, when later on the receiver child it tries to read from "ssl"
(tcp_receiver_loop, tcp_read.c), i get an error saying that this
object is uninitialized. And it is true, it is uninitialized, at least
from where the child tries to access it (via the tcp_connection *c ->
extra_data).
My problem is that there is something wrong with the memory, because
if you try to read from "ssl" from the same function where it was
created (tcpconn_new in tcp_main.c), it works!! no problem.
So, my question is ... what's wrong with the (SSL *) ssl pointer? what
am i doing wrong? why is it ok in one function, but not accessible
from another?
Thanks in advance,
Cesc
More information about the Serdev
mailing list