Enable the following compiler hardening flags:
* -Wl,-z,relro
* -Wl,-z,now
* -fstack-protector
relro / bind_now make the relro region read-only after linking,
preventing certain attacks against ELF data structures.
stack-protector adds stack canaries, which can detect exploits
which overwrite parts of the stack.
Explicitly not added in this change is FORTIFY_SOURCE=2. Adding that
option turns on glibc's warn_unused_result attributes. This generates
a huge number of new compile time warnings, and for the multiple
makefiles which have -Werror in them, turns those warnings into errors.
I'm not able to fix all the errors right away.
Bug: 20558757
Change-Id: I86791177c6695f5325233d9dd9a5dd3ccc2b1a2f
Add replocation-packer step for dynmic executables.
Enable it by default for arm and arm64 platforms.
Bug: http://b/18051137
Change-Id: I0c88fd31595bcea62a087f219acb9ecf9c80f2e5
Some programs (cough sqlite cough) do an improper check to see if
HAVE_MALLOC_H is defined. Instead of defining it with no value,
define it with a value so those checks pass.
Needed for bug: 20099586
Change-Id: I4c293b2c1b5f4caad85ffc1fc34ac385bab23f5c
-Wl,--fix-cortex-a8 is a workaround for an Erratum in Cortex-A8
processors. It slightly increases code size and decreases performance,
and there's no point in using it on non-A8 CPUs.
Instead of forcing it unconditionally, use it when targeting
Cortex-A8 or generic armv7-a (which might or might not be A8).
Change-Id: Ifa59765d380445237edccfe5440a67b3ba1e459a
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
"LOCAL_FDO_SUPPORT := always" enables FDO without user specifying
"BUILD_FDO_OPTIMIZE := true", i.e. it turns on FDO for a
module in any build configuration.
Change-Id: I05d8db2edb2b3f5db073fa14d5bf1083a04571c0
(cherry picked from commit 45d0143ab1)
Implicit function declarations are much more dangerous on LP64 because
sizeof(int) != sizeof(void*), so any function that returns a pointer will
lose its top bits, leading to relatively hard to debug crashes.
Change-Id: Ia05beffb949ca747833c2e12c40daf896f7a60a5
Implicit function declarations are much more dangerous on LP64 because
sizeof(int) != sizeof(void*), so any function that returns a pointer will
lose its top bits, leading to relatively hard to debug crashes.
Change-Id: Ib2570326dde1b1cde09c63c9b4c973d741528ee2
We don't support platform builds under CYGWIN and can safely
assume that all windows host builds are for MinGW32.
HAVE_WINSOCK2_H is currently unused. The only references to it
are in code that define it themselves or in application code that
by definition isn't compiled for windows.
Change-Id: I236d6e070df93f713cb716bb8a461c9c1d32a180
The transitive symbol resolving causes build breakage when a binary
linked against NDK has indirect dependency on platform libraries, or
vice versa.
Change-Id: Idbfe76079c1db14eb1156d0f396e13d26f0ff582
We want to store the symbol information for all android binaries in a global database.
* We ingest unstripped binaries into the global database
* When we collect address data from device (e.g. instruction pointer address), we want to lookup its symbol information through the global database. The key of the mapping is a unique build id, which is the same between binaries on device (stripped) and unstripped binaries.
After applying this patch, the system.img size increases by 0.0047% (16.3KB).
Change-Id: Id92faf2951f43a30947e8d2b690c1af6bf7e3f54