> Valgrind is producing a finding under Fedora 22 and Debian 8. The
> finding is shown below. The issue seems to appear in the latest GCC
> compilers, like 4.9 and 5.1. Code produced by earlier compilers do not
> produce a finding.
        [[snip]]
> I'm building with -Og and -g3. Can I get Valgrind to print its name
> for me? Or, how can I get more information on the offending variable?

Please share your recipe to reproduce the problem that you see,
in particular including the fix hinted by your earlier remark "The CPUID
instruction's ASM block was missing volatile."

Here's my attempt.  The environment is:
=====
$ grep VERSION /etc/os-release   ## Fedora
VERSION="22 (Twenty Two)"
$ gcc --version
gcc (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4)
$ valgrind --version
valgrind-3.10.1
=====
$ svn checkout svn://svn.code.sf.net/p/cryptopp/code/trunk cryptopp-code
$ cd cryptopp-code
$ make -f GNUmakefile SYMBOLS=-g3 OPTIMIZE=-Og
$ valgrind --track-origins=yes ./cryptest.exe tv salsa

        [[snip]]

==8330== Conditional jump or move depends on uninitialised value(s)
==8330==    at 0x5EDAB9: CryptoPP::DetectX86Features() (cpu.cpp:158)
==8330==    by 0x5B2075: HasAESNI (cpu.h:156)
==8330==    by 0x5B2075: CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned 
char const*, unsigned int, CryptoPP::NameValuePairs const&) (rijndael.cpp:209)
==8330==    by 0x51FFDA: CryptoPP::SimpleKeyingInterface::SetKey(unsigned char 
const*, unsigned long, CryptoPP::NameValuePairs const&) (cryptlib.cpp:68)
==8330==    by 0x45A4D8: 
CryptoPP::ModePolicyCommonTemplate<CryptoPP::AdditiveCipherAbstractPolicy>::CipherSetKey(CryptoPP::NameValuePairs
 const&, unsigned char const*, unsigned long) (modes.h:89)
==8330==    by 0x586BD9: 
CryptoPP::AdditiveCipherTemplate<CryptoPP::AbstractPolicyHolder<CryptoPP::AdditiveCipherAbstractPolicy,
 CryptoPP::OFB_ModePolicy> >::UncheckedSetKey(unsigned char const*, unsigned 
int, CryptoPP::NameValuePairs const&) (strciphr.cpp:15)
==8330==    by 0x51FFDA: CryptoPP::SimpleKeyingInterface::SetKey(unsigned char 
const*, unsigned long, CryptoPP::NameValuePairs const&) (cryptlib.cpp:68)
==8330==    by 0x521282: CryptoPP::SimpleKeyingInterface::SetKeyWithIV(unsigned 
char const*, unsigned long, unsigned char const*, unsigned long) 
(cryptlib.cpp:78)
==8330==    by 0x45821A: SetKeyWithIV (cryptlib.h:399)
==8330==    by 0x45821A: main (test.cpp:129)
==8330==  Uninitialised value was created by a stack allocation
==8330==    at 0x5926C90: sigaction (in /usr/lib64/libc-2.21.so)

        [[snip]]

Testing SymmetricCipher algorithm Salsa20.
......==8330== Conditional jump or move depends on uninitialised value(s)
==8330==    at 0x4C2E8C2: __memcmp_sse4_1 (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8330==    by 0x4A764E: compare (char_traits.h:259)
==8330==    by 0x4A764E: __gnu_cxx::__enable_if<std::__is_char<char>::__value, 
bool>::__type std::operator==<char>(std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&) (basic_string.h:4912)
==8330==    by 0x4A235E: operator!=<char, std::char_traits<char>, 
std::allocator<char> > (basic_string.h:4950)
==8330==    by 0x4A235E: TestSymmetricCipher(std::map<std::string, std::string, 
std::less<std::string>, std::allocator<std::pair<std::string const, 
std::string> > >&, CryptoPP::NameValuePairs const&) (datatest.cpp:425)
==8330==    by 0x4A63A2: TestDataFile(std::string const&, 
CryptoPP::NameValuePairs const&, unsigned int&, unsigned int&) 
(datatest.cpp:707)
==8330==    by 0x4A67E3: RunTestDataFile(char const*, CryptoPP::NameValuePairs 
const&, bool) (datatest.cpp:752)
==8330==    by 0x458E61: main (test.cpp:261)
==8330==  Uninitialised value was created by a stack allocation
==8330==    at 0x54B53A: 
CryptoPP::Salsa20_Policy::OperateKeystream(CryptoPP::KeystreamOperation, 
unsigned char*, unsigned char const*, unsigned long) (salsa.cpp:469)

=====


------------------------------------------------------------------------------
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to