|
From: Jeffrey W. <nol...@gm...> - 2015-08-17 04:21:02
|
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.
I see the "Uninitialised value was created by a stack allocation" and
the file and line number. The issue I am having is it points to the
last line of a [rather large] inline assembly block. To further
complicate matters, the routine makes use of the MMX coprocessor.
I tried using addr2line, but its not offering anything more than
Valgrind is reporting:
$ addr2line -e cryptest.exe -a 0x51E41A
0x000000000051e41a
/home/jwalton/.../cryptopp-svn-5.6.3/salsa.cpp:474
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?
Thanks in advance.
**********
Line 474 reported below is actually line 468 of
http://www.cryptopp.com/docs/ref/salsa_8cpp_source.html (I'm tweaking
things trying to isolate the offender).
**********
$ valgrind --track-origins=yes ./cryptest.exe tv salsa
...
Testing SymmetricCipher algorithm Salsa20.
......==3890== Conditional jump or move depends on uninitialised value(s)
==3890== at 0x4C2CC7C: strcmp (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==3890== by 0x48744F: EqualStrings (datatest.cpp:23)
==3890== by 0x48744F: 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:432)
==3890== by 0x48B5F5: TestDataFile(std::string const&,
CryptoPP::NameValuePairs const&, unsigned int&, unsigned int&)
(datatest.cpp:714)
==3890== by 0x48BCF7: RunTestDataFile(char const*,
CryptoPP::NameValuePairs const&, bool) (datatest.cpp:759)
==3890== by 0x404FB0: main (test.cpp:266)
==3890== Uninitialised value was created by a stack allocation
==3890== at 0x51E3D3:
CryptoPP::Salsa20_Policy::OperateKeystream(CryptoPP::KeystreamOperation,
unsigned char*, unsigned char const*, unsigned long) (salsa.cpp:474)
==3890==
==3890== Conditional jump or move depends on uninitialised value(s)
==3890== at 0x4C2CC6A: strcmp (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==3890== by 0x48744F: EqualStrings (datatest.cpp:23)
==3890== by 0x48744F: 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:432)
==3890== by 0x48B5F5: TestDataFile(std::string const&,
CryptoPP::NameValuePairs const&, unsigned int&, unsigned int&)
(datatest.cpp:714)
==3890== by 0x48BCF7: RunTestDataFile(char const*,
CryptoPP::NameValuePairs const&, bool) (datatest.cpp:759)
==3890== by 0x404FB0: main (test.cpp:266)
==3890== Uninitialised value was created by a stack allocation
==3890== at 0x51E3D3:
CryptoPP::Salsa20_Policy::OperateKeystream(CryptoPP::KeystreamOperation,
unsigned char*, unsigned char const*, unsigned long) (salsa.cpp:474)
==3890==
==3890== Conditional jump or move depends on uninitialised value(s)
==3890== at 0x487472: 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:432)
==3890== by 0x48B5F5: TestDataFile(std::string const&,
CryptoPP::NameValuePairs const&, unsigned int&, unsigned int&)
(datatest.cpp:714)
==3890== by 0x48BCF7: RunTestDataFile(char const*,
CryptoPP::NameValuePairs const&, bool) (datatest.cpp:759)
==3890== by 0x404FB0: main (test.cpp:266)
==3890== Uninitialised value was created by a stack allocation
==3890== at 0x51E41A:
CryptoPP::Salsa20_Policy::OperateKeystream(CryptoPP::KeystreamOperation,
unsigned char*, unsigned char const*, unsigned long) (salsa.cpp:474)
==3890==
==3890== Use of uninitialised value of size 8
==3890== at 0x53F635: CryptoPP::BaseN_Encoder::Put2(unsigned char
const*, unsigned long, int, bool) (basecode.cpp:85)
==3890== by 0x571900: NextPutMaybeModifiable (filters.h:204)
==3890== by 0x571900:
CryptoPP::FilterWithBufferedInput::PutMaybeModifiable(unsigned char*,
unsigned long, int, bool, bool) (filters.cpp:376)
==3890== by 0x4F8CDB:
CryptoPP::BufferedTransformation::ChannelPut2(std::string const&,
unsigned char const*, unsigned long, int, bool) (cryptlib.cpp:432)
==3890== by 0x56E9DD:
CryptoPP::StringStore::CopyRangeTo2(CryptoPP::BufferedTransformation&,
unsigned long long&, unsigned long long, std::string const&, bool)
const (filters.cpp:1091)
==3890== by 0x56E96C:
CryptoPP::StringStore::TransferTo2(CryptoPP::BufferedTransformation&,
unsigned long long&, std::string const&, bool) (filters.cpp:1081)
==3890== by 0x487578: Pump (filters.h:738)
==3890== by 0x487578: 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:436)
==3890== by 0x48B5F5: TestDataFile(std::string const&,
CryptoPP::NameValuePairs const&, unsigned int&, unsigned int&)
(datatest.cpp:714)
==3890== by 0x48BCF7: RunTestDataFile(char const*,
CryptoPP::NameValuePairs const&, bool) (datatest.cpp:759)
==3890== by 0x404FB0: main (test.cpp:266)
==3890== Uninitialised value was created by a stack allocation
==3890== at 0x51E3D3:
CryptoPP::Salsa20_Policy::OperateKeystream(CryptoPP::KeystreamOperation,
unsigned char*, unsigned char const*, unsigned long) (salsa.cpp:474)
|
|
From: John R. <jr...@bi...> - 2015-08-18 01:24:10
|
> 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) ===== |