FORTIFY_SOURCE: fortify strchr

Detect when strchr reads off the end of a buffer.

Change-Id: I0e952eedcff5c36d646a9c3bc4e1337b959224f2
FORTIFY_SOURCE: optimize

Don't do the fortify_source checks if we can determine, at
compile time, that the provided operation is safe.

This avoids silliness like calling fortify source on things like:

  size_t len = strlen("asdf");
  printf("%d\n", len);

and allows the compiler to optimize this code to:

  printf("%d\n", 4);

Defer to gcc's builtin functions instead of pointing our code
to the libc implementation.

Change-Id: I5e1dcb61946461c4afaaaa983e39f07c7a0df0ae

Conflicts:

	libc/include/string.h
Add some extra extra checks in for ARMV7A and NEON on ARM targets

Signed-off-by: Paul Beeler <sparksco@gmail.com>
Disable leak checking for mksh; it's way too leaky.

When each shell leaks ~240 allocations, you can't see the leaks from
the program you ran with "adb shell".

Bug: 7291287
Change-Id: Ib8780db72ba0114ebdb24768537da74bbb61f354

Conflicts:
	libc/bionic/malloc_debug_common.cpp

Signed-off-by: Paul Beeler <sparksco@gmail.com>
Don't free anything when reporting leaks.

We don't know that they're not going to be cleaned up by a
C++ global destructor that runs after us. This is the case with
bootanimation, for example.

Bug: 7291287
Change-Id: Iba402514d1735fdc2ae4bc95b65396d816be46c0

Conflicts:
	libc/bionic/malloc_debug_check.cpp

Signed-off-by: Paul Beeler <sparksco@gmail.com>
libc: use more secure system properties if available

Currently, system properties are passed via the environment
variable ANDROID_PROPERTY_WORKSPACE and a file descriptor passed
from parent to child. This is insecure for setuid executables,
as the environment variable can be changed by the caller.

Modify system property handling so that we get the properties
from a root owned properties file, rather than using an
environment variable.  Fall back to the environment variable
if the file doesn't exist.

Bug: 8045561
Change-Id: I54f3efa98cf7d63d88788da5ce0d19e34fd7851a
prctl.h: include sys/cdefs.h

prctl.h uses __BEGIN_DECLS but fails to include sys/cdefs.h
(where it's defined).  Code which includes prctl.h without
previously including sys/cdefs.h will fail to compile.

Fixed.

Change-Id: If4c9f3308f08b93596dcd00e351ae786807e9320
Bring the NOTICE files back up to date.

Change-Id: I978275cf6604b90595ee79d897c0460eeadc7dc8
Fix x86 build to use <elf.h>.

Change-Id: I7b697d5eae69dc08eb31471a42cb8bbe5360be76
Restore bionic's <linux/elf-em.h>.

Used by <linux/audit.h>.

Change-Id: Ica4ebb7f52a7fce13c52fdff35e187ded3939382

Conflicts:
	libc/kernel/common/linux/elf-em.h

Signed-off-by: Paul Beeler <sparksco@gmail.com>
Update the libm/NOTICE file after the upgrade.

Change-Id: Icf9c44402d6f86117d61307219bb1cccd288854d
Regenerate msm_ion.h.

Bug: 8000377
Change-Id: If496d9972cb8aebfc996ac641aa762220aa71f3b
Remove the currently-unused i387 assembler to make way for the new.

Change-Id: I37e4e8fce881246b9b028f9e1619247b1ac25261
Remove dead code from gensyscalls.py.

Change-Id: I0df69f8fd990f829ccbfcd5123c17b523d5a4d45
update xattr.h

Change-Id: Ibd91167ba56e2692359b92fe3108da271f0c2e38
Clean up ARM assembler files to use ENTRY/END.

We also don't need legacy syscall support (non-"swi 0").

Change-Id: Id1012e8ca18bf13f3f4e42200f39ba0e2e632cbf
Use ENTRY/END in ARM __get_sp.

Change-Id: If2f159b266f5fa4ad9d188a17d4cd318b605e446
ifdef pthread_debug to fix build from new build repo changes

Signed-off-by: Paul Beeler <sparksco@gmail.com>