No description
Find a file
Christopher Ferris 5f45d583b0 Create optimized __strcpy_chk/__strcat_chk.
This change pulls the memcpy code out into a new file so that the
__strcpy_chk and __strcat_chk can use it with an include.

The new versions of the two chk functions uses assembly versions
of strlen and memcpy to implement this check. This allows near
parity with the assembly versions of strcpy/strcat. It also means that
as memcpy implementations get faster, so do the chk functions.

Other included changes:
- Change all of the assembly labels to local labels. The other labels
  confuse gdb and mess up backtracing.
- Add .cfi_startproc and .cfi_endproc directives so that gdb is not
  confused when falling through from one function to another.
- Change all functions to use cfi directives since they are more powerful.
- Move the memcpy_chk fail code outside of the memcpy function definition
  so that backtraces work properly.
- Preserve lr before the calls to __fortify_chk_fail so that the backtrace
  actually works.

Testing:

- Ran the bionic unit tests. Verified all error messages in logs are set
  correctly.
- Ran libc_test, replacing strcpy with __strcpy_chk and replacing
  strcat with __strcat_chk.
- Ran the debugger on nexus10, nexus4, and old nexus7. Verified that the
  backtrace is correct for all fortify check failures. Also verify that
  when falling through from __memcpy_chk to memcpy that the backtrace is
  still correct. Also verified the same for __memset_chk and bzero.
  Verified the two different paths in the cortex-a9 memset routine that
  save variables to the stack still show the backtrace properly.

Bug: 9293744

(cherry-picked from 2be91915dc)

Change-Id: Ia407b74d3287d0b6af0139a90b6eb3bfaebf2155
2013-08-15 11:13:39 -07:00
libc Create optimized __strcpy_chk/__strcat_chk. 2013-08-15 11:13:39 -07:00
libdl Drop unnecessary execution permission for .cpp/.c/.h 2013-03-22 10:28:15 +08:00
libm Take upstream libm changes. 2013-06-12 16:37:58 -07:00
libstdc++ Clean up internal libc logging. 2013-03-15 16:12:58 -07:00
libthread_db Fix the pthread_setname_np test. 2013-02-15 12:08:59 -08:00
linker Add more information to error due to truncated Elf32_Ehdr 2013-08-14 15:47:46 -07:00
tests Add futimens. 2013-08-08 17:13:33 -07:00
.gitignore Merge memory checking functionality from sandbox 2010-02-16 11:43:18 -08:00
ABI-bugs.txt Regenerate NOTICE files. 2013-03-07 11:51:10 -08:00
Android.mk Remove the simulator target from all makefiles. 2011-07-11 22:11:41 -07:00
CleanSpec.mk Add an empty CleanSpec.mk 2010-03-08 18:04:02 -08:00