OSDN Git Service

android-x86/bionic.git
11 years agoHad include/arm/fenv.h, but missed include/mips/fenv.h.
Shih-wei Liao [Tue, 31 Jul 2012 03:12:46 +0000 (20:12 -0700)]
Had include/arm/fenv.h, but missed include/mips/fenv.h.

Needed for the device-build for LLVM's constant folding pass.

Change-Id: I412a98d52458231650801a8b59fe3159a789b8b9
Author: fu@mips.com

11 years agoMerge "Install crt(begin|end)_so.o to target library path."
Shih-wei Liao [Mon, 30 Jul 2012 19:44:57 +0000 (12:44 -0700)]
Merge "Install crt(begin|end)_so.o to target library path."

11 years agoInstall crt(begin|end)_so.o to target library path.
Shih-wei Liao [Sat, 28 Jul 2012 07:33:28 +0000 (00:33 -0700)]
Install crt(begin|end)_so.o to target library path.

BUG=6886348.

Change-Id: I176b2c4963d9731b06d10d4e0b92c010a0006b59

11 years agoMerge "Report errors to the log, not just stderr."
Elliott Hughes [Sat, 28 Jul 2012 01:16:17 +0000 (18:16 -0700)]
Merge "Report errors to the log, not just stderr."

11 years agoReport errors to the log, not just stderr.
Elliott Hughes [Sat, 28 Jul 2012 00:40:29 +0000 (17:40 -0700)]
Report errors to the log, not just stderr.

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

11 years agoMerge "Fix a TEMP_FAILURE_RETRY usage error in the linker."
Elliott Hughes [Fri, 27 Jul 2012 22:43:10 +0000 (15:43 -0700)]
Merge "Fix a TEMP_FAILURE_RETRY usage error in the linker."

11 years agoFix a TEMP_FAILURE_RETRY usage error in the linker.
Elliott Hughes [Fri, 27 Jul 2012 22:30:51 +0000 (15:30 -0700)]
Fix a TEMP_FAILURE_RETRY usage error in the linker.

Similar to the fix in c20d0f3993ebb0d3dec958a306a68ebb48bfeadd.

grep(1) says this was the only other instance in bionic.

Change-Id: I1729038762ee1c7c4743a6bd11d5558afd6f5749

11 years agoMerge "Replace ALL_PREBUILTS with BUILD_PREBUILT"
Elliott Hughes [Fri, 27 Jul 2012 21:14:41 +0000 (14:14 -0700)]
Merge "Replace ALL_PREBUILTS with BUILD_PREBUILT"

11 years agoReplace ALL_PREBUILTS with BUILD_PREBUILT
Ying Wang [Thu, 26 Jul 2012 22:55:18 +0000 (15:55 -0700)]
Replace ALL_PREBUILTS with BUILD_PREBUILT

(cherry-picked from 186b36b65bdfbf2c89a661539bf530359364eac9.)

Bug: 6857263
Change-Id: If787d84415dd2ac07105fe0d0b7a27c9be75df64

11 years agoMerge "Correction to use of TEMP_FAILURE_RETRY in send_prop_msg"
Elliott Hughes [Fri, 27 Jul 2012 17:02:59 +0000 (10:02 -0700)]
Merge "Correction to use of TEMP_FAILURE_RETRY in send_prop_msg"

11 years agoCorrection to use of TEMP_FAILURE_RETRY in send_prop_msg
Jens Gulin [Thu, 19 Jul 2012 12:10:46 +0000 (14:10 +0200)]
Correction to use of TEMP_FAILURE_RETRY in send_prop_msg

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

11 years agoMerge "Remove the 'Factory' time zone by not processing the 'factory' file."
Elliott Hughes [Fri, 27 Jul 2012 00:36:21 +0000 (17:36 -0700)]
Merge "Remove the 'Factory' time zone by not processing the 'factory' file."

11 years agoRemove the 'Factory' time zone by not processing the 'factory' file.
Elliott Hughes [Thu, 26 Jul 2012 23:19:46 +0000 (16:19 -0700)]
Remove the 'Factory' time zone by not processing the 'factory' file.

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

11 years agoMerge "vfprintf: fix spelling."
Nick Kralevich [Wed, 25 Jul 2012 23:09:34 +0000 (16:09 -0700)]
Merge "vfprintf: fix spelling."

11 years agovfprintf: fix spelling.
Nick Kralevich [Wed, 25 Jul 2012 23:01:38 +0000 (16:01 -0700)]
vfprintf: fix spelling.

Change-Id: I6dc611143fb1f3e9ccf0a77b40ee48a3c1d72ca9

11 years agoMerge "[MIPS] Use an aligned address to provoke SIGSEGV in abort()"
Elliott Hughes [Wed, 25 Jul 2012 00:42:51 +0000 (17:42 -0700)]
Merge "[MIPS] Use an aligned address to provoke SIGSEGV in abort()"

11 years ago[MIPS] Use an aligned address to provoke SIGSEGV in abort()
Chris Dearman [Tue, 10 Jul 2012 18:46:55 +0000 (11:46 -0700)]
[MIPS] Use an aligned address to provoke SIGSEGV in abort()

Change-Id: I269c9ccc07058773fb0f9d70673673157ab38f6a

11 years agoMerge "Fix implementation of generic atomic operations"
Elliott Hughes [Wed, 25 Jul 2012 00:21:46 +0000 (17:21 -0700)]
Merge "Fix implementation of generic atomic operations"

11 years agoFix implementation of generic atomic operations
Chris Dearman [Tue, 24 Jul 2012 00:30:04 +0000 (17:30 -0700)]
Fix implementation of generic atomic operations

Change-Id: Ie1ea5aacc561e2d6d40125d2952ed0e9116b7b0d

11 years agoMerge "[MIPS] Add atomic routines"
Elliott Hughes [Tue, 24 Jul 2012 20:41:05 +0000 (13:41 -0700)]
Merge "[MIPS] Add atomic routines"

11 years ago[MIPS] Add atomic routines
Raghu Gandham [Fri, 29 Jun 2012 22:52:55 +0000 (15:52 -0700)]
[MIPS] Add atomic routines

Change-Id: I2cb20ce44dd230d222b7fc1ede2e1e3dce6e692b

12 years agoMerge "Upgrade to tzdata2012d."
Elliott Hughes [Sat, 21 Jul 2012 21:09:23 +0000 (14:09 -0700)]
Merge "Upgrade to tzdata2012d."

12 years agoUpgrade to tzdata2012d.
Elliott Hughes [Fri, 20 Jul 2012 23:52:39 +0000 (16:52 -0700)]
Upgrade to tzdata2012d.

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

12 years agoMerge "Update time.h for CLOCK_BOOTTIME."
Elliott Hughes [Fri, 20 Jul 2012 00:18:36 +0000 (17:18 -0700)]
Merge "Update time.h for CLOCK_BOOTTIME."

12 years agoUpdate time.h for CLOCK_BOOTTIME.
Nick Pelly [Thu, 19 Jul 2012 20:50:55 +0000 (13:50 -0700)]
Update time.h for CLOCK_BOOTTIME.

(cherry-pick of 8958a383296ea0e1cc106ae245c37671809ffd49)

Change-Id: Ie8de6b32fa81566db53ad7e9fd4b197f4cede628

12 years agoMerge "linker: Fix LD_PRELOADS for calling constructors"
Nick Kralevich [Wed, 18 Jul 2012 21:02:21 +0000 (14:02 -0700)]
Merge "linker: Fix LD_PRELOADS for calling constructors"

12 years agoMerge "bionic: Report linker relocation address to gdb"
Elliott Hughes [Mon, 16 Jul 2012 18:38:23 +0000 (11:38 -0700)]
Merge "bionic: Report linker relocation address to gdb"

12 years agoMerge "linker: cleanup of undefined state handling, which is really dead code"
Elliott Hughes [Mon, 16 Jul 2012 17:08:16 +0000 (10:08 -0700)]
Merge "linker: cleanup of undefined state handling, which is really dead code"

12 years agolinker: cleanup of undefined state handling, which is really dead code
Robin Burchell [Thu, 5 Jul 2012 07:23:19 +0000 (09:23 +0200)]
linker: cleanup of undefined state handling, which is really dead code

Given that _elf_lookup (and thus, _do_lookup) cannot possibly return an
undefined symbol (due to the check for SHN_UNDEF in _elf_lookup), there's
no need for spurious checks for SHN_UNDEF on its return value.

Conflicts:

linker/linker.c

Change-Id: Ic73cf439924b45f72d4d9ba3f64a888c96cbbd9b

12 years agoMerge "linker: Use SHN_UNDEF instead of describing what it is trying to do."
Elliott Hughes [Mon, 16 Jul 2012 17:00:38 +0000 (10:00 -0700)]
Merge "linker: Use SHN_UNDEF instead of describing what it is trying to do."

12 years agolinker: Use SHN_UNDEF instead of describing what it is trying to do.
Robin Burchell [Thu, 5 Jul 2012 07:21:07 +0000 (09:21 +0200)]
linker: Use SHN_UNDEF instead of describing what it is trying to do.

12 years agoMerge "Use std=gnu99 for the dynamic linker as well as libc."
Elliott Hughes [Mon, 16 Jul 2012 16:45:27 +0000 (09:45 -0700)]
Merge "Use std=gnu99 for the dynamic linker as well as libc."

12 years agoUse std=gnu99 for the dynamic linker as well as libc.
Elliott Hughes [Mon, 16 Jul 2012 16:43:14 +0000 (09:43 -0700)]
Use std=gnu99 for the dynamic linker as well as libc.

Change-Id: I76dd78576c5af6eb6282555f069647b6260edc31

12 years agoMerge "limits.h: Include page.h when relying on PAGE_SIZE"
Elliott Hughes [Mon, 16 Jul 2012 16:39:24 +0000 (09:39 -0700)]
Merge "limits.h: Include page.h when relying on PAGE_SIZE"

12 years agoMerge "FORTIFY_SOURCE: revert memcpy changes."
Nick Kralevich [Mon, 16 Jul 2012 15:24:32 +0000 (08:24 -0700)]
Merge "FORTIFY_SOURCE: revert memcpy changes."

12 years agobionic: Report linker relocation address to gdb
Ryan V. Bissell [Mon, 16 Jul 2012 07:16:18 +0000 (02:16 -0500)]
bionic: Report linker relocation address to gdb

GDB needs the runtime linker's base address in order to
locate the latter's ".text" and ".plt" sections, for the
purpose of detecting solib trampolines.  It also can
potentially use this to calculate the relocated address
of rtld_db_dlactivity.

Bug: http://code.google.com/p/android/issues/detail?id=34856
Change-Id: I63d3e7ae4e20a684ceb25967f2241e7d58dd685d
Signed-off-by: Ryan V. Bissell <ryan@bissell.org>
12 years agolinker: Fix LD_PRELOADS for calling constructors
Kito Cheng [Sat, 14 Jul 2012 16:49:27 +0000 (00:49 +0800)]
linker: Fix LD_PRELOADS for calling constructors

Change-Id: I1eae77a4c59e8a5acc009127d271455bb6fc01b6

12 years agoFORTIFY_SOURCE: revert memcpy changes.
Nick Kralevich [Sat, 14 Jul 2012 00:49:10 +0000 (17:49 -0700)]
FORTIFY_SOURCE: revert memcpy changes.

Performance regressions.  Hopefully this is a temporary
rollback.

Bug: 6821003
Change-Id: I84abbb89e1739d506b583f2f1668f31534127764

12 years agoMerge "FORTIFY_SOURCE: introduce __BIONIC_FORTIFY_UNKNOWN_SIZE macro"
Nick Kralevich [Fri, 13 Jul 2012 22:06:56 +0000 (15:06 -0700)]
Merge "FORTIFY_SOURCE: introduce __BIONIC_FORTIFY_UNKNOWN_SIZE macro"

12 years agoMerge "FORTIFY_SOURCE: strlen check."
Nick Kralevich [Fri, 13 Jul 2012 22:06:40 +0000 (15:06 -0700)]
Merge "FORTIFY_SOURCE: strlen check."

12 years agoMerge "FORTIFY_SOURCE: restore __memcpy_chk()"
Nick Kralevich [Fri, 13 Jul 2012 21:52:26 +0000 (14:52 -0700)]
Merge "FORTIFY_SOURCE: restore __memcpy_chk()"

12 years agoFORTIFY_SOURCE: introduce __BIONIC_FORTIFY_UNKNOWN_SIZE macro
Nick Kralevich [Fri, 13 Jul 2012 21:46:36 +0000 (14:46 -0700)]
FORTIFY_SOURCE: introduce __BIONIC_FORTIFY_UNKNOWN_SIZE macro

Replace all occurances of "(size_t) -1" with a
__BIONIC_FORTIFY_UNKNOWN_SIZE macro.

Change-Id: I0b188f6cf31417d2dbef0e1bd759de3f9782873a

12 years agoFORTIFY_SOURCE: strlen check.
Nick Kralevich [Fri, 13 Jul 2012 18:27:06 +0000 (11:27 -0700)]
FORTIFY_SOURCE: strlen check.

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

12 years agoFORTIFY_SOURCE: restore __memcpy_chk()
Nick Kralevich [Fri, 13 Jul 2012 19:45:14 +0000 (12:45 -0700)]
FORTIFY_SOURCE: restore __memcpy_chk()

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

12 years agoMerge "FORTIFY_SOURCE: enhanced memcpy protections."
Nick Kralevich [Fri, 13 Jul 2012 14:57:57 +0000 (07:57 -0700)]
Merge "FORTIFY_SOURCE: enhanced memcpy protections."

12 years agoFORTIFY_SOURCE: enhanced memcpy protections.
Nick Kralevich [Thu, 12 Jul 2012 22:10:03 +0000 (15:10 -0700)]
FORTIFY_SOURCE: enhanced memcpy protections.

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

12 years agoMerge "memmove: Don't call memcpy if regions overlap"
Nick Kralevich [Thu, 12 Jul 2012 17:06:27 +0000 (10:06 -0700)]
Merge "memmove: Don't call memcpy if regions overlap"

12 years agomemmove: Don't call memcpy if regions overlap
Nick Kralevich [Thu, 12 Jul 2012 00:34:04 +0000 (17:34 -0700)]
memmove: Don't call memcpy if regions overlap

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

12 years agoDon't use -fstack-protector on ssp.c
Nick Kralevich [Tue, 10 Jul 2012 17:46:19 +0000 (10:46 -0700)]
Don't use -fstack-protector on ssp.c

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

12 years agolimits.h: Include page.h when relying on PAGE_SIZE
Arun Raghavan [Tue, 10 Jan 2012 14:07:32 +0000 (19:37 +0530)]
limits.h: Include page.h when relying on PAGE_SIZE

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>
12 years agoMerge "FORTIFY_SOURCE: Add openat, fix bug"
Nick Kralevich [Mon, 9 Jul 2012 19:55:32 +0000 (12:55 -0700)]
Merge "FORTIFY_SOURCE: Add openat, fix bug"

12 years agoFORTIFY_SOURCE: Add openat, fix bug
Nick Kralevich [Mon, 2 Jul 2012 19:24:42 +0000 (12:24 -0700)]
FORTIFY_SOURCE: Add openat, fix bug

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

12 years agoMerge "FORTIFY_SOURCE: add fgets support."
Nick Kralevich [Mon, 9 Jul 2012 19:28:35 +0000 (12:28 -0700)]
Merge "FORTIFY_SOURCE: add fgets support."

12 years agoam 67636eea: am 40e7ed58: Unhide rtld_db_dlactivity()
Andrew Hsieh [Mon, 9 Jul 2012 18:07:46 +0000 (11:07 -0700)]
am 67636eea: am 40e7ed58: Unhide rtld_db_dlactivity()

* commit '67636eea20f7789e6689ee8cf6017e7d48735ca1':
  Unhide rtld_db_dlactivity()

12 years agoam 40e7ed58: Unhide rtld_db_dlactivity()
Andrew Hsieh [Mon, 9 Jul 2012 18:05:16 +0000 (11:05 -0700)]
am 40e7ed58: Unhide rtld_db_dlactivity()

* commit '40e7ed58d73eae59d0cf2fed61284d16692e307b':
  Unhide rtld_db_dlactivity()

12 years agoFORTIFY_SOURCE: add fgets support.
Nick Kralevich [Tue, 3 Jul 2012 18:45:31 +0000 (11:45 -0700)]
FORTIFY_SOURCE: add fgets support.

Change-Id: I8c3410a90c71a3336c4ac8581618fa9330edf5e3

12 years agoUnhide rtld_db_dlactivity()
Andrew Hsieh [Mon, 2 Jul 2012 18:17:04 +0000 (11:17 -0700)]
Unhide rtld_db_dlactivity()

Since linker is built with -fvisibility=hidden rtld_db_dlactivity()
if hidden from gdb.  Unhide it otherwise gdb may not know linker
activity and rescan solib

Change-Id: Ia8cd8d9738c6ea5696ba2ef0ebf2cf783f9ca70a

12 years agoMerge "Modify ion header"
Rebecca Schultz Zavin [Thu, 28 Jun 2012 21:16:10 +0000 (14:16 -0700)]
Merge "Modify ion header"

12 years agoMerge "FORTIFY_SOURCE: add open() checks"
Nick Kralevich [Wed, 27 Jun 2012 19:56:52 +0000 (12:56 -0700)]
Merge "FORTIFY_SOURCE: add open() checks"

12 years agolibc: cleanups
Nick Kralevich [Tue, 26 Jun 2012 23:05:19 +0000 (16:05 -0700)]
libc: cleanups

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

12 years agoFORTIFY_SOURCE: add open() checks
Nick Kralevich [Tue, 26 Jun 2012 22:08:06 +0000 (15:08 -0700)]
FORTIFY_SOURCE: add open() checks

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

12 years agolinker: improve loadable segment protection.
David 'Digit' Turner [Mon, 18 Jun 2012 23:24:17 +0000 (01:24 +0200)]
linker: improve loadable segment protection.

Use the functions in linker_phdr.c to load the PT_LOAD segments
in memory, and toggle their mapping's writable protection bit
as needed. In particular:

  - when loading a library, load the segments then unprotected
    them to allow relocations to work.

  - when relocating the linker of the executable, unprotect
    the segments loaded by the kernel to make relocations work
    too.

  - after all relocations are done, re-protect the segments,
    and apply GNU RELRO protection if needed.

  - just before calling the destructors, undo the GNU RELRO
    protection.

Change-Id: I50e709f03958204b8d6140c0f51ebe24fe089a1b

12 years agolinker: simplify code for dynamic and ARM exidx sections.
David 'Digit' Turner [Mon, 18 Jun 2012 22:08:39 +0000 (00:08 +0200)]
linker: simplify code for dynamic and ARM exidx sections.

This moves the code that determines where the .dynamic and .ARM.exidx
sections are to a single place in soinfo_link_image().

Change-Id: I98adcb440577bed86442349f03f3c629c945efec

12 years agoMerge "linker: rename load_offset to load_bias."
David 'Digit' Turner [Tue, 26 Jun 2012 08:34:41 +0000 (01:34 -0700)]
Merge "linker: rename load_offset to load_bias."

12 years agoMerge "linker: avoid mapping the whole library before load."
David 'Digit' Turner [Tue, 26 Jun 2012 08:34:31 +0000 (01:34 -0700)]
Merge "linker: avoid mapping the whole library before load."

12 years agoMerge "linker: Add PAGE_START/OFFSET/END convenience macros"
David 'Digit' Turner [Tue, 26 Jun 2012 08:34:18 +0000 (01:34 -0700)]
Merge "linker: Add PAGE_START/OFFSET/END convenience macros"

12 years agoMerge "linker: New sources to manage the ELF program header table."
David 'Digit' Turner [Tue, 26 Jun 2012 08:34:07 +0000 (01:34 -0700)]
Merge "linker: New sources to manage the ELF program header table."

12 years agoam 5af97ca8: am c7bab8cb: Merge "Enable sqrtf() x86 assembly code"
Elliott Hughes [Mon, 25 Jun 2012 21:09:42 +0000 (14:09 -0700)]
am 5af97ca8: am c7bab8cb: Merge "Enable sqrtf() x86 assembly code"

* commit '5af97ca8514d9fb4175bff3a79abf26889b94530':
  Enable sqrtf() x86 assembly code

12 years agoam c7bab8cb: Merge "Enable sqrtf() x86 assembly code"
Elliott Hughes [Mon, 25 Jun 2012 21:06:06 +0000 (14:06 -0700)]
am c7bab8cb: Merge "Enable sqrtf() x86 assembly code"

* commit 'c7bab8cb8483e7869eabdbd4add7c9e5beeecc80':
  Enable sqrtf() x86 assembly code

12 years agoMerge "Enable sqrtf() x86 assembly code"
Elliott Hughes [Mon, 25 Jun 2012 17:46:41 +0000 (10:46 -0700)]
Merge "Enable sqrtf() x86 assembly code"

12 years agolinker: rename load_offset to load_bias.
David 'Digit' Turner [Mon, 18 Jun 2012 21:38:46 +0000 (23:38 +0200)]
linker: rename load_offset to load_bias.

This patch changes the definition of the 'load_offset' field
in struct soinfo. The field is renamed because it is not the
basic load bias to add to every p_vaddr value read from the ELF
file to get the corresponding memory address.

This also slightly simplifies the relocation code.

+ Fix for proper load_bias computation for relocatable executables.

Change-Id: I72502c75a70751cba324deee7d313ae61f96609e

12 years agolinker: avoid mapping the whole library before load.
David 'Digit' Turner [Mon, 18 Jun 2012 16:13:49 +0000 (18:13 +0200)]
linker: avoid mapping the whole library before load.

This patch changes the load_library() function in the
dynamic linker to avoid reserving a huge read-only
address-space range just to read the ELF header and
program header (which are typically very small and easily
fit in the first page).

Instead, we use the functions in linker_phdr.c to only
load the data that we need in a temporary mmap-allocated
page of memory, which we release when the function exits.

This avoids issues when loading very large libraries, or
simply debug versions that only need to load a tiny percentage
of their overall file content in RAM.

Change-Id: Id3a189fad2119a870a1b3d43dd81380c54ea6044

12 years agolinker: Add PAGE_START/OFFSET/END convenience macros
David 'Digit' Turner [Mon, 18 Jun 2012 09:15:54 +0000 (11:15 +0200)]
linker: Add PAGE_START/OFFSET/END convenience macros

This patch adds a few macros related to memory pages to help
clarify some of the code in linker.c

Change-Id: I36c727132d257b1497398dd0a9e8a5a4505467ca

12 years agolinker: New sources to manage the ELF program header table.
David 'Digit' Turner [Tue, 19 Jun 2012 09:21:29 +0000 (11:21 +0200)]
linker: New sources to manage the ELF program header table.

This patch introduces two new source files containing a set of functions
to manage the program header table in an ELF binary, including the ability
to load PT_LOAD segments, and apply PT_GNU_RELRO protection.

Note: the files are not used currently, this will appear in a series
      of future patches that will gradually modify linker.c to use
      the phdr_table_xxx functions properly.

Change-Id: Ia3d4c1ff5fc3e265d8258b64b492f4e643f51bdc

12 years agoEnable sqrtf() x86 assembly code
xqian6 [Mon, 25 Jun 2012 08:12:06 +0000 (16:12 +0800)]
Enable sqrtf() x86 assembly code

This patch can improve the sqrtf() performance.

Change-Id: Ic9d11d6a9ecd9b263f54d4878e13595e136b95ce

12 years agoAdd module base to main executable's ARM_exidx.
Evgeniy Stepanov [Fri, 22 Jun 2012 10:52:52 +0000 (14:52 +0400)]
Add module base to main executable's ARM_exidx.

BUG:6697872

Change-Id: I448f4b86397307086231776da38a7af334a75fe5

12 years agoam fa136e8c: am a5948157: Merge "Define __stack_chk_fail_local.S"
Andrew Hsieh [Thu, 21 Jun 2012 02:00:55 +0000 (19:00 -0700)]
am fa136e8c: am a5948157: Merge "Define __stack_chk_fail_local.S"

* commit 'fa136e8ca71cb20956cd1792251869cac8bed257':
  Define __stack_chk_fail_local.S

12 years agoam a5948157: Merge "Define __stack_chk_fail_local.S"
Andrew Hsieh [Thu, 21 Jun 2012 01:58:18 +0000 (18:58 -0700)]
am a5948157: Merge "Define __stack_chk_fail_local.S"

* commit 'a5948157fd34acb2b1d1bfaf129901af865ab5fc':
  Define __stack_chk_fail_local.S

12 years agoMerge "Define __stack_chk_fail_local.S"
Andrew Hsieh [Thu, 21 Jun 2012 01:37:47 +0000 (18:37 -0700)]
Merge "Define __stack_chk_fail_local.S"

12 years agoDefine __stack_chk_fail_local.S
Andrew Hsieh [Wed, 20 Jun 2012 06:35:51 +0000 (14:35 +0800)]
Define __stack_chk_fail_local.S

With -fstack-protector, x86 -m32 needs __stack_chk_fail_local
defined in crtbegin_*.o.

Include __stack_chk_fail_local.S in begin.S otherwise linker
(which is built w/o crt*) may not link.

Change-Id: Id242fcf3eff157264afe3b04f27288ab7991220a

12 years agoam effc607e: Reconcile with jb-release
The Android Open Source Project [Wed, 20 Jun 2012 15:28:23 +0000 (08:28 -0700)]
am effc607e: Reconcile with jb-release

* commit 'effc607e87add0aec14fefb4ac1c00d36559149a':

12 years agoReconcile with jb-release
The Android Open Source Project [Wed, 20 Jun 2012 15:25:32 +0000 (08:25 -0700)]
Reconcile with jb-release

Change-Id: Ia5de9692e507a605d3b6937ec65da26169a3ea8e

12 years agomerge in jb-release history after reset to jb-dev
The Android Automerger [Wed, 20 Jun 2012 13:59:21 +0000 (06:59 -0700)]
merge in jb-release history after reset to jb-dev

12 years agoMerge "linker: reduce size by nearly 20KB"
David 'Digit' Turner [Tue, 19 Jun 2012 21:51:28 +0000 (14:51 -0700)]
Merge "linker: reduce size by nearly 20KB"

12 years agoam 63c4179f: am 4d0128f1: Merge "Minor tweak to get memory around corrupted heap...
Andy McFadden [Tue, 19 Jun 2012 18:33:19 +0000 (11:33 -0700)]
am 63c4179f: am 4d0128f1: Merge "Minor tweak to get memory around corrupted heap chunks dumped." into jb-dev

* commit '63c4179f5951edc2d68700fe75659fbd34febe63':
  Minor tweak to get memory around corrupted heap chunks dumped.

12 years agoam 4d0128f1: Merge "Minor tweak to get memory around corrupted heap chunks dumped...
Andy McFadden [Tue, 19 Jun 2012 18:31:14 +0000 (11:31 -0700)]
am 4d0128f1: Merge "Minor tweak to get memory around corrupted heap chunks dumped." into jb-dev

* commit '4d0128f13a3ca9f7a0c81b6e69f7e20d28e9e6e3':
  Minor tweak to get memory around corrupted heap chunks dumped.

12 years agoMerge "Minor tweak to get memory around corrupted heap chunks dumped." into jb-dev
Andy McFadden [Tue, 19 Jun 2012 18:28:15 +0000 (11:28 -0700)]
Merge "Minor tweak to get memory around corrupted heap chunks dumped." into jb-dev

12 years agoMinor tweak to get memory around corrupted heap chunks dumped.
Ben Cheng [Tue, 19 Jun 2012 14:11:38 +0000 (07:11 -0700)]
Minor tweak to get memory around corrupted heap chunks dumped.

Change-Id: I8f72c5c7e23960b13fc53e2354cd74aca8aac3c0

12 years agolinker: reduce size by nearly 20KB
David 'Digit' Turner [Tue, 19 Jun 2012 00:02:32 +0000 (02:02 +0200)]
linker: reduce size by nearly 20KB

This patch adds a trivial implementation of snprintf() that calls
our internal vsnprintf().

Inspection of the generated machine code showed that the linker
contained a full implementation of stdio's vfprintf. It was pulled
in because the pthread implementation uses snprintf() somewhere.

ProTip: It's possible to see why specific objects files are included
in a final binary by adding the following to your Android.mk, then
looking at the content of /tmp/MAP.TXT:

  LOCAL_LDFLAGS += -Wl,-Map=/tmp/MAP.TXT

Change-Id: I325e71b0cad1d01116a2e00c09e30a80cb716aa3

12 years agoMerge "Add watchdog.h"
Arve Hjønnevåg [Thu, 14 Jun 2012 23:13:16 +0000 (16:13 -0700)]
Merge "Add watchdog.h"

12 years agolibc: make atoi, atol, and atoll pure functions
Nick Kralevich [Thu, 14 Jun 2012 20:48:18 +0000 (13:48 -0700)]
libc: make atoi, atol, and atoll pure functions

Change-Id: Ib831c079c865929b6c91d42f35e117f2e974808f

12 years agoFORTIFY_SOURCE: add strlcpy / strlcat support
Nick Kralevich [Wed, 13 Jun 2012 23:57:27 +0000 (16:57 -0700)]
FORTIFY_SOURCE: add strlcpy / strlcat support

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

12 years agoAdd watchdog.h
Arve Hjønnevåg [Thu, 14 Jun 2012 02:22:18 +0000 (19:22 -0700)]
Add watchdog.h

Change-Id: Ib12d437151ccfbd634e9f01acd8556c79977ca04

12 years agoMerge "linker: small code-cleanup"
David 'Digit' Turner [Thu, 14 Jun 2012 04:45:52 +0000 (21:45 -0700)]
Merge "linker: small code-cleanup"

12 years agoMerge "Don't mark realloc with __attribute__((malloc))"
Nick Kralevich [Wed, 13 Jun 2012 23:13:32 +0000 (16:13 -0700)]
Merge "Don't mark realloc with __attribute__((malloc))"

12 years agoDon't mark realloc with __attribute__((malloc))
Nick Kralevich [Wed, 13 Jun 2012 22:43:14 +0000 (15:43 -0700)]
Don't mark realloc with __attribute__((malloc))

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

12 years agolinker: small code-cleanup
David 'Digit' Turner [Tue, 12 Jun 2012 14:25:37 +0000 (16:25 +0200)]
linker: small code-cleanup

This patch adds to make the linker a little bit easier to understand
by making all functions that acts on a sofino object with a soinfo_
prefix.

This is to more easily distinguish functions that operate on global
state, and those that operate on individual libraries.

This should be purely stylistic, i.e. no feature/behaviour change.

Change-Id: Ie510d13d743aa4317644caefa9910b8af7e84f44

12 years agoMerge "FORTIFY_SOURCE: add sprintf / vsprintf support"
Nick Kralevich [Wed, 13 Jun 2012 18:03:42 +0000 (11:03 -0700)]
Merge "FORTIFY_SOURCE: add sprintf / vsprintf support"

12 years agoFORTIFY_SOURCE: add sprintf / vsprintf support
Nick Kralevich [Tue, 12 Jun 2012 22:59:04 +0000 (15:59 -0700)]
FORTIFY_SOURCE: add sprintf / vsprintf support

sprintf FORTIFY_SOURCE protections are not available
on clang.

Also add various __attribute__s to stdio functions.

Change-Id: I936d1f9e55fe53a68885c4524b7b59e68fed218d

12 years agoMerge "update filter.h / prctl.h / seccomp.h"
Nick Kralevich [Tue, 12 Jun 2012 23:34:46 +0000 (16:34 -0700)]
Merge "update filter.h / prctl.h / seccomp.h"