Quoting Andy Polyakov <[email protected]>:

in that case it crashes here:

        if (s->msg_callback)
                s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE,
s->init_buf->data, (size_t)s->init_num + 4, s, s->msg_callback_arg);


So is the pointer to the callback wrong, or is the SIGSEGV in the
called function?

What happens if you type just 'disass' at debugger prompt. Question is
if you see meaningful code at point of failure, at 0x80e130 in original
example. If you see meaningful instruction with reference to memory,
issue even 'info reg'. If you don't see meaningful code, then it's
likely that pointer to callback is wrong. In which case 'print $r10'
would print address of failure. $r10 is because we already established
that it was called with call *%r10.


(gdb) disass
No function contains program counter for selected frame.
(gdb) disass 0x000000000080e130
No function contains specified address.
(gdb) print $r10
$1 = 8446256

8446256 = 0x000000000080e130

so the pointer was wrong in the first place,
got changed or the function is not there anymore

Basically what is baffling about it is that *if* SEGV is in called
function, then stack back-trace would be more meaningful. Normally you
see meaningless back-traces when you are in assembly subroutine (because
assembly doesn't provide stack unwinding information) or when something
went terribly wrong. Assembly is excluded here...

If it's callback that crashes, then key question who sets it. Meaningful
code at point failure without meaningful back-trace should mean that
callback is static and only some function in its vicinity that could
have set it. 0x80e130 is not impossible value for application code
segment. Yet, it doesn't exclude possibility of something terribly wrong
that going wrong.

I searched  the cyrus code for _set_msg_callback to find where the function
is registered. But could not find it, which other ssl function could be
used
to register the msg_callback? Is registering the msg_callback mandatory?

No.

In which cases would trigger calling the callback?

It says above, if callback is set, then it's called. You probably mean
"trigger setting the callback". There are no such cases in libssl, not
that I know of...


I was thinking of something like a signal call back which is only called
if the signal was received.


So the next step is to find the place where the callback is registerd
by cyrus and if it is changed.



--------------------------------------------------------------------------------
M.Menge                                Tel.: (49) 7071/29-70316
Universität Tübingen                   Fax.: (49) 7071/29-5912
Zentrum für Datenverarbeitung mail: [email protected]
Wächterstraße 76
72074 Tübingen

Attachment: smime.p7s
Description: S/MIME Signatur

Reply via email to