Bug #4585
closedImprove sanity checking and error reporting in KeyChain and TPM (was: Producer example segfaults)
100%
Description
The newest version of ndn-cxx produces a bus error or a segfault when the producer example is executed. Here is the output when I ran the example through gdb and got a bus error:
(gdb) run
Starting program: /home/pi/ndn-cxx/examples/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Breakpoint 1, main (argc=1, argv=0x7efff304) at producer.cpp:101
101 ndn::examples::Producer producer;
(gdb) next
103 producer.run();
(gdb) next
[New Thread 0x7445b450 (LWP 11204)]
<< I: /example/testApp/randomData?ndn.MustBeFresh=1&ndn.InterestLifetime=1500&ndn.Nonce=1194608572
>> D: Name: /example/testApp/randomData/testApp/%FD%00%00%01b%BB%983%05
MetaInfo: ContentType: 0, FreshnessPeriod: 1500 milliseconds
Content: (size: 11)
Signature: (type: SignatureSha256WithRsa, value_length: 256)
Thread 1 "a.out" received signal SIGBUS, Bus error.
0x00012b24 in __gnu_cxx::__atomic_add (__mem=0x4f921, __val=1)
at /usr/include/c++/6/ext/atomicity.h:53
53 { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
And here is the output for the segmentation fault:
(gdb) run
Starting program: /home/travis/ndn-cxx/examples/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, main (argc=1, argv=0x7fffffffded8) at producer.cpp:100
100 {
(gdb) next
101 ndn::examples::Producer producer;
(gdb) next
103 producer.run();
(gdb) next
[New Thread 0x7ffff2f0d700 (LWP 4133)]
Thread 1 "a.out" received signal SIGSEGV, Segmentation fault.
0x00007ffff78feb05 in std::__shared_ptr<ndn::Buffer const, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<ndn::Buffer const, (__gnu_cxx::_Lock_policy)2>&&) (__r=<optimized out>, this=<optimized out>)
at /usr/include/c++/5/bits/shared_ptr_base.h:936
936 __r._M_ptr = 0;
Files
Updated by Davide Pesavento over 6 years ago
- Subject changed from Producer example produces Bus error or Segmentation fault. to Producer example produces Bus error or Segmentation fault
- Description updated (diff)
Updated by Junxiao Shi over 6 years ago
- Category set to Docs
- Target version set to v0.7
Insufficient information, see http://www.lists.cs.ucla.edu/pipermail/nfd-dev/2016-May/001748.html , the following are missing:
- exact version in the form of git commit hash, not “newest” as new commits are added daily
- OS, compiler, Boost version
bt full
output
Please provide information within 7 days. Otherwise, the issue will be rejected.
Updated by Ashlesh Gawande over 6 years ago
Have you tried executing the producer as sudo?
Updated by Travis Machacek over 6 years ago
- File backtrace.txt backtrace.txt added
Git commit hash: 0c145ec5081bc5ceb0d3298bfdffbaedc9ec0646
OS: Ubuntu 16.04
Compiler: 5.4.0
Boost version: 1.58
I have attached the file for the back trace. I have also tried running the producer with and without sudo and still get the same error.
Updated by Davide Pesavento over 6 years ago
Thanks Travis.
It would appear that Tpm::sign
is returning nullptr because it can't find the key (not sure why the key cannot be found, there could be some inconsistencies in the PIB). KeyChain::sign
doesn't perform any sanity checking on the pointer returned by Tpm::sign
and passes it directly to the Block
constructor, which crashes for obvious reasons.
Updated by Davide Pesavento over 6 years ago
- Category changed from Docs to Security
Updated by Davide Pesavento over 5 years ago
- Subject changed from Producer example produces Bus error or Segmentation fault to Improve sanity checking and error reporting in KeyChain and TPM (was: Producer example segfaults)
- Start date deleted (
04/17/2018)
Updated by Davide Pesavento about 5 years ago
- Target version changed from v0.7 to 0.8.0
Updated by Davide Pesavento over 4 years ago
- Has duplicate Bug #5086: ndnsec-cert-gen segmentation fault added
Updated by Davide Pesavento over 4 years ago
- Status changed from New to Code review
- Assignee set to Alex Afanasyev
- % Done changed from 0 to 100
Updated by Davide Pesavento over 4 years ago
- Tags changed from security, bug to security
- Status changed from Code review to Closed