summaryrefslogtreecommitdiffstats
path: root/libc/arch-mips64
Commit message (Collapse)AuthorAgeFilesLines
* [MIPS] Add optimized string functionsNikola Veljkovic2015-06-175-1042/+5
| | | | | | | | | Use same string functions for all MIPS architectures. Bug: 21555893 (cherry picked from commit 38f2eaa07b0ad2e01a40607d3a0ac240ff53abbf) Change-Id: I94521f023d0bb136a4672782148a9f6e77cc6f1e
* Hide accidentally-exposed __clock_nanosleep.Elliott Hughes2015-06-161-3/+3
| | | | | | Bug: http://b/21858067 Change-Id: Iaa83a5e17cfff796aed4f641d0d14427614d9399 (cherry picked from commit b1304935b64ffcd59cd787cc9ac83a2d14dc587b)
* Fix two accidentally leaked mips64 symbols.Elliott Hughes2015-06-151-39/+25
| | | | | | Bug: http://b/21857154 Change-Id: Ie1fb63f54c6c527b8c1172e8f6ce48f23fca9b41 (cherry picked from commit 469b418784a01c759a2ddd889437d6e6c18b256e)
* Add process_vm_readv and process_vm_writev.Elliott Hughes2015-06-102-0/+50
| | | | | | 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
* Hide rt_sigqueueinfo.Yabin Cui2015-05-181-3/+3
| | | | | | Bug: 19358804 Change-Id: I38a53ad64c81d0eefdd1d24599e769fd8a477a56 (cherry picked from commit 40a8f214a5264efe5feaaffd55cea67fb87d097b)
* Include pthread_atfork.h to mips64 crtbeginDmitriy Ivanov2015-04-251-0/+1
| | | | | Bug: http://b/20339788 Change-Id: I2a8c7881f90a05ca768cb9b4c2f8b07c74c64469
* 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
* Remove _memset16 and _memset32 from mips/mips64 bionic.Elliott Hughes2015-04-021-80/+0
| | | | | | These should be in libcutils instead. Change-Id: Ibbc94755e6da61bf9ce2c8f9a047a082bb9bce24
* Make gensyscalls.py use the ALIAS_SYMBOL macro.Christopher Ferris2015-03-2412-24/+12
| | | | Change-Id: Ib94c0abb6fc85126ecc5ed3f1962b2b8b90b9952
* Hide statfs/fstatfs' ST_VALID flag from userspace.Elliott Hughes2015-03-182-10/+6
| | | | | | Spotted while debugging the strace 4.10 upgrade. Change-Id: I1af1be9c9440151f55f74a835e1df71529b0e4fe
* 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
* [MIPS64] Fix mips64 build.Nikola Veljkovic2015-02-231-1/+1
| | | | | | | | | | Build was broken by: https://android-review.googlesource.com/133834 Use <unistd.h> to get syscall(). Remove <asm/unistd.h>, it gets included through <sys/syscall.h>. Change-Id: Id762f6dea5f9538c19b79cdd46deda978efd50fe
* 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
* Ensure raw fchmod/fchmodat syscalls are hidden.Nick Kralevich2015-02-032-6/+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/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Modify MIPS64 stat structure to match a generic one in AOSP.Raghu Gandham2015-01-284-56/+104
| | | | | | | | | The kernel version of the stat structure is used during the syscalls. After the syscall, the kernel stat structure is converted to match the generic one. Eventually we would like the generic stat structure and related syscalls be added to MIPS64 kernel, removing the thunks added to AOSP. Change-Id: I7764e80278c1cc8254754c3531ec2dda7544a8ec
* Fix mips build.Elliott Hughes2015-01-271-4/+4
| | | | | | | Move various mips-only things into the arch-mips directory. As soon as mips writes assembler replacements, we can remove these. Change-Id: Ia7308559bc361f5c8df3e1d456b381865e060b93
* Clean up <stdlib.h> slightly.Elliott Hughes2015-01-261-2/+2
| | | | | | | Interestingly, this mostly involves cleaning up our implementation of various <string.h> functions. Change-Id: Ifaef49b5cb997134f7bc0cc31bdac844bdb9e089
* [MIPS] Add sgidefs.h for mips64Duane Sand2014-12-122-1/+1
| | | | | | | | Sgidefs.h is needed by strace. Replaced now-duplicate arch-mips64/include directory by symlink to arch-mips/include. Change-Id: I7808602cfa452eca3ffbdb94903f4c5bdb33efa3
* Merge "support _POSIX_REALTIME_SIGNALS"Yabin Cui2014-12-091-0/+26
|\
| * support _POSIX_REALTIME_SIGNALSYabin Cui2014-12-081-0/+26
| | | | | | | | | | Bug: 18489947 Change-Id: I2e834d68bc10ca5fc7ebde047b517a3074179475
* | Merge mips setjmp/longjmp family.Elliott Hughes2014-12-084-439/+1
| | | | | | | | | | Bug: 16918359 Change-Id: I9033a7d178d431ddb09f1cfa6e4bf95ae02346e9
* | Switch arch-mips64/include/machine to a symlink.Elliott Hughes2014-12-087-659/+1
| | | | | | | | | | | | | | Imagination already did the work to make the contents of these directories identical. Let's take advantage of that fact. Change-Id: Ib101ba39041fb500c9c618fa2020e72aa2ccd9c2
* | Kill <machine/exec.h>.Elliott Hughes2014-12-021-188/+0
| | | | | | | | | | Bug: 18546535 Change-Id: I479e003deab21e31eb5caa5393067ed1dc558387
* | [MIPS] Rewrite of setjmp/longjmp for mips64 and mipsr6Duane Sand2014-11-256-297/+245
|/ | | | Change-Id: Idcd13413520dd503bc9cf782553675313e500a83
* Bring our <machine/endian.h> files back in sync.Elliott Hughes2014-11-211-4/+0
| | | | | | | | They'd drifted slightly which led to a compilation error in toybox, which was assuming pid_t was defined. arm and arm64 were picking it up via <endian.h> but x86 wasn't. Change-Id: I58401e6c0066959dfc3b305b020876aaf7074bbf
* Mips: remove arch-specific atexit.hDmitriy Ivanov2014-11-212-30/+1
| | | | Change-Id: I687ff4ead6c5e81db44782bf851cb84f87bfe085
* Mips: Remove unused filesDmitriy Ivanov2014-11-211-38/+0
| | | | Change-Id: If98b832ee32f6dcd9f5d7ae21c601c210adfad6b
* Mips: Reuse atexit.h from libc/arch-commonDmitriy Ivanov2014-11-211-8/+1
| | | | Change-Id: Ica1670e6d3d1b6b0c64df93720efa65586e67727
* Add sethostname(2).Elliott Hughes2014-11-071-0/+25
| | | | | | Not very useful, but helps building stuff like toybox out of the box. Change-Id: I110e39030452bd093a84278e019c5752d293718d
* Add clock_settime and clock_nanosleep.Haruki Hasegawa2014-10-131-2/+3
| | | | | | | | | | | Add the missing prototypes, fix the existing prototypes to use clockid_t rather than int, fix clock_nanosleep's failure behavior, and add simple tests. Bug: 17644443 Bug: https://code.google.com/p/android/issues/detail?id=77372 Change-Id: I03fba369939403918abcabae9551a7123953d780 Signed-off-by: Haruki Hasegawa <h6a.h4i.0@gmail.com>
* Remove arch-mips64/bionic/__get_sp.SAndrew Hsieh2014-09-301-1/+0
| | | | | | __get_sp.S doesn't exist Change-Id: Id84f8904c8022c683263a317a18fabeb50fed992
* Clean up the architecture-specific makefiles.Elliott Hughes2014-09-161-24/+25
| | | | | | Group things appropriately and name each group. Change-Id: I0da45eb0ccde19c31d5e984d0e6eb3dad26630dc
* Add posix_fadvise(3).Elliott Hughes2014-09-111-0/+26
| | | | | | | (cherry-pick of 00008263782e484020420c606f7d145fe7d0a4d8.) Bug: 12449798 Change-Id: I07cbf3f670a0d1304b68148325a774f266b5c433
* Ensure __set_errno is still visible on LP32.Elliott Hughes2014-09-08193-573/+193
| | | | | | | | | | | | | | | | | | The use of the .hidden directive to avoid going via the PLT for __set_errno had the side-effect of actually making __set_errno hidden (which is odd because assembler directives don't usually affect symbols defined in a different file --- you can't even create a weak reference to a symbol that's defined in a different file). This change switches the system call stubs over to a new always-hidden __set_errno_internal and has a visible __set_errno on LP32 just for binary compatibility with old NDK apps. (cherry-pick of 7efad83d430f4d824f2aaa75edea5106f6ff8aae.) Bug: 17423135 Change-Id: I6b6d7a05dda85f923d22e5ffd169a91e23499b7b
* Revert "Register __libc_fini as early as possible."Dmitriy Ivanov2014-09-041-0/+5
| | | | | | This reverts commit e880c736d6c1d947f6309d5f1f63c74e8345c6a6. Change-Id: Ide83e442eb5dbfef5298a15bc602c3fe1dda1862
* Register __libc_fini as early as possible.Dmitriy Ivanov2014-09-031-5/+0
| | | | | | | We want __libc_fini to be called after all the destructors. Bug: 14611536 Change-Id: Ibb83a94436795ec178fd605fa531ac29608f4a3e
* MIPS64 syscall() argumentsChris Dearman2014-09-021-1/+1
| | | | | | The seventh argument for syscall is passed in a register, not on the stack Change-Id: Idb69fac77d1f710cff5a3ab4ae1259feb61ae69d
* Fix pthread_getattr_np for the main thread.Elliott Hughes2014-08-261-34/+0
| | | | | | | | | | | | | | | | | | | | On most architectures the kernel subtracts a random offset to the stack pointer in create_elf_tables by calling arch_align_stack before writing the auxval table and so on. On all but x86 this doesn't cause a problem because the random offset is less than a page, but on x86 it's up to two pages. This means that our old technique of rounding the stack pointer doesn't work. (Our old implementation of that technique was wrong too.) It's also incorrect to assume that the main thread's stack base and size are constant. Likewise to assume that the main thread has a guard page. The main thread is not like other threads. This patch switches to reading /proc/self/maps (and checking RLIMIT_STACK) whenever we're asked. Bug: 17111575 Signed-off-by: Fengwei Yin <fengwei.yin@intel.com> Change-Id: I1d4dbffe7bc7bda1d353c3a295dbf68d29f63158
* Remove _flush_cache(2) for mips64.Dan Albert2014-08-211-27/+0
| | | | | | | | | | Also remove declaration. The only user is compiler-rt, and they can replace that call with one to syscall(2). compiler-rt doesn't currently build on mips64 anyway. Bug: 11156955 Change-Id: Ieae0ba49c8e7aa50253401fc1d7c2d17bc867d39
* Simplify _ALIGN_TEXT.Elliott Hughes2014-08-201-3/+1
| | | | | Bug: 16872067 Change-Id: I2b622f252c21ce1b344c040f828ab3f4bf9b6c0a
* Make __set_errno hidden in asm.Dan Albert2014-08-08191-0/+382
| | | | | | | This fixes the build after the -Bsymbolic change. Bug: 16853291 Change-Id: I989c9fec3c32e0289ea257a3bd2b7fd2709b6ce2
* Revert "Replaces vfork() implementation with fork()"Dan Albert2014-08-052-0/+72
| | | | | | | | We're getting cold feet on this one... let's put it back. This reverts commit 210331d9762037afb9b5ed8413079c6f65872df9. Change-Id: I6b0d3c2b1dbf7f1dc9566979a91b7504c2189269
* Implement <sys/fsuid.h>.Elliott Hughes2014-07-302-0/+50
| | | | Change-Id: I1e5e50444a1b5a430ba5b5d9b8b1d91219af5e92
* [MIPSR6] setjmp supports mips32r6 and FP64A/FPXX reg modelsDuane Sand2014-07-232-122/+48
| | | | | | | | | | | Save and restore floating point registers via 64-bit load/stores when possible. Use assembler's builtin macro ops to generate pairs of 32-bit load/stores on Mips I cpus. Some cpus or FR modes have only 16 even-numbered dp fp regs. This is exposed by _MIPS_FPSET, defined by existing compilers. Change-Id: I7f617a3ffea8da41c402ef3a68ab32c91d3d7622
* Add splice, tee, and vmsplice.Elliott Hughes2014-06-243-0/+75
| | | | Change-Id: I5f43380b88d776a8bb607b47dbbc5db5a2fe6163
* Cache getpid.Elliott Hughes2014-06-201-2/+3
| | | | | | | | | | | | | | | | | In practice, with this implementation we never need to make a system call. We get the main thread's tid (which is the same as our pid) back from the set_tid_address system call we have to make during initialization. A new pthread will have the same pid as its parent, and a fork child's main (and only) thread will have a pid equal to its tid, which we get for free from the kernel before clone returns. The only time we'd actually have to make a getpid system call now is if we take a signal during fork and the signal handler calls getpid. (That, or we call getpid in the dynamic linker while it's still dealing with its own relocations and hasn't even set up the main thread yet.) Bug: 15387103 Change-Id: I6d4718ed0a5c912fc75b5f738c49a023dbed5189
* Merge "Remove ioprio_get(2) and ioprio_set(2) from LP64."Dan Albert2014-06-122-50/+0
|\
| * Remove ioprio_get(2) and ioprio_set(2) from LP64.Dan Albert2014-06-122-50/+0
| | | | | | | | | | Bug: 11156955 Change-Id: I07b596d85e4bd6347d488d1a92c8d0a00b5ef3b3