OpenIPC / ipctool

Simple tool (and library) for checking IP camera hardware
https://openipc.org
MIT License
158 stars 34 forks source link

ipctool segfaults on xm510 #126

Open nickoe opened 5 months ago

nickoe commented 5 months ago

Hi

I am playing around with a camera I have laying around, I think we identify this as an xm510. I got telnet access with the Snawoot/hisilicon-dvr-telnet tool.

I tried to download the ipctool binary on https://github.com/OpenIPC/ipctool/releases/download/latest/ipctool which appears to have been updated two days ago.

$ sha256sum ipctool 
8d0f7c48c1f6a616d39bff8dc41c1e2ac86b1b6276995eca0211eecd29cd97eb  ipctool
$ file ipctool 
ipctool: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), statically linked, no section header

My device reports:

~ # cat /proc/cpuinfo
cat /proc/cpuinfo
Processor       : ARMv7 Processor rev 1 (v7l)
BogoMIPS        : 199.06
Features        : swp half fastmult edsp 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc05
CPU revision    : 1

Hardware        : xm510
Revision        : 0000
Serial          : 0000000000000000
cat /proc/kmsg
<5>Linux version 3.0.101 (jinze@xd-server-0001) (gcc version 4.9.2 (Buildroot 2014.08) ) #11 Tue Jun 20 08:36:44 CST 2017
<4>CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=10c53c7d
...

So I guess that it segfaults because it is not built for the correct abi? Does a version for ARMv7 exist somewhere precomipled?

Last part of the transfer for completeness:

~ # echo -ne '\x27\xf8\xd3\xf8\x58\xa0\x77\x03\x5f\x60\x27\x3b\x98\x6f\x4f\x72\x
98\x5f\xc8\x68\x03\x64\x25\xba\xf5\x05\x58\x60\x6c\x43\x1e\x00\x25\x67\x36\x6a\x
0b\x0b\x27\xf2\x28\x8e\xe5\x24\x7e\xc9\x94\x23\x5d\x6f\x83\x4f\x30\x60\x0f\xbf\x
27\x28\x00\x25\xbd\x1b\xf6\x03\x78\x4b\x76\x70\x17\x1d\x4c\xd2\x27\x2c\x43\x00\x
60\x9b\x6c\x27\x19\x78\xa4\x88\x01\x00\x00\x00\x00\x00\x04\x80\xff\x00\x00\x00\x
00\x55\x50\x58\x21\x00\x00\x00\x00\x00\x00\x00\x55\x50\x58\x21\x0e\x17\x03\x08\x
76\xcb\x14\x52\x90\xbf\xd9\xc3\x80\x81\x04\x00\x64\x06\x02\x00\x80\x81\x04\x00\x
50\x00\x00\xab\xa0\x00\x00\x00' >> /tmp/ipctool
~ # chmod 755 /tmp/ipctool
~ # /tmp/ipctool
Segmentation fault
~ # 

I wonder why the file size appaers to be different:

/tmp # ls -la ipctool 
-rwxr-xr-x    1 root     root        271080 Apr  3 23:07 ipctool

vs my own machine

ipctool]$ ls -lb ipctool 
-rwxr-xr-x 1 foo  foo 132744 Apr  3 23:02 ipctool
nickoe commented 5 months ago

I even tried to do:

$ wget https://musl.cc/armv7l-linux-musleabihf-cross.tgz
$ tar xvf armv7l-linux-musleabihf-cross.tgz
$ cmake -DCMAKE_C_COMPILER=$(pwd)/armv7l-linux-musleabihf-cross/bin/armv7l-linux-musleabihf-gcc -DCMAKE_BUILD_TYPE=Release
$ make
$ file ipctool 
ipctool: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), statically linked, no section header

But it appears to result in the same elf file format and it also segfaults. Any help is appreciated.