Commit Graph

45069 Commits

Author SHA1 Message Date
Elliott Hughes b4dc7be6c5 libbase: add ConsumePrefix/ConsumeSuffix.
adb was already using ConsumePrefix, and now we have another would-be
user in cutils. (There appears to be one place in adb that should use
ConsumeSuffix, so I'm assuming we'll want that sooner or later.)

I've kept these inline because adb and google3's versions both were, and
I'm easily led.

Test: treehugger
Change-Id: I29d99032f6f6ccbfaefece59725db8afb02a4c87
2019-05-03 12:49:31 -07:00
Tianjie Xu 56311071fe Merge "Support adb rescue wipe command" 2019-04-29 17:47:20 +00:00
Treehugger Robot d21a090f79 Merge "Nativeloader: Restrict anonymous namespace creation" 2019-04-29 16:08:15 +00:00
Treehugger Robot bce25d2363 Merge "Fix libnativeloader to correctly link to the platform namespace." 2019-04-29 15:08:52 +00:00
Martin Stjernholm 4ca0ca67bf Fix libnativeloader to correctly link to the platform namespace.
This affected binaries in the Runtime APEX, where the platform namespace is
"platform" rather than "default".

Also extend ANDROID_ADDITIONAL_PUBLIC_LIBRARIES to create links to both to
platform and runtime namespaces, so that it can be used to open up access to
internal libraries in the Runtime APEX as well, which is used by ART gtests
and run tests.

Also update some comments in the ld.config*.txt files to accurately explain
why some namespaces need to be visible, and some other minor changes for
consistency. There are no semantically significant changes in those files.

Test: Flash and boot
Test: Run an ART run test with the internal libarttest.so library
Bug: 130293232
Bug: 121117762
Change-Id: I7ebaf5370dd0f533b1bb5f0e67e7c3c1df48e512
2019-04-29 13:09:08 +01:00
xunchang c2265c5343 Support adb rescue wipe command
Support `adb rescue wipe` command on the host side. This command runs
under the rescue mode and wipes data (and cache/metadata).

Bug: 131037235
Test: run adb rescue wipe

Change-Id: Ib3a3f2d564cc19d0446540d616cc21489ba558c2
2019-04-26 10:37:13 -07:00
Andreas Gampe b9df7d936c Nativeloader: Restrict anonymous namespace creation
Create the anonymous namespace only from a non-empty library path.

This is a better heuristic than the current "first-come" one. It
allows creating classloaders that are not directly related to an
app's "main" classloader, that is, do not have any library path.
This is the case, for example, for shared libraries, including
preloaded ones.

Longer-term, the anonymous namespace creation should be made
explicit, so that the framework can have full control.

Bug: 130623656
Test: m
Test: manual
Change-Id: I8251363b372e365d10ae09d23df93d76388ac7f9
2019-04-26 08:55:53 -07:00
Joseph Jang 67231474fe Merge "init: Add reboot timeout handler" 2019-04-26 08:23:06 +00:00
Misha Wagner 79474ce6f3 Merge "Add UID printing to tombstone headers" 2019-04-26 08:22:17 +00:00
josephjang aaddf282ec init: Add reboot timeout handler
In order to prevent device stuck at reboot, we try to create shutdownt
monitor thread with a timeout (default 30s). It will dump init process
and blocked tasks call trace in last kmsg then trigger kernel panic to
reboot device.

Test: reboot device

bug: 128561401
Change-Id: Ieb400ab9fbd983544b61241a4f4b8aa2f4baa863
2019-04-26 06:02:09 +08:00
Ian Kasprzak e30fe5fe89 Merge "Revert "Add a way to turn off unique_fd's operator int."" 2019-04-25 17:16:55 +00:00
Ian Kasprzak 2c58e1924a Revert "Add a way to turn off unique_fd's operator int."
This reverts commit 93d63c010a.

Reason for revert: b/131312539 - All aosp-master-with-phones phones failing boot / health check.

Change-Id: Id4239f93484b7d6b8d9bcd355a59cbd40d9766e2
2019-04-25 15:59:28 +00:00
Tom Cherry 81f5424560 Merge "liblog: remove LIBLOG_WEAK" 2019-04-25 15:43:36 +00:00
Josh Gao 0fcd9292c4 Merge "adbd: reduce queue depths." 2019-04-25 01:09:23 +00:00
Tom Cherry 927c3d9184 liblog: remove LIBLOG_WEAK
I'm not sure why I didn't remove this when I got rid of the other
functions marked as weak.

Test: build
Change-Id: I45e6bca7be0497e33be88d15afea8bb1d5165380
2019-04-24 17:24:23 -07:00
Treehugger Robot 8e6fb82af6 Merge "logd: remove SELinux dup handling" 2019-04-25 00:06:43 +00:00
Treehugger Robot 4b43299132 Merge "Fix a warning on namespace.media.link.default.shared_libs" 2019-04-24 23:16:37 +00:00
Josh Gao 971bae0bcf Merge "Add a way to turn off unique_fd's operator int." 2019-04-24 22:58:00 +00:00
Treehugger Robot ee5083b3c7 Merge "adb: silence warning from libusb." 2019-04-24 22:46:28 +00:00
Treehugger Robot e923e5ef62 Merge "adb: fix double close in wait-for-*." 2019-04-24 22:38:31 +00:00
Josh Gao 28293f16a8 adbd: reduce queue depths.
Each operation we submit results in a contiguous allocation in the
kernel which can trigger OOM-killing. Tune the queue depths to reduce
the chances of this happening, with a minimal impact on performance.

Bug: http://b/126582877
Test: ./benchmark_device.py with blueline
Change-Id: I4b0f83d54a9a9a69f0ab48322d78fb137c94dd35
2019-04-24 15:05:21 -07:00
Nick Kralevich 512a7bfd83 logd: remove SELinux dup handling
Remove the code which attempts to collapse multiple similar SELinux
denials into one denial. SELinux logs are already rate throttled by the
kernel
(https://android-review.googlesource.com/c/platform/system/core/+/941357
for example), so additional filtering here only adds complexity and may
result in SELinux denials being inappropriately suppressed or dropped.

Bug: 118815957
Test: atest logd-unit-tests
Change-Id: I611fa43dc56c99aa992aad002c16c742e6034e5c
2019-04-24 13:32:58 -07:00
Josh Gao 93d63c010a Add a way to turn off unique_fd's operator int.
unique_fd's implicit conversion to int has led to tons of problems (see
all of the overloads for close, fdopen, fdopendir, etc.). Add a switch
that can turn it off, and reduce the ridiculous amount of work to fix up
callers by introducing a borrowed_fd type that can be constructed from
either int or unique_fd.

Test: treehugger
Change-Id: If77cf5cbcaddacdaec5919a15b3520fb68f51a62
2019-04-24 12:59:42 -07:00
Elliott Hughes 4d89dc0f54 Merge "libion: convert a header file using update_all.py" 2019-04-24 19:24:32 +00:00
Tom Cherry 7a03b5d314 Merge "init: simplify async restorecon" 2019-04-24 19:14:28 +00:00
Mark Salyzyn 6fbefd1806 Merge "bootstat: add .* positive/negative test" 2019-04-24 17:06:34 +00:00
Mark Salyzyn aeac7a43d0 bootstat: add .* positive/negative test
Missing test from aosp/949599

Test: boot_reason_test.sh kBootReasonMap
Bug: 116838876
Bug: 128929506
Change-Id: I3a0690cff80b3b2117cf821ece4b81ffdcf50aec
2019-04-24 17:01:58 +00:00
Tom Cherry fe8154175c init: simplify async restorecon
In the future, property service may run in its own thread or process,
which means that PropertyChildReap() needs to be refactored to not run
as part of the init signal handler.

The new method spawns a new thread that handles the queue of paths
that require restorecon. It then communicates back to property service
via android::base::SetProperty(). Property service distinguishes the
thread from other callers of SetProperty() by checking the pid in the
credentials for the socket connection, thus avoiding dependencies on
the rest of init.

The new method also drops the genericness, since restorecon is the
only function that we should ever need to run asynchronously

Test: async restorecon works, including with queued requests
Change-Id: I2ca00459969e77b1820776dac23d0a0d974e330b
2019-04-24 08:50:10 -07:00
Treehugger Robot f9e9d38697 Merge "bootstat: add 3 pmic off reasons to known set" 2019-04-24 14:51:30 +00:00
Yoshitaka Seto f86ef1070e libion: convert a header file using update_all.py
ion_4.12.h is ported from old Linux Kernel Driver.
According to the header comment, this is licensed under GPLv2.
This header is referred from ion.c.

To clarify license matter just in case, let's convert it using
update_all.py in bionic repository.

The original header is moved under original-kernel-headers/linux
directory.

Found this during FOSSID trial.

Test: build and boot
Change-Id: Iabd46f33968a0fbce14a501238730714c4f2cfc6
Signed-off-by: Yoshitaka Seto <yoshitaka.seto@sony.com>
2019-04-24 07:02:42 +00:00
Jone Chou 446d6c6d01 bootstat: add 3 pmic off reasons to known set
regular expression:
- "reboot,pmic_off_fault,.*" (175)
- "reboot,pmic_off_s3rst,.*" (176)
- "reboot,pmic_off_other,.*" (177)

regex is dependent on:
https://android-review.googlesource.com/947976

Test: none
Bug: 116838876
Bug: 128929506
Change-Id: I7fae9ecee536f790c8f493c3f5e5f75b03efb1d6
Signed-off-by: Jone Chou <jonechou@google.com>
2019-04-24 14:14:10 +08:00
Treehugger Robot 74d84224ae Merge "Remove the mount points defined in skip_mount.cfg from ReadDefaultFstab()" 2019-04-24 02:53:53 +00:00
Dongwon Kang 5744cc4e99 Fix a warning on namespace.media.link.default.shared_libs
Test: build & dumpsys media.extractor
Bug: 130882530
Change-Id: Ifd46858b5a864f0fbed87baa3321f233ea12954e
Merged-In: Ifd46858b5a864f0fbed87baa3321f233ea12954e
2019-04-23 23:15:24 +00:00
Treehugger Robot 1cafeb560c Merge "bootstat: Allow regex matches for boot reasons" 2019-04-23 19:21:17 +00:00
Tom Cherry 87882c0a00 Merge "init: handle getpeercon() errors" 2019-04-23 16:06:40 +00:00
Tom Cherry 4bc16589df Merge "init: set up SelinuxAuditCallback() earlier" 2019-04-23 16:04:35 +00:00
Mark Salyzyn 67ee8a8ef9 bootstat: Allow regex matches for boot reasons
If the matching string contains a [, \ or *, then it is also checked
with a regex match.  Exact match is always tried firsts.  If we do
not find an exact string match, switch to iterate through the entire
list for regex strings to find a match.

This allows us to scale with details without consuming a large
number of enums, permitting details that we do not necessarily want
resolution on to propagate to TRON.  The hierarchical nature of the
boot reason <reason>,<subreason>,<detail>... can cause scenarios
where the <detail> does not matter to TRON, but does matter to
bugreport collection.

Add a bootstat --boot_reason_enum function to expose and test the
kBootReasonMap matchihg algorithm.

Add a kBootReasonMap test that exhaustively tests all built-in
entries, and an example of one regex entry.  New regex entries added
to bootstat.cpp will need a series of exact match examples added into
filter_kBootReasonMap() function.

Test: boot_reason_test.sh kBootReasonMap (or all tests)
Bug: 116838876
Bug: 128929506
Change-Id: I3f7b5de22f99195b7ce99672a212174365960b3f
2019-04-23 07:14:44 -07:00
SzuWei Lin 77c28476f1 Remove the mount points defined in skip_mount.cfg from ReadDefaultFstab()
The first stage init skips mounting the mount points defined in
skip_mount.cfg, but these mount points still return from
ReadDefaultFstab(). The behavior causes some error logic which
try to access the partition which had been skipped.

After applying the patch. ReadDefaultFstab() will not contain the
skipped mount points.

Bug: 128961335
Test: `fastboot delete-logical-partition product_a`
Test: `fastboot flash system aosp_arm64-userdebug`
Test: `fastboot -w reboot` and boot to home screen
Change-Id: I3156260b5d37647dbecf98ca90601a089bea5c46
2019-04-23 17:42:40 +08:00
Misha Wagner 39c5b8c21c Add UID printing to tombstone headers
This is for Android Telemetry to be able to categorise the processes
that produce tombstones.

Test: atest debugerd_test:TombstoneTest

Change-Id: Ie635347c9839eb58bfd27739050bd68cbdbf98da
2019-04-23 09:53:07 +01:00
Treehugger Robot 2ddb8df2ef Merge "Adding adb_debug.prop into debug ramdisk" 2019-04-23 02:01:36 +00:00
Treehugger Robot 9cf353a1d3 Merge "libprocessgroup: limit libprocessgroup's VNDK API surface" 2019-04-22 23:37:25 +00:00
Tao Bao 6688eaf23f Merge "adb: Support rescue install and getprop." 2019-04-22 22:08:52 +00:00
Tom Cherry 7f160af142 init: handle getpeercon() errors
Though unlikely, it is possible for getpeercon() to fail.  This change
adds code to handle this case gracefully.

Bug: 130209483
Test: boots, properties are set
Change-Id: I3b3fb76b2312a5cbc87c0da2a044be3ddf8aa400
2019-04-22 13:32:24 -07:00
Suren Baghdasaryan 3bdf315eae libprocessgroup: limit libprocessgroup's VNDK API surface
Limit libprocessgroup VNDK API to the minimum set required for task
profiles usage. This API allows vendors to use cgroups without accessing
cgroup files directly, therefore allowing Android to change cgroup
arrangement details without breaking vendor code.

Bug: 131098932
Test: build and boot
Change-Id: I92463dfb44a108a133bafd2fe52237b6b1d50a69
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-04-22 20:13:13 +00:00
Tom Cherry 2f113ad1e1 init: set up SelinuxAuditCallback() earlier
The setup of SelinuxAuditCallback() was happening after property files
are loaded, and now that these property files can trigger audits, the
audit messages did not contain all of the correct information.  This
change moves the setup of SelinuxAuditCallback() to immediately before
the property area is initialized, to ensure that this can not happen
again.

Bug: 130979265
Test: audits work early
Change-Id: I9eb43269317c74e041626ee7b2bb7fea49250e09
2019-04-22 12:41:39 -07:00
Suren Baghdasaryan 1a043459a9 Merge "Re-enable file descriptor caching and add option to skip caching" 2019-04-22 16:08:34 +00:00
Treehugger Robot 1412f3c99d Merge "fs_mgr: overlayfs: suppress mkfs output" 2019-04-22 16:02:04 +00:00
Bowgo Tsai 05f07d89a6 Adding adb_debug.prop into debug ramdisk
The debug ramdisk can only be used if the device is unlocked.
When it's used, init will load adb_debug.prop and the userdebug
sepolicy from the debug ramdisk, to allow adb root on a user build.

Bug: 126493225
Test: 'make' and checks the file is installed
Change-Id: Id6962414197fc8f47f7c07818e8fb16107dc17a3
2019-04-20 06:08:51 +00:00
Treehugger Robot e7d0c83d3c Merge "init.rc: set fsck log permission on post-fs-data" 2019-04-20 00:12:47 +00:00
Suren Baghdasaryan 8a315d2a3e Re-enable file descriptor caching and add option to skip caching
This reverts commit bee9f5718b
"libprocessgroup: Disable file descriptor caching temporarily" and adds
option to use SetTaskProfiles and SetProcessProfiles without file caching.
This option is used from JNI to avoid access denials because cached files
are not whitelisted for JNI usage.

Bug: 123868658
Bug: 123043091
Test: boot using svelte target
Change-Id: I76b9d6af8a1dd4464cb3cf3e6dc327980efdf361
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-04-20 00:11:21 +00:00