Re: Segmentation fault when amule starts

From: Andrew Terekhov <andrew_terekhov_at_yahoo.com>
Date: Tue, 28 Mar 2023 21:36:27 UTC
 Grazie mille, Zio Mario :)

    On Tuesday, March 28, 2023 at 01:31:44 PM GMT-8, Mario Marietto <marietto2008@gmail.com> wrote:  
 
 yeah,I'm the user who started that post :P

On Tue, Mar 28, 2023 at 11:26 PM Andrew Terekhov <andrew_terekhov@yahoo.com> wrote:

 Thanks a lot, Yuri, worked like a charm.

    On Tuesday, March 28, 2023 at 01:19:03 PM GMT-8, Yuri <yuri@aetern.org> wrote:  
 
 Andrew Terekhov wrote:
> Hi,
> 
> My system is:
> 
> $ uname -a
> FreeBSD obama 13.1-RELEASE-p6 FreeBSD 13.1-RELEASE-p6 GENERIC amd64
> 
> fully updated wrt to packages and ports.
> 
> I installed amule package and it segfaulted when started. So I enabled
> debug info for ports and rebuilt amule as port. What else can I do to
> help fix the problem?

Try the solution from forums:

https://forums.freebsd.org/threads/amule-wont-run-on-freebsd-13-1-release-because-segmentation-fault-error.87980/post-597909


> Below is where it crashes:
> 
> 
> $ lldb amule
> (lldb) target create "amule"
> Current executable set to 'amule' (x86_64).
> (lldb) run
> Process 22227 launched: '/usr/local/bin/amule' (x86_64)
> Process 22227 stopped
> * thread #1, name = 'amule', stop reason = signal SIGSEGV: invalid
> address (fault address: 0x10)
>     frame #0: 0x0000000801699e85 libcryptopp.so.8`CryptoPP::(anonymous
> namespace)::SHA256_HashBlock_CXX(state=0x0000000000000010,
> data=0x00007fffffffd440) at sha.cpp:424:5
>    384     
>    385             input += SHA1::BLOCKSIZE/sizeof(word32);
>    386             length -= SHA1::BLOCKSIZE;
>    387         }
>    388         while (length >= SHA1::BLOCKSIZE);
>    389         return length;
>    390     }
>    391     
>    392     // *************************************************************
>    393     
>    394     ANONYMOUS_NAMESPACE_BEGIN
>    395     
>    396     #define a(i) T[(0-i)&7]
>    397     #define b(i) T[(1-i)&7]
>    398     #define c(i) T[(2-i)&7]
>    399     #define d(i) T[(3-i)&7]
>    400     #define e(i) T[(4-i)&7]
>    401     #define f(i) T[(5-i)&7]
>    402     #define g(i) T[(6-i)&7]
>    403     #define h(i) T[(7-i)&7]
>    404     
>    405     #define blk0(i) (W[i] = data[i])
>    406     #define blk2(i)
> (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15]))
>    407     
>    408     #define Ch(x,y,z) (z^(x&(y^z)))
>    409     #define Maj(x,y,z) (y^((x^y)&(y^z)))
>    410     
>    411     #define R(i)
> h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+SHA256_K[i+j]+(j?blk2(i):blk0(i));\
>    412         d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
>    413     
>    414     // for SHA256
>    415     #define s0(x) (rotrConstant<7>(x)^rotrConstant<18>(x)^(x>>3))
>    416     #define s1(x) (rotrConstant<17>(x)^rotrConstant<19>(x)^(x>>10))
>    417     #define S0(x)
> (rotrConstant<2>(x)^rotrConstant<13>(x)^rotrConstant<22>(x))
>    418     #define S1(x)
> (rotrConstant<6>(x)^rotrConstant<11>(x)^rotrConstant<25>(x))
>    419     
>    420     void SHA256_HashBlock_CXX(word32 *state, const word32 *data)
>    421     {
>    422         word32 W[16]={0}, T[8];
>    423         /* Copy context->state[] to working vars */
> -> 424         memcpy(T, state, sizeof(T));
>    425         /* 64 operations, partially loop unrolled */
>    426         for (unsigned int j=0; j<64; j+=16)
>    427         {
>    428             R( 0); R( 1); R( 2); R( 3);
>    429             R( 4); R( 5); R( 6); R( 7);
>    430             R( 8); R( 9); R(10); R(11);
>    431             R(12); R(13); R(14); R(15);
>    432         }
>    433         /* Add the working vars back into context.state[] */
>    434         state[0] += a(0);
>    435         state[1] += b(0);
>    436         state[2] += c(0);
>    437         state[3] += d(0);
>    438         state[4] += e(0);
>    439         state[5] += f(0);
>    440         state[6] += g(0);
>    441         state[7] += h(0);
>    442     }
>    443     
>    444     #undef Ch
> (lldb) bt
> * thread #1, name = 'amule', stop reason = signal SIGSEGV: invalid
> address (fault address: 0x10)
>   * frame #0: 0x0000000801699e85 libcryptopp.so.8`CryptoPP::(anonymous
> namespace)::SHA256_HashBlock_CXX(state=0x0000000000000010,
> data=0x00007fffffffd440) at sha.cpp:424:5
>     frame #1: 0x000000080169ad1d
> libcryptopp.so.8`CryptoPP::SHA256::HashMultipleBlocks(this=0x00007fffffffd430, input=0x00007fffffffd480, length=64) at sha.cpp:977:13
>     frame #2: 0x000000080161bcbf
> libcryptopp.so.8`CryptoPP::IteratedHashBase<unsigned int,
> CryptoPP::HashTransformation>::Update(unsigned char const*, unsigned
> long) [inlined] CryptoPP::IteratedHashBase<unsigned int,
> CryptoPP::HashTransformation>::HashBlock(this=0x00007fffffffd430,
> input=0x00007fffffffd440) at iterhash.h:109:4
>     frame #3: 0x000000080161bca5
> libcryptopp.so.8`CryptoPP::IteratedHashBase<unsigned int,
> CryptoPP::HashTransformation>::Update(this=0x00007fffffffd430,
> input="^\xd1\U00000013$\U0000001c\xb63\a\U00000019}\x85|\xdeȅ\x84\xdbA\xc6\xdfw\xa0\xa0\xff\xe7N\xc0t\xa0\x83\U0000001d\xdd", length=32) at iterhash.cpp:38:4
>     frame #4: 0x00000008016711e0
> libcryptopp.so.8`CryptoPP::RandomPool::IncorporateEntropy(this=0x0000000000877938, input="^\xd1\U00000013$\U0000001c\xb63\a\U00000019}\x85|\xdeȅ\x84\xdbA\xc6\xdfw\xa0\xa0\xff\xe7N\xc0t\xa0\x83\U0000001d\xdd", length=32) at randpool.cpp:36:7
>     frame #5: 0x000000080165b27d
> libcryptopp.so.8`CryptoPP::AutoSeededRandomPool::Reseed(this=0x0000000000877938, blocking=false, seedSize=32) at osrng.cpp:330:2
>     frame #6: 0x0000000000793fbe
> amule`CryptoPP::AutoSeededRandomPool::AutoSeededRandomPool(this=0x0000000000877938, blocking=false, seedSize=32) at osrng.h:171:4
>     frame #7: 0x0000000000793e3a amule`::__cxx_global_var_init.1() at
> RandomFunctions.cpp:31:39
>     frame #8: 0x0000000000793f7e
> amule`_GLOBAL__sub_I_RandomFunctions.cpp at RandomFunctions.cpp:0
>     frame #9: 0x000000080086e0fd ld-elf.so.1
>     frame #10: 0x000000080086c38b ld-elf.so.1
> 
> 
> 
> 


  


-- 
Mario.