-
Notifications
You must be signed in to change notification settings - Fork 349
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
Doesn't compile on Kali #5
Comments
This happens only when building with
Then building with
|
I reproduce exactly paulmenzel's result on Debian stretch with the following environment:
|
probably unrelated but I compiled capstone master from scratch instead of using version from package managers. |
Yes, doing the change below fixes the problem.
|
If libcapstone.a is not build with `-fPIC`, building `injector` fails with the error below. ``` /usr/bin/ld: injector.o: relocation R_X86_64_32S against undefined symbol `dummy_stack' can not be used when making a shared object; recompile with -fPIC ``` So explicitly link the binary as a position dependent executable by passing `-no-pie` [1]. This probably needs to be made configurable, or the build system needs to detect how `libcapstone.a` is built. [1] https://wiki.ubuntu.com/SecurityTeam/PIE Fixes: xoreaxeaxeax#2, xoreaxeaxeax#5
I can get it to compile by changing the following:
But I'm not entirely sure if the p constraint is correct. The binary tends to only run through 1 iteration after compilation. I'm thinking that the issue has to do with the fact that since I'm running this on an x86 system, and the dummy_stack struct members are both 64 bits, it's trying to read in a 64 bit value into a memory operand, which is probably no bueno. Could prob just patch to add a macro based on system architecture for this structure. |
Hey domas, take a look at it:
t@kali:~/Desktop/Tools/sandsifter# make
cc -c injector.c -o injector.o -Wall
injector.c:321:93: warning: excess elements in array initializer
.start={.bytes={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, .len=0},
^~~~
injector.c:321:93: note: (near initialization for ‘total_range.start.bytes’)
injector.c:322:91: warning: excess elements in array initializer
.end={.bytes={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, .len=0},
^~~~
injector.c:322:91: note: (near initialization for ‘total_range.end.bytes’)
injector.c: In function ‘inject’:
injector.c:817:2: warning: asm operand 7 probably doesn’t match constraints
asm volatile ("
^~~~~~~
injector.c:817:2: error: impossible constraint in ‘asm’
Makefile:38: recipe for target 'injector.o' failed
make: *** [injector.o] Error 1
The text was updated successfully, but these errors were encountered: