On Monday, April 24, 2017 at 1:16:44 PM UTC-4, Anton Gorev wrote:
>
> Yes, -xmemalign=4i fixed all errors I saw before.
>

OK, thanks.

-xmemalign=4i appears to be valid for SPARC, and not i.86pc.
 

> But it isn't so cloudless. Next bugreport attached.
>
> Also maybe output below will be useful:
>
> RSA validation suite running...
>
> signal SEGV (no mapping at the fault address) in _memcpy at 
> 0xffffffff7e200678
> 0xffffffff7e200678: _memcpy+0x0044:     ldx      [%o1 + %o0], %o3
> Current function is CryptoPP::CopyWords
>    28                   memcpy(r, a, n*WORD_SIZE);^M
> (dbx) print r
> dbx: internal error: 
> /home/abuild/agorev/cryptopp/cryptopp-master.2/misc.h:51: bad token '\'
>
> dbx: warning: Errors encountered while skimming "integer.cpp" for macro 
> definitions.
>               See `help macro skimming-errors' for more explanation.
>

This appears to be a bug in DBX. Also see 
https://stackoverflow.com/questions/43624030/is-backslash-newline-valid-on-if-and-elif.
 

>
> r = 0x1011a3c40
> (dbx) print a
> a = (nil)
> (dbx) list -
>    18           for (size_t i=0; i<n; i++)^M
>    19                   r[i] = a;^M
>    20   }^M
>    21   ^M
>    22   inline void CopyWords(word *r, const word *a, size_t n)^M
>    23   {^M
>    24           if (r != a)^M
>    25   #if CRYPTOPP_MSC_VERSION^M
>    26                   memcpy_s(r, n*WORD_SIZE, a, n*WORD_SIZE);^M
>    27   #else^M
> (dbx) up
> Current function is CryptoPP::Integer::Integer
>  2972           CopyWords(reg, t.reg, reg.size());^M
> (dbx) print t
> t = {
>     reg  = {
>         m_alloc = {
> /* try using "print -r" to see any inherited members */
>         }
>         m_mark  = 1025U
>         m_size  = 0
>         m_ptr   = (nil)
>     }
>     sign = POSITIVE
> }
> (dbx) list -
>  2962   ^M
>  2963   Integer::Integer()^M
>  2964           : reg(2), sign(POSITIVE)^M
>  2965   {^M
>  2966           reg[0] = reg[1] = 0;^M
>  2967   }^M
>  2968   ^M
>  2969   Integer::Integer(const Integer& t)^M
>  2970           : reg(RoundupSize(t.WordCount())), sign(t.sign)^M
>  2971   {^M
> (dbx) up
> Current function is CryptoPP::RSAFunction::PreimageBound
>    47           Integer PreimageBound() const {return m_n;}^M
> (dbx) print m_n
> dbx: internal error: 
> /home/abuild/agorev/cryptopp/cryptopp-master.2/misc.h:51: bad token '\'
>
> dbx: warning: Errors encountered while skimming "rsa.cpp" for macro 
> definitions.
>               See `help macro skimming-errors' for more explanation.
>
> m_n = {
>     reg  = {
>         m_alloc = {
> /* try using "print -r" to see any inherited members */
>         }
>         m_mark  = 1025U
>         m_size  = 0
>         m_ptr   = (nil)
>     }
>     sign = POSITIVE
> }
> (dbx)
>
>
Nothing is jumping out at me for the RSA gear. For completeness, did you 
perform a 'make distclean' to ensure everything got rebuilt using the same 
compiler flags?

Maybe a debug build will help isolate the issue. The asserts may alert to 
something fishy. To perform a debug build:

make distclean
CXX=/opt/.../bin/CC CXXFLAGS="-DDEBUG -g2 -xO0" gmake -j 4
 

> P.S. Changes in the CMakeLists.txt:
>
> $ diff -u ../../cryptopp-master/CMakeLists.txt ../CMakeLists.txt
> --- ../../cryptopp-master/CMakeLists.txt        Tue Apr 18 07:57:38 2017
> +++ ../CMakeLists.txt   Mon Apr 24 17:21:07 2017
> @@ -205,6 +205,8 @@
>
>  # Solaris specific
>  if ((NOT CRYPTOPP_CROSS_COMPILE) AND "${UNAME_SYSTEM}" STREQUAL "SunOS")
> +       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xmemalign=4i")
> +
>         if (NOT DISABLE_NATIVE_ARCH)
>                 # SunCC needs -native
>                 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
> $
>
>
I think that change casts a wider net than needed. -xmemalign=4i should be 
limited to SPARC64, and maybe SPARC. It should not apply to the Intel 
machines. Applying it to Intel machines will cause a warning.
 

> Do I need to prepare pull request for this change? And should I revert 
> commit with workaround that we merged before (as it is not necessary 
> because -xmemalign=4i fixes original bugs)?
>

Yeah, we may as well back out the former change, and go with the 
-xmemalign=4i. A new PR will be fine.

Jeff

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to