[Botan-devel] threads - segmentation fault

Stanislav Kuhn kuhn at analytica.biz
Sun Dec 17 08:33:42 EST 2006


Hi guys,

 

We are trying to implement encryption using Botan.

 

Everything works just fine as far as there is just one process.

 

As sson as new process is created at the same time we get segmentation
signal.

 

I have read something in API and set to inicialization parameter
"thread_safe". Anyway still get something like this:

 

[Thread debugging using libthread_db enabled]

[New Thread 16384 (LWP 17939)]

[New Thread 32769 (LWP 17940)]

[New Thread 16386 (LWP 17941)]

[New Thread 32771 (LWP 17942)]

 

Program received signal SIGSEGV, Segmentation fault.

[Switching to Thread 32771 (LWP 17942)]

0x080fbcf6 in Botan::inverse_mod ()

(gdb) backtrace

#0  0x080fbcf6 in Botan::inverse_mod ()

#1  0x08116845 in Botan::Montgomery_Exponentiator::Montgomery_Exponentiator
()

#2  0x080cca40 in Botan::Default_Engine::mod_exp ()

#3  0x0805d961 in Botan::Engine_Core::mod_exp ()

#4  0x081126c2 in Botan::Power_Mod::set_modulus ()

#5  0x08112741 in Botan::Power_Mod::Power_Mod ()

#6  0x0811313f in Botan::Fixed_Exponent_Power_Mod::Fixed_Exponent_Power_Mod
()

#7  0x080c96fe in Botan::(anonymous namespace)::Default_IF_Op::Default_IF_Op
()

#8  0x080c9ea8 in Botan::Default_Engine::if_op ()

#9  0x0805e7ba in Botan::Engine_Core::if_op ()

#10 0x08110b71 in Botan::IF_Core::IF_Core ()

#11 0x080ed8c2 in Botan::IF_Scheme_PublicKey::X509_load_hook ()

#12 0x080ecb08 in
Botan::IF_Scheme_PublicKey::x509_decoder()::IF_Scheme_Decoder:

:key_bits ()

#13 0x080a1196 in Botan::X509::load_key ()

#14 0x080a167d in Botan::X509::load_key ()

#15 0x080541af in Request::HandleData (this=0x8222240) at request.cc:155

#16 0x08053c82 in Request::HandleRequest (this=0x8222240) at request.cc:63

#17 0x080573f4 in Request::Handle (this=0x8222240) at request.cc:428

#18 0x08057580 in request_start (ptr=0x8222240) at request.cc:468

#19 0xb7ebb79d in pthread_start_thread () from /lib/libpthread.so.0

#20 0xb7ebb8f8 in pthread_start_thread_event () from /lib/libpthread.so.0

#21 0xb7d6a1da in clone () from /lib/libc.so.6

 

 

Place is random, so this is just example.

 

I read in APi something like this as well: 

"Note that Botan is not thread safe at the object level; any objects shared
between threads need explicit locking."

 

We have threads created this way:

Every time when we get connection, parent creates new request object that
forks itself as a new thread. In one of the function of the request object
is botan library inicializatin and crypting stuff.

 

Have you got an idea how to get around segmentation faults?

 

Thanks a lot.

Stan

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20061217/607f8dc7/attachment.html>


More information about the botan-devel mailing list