Comments (6)
Yes, doing the change below fixes the problem.
- $(CC) $(CFLAGS) $< -O3 -Wall -l:libcapstone.a -o $@ -pthread
+ $(CC) $(CFLAGS) $< -O3 -Wall -no-pie -l:libcapstone.a -o $@ -pthread
from sandsifter.
This happens only when building with -fPIC
, right? On Debian Sid/unstable, just running make
I get the error below.
$ make
cc -c injector.c -o injector.o -Wall
[…]
cc injector.o -O3 -Wall -l:libcapstone.a -o injector -pthread
/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
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile:35: recipe for target 'injector' failed
make: *** [injector] Error 1
Then building with -fPIC
, your error can be reproduced.
$ make CFLAGS="-fPIC"
cc -fPIC -c injector.c -o injector.o -Wall
[…]
injector.c: In function ‘inject’:
injector.c:778:2: warning: asm operand 15 probably doesn’t match constraints
__asm__ __volatile__ ("\
^~~~~~~
injector.c:778:2: error: impossible constraint in ‘asm’
Makefile:38: recipe for target 'injector.o' failed
make: *** [injector.o] Error 1
from sandsifter.
I reproduce exactly paulmenzel's result on Debian stretch with the following environment:
# cc --version
cc (Debian 6.3.0-18) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# apt-cache policy python3-capstone libcapstone3 libcapstone-dev python-capstone
python3-capstone:
Installé : 3.0.4-1
Candidat : 3.0.4-1
Table de version :
*** 3.0.4-1 500
500 http://ftp.fr.debian.org/debian stretch/main amd64 Packages
100 /var/lib/dpkg/status
libcapstone3:
Installé : 3.0.4-1
Candidat : 3.0.4-1
Table de version :
*** 3.0.4-1 500
500 http://ftp.fr.debian.org/debian stretch/main amd64 Packages
100 /var/lib/dpkg/status
libcapstone-dev:
Installé : 3.0.4-1
Candidat : 3.0.4-1
Table de version :
*** 3.0.4-1 500
500 http://ftp.fr.debian.org/debian stretch/main amd64 Packages
100 /var/lib/dpkg/status
python-capstone:
Installé : 3.0.4-1
Candidat : 3.0.4-1
Table de version :
*** 3.0.4-1 500
500 http://ftp.fr.debian.org/debian stretch/main amd64 Packages
100 /var/lib/dpkg/status
from sandsifter.
probably unrelated but I compiled capstone master from scratch instead of using version from package managers.
from sandsifter.
@f4grx have a look at #2 -- Try adding -no-pie
to the linker step, it resolves the exact same issue I had on Arch.
from sandsifter.
I can get it to compile by changing the following:
+ [esp]"p"(&dummy_stack.dummy_stack_lo),
- [esp]"i"(&dummy_stack.dummy_stack_lo),
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.
from sandsifter.
Related Issues (20)
- Run on 80386 Debian within emulator? HOT 13
- Feature request: Add support for GPUs HOT 1
- have some sort of versioning information
- make fails with injector.c:817:2: error: impossible constraint in ‘asm’ HOT 1
- summarize.py crashes HOT 2
- Resizing terminal window crashes summarize.py
- how to analysis the instructions from sandsifter
- compile error ubuntu 17.04 HOT 1
- I don't understand this.
- File "./sifter.py", line 817, in main arch = re.search(r".*(..)-bit.*", injector_bitness).group(1) HOT 5
- How to install this on Pentium II w/o FPU Debian without internet connection? HOT 12
- mmap_min_addr 0 instead of sudo
- Does not compile HOT 2
- File "./sifter.py", line 196 HOT 4
- injector.c:65:11: fatal error : capstone/capstone.h: No such file or directory HOT 1
- relocation R_X86_64_32S against symbol `dummy_stack' can not be used when making a PIE object... HOT 4
- Disclosure of the "halt catch fire" bug HOT 1
- Injector overflowed sigaltstack
- Make issue on ubuntu. HOT 4
- Found a fork that builds and runs on modern machines HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sandsifter.