Skip to content
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

[FR] add ndk-build option for fortify #976

Closed
DanAlbert opened this issue May 8, 2019 · 3 comments
Closed

[FR] add ndk-build option for fortify #976

DanAlbert opened this issue May 8, 2019 · 3 comments
Assignees
Milestone

Comments

@DanAlbert
Copy link
Member

A command line option would make it easier to enable from Gradle.

@DanAlbert DanAlbert self-assigned this May 8, 2019
@DanAlbert DanAlbert added this to the r21 milestone May 14, 2019
@polishcode
Copy link

Hi @DanAlbert ,
What is currently (starting with e.g. r16b?) proper way to use this switch with ndk-build? I found some scattered info, but with no success. Also your and @enh talk at IO'19. I guess some documentation page about this would be great.
Thanks,
p

@DanAlbert
Copy link
Member Author

https://github.com/google/sanitizers/wiki/AddressSanitizerOnAndroid (https://developer.android.com/ndk/guides has a link to it in the sidebar; if there are ever docs you're looking for and they aren't available there or just aren't easy to find, file a bug; that should be the canonical source for information) for the how to docs and #954 discusses some of the current rough edges.

@DanAlbert
Copy link
Member Author

I decided to go a step further and just enable it by default. There are no (known) false positives and the runtime cost is negligible. https://android-review.googlesource.com/c/platform/ndk/+/1124477

@polishcode I'm not sure why I thought I was responding to a question about ASan before. Sorry about that! You can enable it for older versions of the NDK just by defining _FORTIFY_SOURCE=2. Best option would be to do so in your build scripts (i.e. APP_CFLAGS := -D_FORTIFY_SOURCE=2) to make sure you don't forget it in some TUs.

disigma pushed a commit to wimal-build/ndk that referenced this issue Sep 19, 2019
Test: ./checkbuild.py && ./run_tests.py
Bug: android/ndk#976
Change-Id: Ic14955978abb0045a6bdac3e8a91ed5d12693057
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants