Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerPC: enforcing correct 64-bit ABI causes crashes #1142

Open
hainest opened this issue Nov 4, 2021 · 1 comment
Open

PowerPC: enforcing correct 64-bit ABI causes crashes #1142

hainest opened this issue Nov 4, 2021 · 1 comment

Comments

@hainest
Copy link
Contributor

hainest commented Nov 4, 2021

Applying the changes from #1140, the registerSpace calculations crash because they were written with the 32-bit ABI in mind.

The problem is that the call to liveRegisters now correctly has the 64-bit registers, but the checked registers (https://github.com/dyninst/dyninst/blob/master/dyninstAPI/src/registerSpace.C#L1500) are all from ppc32 (https://github.com/dyninst/dyninst/blob/master/dyninstAPI/src/RegisterConversion-ppc.C#L116). This causes ABI::getIndex to return -1 (terrible error handling here).

@mxz297

The backtrace for posterity.

llnl.cs.rice.edu $ ./test_driver -none -g++ -64 -attach -dynamiclink -pic init_fini_callback

test_driver: /home/th37/spack/opt/spack/linux-rhel7-power9le/gcc-8.3.0/boost-1.70.0-uxbkyhjhacyhddnmhhgqhywb7f3b3lpk/include/boost/dynamic_bitset/dynamic_bitset.hpp:1115: bool boost::dynamic_bitset<Block, Allocator>::test(boost::dynamic_bitset<Block, Allocator>::size_type) const [with Block = long unsigned int; Allocator = std::allocator; boost::dynamic_bitset<Block, Allocator>::size_type = long unsigned int]: Assertion `pos < m_num_bits' failed.

(gdb) bt
#0  0x00007ffff74dfc30 in raise () from /lib64/libc.so.6
#1  0x00007ffff74e1f8c in abort () from /lib64/libc.so.6
#2  0x00007ffff74d5754 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff74d5844 in __assert_fail () from /lib64/libc.so.6
#4  0x00007ffff6cbb848 in boost::dynamic_bitset<unsigned long, std::allocator<unsigned long> >::test (this=0x7fffffffab18, pos=18446744073709551615)
    at /home/th37/spack/opt/spack/linux-rhel7-power9le/gcc-8.3.0/boost-1.70.0-uxbkyhjhacyhddnmhhgqhywb7f3b3lpk/include/boost/dynamic_bitset/dynamic_bitset.hpp:1115
#5  0x00007ffff6cb75f8 in boost::dynamic_bitset<unsigned long, std::allocator<unsigned long> >::operator[] (this=0x7fffffffab18, pos=18446744073709551615)
    at /home/th37/spack/opt/spack/linux-rhel7-power9le/gcc-8.3.0/boost-1.70.0-uxbkyhjhacyhddnmhhgqhywb7f3b3lpk/include/boost/dynamic_bitset/dynamic_bitset.hpp:305
#6  0x00007ffff6cb3dbc in registerSpace::checkLive (this=0x1bfe5250, reg=67, liveRegs=...)
    at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/registerSpace.C:1505
#7  0x00007ffff6cb3a28 in registerSpace::specializeSpace (this=0x1bfe5250, liveRegs=...)
    at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/registerSpace.C:1475
#8  0x00007ffff6cae104 in registerSpace::actualRegSpace (iP=0x1b989660) at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/registerSpace.C:178
#9  0x00007ffff6cda644 in baseTramp::generateCode (this=0x1b9c5940, gen=..., baseInMutatee=140737331003392)
    at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/baseTramp.C:206
#10 0x00007ffff6e99eec in Dyninst::Relocation::InstWidgetPatch::apply (this=0x1bfcb140, gen=...)
    at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/Relocation/Widgets/InstWidget.C:88
#11 0x00007ffff6ed4214 in Dyninst::Relocation::CodeBuffer::BufferElement::generate (this=0x1bfcb0d0, buf=0x1b98f308, gen=..., shift=@0x1b98f4a4: 0, 
    regenerate=@0x7fffffffad38: false) at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/Relocation/CodeBuffer.C:117
#12 0x00007ffff6ed50d0 in Dyninst::Relocation::CodeBuffer::generate (this=0x1b98f308, baseAddr=140737331003392)
    at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/Relocation/CodeBuffer.C:274
#13 0x00007ffff6e633e4 in Dyninst::Relocation::CodeMover::relocate (this=0x1b98f260, addr=140737331003392)
    at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/Relocation/CodeMover.C:179
#14 0x00007ffff6ce7484 in AddressSpace::generateCode (this=0x105ff7b0, cm=..., nearTo=140737348718616)
    at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/addressSpace.C:1939
#15 0x00007ffff6ce6394 in AddressSpace::relocateInt (this=0x105ff7b0, begin=..., end=..., nearTo=140737348718616)
    at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/addressSpace.C:1765
#16 0x00007ffff6ce5e78 in AddressSpace::relocate (this=0x105ff7b0) at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/addressSpace.C:1718
#17 0x00007ffff6e2a668 in PCProcess::installInstrRequests (this=0x105ff7b0, requests=...)
    at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/dynProcess.C:1878
#18 0x00007ffff6f28800 in syscallNotification::installPreFork (this=0x1b989120)
    at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/syscallNotification.C:93
#19 0x00007ffff6e20eb0 in PCProcess::bootstrapProcess (this=0x105ff7b0) at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/dynProcess.C:470
#20 0x00007ffff6e1effc in PCProcess::attachProcess (progpath=..., pid=58804, analysisMode=BPatch_normalMode)
    at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/dynProcess.C:159
#21 0x00007ffff6bdbcb8 in BPatch_process::BPatch_process (this=0x104fd2b0, path=0x101ce7c0 "init_fini_callback.dyn_g++_64_pic_none", pid=58804, 
    mode=BPatch_normalMode) at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/BPatch_process.C:328
#22 0x00007ffff6b60014 in BPatch::processAttach (this=0x104e8cf0, path=0x101ce7c0 "init_fini_callback.dyn_g++_64_pic_none", pid=58804, 
    mode=BPatch_normalMode) at /home/th37/paradyn/xfdPK8J8/dyninst/src/dyninstAPI/src/BPatch.C:1253
#23 0x00007ffff7242bec in DyninstComponent::group_setup (this=0x104eb830, group=0x103e4ae0, params=...)
    at /home/th37/paradyn/xfdPK8J8/testsuite/src/src/dyninst/dyninst_comp.C:209
#24 0x00000000100161e8 in executeGroup (group=0x103e4ae0, groups=..., param=...) at /home/th37/paradyn/xfdPK8J8/testsuite/src/src/test_driver.C:476
#25 0x000000001001811c in startAllTests (groups=..., param=...) at /home/th37/paradyn/xfdPK8J8/testsuite/src/src/test_driver.C:683
#26 0x00000000100193e8 in main (argc=9, argv=0x7fffffffcc48) at /home/th37/paradyn/xfdPK8J8/testsuite/src/src/test_driver.C:881
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant