SideChannelMarvels / Orka

Repository of the official Docker image for SideChannelMarvels.
GNU General Public License v3.0
54 stars 22 forks source link

TracerPIN fails with 32bit binaries #2

Open edermi opened 8 years ago

edermi commented 8 years ago
root@d38c94c36b9a ~/Deadpool/wbs_des_wyseur2007/DCA (git)-[master] # ./Tracer2bin.py 
/usr/local/bin/Tracer: line 26:    64 Aborted                 (core dumped) $pin $modules $options $*
Traceback (most recent call last):
  File "./Tracer2bin.py", line 134, in <module>
    cipher=tracerpin(TMPTRACEFILE, i, RANGE, CHALLENGE, plain)
  File "./Tracer2bin.py", line 83, in tracerpin
    output=subprocess.check_output(['Tracer', '-b', '0', '-c', '0', '-i', '0', '-f', str(addr_range), '-o', tmpfile, '--' , image] + prepareinput(plaintext))
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['Tracer', '-b', '0', '-c', '0', '-i', '0', '-f', '2', '-o', 'trace.tmp90638', '--', '../target/wbDES', 'bd', '25', 'f1', 'bb', 'd7', 'c5', '9e', 'c2']' returned non-zero exit status 134
1 root@d38c94c36b9a ~/Deadpool/wbs_des_wyseur2007/DCA (git)-[master] # Tracer -b 0 -c 0  -i 0 -f 2 -o trace.tmp -- ../target/wbDES bd 25 f1 bb d7 c5 9e c2                                                                                  :(
[*] Trace file trace.tmp opened for writing...

A: Source/pin/vm_ia32_l/jit_region_ia32_linux.cpp: XlateSysCall: 33: Sysenter is supported on IA32 only and the expected location is inside Linux Gate

################################################################################
## STACK TRACE
################################################################################
addr2line -C -f -e "/opt/pin-2.14-71313-gcc.4.4.7-linux/ia32/bin/pinbin" 0x114128b 0x11420f6 0x11423e1 0x1384a63 0x1322b10 0x1323801 0x12642dd 0x126498f 0x126a190 0x1219cd6 0x121b2f0 0x121c280 0x12bd4ff 0x12a330f 0x12a3356 0x133584a 0x0
LEVEL_BASE::MESSAGE_TYPE::DumpTrace()
??:?
LEVEL_BASE::MESSAGE_TYPE::MessageInternal(std::string const&, bool, PIN_ERRTYPE, char*, int)
??:?
LEVEL_BASE::MESSAGE_TYPE::MessageNoReturn(std::string const&, bool, PIN_ERRTYPE, int, ...)
??:?
LEVEL_VM::REGION::XlateSysCall(LEVEL_CORE::INDEX<3>, LEVEL_CORE::INDEX<4>, LEVEL_CORE::INDEX<6>)
??:?
LEVEL_VM::REGION::XlateControlFlow(LEVEL_CORE::INDEX<4>, LEVEL_CORE::INDEX<6>)
??:?
LEVEL_VM::REGION::XlateBbl(LEVEL_CORE::INDEX<4>)
??:?
LEVEL_VM::REGION::Xlate()
??:?
LEVEL_VM::REGION::XlateAndInstrument()
??:?
LEVEL_VM::REGION::MakeApplication(LEVEL_VM::SVT_FACTORY const&)
??:?
LEVEL_VM::JIT::Initialize()
??:?
LEVEL_VM::JIT::CompileInternal(LEVEL_CORE::ADDR<1>, LEVEL_VM::SCT_ATTRIBUTES const*, LEVEL_BASE::EXCEPTION_INFO*, unsigned int)
??:?
LEVEL_VM::JIT::Compile(LEVEL_CORE::ADDR<1>, LEVEL_VM::SCT_ATTRIBUTES const*, LEVEL_BASE::EXCEPTION_INFO*)
??:?
LEVEL_VM::IBRANCH_DISPATCHER::HandleIndirectXfer(LEVEL_VM::SCT_ATTRIBUTES const*, LEVEL_VM::PCTXT*, LEVEL_VM::XFER_INDIRECT_ARGS const*)
??:?
LEVEL_VM::VM::Dispatch(LEVEL_VM::VMSVC_ARGS const*, LEVEL_VM::PCTXT*)
??:?
VmDispatch
??:?
VmEnter
??:?
??
??:0
Detach Service Count: 1711
Pin 2.14
Copyright (c) 2003-2015, Intel Corporation. All rights reserved.
@CHARM-VERSION: $Rev: 71293 $
@CHARM-BUILDER: BUILDER
@CHARM-COMPILER: gcc 4.4.7
@CHARM-TARGET: ia32
@CHARM-CFLAGS:  __OPTIMIZE__=1  __NO_INLINE__=__NO_INLINE__
/usr/local/bin/Tracer: line 26:    83 Aborted                 (core dumped) $pin $modules $options $*

Happens on latest Arch x86_64. Tracing 64 bit binaries works fine, passing --privileged and --security-opt=seccomp:unconfined does not solve the problem.

Currently the only known workaround is to use Valgrind instead of PIN when running into this.

doegox commented 8 years ago

That bug is really strange.
My own experience is:

And now you have the issue in the Docker :-/
See https://github.com/SideChannelMarvels/Tracer/tree/master/TracerPIN -> Troubleshooting

skirge commented 7 years ago

For me this helped: touch /etc/ld.so.nohwcap Execute it before running Tracer. System is Debian 64 bit on 4.8.0 kernel.

doegox commented 7 years ago

Thanks @skirge. I tried, Debian 64 bit on 4.8.0 kernel too, still same error even after reboot :(