summaryrefslogtreecommitdiffstats
path: root/libc/arch-arm
Commit message (Collapse)AuthorAgeFilesLines
* cortex-a9: Fix reference to __memcpy_base_aligned.Kyle Repinski2016-06-271-1/+1
| | | | | | | With a different memcpy, __memcpy_base_aligned ceased to exist. Instead, point to the name defined by whatever includes memcpy_base.S Change-Id: I242cf49cbada35337ba155d7f170e86a905ff55f
* libc: Add memchr to a53+a57 targetSteve Kondik2015-11-241-0/+1
| | | | Change-Id: I3991c06dd4813c7cc73d50b56fd7974116d79892
* libc: arm: Add optimised memchr to scorpionMichael Bestas2015-11-051-0/+1
| | | | Change-Id: I49513fea4fad28ce053c75fc043117aa1ada794d
* libc: arm: add optimized memchr implementationYingshiuan Pan2015-10-319-1/+162
| | | | | | | | | | | | | This optimization is extracted from cortex-strings and bionic-ized, and applied to arm-v7a cpus (a7, a9, a15, a53, denver, krait). I ran stringbench[1] on ARM Juno, this optimization could outperform origin C implementation by 77%. [1] https://android.git.linaro.org/gitweb/platform/external/stringbench.git Change-Id: I1c3fb0c89ce2b3ee7e44f492367b6caf6db58ccf Signed-off-by: Yingshiuan Pan <yingshiuan.pan@linaro.org>
* libc: Add Scorpion-optimized variantSteve Kondik2015-10-292-1/+18
| | | | | | | | * Based on cortex-a8 variant with the following changes: Use krait memset/strcmp/memmove * Enable with TARGET_CPU_VARIANT := scorpion Change-Id: I01d0f22efba5a418ddd20fca0d0c570d855e0f6f
* Fix over read in strcpy/stpcpy/strcat.Christopher Ferris2015-10-294-148/+176
| | | | | | | | | | | | | | | | | | | | | | | This bug will happen when these circumstances are met: - Destination address & 0x7 == 1, strlen of src is 11, 12, 13. - Destination address & 0x7 == 2, strlen of src is 10, 11, 12. - Destination address & 0x7 == 3, strlen of src is 9, 10, 11. - Destination address & 0x7 == 4, strlen of src is 8, 9, 10. In these cases, the dest alignment code does a ldr which reads 4 bytes, and it will read past the end of the source. In most cases, this is probably benign, but if this crosses into a new page it could cause a crash. Fix the labels in the cortex-a9 strcat. Modify the overread test to vary the dst alignment to expost this bug. Also, shrink the strcat/strlcat overread cases since the dst alignment variation increases the runtime too much. Bug: 24345899 Change-Id: Ib34a559bfcebd89861985b29cae6c1e47b5b5855
* Make all labels local.Christopher Ferris2015-10-292-176/+176
| | | | | | Change the non-local labels to .L labels. Change-Id: I720e894f2e311af8f4a0970303d8b86575fb69a5
* Add optimized cortex-a7/cortex-a53 memset/memcpy.Christopher Ferris2015-10-2914-430/+986
| | | | | | | | | | | | | | | | | | Add an optimized memset that is ~20% faster for cortex-a7 and cortex-a53. Add a 32 bit optimized cortex-a53 memcpy that is about ~20% faster on cached data. Fix the cortex-a15 __str{cat,cpy}_chk.S, memcpy_base.S to remove the phony functions, since they aren't needed any more. Then add a direct include of these for cortex-a53. Verified the new functions by stepping through all of the major paths and verifying the backtrace is still correct. Bug: 22696180 Change-Id: Iec92a3f82d51243cca76c9aff9f35d920ff865ae
* [AOSP Master] libc: krait: Use performance version of memcpyBrent DeGraaf2015-10-294-104/+71
| | | | | | | * This commit improves performance for small copies compared to the original CAF one. It also cleans up some functions. Change-Id: Iaa52635240da8b8746693186b66b69778e833c32
* Remove pushes from memsets (krait/cortex-a9).Christopher Ferris2015-10-292-28/+19
| | | | | | | | | | On the path that only uses r0 in both the krait and cortex-a9 memset, remove the push and use r3 instead. In addition, for cortex-a9, remove the artificial function since it's not needed since dwarf unwinding is now supported on arm. Change-Id: Ia4ed1cc435b03627a7193215e76c8ea3335f949a
* Replace bx lr with update of pc from the stack.Christopher Ferris2015-10-295-16/+8
| | | | | | | | | | | | | When there is arm assembler of this format: ldmxx sp!, {..., lr} or pop {..., lr} bx lr It can be replaced with: ldmxx sp!, {..., pc} or pop {..., pc} Change-Id: Ic27048c52f90ac4360ad525daf0361a830dc22a3
* Add cortex-a53.a57 target for 32 bit big/little.Christopher Ferris2015-10-291-0/+21
| | | | | | | | The routines optimized for cortex-a7 and cortex-a53 cause performance drops on cortex-a57. Instead create a target that is the middle ground that works relatively well on either core. Change-Id: Ie2b6cc9a59a01c7b30602ee368b2b90f5e886289
* Performance: krait: Implement optimized versions of memmoveXin Qi2015-10-062-2/+221
| | | | | | | Code has been refactored to thumb2 for consistency with the rest of bionic libc, as well as performance and correctness. Change-Id: I5f738ef3eb12ece6b55285f1588eab3d4bbbe27d
* Performance: krait: Re-factor high-performance memcpy for thumb2Brent DeGraaf2015-10-062-118/+219
| | | | | | | | The majority of libc under bionic is built for thumb2. Refactor the high performance memcpy used in previous builds for thumb2, including information that can be used for stack-unwinding. Change-Id: I8a25e9cdc242a54f0fea41c135e11312f0bbb449
* Revert "Stop libc from cross-referencing unwind symbols"Dan Albert2015-07-202-94/+0
| | | | | | | | This reverts commit cd13b14e98d4921af126667fae0cf6613a5615c5. Bug: http://b/19958712 Change-Id: I7cc7f69728c42c37e129aee30d761c4cd7e30e94 (cherry picked from commit 95fd031c4d22b90c542621170bb6d4d05bb94457)
* Merge "Add support for cortex-a53 in bionic." into mnc-devTim Murray2015-06-161-0/+1
|\
| * Add support for cortex-a53 in bionic.Tim Murray2015-06-161-0/+1
| | | | | | | | | | | | allows -mcpu=cortex-a53 to be passed as part of a command line. Change-Id: Id4203a9fd197f4c3b661bad21ac58c32819fd687
* | Hide accidentally-exposed __clock_nanosleep.Elliott Hughes2015-06-161-2/+3
|/ | | | | | Bug: http://b/21858067 Change-Id: Iaa83a5e17cfff796aed4f641d0d14427614d9399 (cherry picked from commit b1304935b64ffcd59cd787cc9ac83a2d14dc587b)
* Add process_vm_readv and process_vm_writev.Elliott Hughes2015-06-102-0/+44
| | | | | | Bug: http://b/21761353 Change-Id: Ic8ef3f241d62d2a4271fbc783c8af50257bac498 (cherry picked from commit be57a40d2973739c4fb0aa1cfb0014f34aeec2bd)
* libc: Add O_PATH support for fgetxattr / fsetxattrNick Kralevich2015-06-022-4/+6
| | | | | | | | | | | | | | | | | | | | | | Support O_PATH file descriptors when handling fgetxattr and fsetxattr. This avoids requiring file read access to pull extended attributes. This is needed to support O_PATH file descriptors when calling SELinux's fgetfilecon() call. In particular, this allows the querying and setting of SELinux file context by using something like the following code: int dirfd = open("/path/to/dir", O_DIRECTORY); int fd = openat(dirfd, "file", O_PATH | O_NOFOLLOW); char *context; fgetfilecon(fd, &context); This change was motivated by a comment in https://android-review.googlesource.com/#/c/152680/1/toys/posix/ls.c (cherrypicked from commit 2825f10b7f61558c264231a536cf3affc0d84204) Change-Id: Ic0cdf9f9dd0e35a63b44a4c4a08400020041eddf
* Fix error handling for negative size in ftruncate.Dan Albert2015-06-011-14/+0
| | | | | | Bug: 21309901 Change-Id: I54692ab8105dd09db6af7a2c0894a17bdd118aa0 (cherry picked from commit c05554ec5c9aff5e0f1e83de9bb62c3569eecca2)
* Hide rt_sigqueueinfo.Yabin Cui2015-05-181-2/+3
| | | | | | Bug: 19358804 Change-Id: I38a53ad64c81d0eefdd1d24599e769fd8a477a56 (cherry picked from commit 40a8f214a5264efe5feaaffd55cea67fb87d097b)
* Use unified syntax to compile with both llvm and gcc.Chih-Hung Hsieh2015-05-156-73/+83
| | | | | | | | | | | All arch-arm and arch-arm64 .S files were compiled by gcc with and without this patch. The output object files were identical. When compiled with llvm and this patch, the output files were also identical to gcc's output. BUG: 18061004 Change-Id: I458914d512ddf5496e4eb3d288bf032cd526d32b (cherry picked from commit 33f33515b503b634d9fbc57dda7123ea9cf23fc6)
* Simplify three copyright headers.Elliott Hughes2015-05-121-1/+1
| | | | | | | | | There's no reason to have multiple years in our own copyright headers, and given the stupidity of our NOTICE file generation, it just creates more junk. Change-Id: I065a3811c2e2584e3b649a18ad9460286bc72b92 (cherry picked from commit c69ace87ec110a91005bdf19dbafeb355f399c06)
* Simplify close(2) EINTR handling.Elliott Hughes2015-04-231-2/+3
| | | | | | | | | | | | | | | | This doesn't affect code like Chrome that correctly ignores EINTR on close, makes code that tries TEMP_FAILURE_RETRY work (where before it might have closed a different fd and appeared to succeed, or had a bogus EBADF), and makes "goto fail" code work (instead of mistakenly assuming that EINTR means that the close failed). Who loses? Anyone actively trying to detect that they caught a signal while in close(2). I don't think those people exist, and I think they have better alternatives available. Bug: https://code.google.com/p/chromium/issues/detail?id=269623 Bug: http://b/20501816 Change-Id: I11e2f66532fe5d1b0082b2433212e24bdda8219b
* Use assembly memmove for all arm32 processors.Christopher Ferris2015-04-083-9/+15
| | | | | Bug: 15110993 Change-Id: Ia3dcd6b8c4032f8c72b6f2e628b635ce99667c09
* Stop libc from cross-referencing unwind symbolsDmitriy Ivanov2015-04-072-0/+94
| | | | | | | | | | | | | This makes unwind symbols 'protected', which should prevent them from relocating against libc++.so/libcutls.so. This is temporary file and it is going to be removed once libc.so stops exporting them. Bug: http://b/19958712 Change-Id: I96a765afe47e68d2e2ceb288870e63a25ca52081
* Use ALIAS_SYMBOL for assembler aliasing.Christopher Ferris2015-03-251-4/+2
| | | | Change-Id: I8d04d2da0a1ac440cc9044fc819c9a8eda5ff17d
* Make gensyscalls.py use the ALIAS_SYMBOL macro.Christopher Ferris2015-03-243-6/+3
| | | | Change-Id: Ib94c0abb6fc85126ecc5ed3f1962b2b8b90b9952
* Fix "faccessat ignores flags"Nick Kralevich2015-02-241-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The kernel system call faccessat() does not have any flags arguments, so passing flags to the kernel is currently ignored. Fix the kernel system call so that no flags argument is passed in. Ensure that we don't support AT_SYMLINK_NOFOLLOW. This non-POSIX (http://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html) flag is a glibc extension, and has non-intuitive, error prone behavior. For example, consider the following code: symlink("foo.is.dangling", "foo"); if (faccessat(AT_FDCWD, "foo", R_OK, AT_SYMLINK_NOFOLLOW) == 0) { int fd = openat(AT_FDCWD, "foo", O_RDONLY | O_NOFOLLOW); } The faccessat() call in glibc will return true, but an attempt to open the dangling symlink will end up failing. GLIBC documents this as returning the access mode of the symlink itself, which will always return true for any symlink on Linux. Some further discussions of this are at: * http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003617.html * http://permalink.gmane.org/gmane.linux.lib.musl.general/6952 AT_SYMLINK_NOFOLLOW seems broken by design. I suspect this is why this function was never added to POSIX. (note that "access" is pretty much broken by design too, since it introduces a race condition between check and action). We shouldn't support this until it's clearly documented by POSIX or we can have it produce intuitive results. Don't support AT_EACCESS for now. Implementing it is complicated, and pretty much useless on Android, since we don't have setuid binaries. See http://git.musl-libc.org/cgit/musl/commit/?id=0a05eace163cee9b08571d2ff9d90f5e82d9c228 for how an implementation might look. Bug: 18867827 Change-Id: I25b86c5020f3152ffa3ac3047f6c4152908d0e04
* Fix memchr overflow.Elliott Hughes2015-02-141-2/+2
| | | | | | | | | The overflow's actually in the generic C implementation of memchr. While I'm here, let's switch our generic memrchr to the OpenBSD version too. Bug: https://code.google.com/p/android/issues/detail?id=147048 Change-Id: I296ae06a1ee196d2c77c95a22f11ee4d658962da
* Merge changes Ib87855e8,I4b46ae20,I66364a5c,Id3fcf680Colin Cross2015-02-051-18/+0
|\ | | | | | | | | | | | | | | * changes: Use LOCAL_LDFLAGS_64 instead of enumerating 64-bit architectures Fix typo in cpu variant makefile depenendency for arm64 Remove libc_static_common_src_files Share LP32 makefile settings between arches
| * Share LP32 makefile settings between archesColin Cross2015-02-041-18/+0
| | | | | | | | | | | | | | | | Add <var>_32 to patch-up-arch-specific-flags, and move the LP32 cruft varaibles from the 32-bit arch specific makefiles into the top level Android.mk. Change-Id: Id3fcf6805d4af048c2524c94b1295416ebe7d057
* | Ensure raw fchmod/fchmodat syscalls are hidden.Nick Kralevich2015-02-032-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In https://android-review.googlesource.com/#/c/127908/5/libc/SYSCALLS.TXT@116 Elliott said: for LP64 these will be hidden. for LP32 we were cowards and left them all public for compatibility (though i don't think we ever dremeled to see whether it was needed). we don't have an easy way to recognize additions, though, so we can't prevent adding new turds. Add a mechanism to prevent the adding of new turds, and use that mechanism on the fchmod/fchmodat system calls. Bug: 19233951 Change-Id: I98f98345970b631a379f348df57858f9fc3d57c0
* | Add fchmodat(AT_SYMLINK_NOFOLLOW) and fchmod O_PATH supportNick Kralevich2015-02-022-4/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many libc functions have an option to not follow symbolic links. This is useful to avoid security sensitive code from inadvertantly following attacker supplied symlinks and taking inappropriate action on files it shouldn't. For example, open() has O_NOFOLLOW, chown() has lchown(), stat() has lstat(), etc. There is no such equivalent function for chmod(), such as lchmod(). To address this, POSIX introduced fchmodat(AT_SYMLINK_NOFOLLOW), which is intended to provide a way to perform a chmod operation which doesn't follow symlinks. Currently, the Linux kernel doesn't implement AT_SYMLINK_NOFOLLOW. In GLIBC, attempting to use the AT_SYMLINK_NOFOLLOW flag causes fchmodat to return ENOTSUP. Details are in "man fchmodat". Bionic currently differs from GLIBC in that AT_SYMLINK_NOFOLLOW is silently ignored and treated as if the flag wasn't present. This patch provides a userspace implementation of AT_SYMLINK_NOFOLLOW for bionic. Using open(O_PATH | O_NOFOLLOW), we can provide a way to atomically change the permissions on files without worrying about race conditions. As part of this change, we add support for fchmod on O_PATH file descriptors, because it's relatively straight forward and could be useful in the future. The basic idea behind this implementation comes from https://sourceware.org/bugzilla/show_bug.cgi?id=14578 , specifically comment #10. Change-Id: I1eba0cdb2c509d9193ceecf28f13118188a3cfa7
* Clean up <stdlib.h> slightly.Elliott Hughes2015-01-265-5/+12
| | | | | | | Interestingly, this mostly involves cleaning up our implementation of various <string.h> functions. Change-Id: Ifaef49b5cb997134f7bc0cc31bdac844bdb9e089
* Add ARM_IRELATIVE relocationDmitriy Ivanov2015-01-081-0/+2
| | | | | Bug: 17399706 Change-Id: I1dea46c3a3c4572558e718283489c323794176c7
* Move the generic arm memcmp.S into the generic directory.Elliott Hughes2014-12-157-1/+5
| | | | Change-Id: I48e4d14a0dcddbb246edbac6d0329619574ab44d
* Remove arm assembler not referenced from any makefile.Elliott Hughes2014-12-143-1617/+0
| | | | | | | I also suspect that libc/arch-arm/bionic/memcmp.S is supposed to like in the generic directory these days, but this change just removes dead code. Change-Id: I9072488df6e9b7261d79b6014914a0e937cb387b
* Fix arm64 clone stack handling.Elliott Hughes2014-12-101-2/+5
| | | | | | | Make sure we adjust the stack pointer so a signal can't overwrite data. Bug: 15195265 Change-Id: I5ab9469a82cb214c32f40a713268a1ab74a4c6fa
* Use the stmdb instead of str to save the fn/argJiangli Yuan2014-12-101-4/+2
| | | | | | | | | | Directly save data into stack without properly adjustment of stack point is dangous. For example, if a signal comes, kernel will put sigframe into userspace's stack, which will overwrite the saved data if sp is not adjusted properly. Bug: 15195265 Change-Id: Iea0cadfd3b94d50cf40252ad52fe5950811b9192 Signed-off-by: Jiangli Yuan <a6808c@motorola.com>
* Merge "support _POSIX_REALTIME_SIGNALS"Yabin Cui2014-12-091-0/+14
|\
| * support _POSIX_REALTIME_SIGNALSYabin Cui2014-12-081-0/+14
| | | | | | | | | | Bug: 18489947 Change-Id: I2e834d68bc10ca5fc7ebde047b517a3074179475
* | Simplify our endian.h implementation.Elliott Hughes2014-12-081-75/+0
| | | | | | | | | | | | | | We can rely on the compiler's builtins. Tested on arm, arm64, mips, x86, and x86-64. Change-Id: I0f774ed7e85b3c791a3178d8ef17c6500e6a9ace
* | Switch arm and arm64 over to the x86 style of jmpbuf.Elliott Hughes2014-12-081-20/+10
| | | | | | | | | | | | | | | | Specifically, use the argument to sigsetjmp as a flag in the buffer to indicate whether or not the signal mask is valid. Bug: 16918359 Change-Id: I5bb1f1220f14c105c6bc57e0c28c1dc366d1438f
* | Fix signal mask save/restore for arm64.Elliott Hughes2014-12-061-1/+0
| | | | | | | | | | Bug: 16918359 Change-Id: Ieb15f7f1658f5accee05665b72ba17831a80ea9d
* | Clean up arm setjmp family.Elliott Hughes2014-12-055-314/+146
| | | | | | | | | | Bug: 16918359 Change-Id: I9b986bdbdbaefe9d9896a820ee8cfe860adfe5c5
* | Clean up the arm64 setjmp.Elliott Hughes2014-12-052-17/+4
| | | | | | | | | | | | | | | | Note that this doesn't address the fact that we don't save/restore the real-time signals. But it does let us pass the tests we currently fail. Bug: 16918359 Change-Id: I063a6926164289a71026a412da7f5dd2ca9a74b3
* | Code using neon uses ARCH_ARM_HAVE_NEON.Elliott Hughes2014-12-031-16/+0
| | | | | | | | | | Bug: 18556103 Change-Id: Ia8674dda223f81d616d15ee47b402ab4a3f98079
* | Remove __ARM_HAVE_VFP.Elliott Hughes2014-12-033-18/+0
| | | | | | | | | | Bug: 18556103 Change-Id: I6d4cc6a1b359ad2df1ce6687fd26f392059f6efd