OSDN Git Service

android-x86/bionic.git
11 years agoMerge "Remove the last .jam file."
Elliott Hughes [Thu, 9 Aug 2012 18:59:20 +0000 (11:59 -0700)]
Merge "Remove the last .jam file."

11 years agoRemove the last .jam file.
Elliott Hughes [Thu, 9 Aug 2012 18:54:23 +0000 (11:54 -0700)]
Remove the last .jam file.

How did I miss this before?

Change-Id: I2e582133fc4800656fdd81104f8dfc7ee8f5b580

11 years agoMerge "MIPS support to sys/ headers"
Elliott Hughes [Wed, 8 Aug 2012 23:32:55 +0000 (16:32 -0700)]
Merge "MIPS support to sys/ headers"

11 years agoMerge "Fix x86 build."
Elliott Hughes [Wed, 8 Aug 2012 23:07:26 +0000 (16:07 -0700)]
Merge "Fix x86 build."

11 years agoFix x86 build.
Elliott Hughes [Wed, 8 Aug 2012 23:06:51 +0000 (16:06 -0700)]
Fix x86 build.

Change-Id: Ice50ca71a19f3bf26de7cfd4c02075f1e6e0823f

11 years agoMerge "Clean up the linker a bit, remove prelinking support."
Elliott Hughes [Wed, 8 Aug 2012 22:17:23 +0000 (15:17 -0700)]
Merge "Clean up the linker a bit, remove prelinking support."

11 years agoMerge "Clean up libc/Android.mk a bit after the crtbrand changes."
Elliott Hughes [Wed, 8 Aug 2012 21:32:23 +0000 (14:32 -0700)]
Merge "Clean up libc/Android.mk a bit after the crtbrand changes."

11 years agoClean up libc/Android.mk a bit after the crtbrand changes.
Elliott Hughes [Wed, 8 Aug 2012 21:07:37 +0000 (14:07 -0700)]
Clean up libc/Android.mk a bit after the crtbrand changes.

Change-Id: Icfb95fffe70967418cd93da8cbeae22dcd68f8c9

11 years agoMerge "Add a .note.android.ident section to Android ELF binaries."
Jean-Baptiste Queru [Wed, 8 Aug 2012 20:44:26 +0000 (13:44 -0700)]
Merge "Add a .note.android.ident section to Android ELF binaries."

11 years agoClean up the linker a bit, remove prelinking support.
Elliott Hughes [Fri, 3 Aug 2012 23:49:39 +0000 (16:49 -0700)]
Clean up the linker a bit, remove prelinking support.

Also make the errors more readable, since none of us seemed to know
what they actually meant. The new style is still as verbose as the
old, but that's probably necessary in the absence of chained exceptions
in C. Here's what you'd see if you try to boot after removing
libsurfaceflinger.so:

  32267 32267 E AndroidRuntime: java.lang.UnsatisfiedLinkError: Cannot load library: (linker.c:1629, pid 32259) soinfo_link_image: could not load library "libsystem_server.so" needed by "libandroid_servers.so"; caused by (linker.c:1629, pid 32259) soinfo_link_image: could not load library "libsurfaceflinger.so" needed by "libsystem_server.so"; caused by (linker.c:709, pid 32259) load_library: library "libsurfaceflinger.so" not found

This patch also fixes almost all of the compiler warnings.

Change-Id: I64bb59aed6d4e039c15ea45be2367f319ef879f8

11 years agoMerge "When compiling with clang, don't "fortify_source" the strlcpy and strlcat."
Shih-wei Liao [Mon, 6 Aug 2012 18:02:19 +0000 (11:02 -0700)]
Merge "When compiling with clang, don't "fortify_source" the strlcpy and strlcat."

11 years agoWhen compiling with clang, don't "fortify_source" the strlcpy and
Shih-wei Liao [Mon, 6 Aug 2012 17:57:37 +0000 (10:57 -0700)]
When compiling with clang, don't "fortify_source" the strlcpy and
strlcat.

Change-Id: I91f58322f28e425ab9d22b51c23fcd6b772ede97

11 years agoMerge "Revert "Fix the clang build: this compiler doesn't support the gnu_inline...
Shih-wei Liao [Mon, 6 Aug 2012 17:05:14 +0000 (10:05 -0700)]
Merge "Revert "Fix the clang build: this compiler doesn't support the gnu_inline function attribute""

11 years agoMerge "When compiling with clang, don't "fortify_source" the strlen."
Shih-wei Liao [Mon, 6 Aug 2012 17:04:22 +0000 (10:04 -0700)]
Merge "When compiling with clang, don't "fortify_source" the strlen."

11 years agoWhen compiling with clang, don't "fortify_source" the strlen.
Shih-wei Liao [Mon, 6 Aug 2012 16:50:56 +0000 (09:50 -0700)]
When compiling with clang, don't "fortify_source" the strlen.

At this point, FORTIFY_SOURCE and clang are just plain incompatible.
Need to solve the underlying incompatibility first.

Change-Id: I3366477d19461e1ec93b1c30e0c7e8145b391b9b

11 years agoMerge "Remove an awkward #include that is no longer upstream."
Elliott Hughes [Mon, 6 Aug 2012 14:57:59 +0000 (07:57 -0700)]
Merge "Remove an awkward #include that is no longer upstream."

11 years agoRevert "Fix the clang build: this compiler doesn't support the gnu_inline function...
Shih-wei Liao [Sat, 4 Aug 2012 00:44:08 +0000 (17:44 -0700)]
Revert "Fix the clang build: this compiler doesn't support the gnu_inline function attribute"

This reverts commit 4f1f149c3757c594f9ff987e5ddd919c3e7dba10.

11 years agoMerge "Remove yet more SH4 cruft."
Elliott Hughes [Fri, 3 Aug 2012 22:05:15 +0000 (15:05 -0700)]
Merge "Remove yet more SH4 cruft."

11 years agoRemove yet more SH4 cruft.
Elliott Hughes [Fri, 3 Aug 2012 21:58:18 +0000 (14:58 -0700)]
Remove yet more SH4 cruft.

Surely this is the last piece?

Change-Id: I4bd43afb102334ec34d0e14a65c2b319826473d7

11 years agoMerge "bionic: modify syscall to use 6 registers to pass parameter."
Elliott Hughes [Fri, 3 Aug 2012 20:55:56 +0000 (13:55 -0700)]
Merge "bionic: modify syscall to use 6 registers to pass parameter."

11 years agobionic: modify syscall to use 6 registers to pass parameter.
Jin Wei [Thu, 12 Apr 2012 08:50:42 +0000 (16:50 +0800)]
bionic: modify syscall to use 6 registers to pass parameter.

Kernel allows to use 6 registers(exclude eax) to pass parameter.
But in syscall's implementation, it only uses five registers.
It will lead to error when 6 parameters passed.

Change-Id: I92d663194e6334c3847f0c0c257ca3b9dee0edef
Author: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Xiaokang Qin <xiaokang.qin@intel.com>
Signed-off-by: Beare, Bruce J <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 30838

11 years agoMerge "Upgrade to tzdata2012e."
Elliott Hughes [Fri, 3 Aug 2012 19:30:18 +0000 (12:30 -0700)]
Merge "Upgrade to tzdata2012e."

11 years agoUpgrade to tzdata2012e.
Elliott Hughes [Fri, 3 Aug 2012 19:26:06 +0000 (12:26 -0700)]
Upgrade to tzdata2012e.

Includes this change:

  * australasia (Pacific/Fakaofo): Tokelau is UTC+13, not UTC+14.
    (Thanks to Steffen Thorsen.)

Change-Id: I51bfab759f424b90daeb1960c6cfb2b55b78ff46

11 years agoMerge "Fix the clang build: this compiler doesn't support the gnu_inline function...
David Turner [Fri, 3 Aug 2012 11:40:36 +0000 (04:40 -0700)]
Merge "Fix the clang build: this compiler doesn't support the gnu_inline function attribute"

11 years agoFix the clang build: this compiler doesn't support the gnu_inline function attribute
Shih-wei Liao [Fri, 3 Aug 2012 11:20:06 +0000 (04:20 -0700)]
Fix the clang build: this compiler doesn't support the gnu_inline function attribute

Recent clang compiler doesn't have gnu_inline working. When frameworks/rs
is compiled with clang instead of gcc, it no longer works. Will be fixed
by this patch.

Change-Id: I8b281a1305151909e18958b73914ea27343cb4cd

11 years agoMerge "[MIPS] Support for TLS register"
Elliott Hughes [Fri, 3 Aug 2012 01:33:19 +0000 (18:33 -0700)]
Merge "[MIPS] Support for TLS register"

11 years agoRemove an awkward #include that is no longer upstream.
Elliott Hughes [Fri, 3 Aug 2012 01:12:36 +0000 (18:12 -0700)]
Remove an awkward #include that is no longer upstream.

This was causing trouble in https://android-review.googlesource.com/#/c/37590/.

Change-Id: Ib7cb4fbaef6e9c1470c59f67d24bd24c7ce90bcc

11 years agoMIPS support to sys/ headers
Raghu Gandham [Thu, 2 Aug 2012 23:50:10 +0000 (16:50 -0700)]
MIPS support to sys/ headers

Change-Id: I32207a1d918e4842da341f6b242ae39c69a83b03

11 years ago[MIPS] Support for TLS register
Raghu Gandham [Fri, 3 Aug 2012 00:47:37 +0000 (17:47 -0700)]
[MIPS] Support for TLS register

Change-Id: I6b5194e5e379b573e3b1203d8015e20fb3edd647
Signed-off-by: Chris Dearman <chris@mips.com>
11 years agoMerge "MIPS support for libc."
Elliott Hughes [Thu, 2 Aug 2012 23:14:47 +0000 (16:14 -0700)]
Merge "MIPS support for libc."

11 years agoMIPS support for libc.
Raghu Gandham [Thu, 26 Jul 2012 01:16:42 +0000 (18:16 -0700)]
MIPS support for libc.

Change-Id: I2864dea04b3faf2d919165dcaa600af5b16c41c8
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Raghu Gandham <raghu@mips.com>
11 years agoMerge "Fix a ENOTUP/ENOTSUP typo."
Elliott Hughes [Thu, 2 Aug 2012 22:46:43 +0000 (15:46 -0700)]
Merge "Fix a ENOTUP/ENOTSUP typo."

11 years agoFix a ENOTUP/ENOTSUP typo.
Elliott Hughes [Thu, 2 Aug 2012 22:45:04 +0000 (15:45 -0700)]
Fix a ENOTUP/ENOTSUP typo.

Change-Id: Ifa347a09a2aa1f505965ae7c1383fd0caf95793c

11 years agoMerge "Error numbers are target specific."
Elliott Hughes [Thu, 2 Aug 2012 22:42:48 +0000 (15:42 -0700)]
Merge "Error numbers are target specific."

11 years agoMerge "MIPS support to the linker"
Elliott Hughes [Thu, 2 Aug 2012 21:43:55 +0000 (14:43 -0700)]
Merge "MIPS support to the linker"

11 years agoMIPS support to the linker
Raghu Gandham [Tue, 31 Jul 2012 19:07:22 +0000 (12:07 -0700)]
MIPS support to the linker

Change-Id: I37ec2d6c51d82bb9e9dbfef4b38c85366bead255
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Raghu Gandham <raghu@mips.com>
Signed-off-by: Bhanu Chetlapalli <bhanu@mips.com>
11 years agoError numbers are target specific.
Chris Dearman [Sat, 28 Jan 2012 01:55:49 +0000 (17:55 -0800)]
Error numbers are target specific.

Use the system supplied error numbers when mapping error numbers to messages.

Change-Id: I520556fa3e2ff668fdc4eda36ad31491fbb48ea8
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Raghu Gandham <raghu@mips.com>
11 years agoMerge "Had include/arm/fenv.h, but missed include/mips/fenv.h."
Shih-wei Liao [Wed, 1 Aug 2012 03:54:18 +0000 (20:54 -0700)]
Merge "Had include/arm/fenv.h, but missed include/mips/fenv.h."

11 years agoMerge "Updated the cleaned header file mman.h for MIPS."
Elliott Hughes [Tue, 31 Jul 2012 22:16:07 +0000 (15:16 -0700)]
Merge "Updated the cleaned header file mman.h for MIPS."

11 years agoUpdated the cleaned header file mman.h for MIPS.
Raghu Gandham [Thu, 26 Jul 2012 01:16:42 +0000 (18:16 -0700)]
Updated the cleaned header file mman.h for MIPS.

Change-Id: I8b3734e535711ca07fbf4066e6d967d1ce0f30eb

11 years agoMerge "bionic: Stack pointer/signal race condition."
Elliott Hughes [Tue, 31 Jul 2012 17:32:58 +0000 (10:32 -0700)]
Merge "bionic: Stack pointer/signal race condition."

11 years agoMerge "fix __cxa_finalize() implementation to be thread safe."
Elliott Hughes [Tue, 31 Jul 2012 17:31:20 +0000 (10:31 -0700)]
Merge "fix __cxa_finalize() implementation to be thread safe."

11 years agofix __cxa_finalize() implementation to be thread safe.
Srinavasa Nagaraju [Tue, 28 Feb 2012 03:08:22 +0000 (12:08 +0900)]
fix __cxa_finalize() implementation to be thread safe.

__cxa_finalize() modifies the access permissions of __atexit
global variable without acquiring  _ATEXIT_LOCK(). Fix it prevent
any possible races.

Change-Id: I11939d0ebcbf6f360c14163222d40a449d96948e

11 years agoAdd a .note.android.ident section to Android ELF binaries.
Michael Hope [Tue, 31 Jul 2012 04:18:22 +0000 (16:18 +1200)]
Add a .note.android.ident section to Android ELF binaries.

This allows debugging tools to know they are working with Android
binaries and adapt accordingly.

Signed-off-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Signed-off-by: Michael Hope <michael.hope@linaro.org>
Change-Id: Ic906992fcad61c028bb765821637a3e1333bf52b

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 agobionic: Stack pointer/signal race condition.
Peter Enderborg [Mon, 9 Jul 2012 14:17:17 +0000 (16:17 +0200)]
bionic: Stack pointer/signal race condition.

Move the stackpointer so a captured signal does not corrupt
stack variables needed for __thread_entry.

Change-Id: I3e1e7b94a6d7cd3a07081f849043262743aa8064

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()