summaryrefslogtreecommitdiffstats
path: root/libc
Commit message (Collapse)AuthorAgeFilesLines
* Merge "bionic: Stack pointer/signal race condition."Elliott Hughes2012-07-311-4/+2
|\
| * bionic: Stack pointer/signal race condition.Peter Enderborg2012-07-271-4/+2
| | | | | | | | | | | | | | Move the stackpointer so a captured signal does not corrupt stack variables needed for __thread_entry. Change-Id: I3e1e7b94a6d7cd3a07081f849043262743aa8064
* | Merge "fix __cxa_finalize() implementation to be thread safe."Elliott Hughes2012-07-311-0/+4
|\ \
| * | fix __cxa_finalize() implementation to be thread safe.Srinavasa Nagaraju2012-07-311-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | __cxa_finalize() modifies the access permissions of __atexit global variable without acquiring _ATEXIT_LOCK(). Fix it prevent any possible races. Change-Id: I11939d0ebcbf6f360c14163222d40a449d96948e
* | | Install crt(begin|end)_so.o to target library path.Shih-wei Liao2012-07-281-0/+12
|/ / | | | | | | | | | | BUG=6886348. Change-Id: I176b2c4963d9731b06d10d4e0b92c010a0006b59
* | Report errors to the log, not just stderr.Elliott Hughes2012-07-274-72/+66
| | | | | | | | | | | | | | | | | | | | In particular this affects assert(3) and __cxa_pure_virtual, both of which have managed to confuse people this week by apparently aborting without reason. (Because stderr goes nowhere, normally.) Bug: 6852995 Bug: 6840813 Change-Id: I7f5d17d5ddda439e217b7932096702dc013b9142
* | Replace ALL_PREBUILTS with BUILD_PREBUILTYing Wang2012-07-271-15/+56
| | | | | | | | | | | | | | (cherry-picked from 186b36b65bdfbf2c89a661539bf530359364eac9.) Bug: 6857263 Change-Id: If787d84415dd2ac07105fe0d0b7a27c9be75df64
* | Merge "Correction to use of TEMP_FAILURE_RETRY in send_prop_msg"Elliott Hughes2012-07-271-1/+1
|\ \
| * | Correction to use of TEMP_FAILURE_RETRY in send_prop_msgJens Gulin2012-07-271-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | RETRY macro may retry command if result is -1. In this case the command was "connect < 0" instead of just connect. The comparison will not return -1 and thus retry is never done. This is now corrected so that interrupts will cause retry instead of fail. (There was no other negative side effect of the bug. The result code from RETRY was used in an if-statement and it would be true for all negative connect results. This was according to expectations.) Change-Id: Ie206b39878e9befea4e3be9a4061ee39eb232d80
* | Merge "Remove the 'Factory' time zone by not processing the 'factory' file."Elliott Hughes2012-07-263-1/+1
|\ \
| * | Remove the 'Factory' time zone by not processing the 'factory' file.Elliott Hughes2012-07-263-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The factory file (and Factory time zone) was meant as a way to say "not configured" that would give a clear error when running date(1). For us it would just look like UTC, so it is of no value. Bug: 2997381 Change-Id: I1a4b85dce97d1d9370b22ba79e8fe5dafff56541
* | | vfprintf: fix spelling.Nick Kralevich2012-07-251-1/+1
|/ / | | | | | | Change-Id: I6dc611143fb1f3e9ccf0a77b40ee48a3c1d72ca9
* | [MIPS] Use an aligned address to provoke SIGSEGV in abort()Chris Dearman2012-07-241-0/+5
| | | | | | | | Change-Id: I269c9ccc07058773fb0f9d70673673157ab38f6a
* | Fix implementation of generic atomic operationsChris Dearman2012-07-242-13/+12
| | | | | | | | Change-Id: Ie1ea5aacc561e2d6d40125d2952ed0e9116b7b0d
* | [MIPS] Add atomic routinesRaghu Gandham2012-07-242-0/+104
| | | | | | | | Change-Id: I2cb20ce44dd230d222b7fc1ede2e1e3dce6e692b
* | Upgrade to tzdata2012d.Elliott Hughes2012-07-204-78/+127
| | | | | | | | | | | | | | | | | | | | | | This upgrade involved rewriting the script; the data has moved to ftp.iana.org, where it's slightly less convenient to access, so it's time to use something that can talk FTP... As for tzdata2012d, it's just updating Morocco for this weekend's changes, now they've been decided at the last minute (as usual). Change-Id: I772df57a6e09b3bf3d9541bfc08930d6f18633b4
* | Update time.h for CLOCK_BOOTTIME.Nick Pelly2012-07-191-0/+1
|/ | | | | | (cherry-pick of 8958a383296ea0e1cc106ae245c37671809ffd49) Change-Id: Ie8de6b32fa81566db53ad7e9fd4b197f4cede628
* Merge "limits.h: Include page.h when relying on PAGE_SIZE"Elliott Hughes2012-07-161-0/+1
|\
| * limits.h: Include page.h when relying on PAGE_SIZEArun Raghavan2012-07-101-0/+1
| | | | | | | | | | | | | | limits.h relies on PAGE_SIZE being defined without actually including page.h. Make sure this is included to avoid compilation failures. Signed-off-by: Arun Raghavan <arun.raghavan@collabora.co.uk>
* | FORTIFY_SOURCE: revert memcpy changes.Nick Kralevich2012-07-132-38/+4
| | | | | | | | | | | | | | | | Performance regressions. Hopefully this is a temporary rollback. Bug: 6821003 Change-Id: I84abbb89e1739d506b583f2f1668f31534127764
* | FORTIFY_SOURCE: introduce __BIONIC_FORTIFY_UNKNOWN_SIZE macroNick Kralevich2012-07-133-4/+8
| | | | | | | | | | | | | | Replace all occurances of "(size_t) -1" with a __BIONIC_FORTIFY_UNKNOWN_SIZE macro. Change-Id: I0b188f6cf31417d2dbef0e1bd759de3f9782873a
* | FORTIFY_SOURCE: strlen check.Nick Kralevich2012-07-133-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test is designed to detect code such as: int main() { char buf[10]; memcpy(buf, "1234567890", sizeof(buf)); size_t len = strlen(buf); // segfault here with _FORTIFY_SOURCE printf("%d\n", len); return 0; } or anytime strlen reads beyond an object boundary. This should help address memory leakage vulnerabilities and make other unrelated vulnerabilities harder to exploit. Change-Id: I354b425be7bef4713c85f6bab0e9738445e00182
* | FORTIFY_SOURCE: restore __memcpy_chk()Nick Kralevich2012-07-131-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In our previous FORTIFY_SOURCE change, we started using a custom inline for memcpy(), rather than using GCC's __builtin_memcpy_chk(). This allowed us to delete our copy of __memcpy_chk(), and replace it by __memcpy_chk2(). Apparently GCC uses __memcpy_chk() outside of __builtin_memcpy_chk(). Specifically, __memcpy_chk() is used by __builtin__memMOVE_chk() under certain optimization levels. Keep the old __memcpy_chk() function around, and have it call into __memcpy_chk2(). Change-Id: I2453930b24b8a492a3b6ed860e18d92a6b762b80
* | FORTIFY_SOURCE: enhanced memcpy protections.Nick Kralevich2012-07-123-7/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two changes: 1) Detect memory read overruns. For example: int main() { char buf[10]; memcpy(buf, "abcde", sizeof(buf)); sprintf("%s\n", buf); } because "abcde" is only 6 bytes, copying 10 bytes from it is a bug. This particular bug will be detected at compile time. Other similar bugs may be detected at runtime. 2) Detect overlapping buffers on memcpy() It is a bug to call memcpy() on buffers which overlap. For example, the following code is buggy: char buf3[0x800]; char *first_half = &buf3[0x400]; char *second_half = &buf3[1]; memset(buf3, 0, sizeof(buf3)); memcpy(first_half, second_half, 0x400); printf("1: %s\n", buf3); We now detect this at compile and run time. Change-Id: I092bd89f11f18e08e8a9dda0ca903aaea8e06d91
* | memmove: Don't call memcpy if regions overlapNick Kralevich2012-07-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | memmove() unconditionally calls memcpy() if "dst" < "src". For example, in the code below, memmove() would end up calling memcpy(), even though the regions of memory overlap. int main() { char buf3[0x800]; char *dst = &buf3[1]; char *src = &buf3[0x400]; memset(buf3, 0, sizeof(buf3)); memmove(dst, src, 0x400); printf("1: %s\n", buf3); return 0; } Calling memcpy() on overlaping regions only works if you assume that memcpy() copies from start to finish. On some architectures, it's more efficient to call memcpy() from finish to start. This is also triggering a failure in some of my code. More reading: * http://lwn.net/Articles/414467/ * https://bugzilla.redhat.com/show_bug.cgi?id=638477#c31 (comment 31) Change-Id: I65a51ae3a52dd4af335fe5c278056b8c2cbd8948
* | Don't use -fstack-protector on ssp.cNick Kralevich2012-07-101-1/+20
| | | | | | | | | | | | | | | | | | | | | | libc's stack protector initialization routine (__guard_setup) is in bionic/ssp.c. This code deliberately modifies the stack canary. This code should never be compiled with -fstack-protector-all otherwise it will crash (mismatched canary value). Force bionic/ssp.c to be compiled with -fno-stack-protector Change-Id: Ib95a5736e4bafe1a460d6b4e522ca660b417d8d6
* | Merge "FORTIFY_SOURCE: Add openat, fix bug"Nick Kralevich2012-07-092-7/+45
|\ \
| * | FORTIFY_SOURCE: Add openat, fix bugNick Kralevich2012-07-092-7/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add fortify_source support for openat(). This change requires that an argument be supplied when using O_CREAT. Fix unnecessary call to __open_2. If, at compile time, we know that "flags" is constant and DOESN'T contain O_CREAT, the call to __open_2 is useless. Change-Id: Ifcd29c4fb25e25656961d7552d672e161f0cfdbd
* | | FORTIFY_SOURCE: add fgets support.Nick Kralevich2012-07-093-0/+100
|/ / | | | | | | Change-Id: I8c3410a90c71a3336c4ac8581618fa9330edf5e3
* | Merge "Modify ion header"Rebecca Schultz Zavin2012-06-281-6/+10
|\ \
| * | Modify ion headerRebecca Schultz Zavin2012-06-111-6/+10
| | | | | | | | | | | | | | | Change-Id: Ib963e8b064f7883bf098e006c70df20732496100 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
* | | Merge "FORTIFY_SOURCE: add open() checks"Nick Kralevich2012-06-272-0/+54
|\ \ \
| * | | FORTIFY_SOURCE: add open() checksNick Kralevich2012-06-262-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a FORTIFY_SOURCE check which requires that you pass a "mode" argument when calling open(..., O_CREAT). If a mode isn't passed, then the file is created with "undefined" permissions. Change-Id: I4427be4f9ce170c69da01af5b00fb05b03613a28
* | | | libc: cleanupsNick Kralevich2012-06-261-8/+8
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | Prefix private functions with underscores, to prevent name conflicts. Use __error__ instead of error, since occasionally programs will create their own "#define error ...". Change-Id: I7bb171df58aec5627e61896032a140db547fd95d
* | | am 63c4179f: am 4d0128f1: Merge "Minor tweak to get memory around corrupted ↵Andy McFadden2012-06-191-20/+22
|\ \ \ | | |/ | |/| | | | | | | | | | | | | heap chunks dumped." into jb-dev * commit '63c4179f5951edc2d68700fe75659fbd34febe63': Minor tweak to get memory around corrupted heap chunks dumped.
| * | am 4d0128f1: Merge "Minor tweak to get memory around corrupted heap chunks ↵Andy McFadden2012-06-191-20/+22
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | dumped." into jb-dev * commit '4d0128f13a3ca9f7a0c81b6e69f7e20d28e9e6e3': Minor tweak to get memory around corrupted heap chunks dumped.
| | * | Minor tweak to get memory around corrupted heap chunks dumped.Ben Cheng2012-06-191-20/+22
| | | | | | | | | | | | | | | | Change-Id: I8f72c5c7e23960b13fc53e2354cd74aca8aac3c0
* | | | Merge "Add watchdog.h"Arve Hjønnevåg2012-06-141-0/+65
|\ \ \ \
| * | | | Add watchdog.hArve Hjønnevåg2012-06-131-0/+65
| | | | | | | | | | | | | | | | | | | | Change-Id: Ib12d437151ccfbd634e9f01acd8556c79977ca04
* | | | | libc: make atoi, atol, and atoll pure functionsNick Kralevich2012-06-141-3/+3
| | | | | | | | | | | | | | | | | | | | Change-Id: Ib831c079c865929b6c91d42f35e117f2e974808f
* | | | | FORTIFY_SOURCE: add strlcpy / strlcat supportNick Kralevich2012-06-144-0/+174
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add strlcpy / strlcat support to FORTIFY_SOURCE. This allows us to do consistency checks on to ensure we don't overflow buffers when the compiler is able to tell us the size of the buffer we're dealing with. Unlike previous changes, this change DOES NOT use the compiler's builtin support. Instead, we do everything the compiler would normally do. Change-Id: I47c099a911382452eafd711f8e9bfe7c2d0a0d22
* | | | Merge "Don't mark realloc with __attribute__((malloc))"Nick Kralevich2012-06-131-1/+1
|\ \ \ \
| * | | | Don't mark realloc with __attribute__((malloc))Nick Kralevich2012-06-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html realloc should NOT be marked with __attribute__((malloc)). Quoting: realloc-like functions do not have this property as the memory pointed to does not have undefined content. For reference, __mallocfunc is defined in sys/cdefs.h as: #define __mallocfunc __attribute__((malloc)) Change-Id: I56083542ba92e4608dd7c55fb5596a138eb50cc9
* | | | | Merge "FORTIFY_SOURCE: add sprintf / vsprintf support"Nick Kralevich2012-06-134-14/+178
|\ \ \ \ \
| * | | | | FORTIFY_SOURCE: add sprintf / vsprintf supportNick Kralevich2012-06-134-14/+178
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sprintf FORTIFY_SOURCE protections are not available on clang. Also add various __attribute__s to stdio functions. Change-Id: I936d1f9e55fe53a68885c4524b7b59e68fed218d
* | | | | Merge "update filter.h / prctl.h / seccomp.h"Nick Kralevich2012-06-123-23/+127
|\ \ \ \ \
| * | | | | update filter.h / prctl.h / seccomp.hNick Kralevich2012-06-123-23/+127
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull in an updated version of filter.h / prctl.h / seccomp.h from the linux kernel. Pulled from upstream kernel at 94fa83c424321189ca24fb6cb4c0d224cdedc72d This file was generated using the following command: cd bionic/libc/kernel/ ./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/seccomp.h ./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/filter.h ./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/prctl.h Change-Id: I1ca996541d05b0d5927ab828a6ce49c09877ea01
* | | | | am c5cab345: am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"Robert Greenwalt2012-06-123-1/+135
|\ \ \ \ \ | |/ / / / |/| / / / | |/ / / | | | | * commit 'c5cab3452d5ced55474e56497594579108670b51': Avoid multiple dns lookups for the same query
| * | | am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"Robert Greenwalt2012-06-123-1/+135
| |\ \ \ | | | | | | | | | | | | | | | | | | | | * commit '028ccf5d40dd9a945ea92aa79822c08c6f6aa1d2': Avoid multiple dns lookups for the same query
| | * \ \ Merge "Avoid multiple dns lookups for the same query"Robert Greenwalt2012-06-123-1/+135
| | |\ \ \