Commit graph

40 commits

Author SHA1 Message Date
Jiyong Park
612210c75b Mark as recovery_available: true
Libraries that are direct or indirect dependencies of modules installed
to recovery partition (e.g. toybox) are marked as recovery_available:
true. This allows a recovery variant of the lib is created when it is
depended by other recovery or recovery_available modules.

Bug: 67916654
Bug: 64960723
Test: m -j
Change-Id: Ie59155c08890e96ce1893fa3687afcf763d7aea3
2018-05-15 09:47:04 +09:00
Logan Chien
25b742c627 libctuils: Exclude qtaguid.cpp from VNDK-SP variant
This commit excludes `qtaguid.cpp` from the VNDK-SP variant of
`libcutils.so` because the interface of `libnetd_client.so` may vary
between AOSP releases.

Besides, these functions don't work in vendor processes either because
VNDK-SP libraries are loaded in an isolated `vndk` linker namespace,
which cannot access `/system/lib[64]/libnetd_client.so` directly.  This
change makes it easier to spot the issue at build time and saves several
bytes.

Test: Build aosp_walleye-userdebug and
/system/lib[64]/vndk-sp-$VER/libctuils.so no longer exports qtaguid_*
functions.

Bug: 79329469
Change-Id: Idf6b60f6e58371ea320193641669d1e4412d62b8
2018-05-08 17:41:21 +08:00
Elliott Hughes
9f49508f36 Rewrite get_sched_policy_name for safety.
This way you'll get a build time error if you make the usual mistake of
adding to the enum but not adding an entry to the array.

Also improve the unit tests, and fix get_sched_policy_name's incorrect
behavior on invalid inputs.

Bug: N/A
Test: ran tests
Change-Id: Iefcb1ec9ef66267837da7a576c8be3d0cfb16cd0
2018-04-25 14:55:48 -07:00
Steven Moreland
e1c834db04 Use override_export_include_dirs.
Bug: 62878521
Test: soong build system finds renamed attribute
Change-Id: I51e42f4378db366b8711cd373fb835fecda88416
2018-01-05 14:42:12 -08:00
Jeff Sharkey
53d37ba23f Better, consistent definition of AID_SHARED_GID.
AID_SHARED_GID is a GID shared by a specific app across all users on
the same device.  Bring the UserHandle and multiuser.c implementations
into agreement, and copy/paste the unit tests that verify that both
behave identically.

This fixes a regression where multiuser_get_shared_gid() was applying
per-user isolation when it shouldn't have.

Test: adb shell /data/nativetest64/libcutils_test/libcutils_test64
Bug: 34151068, 64548938
Change-Id: I491dd79d23a214425a68865d1d0f8269916aad4c
2017-11-13 16:49:26 -07:00
Elliott Hughes
1412f5ffe3 Remove dead dlmalloc stubs.
Used to be used by ART, but long gone.

Bug: N/A
Test: ran tests
Change-Id: Id231d97b2b797562619e6fd90536b17dbe39f71e
2017-11-10 16:24:18 -08:00
Elliott Hughes
8e9aeb9053 Move libcutils source to C++.
Just the minimial changes to get this to actually build, because otherwise
we always bog down trying to rewrite everything (when the real answer
is usually "stop using libcutils, it's awful").

This doesn't move a handful of files: two are basically just BSD libc
source, a couple have outstanding code reviews, and one can be deleted
(but I'll do that in a separate change).

I'm also skipping the presubmit hooks because otherwise clang-format
wants to reformat everything. I'll follow up with that...

Bug: N/A
Test: builds
Change-Id: I06403f465b67c8e493bad466dd76b1151eed5993
2017-11-10 13:18:10 -08:00
Treehugger Robot
6707ef139d Merge changes from topic "qtaguidReplace"
* changes:
  Redirect qtaguid native call to netd fwmark client
  Move qtaguid API out of libcutils
2017-11-10 18:34:36 +00:00
Chenbo Feng
baede73bd9 Redirect qtaguid native call to netd fwmark client
In order to replace qtaguid module with new eBPF network monitoring
module. We firstly move the current qtaguid userspace implementation
into netd and hide the detail from other processes. The current API will
talk to netd fwmark client to pass down the qtaguid related request from
high level framework and netd will use the proper method to complete the
request.

Test: Current TrafficStats CTS tests should not fail.
Bug: 30950746
Change-Id: Ie90c28f3594ab2877746b2372a1b6944768bfb18
2017-11-09 18:02:22 -08:00
Luis Hector Chavez
fae195b1e4 libcutils: Work around the lack of __mulodi4
The parent change ran into an issue where enabling UBSan on an i686
build caused it to use __mulodi4.

https://github.com/android-ndk/ndk/issues/184 documents linking against
libclang_rt.builtins-i686.a, but that's not available from soong either.

Bug: 62378620
Bug: 29412086
Test: x86 builds work again
Change-Id: I730d59558aa4ed28f8a11b5393e037111e320f29
2017-11-04 00:36:01 +00:00
Luis Hector Chavez
e97a4b9799 libcutils: Make uevent_kernel_* namespace-aware
This change adds user namespace-awareness to uevent_kernel_* in
libcutils. Instead of assuming that root is always uid 0, it detects
whether the uid 0 is mapped in the current user namespace and returns
the appropriately mapped uid (or the kernel's "overflowuid" in case it
is not mapped).

In older kernels, or those where user namespaces are not enabled, this
still uses uid 0 for root.

Bug: 62378620
Test: bullhead networking still works
Test: Android in Chrome OS can now receive netlink-related messages

Change-Id: I7ea3454e8f38b9c70c65294d6b2a99e5a88f9d70
2017-11-03 13:02:46 -07:00
Justin Yun
9ca92458e2 Mark the modules as VNDK-SP in Android.bp
As a VNDK-SP module, Android.bp must have 'vndk' tag as well as
'vendor_available: true'.

The 'vndk' tag for VNDK-SP formated as follows:
vndk: {
    enabled: true,
    support_system_process: true,
},

VNDK-SP modules will be installed both in system/lib(64) as normal
and in system/lib(64)/vndk-sp as a vendor variant.

Bug: 63866913
Test: build and boot with BOARD_VNDK_VERSION=current
Merged-In: I51fe0859f63ad58b7b91909e7d7d4206443228cd
Change-Id: I51fe0859f63ad58b7b91909e7d7d4206443228cd
(cherry picked from commit aeb68e86e4)
2017-08-23 17:56:13 +09:00
Yifan Hong
b6807125df Remove private headers from libcutils.vendor
Bug: 63135587
Test: m -j
Test: BOARD_VNDK_VERSION=current m -j
Test: mma -j
Test: BOARD_VNDK_VERSION=current mma -j

Change-Id: I9eecf23c4c311bd8336a5bfaaeb2afb3b51c6513
Merged-In: I9eecf23c4c311bd8336a5bfaaeb2afb3b51c6513
2017-08-02 16:40:36 -07:00
Lennart Wieboldt
cd15fc7ba8 Remove LOCAL_CLANG and clang: true
clang is the default compiler since Android nougat

Test: mma & verified it´s still build with clang
Change-Id: I34adaeef2f6558a09f26027271222bad94780507
Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
2017-07-25 14:29:50 +02:00
Mark Salyzyn
163ecc68c7 libcutils: convert fs_config.cpp
C++ify fs_config.c

Test: gTest libcutils-test
Bug: 37703469
Change-Id: Id48ae22f203ed923942257575296c69b32345ae6
2017-05-03 08:04:35 -07:00
Steven Moreland
385fe692cc libcutils: vendor_available
By setting vendor_available, the following may become true:

* a prebuilt library from this release may be used at runtime by
  in a later releasse (by vendor code compiled against this release).
  so this library shouldn't depend on runtime state that may change
  in the future.
* this library may be loaded twice into a single process (potentially
  an old version and a newer version). The symbols will be isolated
  using linker namespaces, but this may break assumptions about 1
  library in 1 process (your singletons will run twice).

Background:

This means that these modules may be built and installed twice --
once for the system partition and once for the vendor partition. The
system version will build just like today, and will be used by the
framework components on /system. The vendor version will build
against a reduced set of exports and libraries -- similar to, but
separate from, the NDK. This means that all your dependencies must
also mark vendor_available.

At runtime, /system binaries will load libraries from /system/lib*,
while /vendor binaries will load libraries from /vendor/lib*. There
are some exceptions in both directions -- bionic(libc,etc) and liblog
are always loaded from /system. And SP-HALs (OpenGL, etc) may load
/vendor code into /system processes, but the dependencies of those
libraries will load from /vendor until it reaches a library that's
always on /system. In the SP-HAL case, if both framework and vendor
libraries depend on a library of the same name, both versions will be
loaded, but they will be isolated from each other.

It's possible to compile differently -- reducing your source files,
exporting different include directories, etc. For details see:

https://android-review.googlesource.com/368372

None of this is enabled unless the device opts into the system/vendor
split with BOARD_VNDK_VERSION := current.

Bug: 36426473
Bug: 36079834
Test: m -j libcutils
Test: attempt to compile with BOARD_VNDK_VERSION := current
Test: (sanity) boot internal marlin
(cherry picked from commit 9610c548a8)
Merged-In: I76f9b28ef08a26d84d1365881e00696cc1dcfe5d
Change-Id: I76f9b28ef08a26d84d1365881e00696cc1dcfe5d
2017-04-19 10:32:45 -07:00
Steven Moreland
d73be1b96b libcutils: compile with BOARD_VNDK_VERSION current
- moved __android_log_is_debuggable to a new public header
    (log_properties.h)
- vendor version of sched_policy uses ALOG* instead SLOG*

Test: (sanity) liblog-unit-tests
Test: (sanity) libcutils_test (noting b/b/32972117, two tests continue
  to fail)
Test: system/core as a whole makes with BOARD_VNDK_VERSION := current
  now with no problems.
Test: boots/works on internal marlin
Bug: 33241851

(cherry picked from commit 1f83aa424f)

Merged-In: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
Change-Id: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
2017-04-17 14:44:17 -07:00
Josh Gao
46de1d7f03 adb: don't try to resolve 'localhost'
Misconfigured systems can have localhost pointing to an address that
isn't 127.0.0.1 or ::1.

adb is the only caller of the libcutils socket_loopback functions, so
move them into adb and switch the implementations over to using
INADDR_LOOPBACK and in6addr_loopback, instead of resolving 'localhost'
when connecting.

Bug: http://b/37282612
Test: `killall adb; adb shell`
Test: `killall adb; ip addr del 127.0.0.1/8 dev lo; adb shell`
Change-Id: I01c1885f1d9757ad0f7b353dd04b4d1f057741c8
2017-04-12 16:07:49 -07:00
Dan Willemsen
e0cd1e043d Enable more modules on linux_bionic builds
Bug: 31559095
Test: Enable host bionic, run soong
Change-Id: Ib4ebd909322cf464b6a40040e4b60ece7d905b6f
2017-03-15 15:44:00 -07:00
Isaac Chen
795267d4c7 Removed cpusets/schedboost build time dependency.
These two Soong product_variables were usually controlled by
ENABLE_CPUSETS and ENABLE_SCHEDBOOST in BoardConfig.mk. This change
turns the build time variables into runtime decision by checking if
a special file, "tasks", can be found under the mount points,
/dev/cpuset and /dev/stune, for cpusets and schedboost, respectively.

That special file only exists when the corresponding Linux kernel
configurations, CONFIG_CPUSETS and CONFIG_SCHEDTUNE, are set.

Bug: 34726944

Test: Tested on Sailfish with following configurations
          neither cpuset nor schedtune enabled in the kernel
          cpuset enabled, but schedtune disabled in the kernel
          both cpuset and schedtune enabled in the kernel

Change-Id: I6695b8b32b2fecb4fd995018418bbe2edc5d590f
2017-02-20 20:53:24 +08:00
Evgenii Stepanov
54c7886c40 Disable integer sanitization on host.
Test: NFC until https://android-review.googlesource.com/#/c/329510
Change-Id: I4d1bb66821b2984bbee12438cfd72b9b63d56605
2017-01-31 16:33:53 -08:00
Treehugger Robot
c8121ba029 Merge "Support arbitrary-length properties in property_list." 2017-01-27 03:18:04 +00:00
Elliott Hughes
4eacd70f85 Support arbitrary-length properties in property_list.
Bug: http://b/33926793
Test: visual inspection
Change-Id: Ida84c3aaafa5411a9886f8d3d45679fd60ddc00d
2017-01-26 17:33:12 -08:00
Vijay Venkatraman
651f8383e6 Revert "Revert "Exporting C headers from system/core""
This reverts commit a3f2be2b73.

Test: compile
Change-Id: I04b3a8e47e1fa3eb9d80c14ae3a90c68a780e858
2017-01-25 12:50:29 -08:00
Vijay Venkatraman
a3f2be2b73 Revert "Exporting C headers from system/core"
This reverts commit 3c6763ca21.

Change-Id: If3b3e106478d28a5df927d57649abdca0a99dd0e
2017-01-25 00:44:08 +00:00
Vijay Venkatraman
3c6763ca21 Exporting C headers from system/core
Moved headers from include/libcutils and include/liblog to
libcutils/include and liblog/include respectively, so they can be
exported via these libs. They needed to be moved since Soong does
not allow export from external folder.

Added symlink from old locations. They are needed since Soong
includes system/core/include by default. Once all modules are
cleaned up to explicitly add the required libs, the symlinks will be
removed.

Also added liblog_vndk_headers that exports a special log/log.h for
VNDK.

Moved headers of libcutils to libcutils_headers. They should be used
by modules for header-only inlines. Added libcutils_headers as
dependency of libcutils.

Added libcutils_vndk_headers that exports a special cutils/log.h
deprecating usage of the file. A later CL will deprecate the one in
libcutils_headers

Test: Add above libs to shared lib of local module
Change-Id: I6e1f9c5f23d8b6eae13dc3b7e5dfe7fae93b8510
2017-01-22 19:45:38 -08:00
Josh Gao
cbe70cb0a8 debuggerd: advance our amazing bet.
Remove debuggerd in favor of a helper process that gets execed by
crashing processes.

Bug: http://b/30705528
Test: debuggerd_test
Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906
2017-01-17 13:57:57 -08:00
Mark Salyzyn
52bd37e633 libcutils: move cutils/files.h to cutils/android_get_control_file.h
files.[h|cpp] is bound to be abused with junk, replace with
android_get_control_file.[h|cpp]. Plus some sundry cleanup.

Test: gTest libcutils-tests, logd-unit-tests, liblog-unit-tests,
      logcat-unit-tests and init_tests
Bug: 32450474
Change-Id: Ibd4a7aa4624ea19a43d1f98a3c71ac37805d36b5
2016-11-16 15:56:56 -08:00
Mark Salyzyn
0b034d9d7b libcutils: add android_get_control_file()
Solve one more issue where privilege is required to open a file and
we do not want to grant such to the service. This is the client side
of the picture, init is the server. The file's descriptor was placed
into the environment as "ANDROID_FILE_<path>" where non-alpha and
non-numeric characters in the <path> are replaced with _ and this
function picks the file descriptor up.

Added definition ANDROID_FILE_ENV_PREFIX ("ANDROID_FILE_") and
android_get_control_file() prototype in a new include <cutils/files.h>

android_get_control_file() checks if the resulting file descriptor is
valid, open and matches the name reference, which on purpose will fail
if a symbolic link is in the path rather than using a fully qualified
path.  Add gTest unit test for both.

Test: gTest libcutils_test --gtest_filter=FileTest.android_get_control_file
Bug: 32450474
Change-Id: I2d0310a1727f1e393a00d9fc7e6cf5d028f27905
2016-11-03 13:34:20 -07:00
Treehugger Robot
5171bebf41 Merge "Remove socket_loopback_client." 2016-10-14 18:21:38 +00:00
Treehugger Robot
955648a915 Merge "Rely on the platform -std default." 2016-10-14 02:28:38 +00:00
Elliott Hughes
dd92a0a812 Remove socket_loopback_client.
Bug: http://b/31537253
Test: builds
Change-Id: If02c8107206fb60e4622f8937bee0d0a362e1c7d
2016-10-13 16:51:46 -07:00
Elliott Hughes
36e0d390a2 Rely on the platform -std default.
Bug: http://b/32019064
Test: builds
Change-Id: I18a1d816d63b64601485045070851f32d44e85eb
2016-10-10 14:31:12 -07:00
Dimitry Ivanov
625484ddfa Revert "Revert "Revert "Revert "Remove liblog from libcutils as a whole static lib""""
This reverts commit 6a452917b3.

Bug: http://b/31289077
Bug: http://b/27171986
Change-Id: Id020fa10c50847bf16a2fcbc7d5e72cf8766b711
2016-10-07 18:43:37 +00:00
John Reck
6a452917b3 Revert "Revert "Revert "Remove liblog from libcutils as a whole static lib"""
This reverts commit 595c1480d0.

Revert reason: broke bullhead-eng build in master

Change-Id: Ie64fc31c3c971366ab9f2543b91b8f5d2040868b
2016-10-07 16:22:38 +00:00
Dimitry Ivanov
595c1480d0 Revert "Revert "Remove liblog from libcutils as a whole static lib""
This reverts commit f93d732a45.

Bug: http://b/31289077
Bug: http://b/27171986
Change-Id: Ib6e6c0a01296f0a01d98cbf1a9d2659883280d44
2016-10-06 12:47:07 +00:00
Dimitry Ivanov
f93d732a45 Revert "Remove liblog from libcutils as a whole static lib"
This reverts commit 6dd58c00ca.

Bug: http://b/31289077
Bug: http://b/27171986
Change-Id: I519d77de118f02346a4f89b197ca4df7e9f883ac
2016-10-03 22:18:49 +00:00
Dimitry Ivanov
6dd58c00ca Remove liblog from libcutils as a whole static lib
libcutils no longer needs to export liblog symbols.

Bug: http://b/31289077
Bug: http://b/27171986
Test: make
Change-Id: I546a5bce56c0c88ac2493c320298d4dc13954566
2016-10-03 03:07:13 -07:00
Dmitriy Filchenko
1bb49f483b Remove process_name.c
BUG: 29824203

Change-Id: I88d67cafb8ec0c4eea3db047bac0671de698ba02
2016-08-18 23:54:46 +00:00
Dan Willemsen
eee8e7face libcutils: Switch to Android.bp
Change-Id: If36cb30e8e4432f1a5c7f9a6d30a75c012a4c67c
2016-07-12 16:37:08 -07:00