summaryrefslogtreecommitdiffstats
path: root/libc/bionic
Commit message (Collapse)AuthorAgeFilesLines
* Make .note.android.ident section type SH_NOTEColin Cross2015-02-121-48/+0
| | | | | | | | | | | | | | | | | | The .note.android.ident section is only used by GDB, which doesn't care what section type the section is, but it would be convenient for readelf -n to be able to find the section too. The old way of getting the .note.android.ident section to be of type SH_NOTE involved compiling from .c to .s using gcc, running sed to change progbits to note, and then compiling from .s to .o using gcc. Since crtbrand.c only contains a section containing data, a crtbrand.S can be checked in that will compile on all platforms, avoiding the need for sed. Also add crtbrand.o to crtbegin_so.o so that libraries also get the note, and to the crt workaround in arm libc.so. Change-Id: Ica71942a6af4553b56978ceaa288b3f4c15ebfa2
* Remove no-op sed step when compiling crtbrand.oColin Cross2015-02-111-15/+0
| | | | | | | | | | | | crtbrand.c was compiled to a .s file, run through a sed script to translate a %progbits to %note, and the compiled to .o. However, when the sed command was copied from the original source it was not updated to use the new name of the section (.note.ABI-tag to .note.android.ident), so it didn't modify the file. Since the section has been generated with type %progbits instead of %note for two years, just delete the whole sed step. Change-Id: Id78582e9b43b628afec4eed22a088283132f0742
* Merge "Switch pthread_cond_t to <stdatomic.h>."Yabin Cui2015-02-101-40/+60
|\
| * Switch pthread_cond_t to <stdatomic.h>.Yabin Cui2015-02-091-40/+60
| | | | | | | | | | Bug: 17574458 Change-Id: Ic7f79861df4fe751cfa6c6b20b71123cc31e7114
* | Remove stray log line.Narayan Kamath2015-02-091-4/+0
| | | | | | | | Change-Id: Id948ae37a91dadd9d40e91de97f18774bdccfc78
* | Merge "Use the libcxxabi __cxa_demangle."Elliott Hughes2015-02-051-18/+3
|\ \
| * | Use the libcxxabi __cxa_demangle.Elliott Hughes2015-02-051-18/+3
| | | | | | | | | | | | | | | Bug: 18930951 Change-Id: If2ea3633ac6dfd4ec975c0f16bdf3dd58e05c614
* | | Apparently, logd does need the NULs.Elliott Hughes2015-02-051-4/+4
|/ / | | | | | | Change-Id: I04b834e65c26c5821b952f78a0de7f92527cbdba
* | Merge "Switch sem_t from bionic atomics to stdatomic.h."Yabin Cui2015-02-041-67/+88
|\ \
| * | Switch sem_t from bionic atomics to stdatomic.h.Yabin Cui2015-02-031-67/+88
| |/ | | | | | | | | Bug: 17572887 Change-Id: If66851ba9b831cdd698b9f1303289bb14448bd03
* | Merge "Add test about pthread_mutex_t owner tid limit."Yabin Cui2015-02-031-24/+3
|\ \
| * | Add test about pthread_mutex_t owner tid limit.Yabin Cui2015-02-031-24/+3
| | | | | | | | | | | | | | | Bug: 19216648 Change-Id: I7b12955bdcad31c13bf8ec2740ff88ba15223ec0
* | | Ensure raw fchmod/fchmodat syscalls are hidden.Nick Kralevich2015-02-032-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Switch pthread_mutex_t from bionic atomics to <stdatomic.h>."Hans Boehm2015-02-031-316/+294
|\ \ \ | |/ /
| * | Switch pthread_mutex_t from bionic atomics to <stdatomic.h>.Yabin Cui2015-02-021-316/+294
| | | | | | | | | | | | | | | Bug: 17574456 Change-Id: I5ce3d3dc07e804e9ce55c42920f47531b56e04de
* | | Merge "Add fchmodat(AT_SYMLINK_NOFOLLOW) and fchmod O_PATH support"Nick Kralevich2015-02-022-0/+139
|\ \ \
| * | | Add fchmodat(AT_SYMLINK_NOFOLLOW) and fchmod O_PATH supportNick Kralevich2015-02-022-0/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Small logging cleanup.Elliott Hughes2015-02-021-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't send the trailing NUL bytes to the logger, call strlen if we already know the length, or cast more specifically than we need to. Change-Id: I68c9388a22bddea49120a1022dda8db8991360c1
* | | | Fix clang build.Elliott Hughes2015-02-021-0/+1
| | | | | | | | | | | | | | | | Change-Id: I863137b5d35602267b4ef3a74399cf394c9994d6
* | | | Fortify poll and ppoll.Elliott Hughes2015-02-021-0/+49
|/ / / | | | | | | | | | | | | | | | | | | And remove the test for FD_ZERO fortification, which never made much sense anyway. Change-Id: Id1009c5298d461fa4722189e8ecaf22f0c529536
* | | Include <malloc.h> for struct mallinfo.Elliott Hughes2015-01-301-0/+1
|/ / | | | | | | | | | | GCC doesn't seem to care, but clang does. Change-Id: I9884820339a9e6f142862928c357f1a538184ae0
* | Rewrite __cxa_guard.cpp with <stdatomic.h>.Yabin Cui2015-01-291-43/+62
|/ | | | | Bug: 19180923 Change-Id: If4912d01db43c72ef12f4b04270ddb5d76d09462
* Add missing includes.Elliott Hughes2015-01-2810-1/+13
| | | | Change-Id: Ibf549266a19a67eb9158d341a69dddfb654be669
* Switch pthread_once_t to stdatomic.h.Yabin Cui2015-01-271-45/+30
| | | | | | Bug: 17574610 Change-Id: I653f2aa4b5b38dbdaffe4a6c3deccfe6ad3b0e74
* Fix mips build.Elliott Hughes2015-01-272-95/+0
| | | | | | | Move various mips-only things into the arch-mips directory. As soon as mips writes assembler replacements, we can remove these. Change-Id: Ia7308559bc361f5c8df3e1d456b381865e060b93
* x86 has an assembler bcopy implementation.Elliott Hughes2015-01-261-0/+4
| | | | Change-Id: I4ed7af3c5b104f86550120401f773150c460f37b
* Clean up <stdlib.h> slightly.Elliott Hughes2015-01-266-68/+9
| | | | | | | Interestingly, this mostly involves cleaning up our implementation of various <string.h> functions. Change-Id: Ifaef49b5cb997134f7bc0cc31bdac844bdb9e089
* Add <error.h>.Elliott Hughes2015-01-261-0/+95
| | | | | Bug: https://code.google.com/p/android/issues/detail?id=79170 Change-Id: Id91765fac45124545e2674a5b2c814707c1a448b
* Reduce <signal.h> namespace pollution.Elliott Hughes2015-01-242-0/+2
| | | | | | <signal.h> shouldn't drag in all of <string.h>. Change-Id: I57aea36dad5e89ea2f9541c35594ca6225e532be
* Use a more specific return type for app_id_from_name.Elliott Hughes2015-01-221-2/+2
| | | | | | | I suspect we can simplify this code, but I don't know enough about it to get involved now. Change-Id: I1c39761ae31beb70d41ffa6f0e396a4f17529d46
* Turn on -Wold-style-cast and fix the errors.Elliott Hughes2015-01-2112-47/+54
| | | | | | A couple of dodgy cases where we cast away const, but otherwise pretty boring. Change-Id: Ibc39ebd525377792b5911464be842121c20f03b9
* Fix possible leak in pthread_detach.Yabin Cui2015-01-153-15/+24
| | | | | | | | | If pthread_detach() is called while the thread is in pthread_exit(), it takes the risk that no one can free the pthread_internal_t. So I add PTHREAD_ATTR_FLAG_ZOMBIE to detect this, maybe very rare, but both glibc and netbsd libpthread have similar function. Change-Id: Iaa15f651903b8ca07aaa7bd4de46ff14a2f93835
* Make pthread stack size match real range.Yabin Cui2015-01-081-0/+1
| | | | | Bug: 18908062 Change-Id: I7037ac8273ebe54dd19b1561c7a376819049124c
* Merge "_Unwind_Context is a struct."Elliott Hughes2015-01-071-5/+0
|\
| * _Unwind_Context is a struct.Elliott Hughes2015-01-061-5/+0
| | | | | | | | Change-Id: Iff2c52dc630eb83b931a78fdebc4494d69462db7
* | Remove PTHREAD_ATTR_FLAG_USER_ALLOCATED_STACK.Yabin Cui2015-01-065-56/+44
|/ | | | | | Patch for https://android-review.googlesource.com/#/c/120844/. Change-Id: Idca5ccd7b28e8f07f1d2d1b6e3bba6781b62f0e0
* Merge "Reserve enough user request stack space in pthread_create."Yabin Cui2015-01-024-14/+23
|\
| * Reserve enough user request stack space in pthread_create.Yabin Cui2015-01-024-14/+23
| | | | | | | | | | Bug: 18830897 Change-Id: I1ba4aaeaf66a7ff99c5d82ad45469011171b0a3b
* | Remove bogus transitive includes.Elliott Hughes2014-12-2913-0/+13
|/ | | | | | | <signal.h> shouldn't get you the contents of <errno.h>, and <fcntl.h> shouldn't get you the contents of <unistd.h>. Change-Id: I347499cd8671bfee98e6b8e875a97cab3a3655d3
* Remove t->tls==NULL check in pthread_key_delete.Yabin Cui2014-12-191-10/+0
| | | | Change-Id: I6c0c71d30fe9d5b888752a4204abd95d5149bb96
* Use mmap to create the pthread_internal_tYabin Cui2014-12-197-88/+79
| | | | | | | | | Add name to mmaped regions. Add pthread benchmark code. Allocate pthread_internal_t on regular stack. Bug: 16847284 Change-Id: Id60835163bb0d68092241f1a118015b5a8f85069
* Split the shared group data from the shared passwd data.Elliott Hughes2014-12-181-35/+47
| | | | | | | | | | | | | | Found by the toybox id(1) which calls both getpwuid(3) and getgrgid(3) before looking at either result. The use of a shared buffer in this code meant that even on a single thread, the data for any of the passwd functions would be clobbered by the data for any of the group functions (or vice versa). This might seem like an insufficient fix, but POSIX explicitly says (for getpwnam) that the result "might be overwritten by a subsequent call to getpwent(), getpwnam(), or getpwuid()" and likewise for other members of that group, plus equivalent text for the group-related functions. Change-Id: I2272f47e91f72e043fdaf7c169fa9f6978ff4370
* Fix pthread key num calculation.Yabin Cui2014-12-121-1/+1
| | | | | Bug: 18723085 Change-Id: Iba2c834b350e4cdba0b2d771b221560a3e5df952
* Fix ptsname(3) and ttyname(3) to use TLS.Elliott Hughes2014-12-091-4/+11
| | | | | | Be safe by default. Change-Id: I6c4a3f1fd4eee3a651b3162ce95b7e873de57521
* Merge "support _POSIX_REALTIME_SIGNALS"Yabin Cui2014-12-093-0/+117
|\
| * support _POSIX_REALTIME_SIGNALSYabin Cui2014-12-083-0/+117
| | | | | | | | | | Bug: 18489947 Change-Id: I2e834d68bc10ca5fc7ebde047b517a3074179475
* | Change _POSIX_CPUTIME macro to make it compitable with glibc.Yabin Cui2014-12-091-2/+10
| | | | | | | | Change-Id: I7a8dbb74bd622693c9fef60bd779687207517b7d
* | Merge "Add cache related sysconf queries"Tao Bao2014-12-051-0/+18
|\ \
| * | Add cache related sysconf queriesTao Bao2014-12-041-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | Several cache related queries are added, such as _SC_LEVEL1_DCACHE_LINESIZE, _SC_LEVEL1_DCACHE_SIZE and etc. For the moment, we always return 0 for these queries. Change-Id: I36f67af8128672d8c1eef49d6f2431cca5a94719
* | | implement posix_madviseYabin Cui2014-12-041-0/+42
| | | | | | | | | | | | | | | Bug: 18472477 Change-Id: I8183de6c281acf69ed5f7f88351b056b9827b162