Commit Graph

10192 Commits

Author SHA1 Message Date
Dmitriy Ivanov
f947be2889 Revert "Fix symbol lookup order during relocation"
This reverts commit 976402cca1.

Bug: 18222321
Bug: 18211780
Change-Id: Iafdd3d843db7b1cf288be9a0232022816622c944
2014-11-03 22:15:08 -08:00
Dmitriy Ivanov
494bee796a Revert "Fix arm64 and arm builds."
This reverts commit 445111a1c9.

Bug: 18222321
Bug: 18211780
Change-Id: I4fa9e1b63ec9b528f8bfed73c2ec15046c43a2fe
2014-11-03 22:14:19 -08:00
Elliott Hughes
d18f4b2578 Ensure we initialize stdin/stdout/stderr's recursive mutexes.
(cherry-pick of 6a03abcfd23f31d1df06eb0059830e22621282bb.)

Bug: 18208568
Change-Id: I9da16ce0f9375bc363d1d02be706d73fd3b1e150
2014-11-03 13:46:41 -08:00
Dmitriy Ivanov
445111a1c9 Fix arm64 and arm builds.
Bug: 18186310

(cherry picked from commit 4e446b19d8)

Change-Id: Ibc77a9ade36dc6b9bf5a316b5ab9ae5f0a70e826
2014-10-31 19:29:04 -07:00
Dmitriy Ivanov
976402cca1 Fix symbol lookup order during relocation
Relocate symbol against DF_1_GLOBAL shared libraries
  loaded before this shared library. This includes
  main executable, ld_preloads and other libraries
  that have DF_1_GLOBAL flag set.

Bug: 2643900
Bug: 15432753
Bug: 18186310

(cherry picked from commit d225a5e652)

Change-Id: I4e889cdf2dfbf8230b0790053d311ee6b0d0ee2d
2014-10-31 17:10:30 -07:00
Dmitriy Ivanov
bf3d5ef5fd Fix mips build
Bug: 18186310

(cherry picked from commit 90b74fb867)

Change-Id: I8d4ed254e5c421b65b62c401abdb1ee07e5dc3b2
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
6442dbd3bc Remove unnecessary lookups during relocations
local_group includes this library and its dependencies.

Bug: 18186310

(cherry picked from commit e47b3f8456)

Change-Id: I93c2d873e924df7319569307444bf603d7d27bf0
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
fd2747bb58 Fix relocation to look for symbols in local group
The local group is a sequence of libraries in default (breadth-first)
  order. It allows RTLD_LOCALLY loaded library to correctly relocate
  symbols within its group (see test-cases).

  Local group lookup is performed after main executable and ld_preloads.

Bug: 2643900
Bug: 15432753
Bug: 18186310

(cherry picked from commit cfa97f172d)

Change-Id: I5fa8c673f929e4652c738912c7ae078d7ec286d2
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
4d0c1f673f Correct way to specify additional dependencies
Previous one was not covering all the targets

Bug: 17548097
Bug: 18186310

(cherry picked from commit 4a9e1937c5)

Change-Id: I2cd9e58893555d16cbfe291b2d1279621489d5ad
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
382e06ce8e Add dlfcn_test to glibc test suite.
Bug: 18186310

(cherry picked from commit eb27bbae8f)

Change-Id: I1d608dfa12dbafbdcdb8bc6d818c5872404c19e0
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
e4bc6f026a Ignore DT_BIND_NOW (0x18)
Bug: 18186310
Bug: 17552334

(cherry picked from commit ea6eae182a)

Change-Id: I07d6f6fbb462fea329581d0da02f6d88be1c262f
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
1d3e81a9e7 Resolve "unused DT entry" warnings for x86_64
Bug: 18186310

(cherry picked from commit 513e29e16f)

Change-Id: I1e4c5af2cdc09dc978c7a78fcdcf8796c919751e
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
c87f65d2cd Add RTLD_NODELETE flag support
Bug: 18186310
Bug: https://code.google.com/p/android/issues/detail?id=64069

(cherry picked from commit 1b20dafdbe)

Change-Id: Ic02eec22a7c322ece65eb40730a3404f611526b1
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
210ff1b27b Fix mips build
Bug: 18186310

(cherry picked from commit ecf532fa1c)

Change-Id: Ia12f2fa28c8cd3204eb7d6b4c7d872f4e81fb8ef
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
0f47d9c1ce Fix unused DT entry warnings.
DT_STRSZ Implement strtab boundary checks
 DT_FLAGS_1 Warn if flags other than DF_1_NOW|DF_1_GLOBAL are set

Bug: 17552334
Bug: 18186310

(cherry picked from commit 6cdeb5234d)

Change-Id: I7ffc7bc600798308a77ad949a644949b64250ae2
2014-10-31 17:03:59 -07:00
Dmitriy Ivanov
f90e21004e Return has_DT_SYMBOLIC flag.
This reverts commit 8f61d99183

 Despite the fact that static linker does all the work while linking
 -Bsymbolic executables, according to the SCO doc following DT_SYMBOLIC
 and DF_SYMBOLIC flags is still a requirement for the dynamic linker
 as well.

 (see http://www.sco.com/developers/gabi/2012-12-31/ch5.dynamic.html)

Bug: 18186310

(cherry picked from commit 96bc37f2e1)

Change-Id: Ie217be4f3305d877066e4cfe91975ae1c7768330
2014-10-31 17:03:59 -07:00
Elliott Hughes
748fbe5c41 Fix a couple more cases of missing CLOEXEC.
The debuggerd case can probably never happen, because you're crashing at this
point anyway. The system property one seems possible though.

Bug: 18186310

(cherry picked from commit 0dc39f9952)

Change-Id: I3e84488fc246f6c28cbd82e96d0cd4343a12c28a
2014-10-31 17:03:21 -07:00
Dmitriy Ivanov
d5eb10875a Temporary disable DL_WARNs for unused DT_*
Bug: 17552334
Bug: 18186310

(cherry picked from commit 1b77423eff)

Change-Id: I8a9d05195a862bc287fff7156913606f0311b8bb
2014-10-31 17:02:14 -07:00
Dmitriy Ivanov
09608848ed Fix 64bit build
Bug: 18186310

(cherry picked from commit f240aa8089)

Change-Id: Id46f1f9be90a17a58fb44d3540095c8c685c9726
2014-10-31 17:02:14 -07:00
Dmitriy Ivanov
634a045c5c Fix some unused DT_ warnings
* DT_PLTGOT - ignored for non-mips
 * DT_RELCOUNT/RELACOUNT - ignored
 * DT_RELENT/RELAENT - sanity checks
 * DT_SYMENT - sanity check
 * DT_SONAME - ignore for now.

Bug: 18186310

(cherry picked from commit 4a6e9a835a)

Change-Id: Ib40095f0770d65628fc7abac5a471378de35ebe7
2014-10-31 17:02:14 -07:00
Dmitriy Ivanov
b364d95380 Remove has_DT_SYMBOLIC flag
From the elf-spec: "Symbolically bound shared objects are
  identified by the .dynamic entry DT_SYMBOLIC. This tag is
  informational only; the runtime linker processes symbol
  lookups from these objects in the same manner as any
  other object."

Bug: 18186310

(cherry picked from commit 8f61d99183)

Change-Id: I37024799ac8d1837993c8ae78780a448bedd6539
2014-10-31 17:02:13 -07:00
Dmitriy Ivanov
c85e82dde5 Fix dlsym() to take into account RTLD_GLOBAL/LOCAL
Symbols from libraries opened with RTLD_LOCAL (default)
  should not be visible via dlsym(RLTD_DEFAULT/RTLD_NEXT, .)

Bug: 17512583
Bug: 18186310

(cherry picked from commit e8ba50fe0d)

Change-Id: Idf6bbe2233fb2bfc0c88677e7d1fc518fb3f7a8b
2014-10-31 17:02:13 -07:00
Dmitriy Ivanov
926797a8a9 Reformatting
No functional changes.

Bug: 18186310

(cherry picked from commit 6abf624d12)]

Change-Id: I0acf52d8ee7fe2d4f44bc832cbe9fabe1782f03f
2014-10-31 17:02:13 -07:00
Dan Albert
653263a964 Only use <atomic> for C++11 and newer.
Any pre-C++11 clients of stdatomic.h that use libc++ are being forced
over to <atomic>, which they don't have the language support to use.

Bug:17736764

Change-Id: I62445c1f2541410a1569498c09433c7196635537
(cherry picked from commit 3ce0769aa5)
2014-10-30 13:22:34 -07:00
Elliott Hughes
b0693ec582 Merge changes I0feda6b2,I22d13fde,I49d7d09d,Ice490bfe into lmp-mr1-dev
* changes:
  Fix the type of u_ar0 in <sys/user.h>.
  Add greg_t for arm64.
  POSIX says <signal.h> gets you ucontext_t.
  Add in_port_t and move it and in_addr_t to the correct header file.
2014-10-29 23:22:30 +00:00
Elliott Hughes
0c4e98adbe Fix the type of u_ar0 in <sys/user.h>.
(cherry picked from commit e03950fa0c)

Bug: 18172268
Change-Id: I0feda6b253882f68f47bcf30fad998286cc7f620
2014-10-29 11:57:36 -07:00
Elliott Hughes
d0fb6a2940 Add greg_t for arm64.
This was already present for the other architectures. I think we skipped
this because glibc seems to have an incorrect definition (int rather than
long), but the kernel has the sane definition (just not in a uapi header).

(cherry picked from commit 8e4d371091)

Bug: 18172268
Change-Id: I22d13fdeb6431ea122dd028a229782dcaf2286b2
2014-10-29 11:56:59 -07:00
Elliott Hughes
ab4d5cf242 POSIX says <signal.h> gets you ucontext_t.
POSIX also says that ucontext_t's uc_sigmask has type sigset_t.

MIPS64 strace needs this.

The #define is to keep chromium off our lawn; otherwise it tries to redefine
all this stuff itself. We should probably clean that up and remove the #define.

(cherry picked from commit 26a8eb50a8)

Bug: 18172268
Change-Id: I49d7d09dabfc6c6926a8e1f4b235d041e2f2fc4d
2014-10-29 11:55:02 -07:00
Elliott Hughes
eedbf70e8e Add in_port_t and move it and in_addr_t to the correct header file.
No one's reported this, but I saw it in an Android port of fuser(1).

We still have lots of problems in our network headers because we
get most of the structs direct from the kernel, and it doesn't use
types like this (which is why we've got away without this one for
so long). One day we should probably look at cleaning that up, but
doing so can wait.

(cherry picked from commit 35d226e05d)

Bug: 18172268
Change-Id: Ice490bfe84afb04722d738128053d4c533b8a664
2014-10-29 11:49:45 -07:00
Christopher Ferris
98d57c95bc Add stpcpy assembler version.
For generic, continue to use the C version of the code.

Bug: 13746695

(cherry picked from commit 7d849ac378)

Change-Id: Iae44785f37f9bb59103ab78fb9f74c92f8a95c7f
2014-10-29 11:07:03 -07:00
Christopher Ferris
1c8ea807eb Cleanup arm assembly.
Remove the old arm directives.
Change the non-local labels to .L labels.
Add cfi directives to strcpy.S.

Bug: 18157900

(cherry picked from commit c8bd2abab2)

Change-Id: Ifa1c3d16553d142eaa0d744af040f0352538106c
2014-10-28 18:19:33 -07:00
Christopher Ferris
0cc59dd303 Add __memcpy_chk assembly for 64 bit.
Bug: 17623887

(cherry picked from commit 8cf61dab5f)

Change-Id: I91e66ca0c26f04b50308059f9c89d388d55f6e3a
2014-10-28 16:18:47 -07:00
Elliott Hughes
86d16a053e Clean up the architecture-specific makefiles.
Group things appropriately and name each group.

Bug: 18160821

(cherry picked from commit 7c02d9428c)

Change-Id: I863242515af44058154d03e2d8c34678e682d66a
2014-10-28 15:13:36 -07:00
Elliott Hughes
b378c27226 No arm source refers to SOFTFLOAT.
So why bother #defining it?

Bug: 18160821

(cherry picked from commit b1a6c319c4)

Change-Id: I9cd9c144ba7071fddda12fa16d1232ad861b66be
2014-10-28 15:13:04 -07:00
Elliott Hughes
22e2c9d963 Fix mips signed/unsigned signal_test.cpp build breakage.
(cherry picked from commit aa13e839f0)

Bug: 17436734
Change-Id: I167fc5d74c49cca7031c5739bc53fdf3bde71887
2014-10-28 14:02:10 -07:00
Christopher Ferris
43dc3a9aae Remove the unnecessary generic-neon code.
Bug: 18156619
(cherry picked from commit 2169e17482)

Change-Id: I4a7f5bb9ad4c27b274f3a3c86c1617ca0578b98f
2014-10-28 12:07:25 -07:00
Elliott Hughes
1ea31a2901 Merge "Don't mask out SA_RESTORER from sa_flags." into lmp-mr1-dev 2014-10-28 15:36:56 +00:00
Elliott Hughes
cd99bbfd50 Merge "Disable tzdata in $ANDROID_DATA." into lmp-mr1-dev 2014-10-28 15:06:31 +00:00
Elliott Hughes
28ea229bb2 Don't mask out SA_RESTORER from sa_flags.
glibc doesn't do this, and we probably shouldn't either.

Bug: 16703540
Bug: 17436734

(cherry picked from commit afe58ad989)

Change-Id: Iada5d0ae814f438cb276f056b2b5e3675f0e3666
2014-10-28 07:55:53 -07:00
Pavel Chupin
8eb8c39299 [x86,x86_64] Fix libgcc unwinding through signal
This change provides __restore/__restore_rt on x86 and __restore_rt on
x86_64 with unwinding information to be able to unwind through signal
frame via libgcc provided unwinding interface. See comments inlined for
more details.

Also remove the test that had a dependency on
__attribute__((cleanup(foo_cleanup))). It doesn't provide us with any
better test coverage than we have from the newer tests, and it doesn't
work well across a variety architectures (presumably because no one uses
this attribute in the real world).

Tested this on host via bionic-unit-tests-run-on-host on both x86 and
x86-64.

Bug: 17436734
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>

(cherry picked from commit 50321e2e66)

Change-Id: Iba90e36958b00c7cc7db5eeebf888dc89ce4d619
2014-10-27 16:42:49 -07:00
Elliott Hughes
190dce9e56 Stack unwinding unit tests.
Bug: 17436734

(cherry picked from commit bee1993a14)

Change-Id: I7205a862ba2c3b474e287f5e9c8982cef4610af9
2014-10-27 16:42:37 -07:00
Elliott Hughes
e5e61a0a92 Use the kernel's sa_restorer for aarch64.
gdb was happy with what we had, but libgcc and libunwind weren't.
libgcc is happy with the kernel's restorer (because of the extra nop),
though libunwind looks like it's going to need code changes regardless.

We could make our restorer more like the kernel's one, but why bother
when we can just let the kernel supply the canonical one?

Bug: 17436734

(cherry picked from commit 1cff9a8964)

Change-Id: Ie13d73fd97395e1979a67c2294e036a97c50000d
2014-10-27 16:42:19 -07:00
Elliott Hughes
5054e1a121 Fix 32-bit arm unwinding through signal frames.
gdb was already okay; libgcc and libunwind need a little extra help.

Bug: 17436734

(cherry picked from commit 148dff3ec6)

Change-Id: I2cc997017acc57c930284af5264f353656b98c7b
2014-10-27 16:41:56 -07:00
Elliott Hughes
7dc2b7b30d Fix signal trampolines.
* LP32 should use sa_restorer too. gdb expects this, and future (>= 3.15) x86
  kernels will apparently stop supporting the case where SA_RESTORER isn't
  set.

* gdb and libunwind care about the exact instruction sequences, so we need to
  modify the code slightly in a few cases to match what they're looking for.

* gdb also cares about the exact function names (for some architectures),
  so we need to use __restore and __restore_rt rather than __sigreturn and
  __rt_sigreturn.

* It's possible that we don't have a VDSO; dl_iterate_phdr shouldn't assume
  that getauxval(AT_SYSINFO_EHDR) will return a non-null pointer.

This fixes unwinding through a signal handler in gdb for all architectures.
It doesn't fix libunwind for arm and arm64. I'll keep investigating that...

(cherry picked from commit 36f451a6d9)

Bug: 17436734
Change-Id: Ic1ea1184db6655c5d96180dc07bcc09628e647cb
2014-10-27 16:41:28 -07:00
Elliott Hughes
4c30130a21 Disable tzdata in $ANDROID_DATA.
Bug: 18139284
Change-Id: I2670dc1791d635139a5d39a438dc08777439476b
2014-10-27 13:38:21 -07:00
Elliott Hughes
aa6cd5819c Use mxcr_mask instead of mxcsr_mask to match glibc.
Bug: 18097559

(cherry picked from commit f485547b92)

Change-Id: I242105faa8210abc9635a951b25b127cd64ed23c
2014-10-24 08:43:34 -07:00
Elliott Hughes
8fab8119dd Update bionic to tzdata2014i.
From the release notes:

   Changes affecting future time stamps

     Pacific/Fiji will observe DST from 2014-11-02 02:00 to
     2015-01-18 03:00.  (Thanks to Ken Rylander for the heads-up.)
     Guess that future years will use a similar pattern.

     A new Zone Pacific/Bougainville, for the part of Papua New
     Guinea that plans to switch from UTC+10 to UTC+11 on
     2014-12-28 at 02:00.  (Thanks to Kiley Walbom for the
     heads-up.)

   Changes affecting time zone abbreviations

     Since Belarus is not changing its clocks even though Moscow
     is, the time zone abbreviation in Europe/Minsk is changing
     from FET to its more-traditional value MSK on 2014-10-26 at
     01:00.  (Thanks to Alexander Bokovoy for the heads-up about
     Belarus.)

     The new abbreviation IDT stands for the pre-1976 use of UT+8
     in Indochina, to distinguish it better from ICT (UT+7).

   Changes affecting past time stamps

     Many time stamps have been corrected for Asia/Ho_Chi_Minh
     before 1976 (thanks to Trần Ngọc Quân for an indirect pointer
     to Trần Tiến Bình's authoritative book).  Asia/Ho_Chi_Minh has
     been added to zone1970.tab, to give tzselect users in Vietnam
     two choices, since north and south Vietnam disagreed after our
     1970 cutoff.

     Asia/Phnom_Penh and Asia/Vientiane have been turned into
     links, as they differed from existing zones only for older
     time stamps.  As usual, these changes affect pre-1970 time
     stamps only.  Their old contents have been moved to the
     'backzone' file.

Bug: 18085936

(cherry picked from commit a05c2a2a70)

Change-Id: If0253cc1515e1bc98e99c6e24eec797836ca7c27
2014-10-22 13:45:25 -07:00
Christopher Ferris
82eeec689f Merge "Fix generic __memcpy_chk implementation." into lmp-mr1-dev 2014-10-22 20:16:18 +00:00
Christopher Ferris
9b7b0d82eb Merge "Fix race condition in timer disarm/delete." into lmp-mr1-dev 2014-10-22 19:43:44 +00:00
Christopher Ferris
f13e1eb92f Fix generic __memcpy_chk implementation.
- Clean up the labels (add .L to make them local).
- Change to using cfi directives.
- Fix unwinding of the __memcpy_chk fail path.

Bug: 18033671

(cherry pick from commit 7123d4371a)

Change-Id: Ife93bcbfc1949ef29fc8e2dc515b7120632b82b1
2014-10-22 12:02:13 -07:00