fPIE error when running #3065
Replies: 2 comments 39 replies
-
@yanivagman looks like Android >= 5, because of security reasons, only support PIE executables. Probably to randomize location of executable code (together with ASLR and DEP, sandboxing, etc.). While we don't directly support Android, I think we can compile artifacts as PIE binaries, right? I'm converting this as issue. @skandbug for now I believe you will have to compile tracee yourself you can check the building documentation and let us know if you have any doubts (you can always |
Beta Was this translation helpful? Give feedback.
-
If you use the "tracee-make" environment in any arm64 you should be able to generate a static binary that could run in android I suppose. Instructions: Apply this patch: diff --git a/Makefile b/Makefile
index ac864283..2021184c 100644
--- a/Makefile
+++ b/Makefile
@@ -436,8 +436,11 @@ $(OUTPUT_DIR)/tracee: \
$(MAKE) btfhub
$(GO_ENV_EBPF) $(CMD_GO) build \
-tags $(GO_TAGS_EBPF) \
- -ldflags="$(GO_DEBUG_FLAG) \
- -extldflags \"$(CGO_EXT_LDFLAGS_EBPF)\" \
+ -buildmode=pie \
+ -ldflags=" \
+ $(GO_DEBUG_FLAG) \
+ -linkmode external \
+ -extldflags \"-static-pie $(CGO_EXT_LDFLAGS_EBPF)\" \
-X github.com/aquasecurity/tracee/cmd/tracee/cmd.version=\"$(VERSION)\" \
" \
-v -o $@ \
@@ -468,8 +471,11 @@ $(OUTPUT_DIR)/tracee-ebpf: \
$(MAKE) btfhub
$(GO_ENV_EBPF) $(CMD_GO) build \
-tags $(GO_TAGS_EBPF) \
- -ldflags="$(GO_DEBUG_FLAG) \
- -extldflags \"$(CGO_EXT_LDFLAGS_EBPF)\" \
+ -buildmode=pie \
+ -ldflags=" \
+ $(GO_DEBUG_FLAG) \
+ -linkmode external \
+ -extldflags \"-static-pie $(CGO_EXT_LDFLAGS_EBPF)\" \
-X main.version=\"$(VERSION)\" \
" \
-v -o $@ \ and
And you should have your fPIE binary inside ./dist/ directory (tracee-ebpf and tracee binaries).
Let me know if that works for you. I can't guarantee we will make that change anytime soon (as we need to check implications). |
Beta Was this translation helpful? Give feedback.
-
Thank you team for providing such a great tool.
I need help in using it.
I put the
tracee-aarch64.v0.13.1.tar.gz
binary file in the Android emulator and unpacked it and ran it with the following error:"./dist/tracee": error: Android 5.0 and later only support position-independent executables (-fPIE).
How can I use it in aarch64 architecture platforms (e.g, Android).
Beta Was this translation helpful? Give feedback.
All reactions