Commit graph

40137 commits

Author SHA1 Message Date
Josh Gao
09b309807f Merge "adb: fix double close in jdwp_service." into pi-dev 2018-05-15 04:50:43 +00:00
Dan Willemsen
0051684905 Revert "Only log the lmkd state change when the killing really happened."
This reverts commit 5e60f88cab.

Reason for revert: broke some builds

Bug: 78603347
Change-Id: I46bf6face35f5399d7d43146b360c0703eedfb1a
2018-05-15 03:26:05 +00:00
Josh Gao
d88f3b6964 adb: fix double close in jdwp_service.
Bug: http://b/78793027
Test: treehugger
Change-Id: Ie66d12e70bdaf09148e3d672e3c7c3da9e8ab2fe
(cherry picked from commit b7a9956cbc)
2018-05-14 17:36:45 -07:00
Yangster-mac
5e60f88cab Only log the lmkd state change when the killing really happened.
Test: statsd test
BUG: b/78603347
Change-Id: Ie08b0c3260f2f96b48e9e12c2c88208a3613042d
2018-05-14 22:25:29 +00:00
Suren Baghdasaryan
da88b24c97 lmkd: Enable more logs during a kill
Logs that provide information about memory conditions during a process
kill event contain useful information and do not affect device
performance because these events are rare. Enabling them even when
ro.config.debug flag is not set will help in understanding low memory
conditions.

Bug: 79572814

Change-Id: Iae6e9bb612b9a7904ca491de3f1ddc727f24c7e0
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-05-11 21:03:14 +00:00
Gwendal Grignou
232ce729f5 Merge "allow config/sdcardfs directory to be seen for ARC++" into pi-dev 2018-05-11 01:36:14 +00:00
Logan Chien
cff5b8a7d0 Merge "libctuils: Exclude qtaguid.cpp from VNDK-SP variant" into pi-dev 2018-05-10 06:05:25 +00:00
android-build-team Robot
c8b1a2524e Merge "Documented adb install --instant" into pi-dev 2018-05-09 18:53:27 +00:00
android-build-team Robot
289668011f Merge "Move libstatssocket from frameworks/base to system/core/" into pi-dev 2018-05-09 18:08:46 +00:00
Felipe Leme
95c5b7f358 Documented adb install --instant
Test: m -j32 adb && ./out/host/linux-x86/bin/adb help 2>&1 | grep instant
Bug: 79422318

Change-Id: I2830a9e3cf81becac1a6334670d8dc487fe72322
    (cherry picked from commit 807be77c25)
2018-05-09 09:42:55 -07:00
Logan Chien
94223374c8 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
Merged-In: Idf6b60f6e58371ea320193641669d1e4412d62b8
(cherry picked from commit 25b742c627)
2018-05-09 10:16:12 +08:00
Gwendal Grignou
8526413941 allow config/sdcardfs directory to be seen for ARC++
Normally, the whole configfs is mounted on /config and /config will be
word readable:

sailfish:/ $ ls -ld /config/*
drwxrwx--- 258 system package_info 0 2018-05-08 16:08 /config/sdcardfs
sailfish:/ $ ls -ld /config/
drwxr-xr-x 3 root root 0 1969-12-31 16:00 /config/

On ARC++, we only mount-bind config/sdcardfs, so it is important that
/config is set properly.

It is actually 0500, so system could not see /config/sdcardfs, even if
/config/sdcardfs is set properly:
Although root can, as system uid, we can not reach /config/sdcardfs:
:/ $ ls -ld /config
dr-x------ 3 root root 31 2018-05-02 21:56 /config
:/ $ ls -ld /config/sdcardfs
ls: /config/sdcardfs: Permission denied

With this change, system (and systemservice) is able to reach
/config/sdcardfs:
:/ $ ls -ld /config
dr-xr-xr-x 3 root root 31 2018-05-02 21:56 /config
:/ $ ls -ld /config/sdcardfs
drwxrwx--- 109 system package_info 0 2018-05-08 15:29 /config/sdcardfs

Bug: 63876697
Test: After change, package service is able to create the bindings in
/config/sdcardfs.

Change-Id: I7e9b99d7af2ad001fbb1b95bee35d494e861be78
Signed-off-by: Gwendal Grignou <gwendal@google.com>
2018-05-08 16:18:48 -07:00
Logan Chien
88f5b6aa5d Merge "init: Use sepolicy version instead" into pi-dev 2018-05-08 03:42:15 +00:00
Yao Chen
b13a102c0a Move libstatssocket from frameworks/base to system/core/
So that lmkd can build on PDK.

Bug: 79349329
Test: builds locally
Change-Id: I981e6ef9f9769b873640e5f169a9495ccea2f25c
2018-05-07 17:19:10 -07:00
Josh Gao
35c76427a2 Merge changes I19704971,I20e0537a into pi-dev
* changes:
  tombstoned: make missing O_TMPFILE workaround actually work around.
  tombstoned: don't bail out if we fail to unlink a file that isn't there.
2018-05-04 21:37:42 +00:00
Josh Gao
65c2b8d2d2 Merge "tombstoned: don't create tombstones for failed dumps." into pi-dev 2018-05-04 21:37:22 +00:00
Logan Chien
c50144ef1d init: Use sepolicy version instead
This commit uses vendor sepolicy file version (defined in
`/vendor/etc/selinux/plat_sepolicy_vers.txt`) to determine whether the
source context should be set as `u:r:vendor_init:s0`.

Before this commit, the criterion was `ro.vndk.version` >= 28.  However,
the check in `property_service.cpp` will always be true because
`ro.vndk.version` hasn't been loaded from `/vendor/default.prop`.

Furthermore, under some circumstances, `ro.vndk.version` may be
different from `plat_sepolicy_vers.txt` (e.g. O-MR1 vendor does not
define `ro.vndk.version`).

Bug: 78605339  # high-level bug to combine O-MR1 and P GSI
Bug: 79135481  # the usage of `ro.vndk.version` in init
Test: vts-tradefed run vts -m VtsTrebleVintfTest  # tetheroffload
Change-Id: Ied46e9346b4ca7931aa4dcf1c9dbc11de0e12d93
Merged-In: Ied46e9346b4ca7931aa4dcf1c9dbc11de0e12d93
2018-05-04 15:21:14 +08:00
Josh Gao
e96dc1a061 tombstoned: make missing O_TMPFILE workaround actually work around.
We can't actually link an unlinked file back onto disk if it wasn't
opened with O_TMPFILE. Switch to using a temporary filename instead.

Bug: http://b/77729983
Test: agampe
Change-Id: I1970497114f0056065a1ba65f6358f08b51ec551
(cherry picked from commit f5974aedc4)
2018-05-03 17:55:16 -07:00
Yao Chen
389aee1117 Fix the stats log in lmkd
1. let logs be written to statsd directly like all other stats logs.
   + stats log should not write to logd anymore(b/78239479)
2. fixed the log format
   + need to embed the elapsed real time in the log
3. fixed the log context reuse problem
   +reset the log context buffer and internal state before reuse

Bug: 78603347
Bug: 78239479

Test: tested with alloc_stress, and saw logs written to statsd

performance measurement (memory & cpu):
https://paste.googleplex.com/5508158646648832

Change-Id: I345f0eace8ba1687ff480fb88e9abba1d8533f76
2018-05-03 16:04:27 -07:00
Josh Gao
5a9929a392 tombstoned: don't bail out if we fail to unlink a file that isn't there.
Bug: http://b/77729983
Test: crasher with no tombstones
Change-Id: I20e0537a347dd1f83877150ab13f53441dd65d95
(cherry picked from commit 28f8cf0f97)
2018-05-03 15:44:21 -07:00
Josh Gao
598061ff6d tombstoned: don't create tombstones for failed dumps.
Instead of creating tombstone FDs in place and passing them out to
crash_dump directly, create them as O_TMPFILEs and link them into place
when crash_dump reports success, to avoid creating empty tombstones
in cases like an aborting thread racing with another thread that
manages to cleanly exit_group before the dump finishes.

Bug: http://b/77729983
Test: debuggerd_test
Test: adb shell 'for x in `seq 0 50`; do crasher; done'
Change-Id: I31ce4fd4a524abf8bde57152450209483d9d0ba9
(cherry picked from commit 48383c806a)
2018-05-02 14:43:50 -07:00
Mathew Inwood
979931803b Merge "Add support for logging package name." into pi-dev 2018-05-02 10:39:15 +00:00
Bowgo Tsai
fe92dd0973 First-stage mount: avoid triggering a FATAL error
Related AOSP changes:
  1. https://android-review.googlesource.com/#/c/platform/system/core/+/405009/
  2. https://android-review.googlesource.com/#/c/platform/system/core/+/532637/

The second CL raises a FATAL error when it detects fstab-dt has no content
during first-stage mount. However, with the first CL, the fstab-dt entry
might be "skipped" when bootloader sets the status property to a value
other than "ok"/"okay". (e.g., to skip mounting /vendor on upgrading
devices which have no vendor partition).

Use LOG(INFO) when there is nothing to mount here. The later stages
should trigger a FATAL error when some important files in those
partitions are not available, e.g., SEPolicy files.

Bug: 78441220
Test: boot a device
Change-Id: Iae2f47d455679298bdb067d96b771a30c1a82e6f
Merged-In: Iae2f47d455679298bdb067d96b771a30c1a82e6f
(cherry picked from commit 8fe363f260)
2018-05-02 10:23:16 +08:00
Josh Gao
3bac1ffdd0 Merge changes from topic "unwindstack_clone" into pi-dev
* changes:
  libdebuggerd: clone registers before we Unwind with them.
  libunwindstack: add Regs::Clone.
2018-05-02 00:03:50 +00:00
Mathew Inwood
9079f7c283 Add support for logging package name.
The functionality already exists in Java, add it to the C++ class too.

Bug: 77517571
Test: m
Test: Exercised by ag/3984344 in art
Change-Id: Id27a6c506783a02e4334498dadf55167efab097f
2018-05-01 16:21:44 +01:00
Josh Gao
f7023c9844 crash_dump: defuse our signal handlers earlier.
We have a LOG(FATAL) that can potentially happen before we turn off
SIGABRT. Move the signal handler defusing to the very start of main.

Bug: http://b/77920633
Test: treehugger
Change-Id: I7a2f2a0f2bed16e54467388044eca254102aa6a0
(cherry picked from commit 38ac45df17)
2018-04-30 14:52:12 -07:00
Paul Crowley
d8525007e1 Wipe metadata when we wipe userdata and cache.
Bug: 78469699
Test: Run "fastboot -w" and see that metadata is wiped
Merged-In: I2d795281c48b59c87d4f8f010037d95186f55684
Change-Id: I2d795281c48b59c87d4f8f010037d95186f55684
2018-04-25 21:55:25 +00:00
Tom Cherry
398b551d51 logd: notify kernel log readers of new messages
LogBuffer::log() returns either a negative number on error or a
positive number indicating the length of the message written.
Therefore, the check to notify kernel log readers of a new message
should be that this function's return value is > 0.

Bug: 78209416
Test: `adb logcat -b kernel` updates when new log messages are present
Merged-In: Icc18c0c22e62340994e5c26aedb72282d61c1541
Change-Id: Icc18c0c22e62340994e5c26aedb72282d61c1541
(cherry picked from commit cbfebdbadb)
2018-04-25 09:43:21 -07:00
Josh Gao
86ea074184 libdebuggerd: clone registers before we Unwind with them.
Bug: http://b/77296294
Test: manual inspection of tombstone generated by crasher
Change-Id: I4b017701d7d2041db4aefbbb90977e99b844c328
(cherry picked from commit 5d1c14f41b)
2018-04-23 12:11:48 -07:00
Josh Gao
fe3963143f libunwindstack: add Regs::Clone.
Add a way to copy a Regs object.

Bug: http://b/77296294
Test: libunwindstack_test
Change-Id: I28aff510aa3e1b677d5ae46dc3bfe7652817ce52
(cherry picked from commit 2f37a15472)
2018-04-23 12:11:38 -07:00
Mathew Inwood
564e3581cb Merge "Add support for logging complex events from C++." into pi-dev 2018-04-20 07:42:03 +00:00
Josh Gao
51fd5440c1 Merge "adb: don't error in handle_host_request if we can't acquire a transport." into pi-dev 2018-04-19 22:32:27 +00:00
Tom Cherry
c415debdbf Merge "Add a dummy entry for the 70220 event tag" into pi-dev 2018-04-19 20:51:39 +00:00
Josh Gao
05e5bc1b17 adb: don't error in handle_host_request if we can't acquire a transport.
Host services are attempted after handle_host_request, which means that
failing to find a transport to give to handle_forward_request shouldn't
send an error over to the other end.

Bug: http://b/78294734
Test: `adb track-devices` with multiple devices connected
Change-Id: I46c89cc1894b51d48fea7d4e629b1d57f73e3fd6
(cherry picked from commit 78f133d7d4)
2018-04-19 13:29:59 -07:00
Tom Cherry
f9ec346f30 Add a dummy entry for the 70220 event tag
This will prevent services from reaching out to logd if this tag is
present in the event log.

Bug: 64734187
Test: tree-hugger
Merged-In: If117e1c0cfa678af4190913f0ca87f4e92c54373
Change-Id: If117e1c0cfa678af4190913f0ca87f4e92c54373
(cherry picked from commit dcc4b2bb4a)
2018-04-19 11:03:28 -07:00
Paul Crowley
2df20b6271 Merge "Set property for metadata encryption on first boot" into pi-dev 2018-04-19 17:17:07 +00:00
Mathew Inwood
d0613ac54a Add support for logging complex events from C++.
Also include relevant new metric_logger.proto values.

Test: m
Test: Exercised by ag/3890335 in art
Bug: 77517571
Change-Id: Ia527f2b94c7a6147ad9d537376266e5ffc597b04
2018-04-19 16:58:27 +01:00
TreeHugger Robot
dc29476d7e Merge "Remove test_suites: ["vts"] from memunreachable_binder_test" into pi-dev 2018-04-19 15:18:22 +00:00
Tim Murray
658ae90f69 cutils: add restricted cpuset
Bug 78197570
Test: CTS
Exempt-From-Owner-Approval: owner OOO, build cop says it's fine

Change-Id: I6df972950b75a839caa463ae282ad000b959e8ae
2018-04-18 16:42:12 -07:00
Colin Cross
2f569b75a4 Remove test_suites: ["vts"] from memunreachable_binder_test
memunreachable_binder_test is pulled in by
test/vts/tools/build/tasks/list/vts_test_bin_package_list.mk, it
doesn't need to be listed in test_suites.

Fixes warnings:
build/make/core/base_rules.mk:620: warning: overriding commands for target `out/host/linux-x86/vts/android-vts/testcases/memunreachable_binder_test'
build/make/core/base_rules.mk:620: warning: ignoring old commands for target `out/host/linux-x86/vts/android-vts/testcases/memunreachable_binder_test'

Bug: 78229249
Test: vts-tradefed run commandAndExit vts -m VtsKernelBinderTest
Change-Id: Ifd282b2f5bb652295fa34ad247919eb85ea7abc8
Merged-In: Ifd282b2f5bb652295fa34ad247919eb85ea7abc8
(cherry picked from commit f013b62152)
2018-04-18 16:35:05 -07:00
Paul Crowley
5872cbdf02 Set property for metadata encryption on first boot
Bug: 77335096
Test: device boots twice with and without metadata encryption
Change-Id: Iaed78288cb37865ba23833721b73b11414e7e862
2018-04-18 14:40:54 -07:00
TreeHugger Robot
e58d713e47 Merge "Re-land "If enablefilecrypto or init_user0 fails, reboot into recovery."" into pi-dev 2018-04-17 20:34:14 +00:00
TreeHugger Robot
ab90190dda Merge "Remove header version check for command "fastboot boot boot.img"" into pi-dev 2018-04-17 19:37:43 +00:00
TreeHugger Robot
b35c019d5c Merge "Add /mnt/vendor rw mount point for vendor partitions." into pi-dev 2018-04-17 19:16:55 +00:00
Hridya Valsaraju
11a52dda76 Remove header version check for command "fastboot boot boot.img"
The header version argument is meant for creation of boot images
using boot and flash:raw commands. It is unnecessary to specify the same
while using the boot command with a complete boot image.

Bug: 77920157
Test: fastboot boot boot.img
Change-Id: Ia8fca4180e15906a3ae7c732496a744eb4b15e91
Merged-In: Ia8fca4180e15906a3ae7c732496a744eb4b15e91
2018-04-17 17:28:25 +00:00
Tri Vo
b511475664 Add /mnt/vendor rw mount point for vendor partitions.
Changes to init's behavior during early mount:
1. Mounting of tmpfs on /mnt is moved from init stage to early mount.
2. init creates /mnt/vendor used to mount vendor partitions.
3. If a device tree fstab entry for early mount specifies a mount point
under /mnt/vendor e.g. /mnt/vendor/foo, init will create
/mnt/vendor/foo mount point.

Bug: 64905218
Test: change dt fstab entry to mount persist to /mnt/vendor/persist;
mount point is created correctly, and partition is mounted in early
mount. See go/pag/1069774
Test: device boots with /mnt/vendor and previous contents of /mnt present,
and selinux label "mnt_vendor_file" is applied correctly.
Test: cts-tradefed run commandAndExit cts --skip-all-system-status-check
--primary-abi-only --skip-preconditions -m CtsAppSecurityHostTestCases
-t android.appsecurity.cts.PermissionsHostTest
Change-Id: I3739130739eadf508355c7f2531366fcaed74175
2018-04-17 10:15:07 -07:00
TreeHugger Robot
b3b1a5eacf Merge "Fix FDE" into pi-dev 2018-04-17 16:48:29 +00:00
Paul Crowley
dc97e3e091 Re-land "If enablefilecrypto or init_user0 fails, reboot into recovery."
An earlier such change was reverted in commit e242a97db5.

Bug: 70487538
Test: ensure that angler can boot
Merged-In: Id5f57fce1c9b817a2650e0c848143d8a0d286bf0
Change-Id: Id5f57fce1c9b817a2650e0c848143d8a0d286bf0
2018-04-17 09:05:39 -07:00
Suren Baghdasaryan
ffdc4ddb25 lmkd: Introduce support for legacy kill algorithm that uses minfree levels
Add ability to switch to the algorithm used by lowmemorykiller driver
for determining when to kill. It uses minfree levels to decide at which
levels of free memory and file cache to kill a process. oom_adj_score
is also determined by comparing current memory resources against minfree
levels.
ro.lmk.use_minfree_levels property is introduces for switching into this
mode. By default it is disabled.

Bug: 77299493
Bug: 75322373
Change-Id: I6b51972951026854a079fcda33d6786b7ed035e4
Merged-In: I6b51972951026854a079fcda33d6786b7ed035e4
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit d273b6630d)
2018-04-17 01:42:06 +00:00
Suren Baghdasaryan
9926e57ee8 lmkd: Switch to using /proc/meminfo to have access to file cache size
Current mechanism of getting system memory state by using sysinfo()
is not enough because it does not provide information about file cache
size which is needed to correctly assess memory state. Switch to using
data from /proc/meminfo that includes information provided by sysinfo()
and file cache size in addition to that.

Bug: 77299493
Bug: 75322373
Change-Id: I16106fc4f9254f17f776803e60502b7b6474e1b7
Merged-In: I16106fc4f9254f17f776803e60502b7b6474e1b7
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit 9ac54eb2f8)
2018-04-17 01:41:59 +00:00