* In Android 14, This library got listed on /vendor/etc/linker.config.pb,
which is duplicated with /system/etc/linker.config.pb, as a result
linkerconfig fails and stops the entire system from booting.
[ 5.840677] DEBUG: Abort message: 'duplicate: libstdc++.so is provided by default and system in [vendor]'
Change-Id: Ib6eee48de87100c2fb0dd765d57ee95d3159c4ef
Signed-off-by: zlewchan <zlewchan@icloud.com>
A lot of blobs still link this even on 8.1, so allow
devices to build a vendor copy of it.
Change-Id: I2349478ec0507e3a5136fe89f15e7dc4bfc1a03e
Signed-off-by: zlewchan <zlewchan@icloud.com>
Author: Christopher R. Palmer <crpalmer@gmail.com>
Date: Tue Nov 3 16:44:44 2015 -0500
linker: Add support for dynamic "shim" libs
Add a new environment variable
LD_SHIM_LIBS
that is a colon (":") separated list of vertical bar ("|") separated pairs.
The pairs are the name for a soinfo reference (executable or shared library)
followed by the name of the shim library to load. For example:
LD_SHIM_LIBS=rmt_storage|libshim_ioprio.so:/system/lib/libicuuv.so|libshim_icu53.so
will instruct the linker to load the dynamic library libshim_ioprio.so
whenver rmt_storage is executed [*] and will load libshim_icu53.so whenever
any executable or other shared library links against /system/lib/libicuuv.so.
There are no restrictions against circular references. In this example,
libshim_icu53.so can link against libicuuv.so which provides a simple and
convenient means of adding compatibility symbols.
[*] Note that the absolute path is not available to the linker and therefore
using the name of executables does depend on the invocation and therefore
should only be used if absolutely necessary. That is, running
/system/bin/rmt_storage would not load any shim libs in this example because
it does not match the name of the invocation of the command.
If you have trouble determining the sonames being loaded, you can also set
the environment variable LD_DEBUG=1 which will cause additional information
to be logged to help trace the detection of the shim libs.
Change-Id: I0ef80fa466167f7bcb7dac90842bef1c3cf879b6
Author: Christopher R. Palmer <crpalmer@gmail.com>
Date: Sun Nov 15 14:26:32 2015 -0500
linker: Fix the fact that shim libs do not properly call constructors
Change-Id: I34333e13443a154e675b853fa41442351bc4243a
Author: Christopher R. Palmer <crpalmer@gmail.com>
Date: Tue Dec 1 07:10:36 2015 -0500
linker: Don't try to walk the g_active_shim_libs when doing dlsym
This is a bug in the original shim_lib implementation which was
doing the shim lib resolution both when loading the libraries
and when doing the dynamic symbol resolution.
Change-Id: Ib2df0498cf551b3bbd37d7c351410b9908eb1795
Author: Christopher R. Palmer <crpalmer@gmail.com>
Date: Sun Nov 29 08:28:10 2015 -0500
linker: Reset the active shim libs each time we do a dlopen
We use the active libs to avoid recursively trying to load the
same library:
A -> shimlibs add B -> depends on A -> shimlibs add B -> ...
However, when we repeatedly dlopen the same library we need
to reset the active shim libs to avoid failing to add B the
second time we dlopen A.
Change-Id: I27580e3d6a53858e8bca025d6c85f981cffbea06
Author: Danny Baumann <dannybaumann@web.de>
Date: Fri Dec 11 10:29:16 2015 +0100
Make shim lib load failure non-fatal.
Instead, print an appropriate warning message. Aborting symbol
resolution on shim lib load failure leads to weird symbol lookup
failures, because symbols in libraries referenced after the one loading
the shim won't be loaded anymore without a log message stating why that
happened.
Change-Id: Ic3ad7095ddae7ea1039cb6a18603d5cde8a16143
Author: Christopher R. Palmer <crpalmer@gmail.com>
Date: Sat Dec 12 06:10:09 2015 -0500
bionic: Do not allow LD_SHIM_LIBS for setuid executables
That's really not safe...
Change-Id: If79af951830966fc21812cd0f60a8998a752a941
Author: Christopher R. Palmer <crpalmer@gmail.com>
Date: Sun Feb 14 11:38:44 2016 -0500
bionic: linker: Load shim libs *before* the self-linked libs
By loading them earlier, this allows us to override a symbol in
a library that is being directly linked.
I believe this explains why some people have had problems shimming
one lib but when the changet he shim to be against a different
lib it magically works.
It also makes it possible to override some symbols that were
nearly impossible to override before this change. For example, it is
pretty much impossible to override a symbol in libutils without
this change because it's loaded almost everywhere so no matter
where you try to place the shimming, it will be too late and
the other symbol will have priority.
In particularly, this is necessary to be able to correctly
shim the VectorImpl symbols for dlx.
Change-Id: I461ca416bc288e28035352da00fde5f34f8d9ffa
Author: Chirayu Desai <chirayudesai1@gmail.com>
Date: Thu Aug 25 19:02:41 2016 +0530
linker: Update find_library call for shimlibs
commits 0cdef7e7f3
"Respect caller DT_RUNPATH in dlopen()."
and 42d5fcb9f4
"Introducing linker namespaces"
added new arguments to find_library, add them here.
Change-Id: I8f35a45b00d14f8b2ce01a0a96d2dc7759be04a6
Author: Chippa-a <vusal1372@gmail.com>
Date: Sat Aug 27 14:56:30 2016 +0200
linker: Update LD_SHIM_LIBS parser function
* Upgrade the code using the same changes as
42d5fcb9f4bda20e78f0
Change-Id: Ic8be0871945bd9feccd0f94a6770f3cc78a70a0f
Author: Danny Baumann <dannybaumann@web.de>
Date: Wed Sep 7 16:54:06 2016 +0200
Inject shim libs as if they were DT_NEEDED.
The previous separate approach had one flaw: If the shim lib requires
another lib that's already loaded, find_library_internal() would return
the previously loaded copy, but the later load action would fail as the
ELF reader map of the initial loading round was already discarded and
thus a new ElfReader instance for the soinfo instance was created, which
didn't know about the previous reading/loading state.
Change-Id: Ib224dbd35d114197097e3dee14a077cc9130fedb
Author: jrior001 <jriordan001@gmail.com>
Date: Fri Oct 7 19:36:51 2016 -0400
linker: load shims prior to DT_NEEDED check
This allows shims to override existing symbols, not just
inject new symbols.
Change-Id: Ib9216bcc651d8d38999c593babb94d76dc1dbc95
Author: Adrian DC <radian.dc@gmail.com>
Date: Sat, 8 Apr 2017 22:40:01 +0200
* Adapt to latest AOSP Oreo bionic linker changes
* Additional header to avoid unused function
Change-Id: Ib9216bcc651d8d38999c593babb94d76dc1dbc95
Author: Paul Keith <javelinanddart@gmail.com>
Date: Thu Feb 15 21:57:33 2018 +0100
linker: Move shims to TARGET_LD_SHIM_LIBS
* To reduce security exposure, let's set this at compile time,
and block off all the code unless the board flag is set
Change-Id: Ieec5f5d9e0f39a798fd48eae037ecffe9502474c
Author: Nich <nctrenco@gmail.com>
Date: Fri Jun 8 09:48:17 2018 +0800
linker: Provide soinfo path of the shimmed binary
This is a forward port of part of the original change that was missed out
since the initial port of the shim logic to O.
Change-Id: I1f7ff98472cfef5cb2d2bcb303082784898cd0c6
Author: Nich <nctrenco@gmail.com>
Date: Tue Jun 5 13:36:43 2018 +0800
linker: Remove unused find_libraries declaration
commit "Inject shim libs as if they were DT_NEEDED." removed references
to the forward declaration.
Change-Id: I5f1aaa3a96f2af3edef07d4ea4e204b586424631
Author: Nich <nctrenco@gmail.com>
Date: Sun Jun 10 00:45:51 2018 +0800
linker: Make shim reference path absolute
This way, we can filter out non-existent binaries, and ensure we get
its absolute path before matching with get_realpath(). This for one
allows the use of symlinks in TARGET_LD_SHIM_LIBS.
Change-Id: I823815271b3257965534b6b87d8ea36ffb68bc08
Author: Nich <nctrenco@gmail.com>
Date: Fri Jun 15 03:59:05 2018 +0800
linker: Ensure active matching pairs
Change-Id: I54c666b4560dbfb40839b0bf9132a7fd8d3ed2dd
Author: Nich <nctrenco@gmail.com>
Date: Thu Jun 21 01:58:10 2018 +0800
linker: Don't involve shim in for_each_dt_needed
for_each_dt_needed may have other usages that shouldn't involve the
shim, for example, in the unloading of soinfos.
Change-Id: Id38de183d90c3f707767bdca032a5ea2bc82fde8
Author: Jiyong Park <jiyong@google.com>
Date: Fri Jan 25 18:18:01 2019 +0900
Call realpath(3) only when the path is accessible for read
Suppress the SELinux denial log spam by not calling realpath(3) when the
path does not exist or is not accessible for read, and then not auditing
access(2) failure.
Change-Id: I729ecb8ea0bb581069eb849bae7cd28e6ab636cc
Change-Id: Ic3ad7095ddae7ea1039cb6a18603d5cde8a16152
Signed-off-by: Wang Han <416810799@qq.com>
Several obfuscation libraries do not work with ThinLTO optimized bionic
linker. Given we switched on the optimization late in the 24Q3 (V)
release cycle, apply the local opt-out to avoid breaking the apps.
This workaround will be removed in the following Android release.
Test: manual
Bug: 352456802
(cherry picked from https://android-review.googlesource.com/q/commit:aede6ea8d39868c7bf358ee8ee4208a6431d5f57)
Merged-In: Ib3902b7985acce8f1c021c230b67aea821ee8dd2
Change-Id: Ib3902b7985acce8f1c021c230b67aea821ee8dd2
untag_memory didn't correctly handle the case where from = to, and would
always untag the first byte.
not changing the assembly for now to make this more obvious for
cherry-picking purposes.
Test: atest bionic-unit-tests-static
Bug: 348142687
(cherry picked from https://android-review.googlesource.com/q/commit:6b174efa140304f857547e3058baff445dd2f17f)
Merged-In: I47c635897e0b50bbe4367a869d9b53fa45be0dc0
Change-Id: I47c635897e0b50bbe4367a869d9b53fa45be0dc0
am skip reason: Merged-In Ia375c29d18e31e646b795e643534f0be07d382b9 with SHA-1 82b033271d is already in history
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3118835
Change-Id: Icadfe6e3f372055cf53c76d32ce9724d4620128a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Cast the constant (which should probably be unsigned in the kernel headers, but isn't), rather than the already [correctly] unsigned expression involving `c_cflag`.
This came up when there was a suggestion on the linux-api mailing list [https://lore.kernel.org/linux-api/be31d737-8263-4e59-8b30-7221ee0549fc@cs.ucla.edu/T/#mdd466d7eaefe8805de7b0cecf013c5cddb04c660] to maybe change the signedness of the constants; this was the only build breakage that would result in AOSP from doing so.
Change-Id: I64aeee0a8f5d2edd54a9a9352b1aa2b9e3aa245e
Similar to mmap(), this confuses me every time I look at it. Move it out
of the way, and make it clearer that this is just junk that can be
deleted when we remove 32-bit support.
Also improve coverage by adding a test for the varargs special case.
Test: treehugger
Merged-in: Ia375c29d18e31e646b795e643534f0be07d382b9
Change-Id: Ia375c29d18e31e646b795e643534f0be07d382b9
Similar to mmap(), this confuses me every time I look at it. Move it out
of the way, and make it clearer that this is just junk that can be
deleted when we remove 32-bit support.
Also improve coverage by adding a test for the varargs special case.
Ignore-AOSP-First: work around the lack of an ABI 35 dump in AOSP
Test: treehugger
Change-Id: Ia375c29d18e31e646b795e643534f0be07d382b9
Also group all the RELR/arm64/riscv64 bits together rather than mixing them up slightly as we'd done so far.
Change-Id: Iff1ea2cfca9ff702b88aa2e7d09db46e2f34f965
Fail to compile bionic/tests/complex_test.cpp when updating compiler due
to the conflict.
Bug: b/346349678
Test: change the clang version and then run mm to build
Change-Id: Ic22b7325b6e52006e620e13944f3f1d76030d782