make Android use mmap to make write+exec mappings#240
Closed
notaz wants to merge 2 commits intolibffi:masterfrom
Closed
make Android use mmap to make write+exec mappings#240notaz wants to merge 2 commits intolibffi:masterfrom
notaz wants to merge 2 commits intolibffi:masterfrom
Conversation
Some Android versions use SELinux, but it doesn't seem to complain about write+exec mappings. Also the check depends on getline(), which older versions of NDK lack.
On Linux, by default libffi relies on malloc() memory to have write+execute permissions, which is usually comes as a side effect of making the stack executable (either by execstack linker option or by compiling and linking some .S files; libffi linked programs get linked to such objects). On Android, at least on some versions of NDK for ARM, it is not enough to just link some objects compiled from .S (or libffi) to enable execstack and to get executable heap, so libffi just crashes in such configuration. It can be argued it's not even desirable to make the whole heap executable because of security implications, so enable FFI_MMAP_EXEC_WRIT to make only needed memory executable instead.
| alternative means]) | ||
| ;; | ||
| *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) | ||
| *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris* | *-linux-android*) |
Contributor
There was a problem hiding this comment.
Could you rebase this PR to master? Conflicts arise since commit 30b3440.
Author
|
#265 created |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is already used by java-native-access/jna , for example