Commit graph

40113 commits

Author SHA1 Message Date
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
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
Suren Baghdasaryan
8b9deaf618 lmkd: Add zoneinfo and meminfo parsing routines
/proc/zoneinfo and /proc/meminfo contain information necessary for lmkd
to assess system memory state. Add routines to parse these files.

Bug: 77299493
Bug: 75322373
Change-Id: Ie7d80bbb81fd0d2fc0629f6f678e6afc97fed1f6
Merged-In: Ie7d80bbb81fd0d2fc0629f6f678e6afc97fed1f6
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit da0bc05b22)
2018-04-17 01:41:38 +00:00
Suren Baghdasaryan
7cb8aade20 Merge changes I8e27f8b9,I78d2dc79 into pi-dev
* changes:
  lmkd: Optimize frequent file reads by keeping file descriptors open
  lmkd: Fix usage of ro.lmk.kill_heaviest_task property
2018-04-17 00:09:15 +00:00
TreeHugger Robot
4807bc214f Merge "Make bootstat container-friendly" into pi-dev 2018-04-16 23:37:39 +00:00
Paul Lawrence
7fdcbdfc7b Fix FDE
Need a larger tmpfs to stop crashes
Need to run start-zygote after mounting the real data

Test: Cherry-pick ag/3898232. System boots, can set pattern, system
      reboots. Wifi works at all points.
Bug: 76452634

Change-Id: Id24241db940d352fd3bcdef594b5358854c6f71d
2018-04-16 12:58:14 -07:00
Luis Hector Chavez
583d34c1c6 Make bootstat container-friendly
This change allows bootstat to read the ro.boot.boottime_offset
property, which is set on devices where Android runs in a container.
This is because the CLOCK_BOOTTIME clock is not reset when (from
Android's perspective) the device restarts, since the host OS does not
restart itself.

Bug: 77273909
Test: CtsBootStatsTestCases

Change-Id: Ifb792864394be0b4686cc9d555c0afced856f4b4
2018-04-16 11:15:49 -07:00
Suren Baghdasaryan
b2d59ee367 lmkd: Optimize frequent file reads by keeping file descriptors open
To check system memory state lmkd is using same files every time vmpressure
event is received. Instead of opening and closing these files every time
we store the file descriptor and use pread() to reread the file from
the beginning.

Bug: 77299493
Bug: 75322373
Change-Id: I8e27f8b9526e82e3cc313a02fce215c2e4dd3d29
Merged-In: I8e27f8b9526e82e3cc313a02fce215c2e4dd3d29
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit d716fe3610)
2018-04-16 09:33:44 -07:00
Suren Baghdasaryan
9ff66ff0b3 lmkd: Fix usage of ro.lmk.kill_heaviest_task property
lmkd should use ro.lmk.kill_heaviest_task property to select between
algorithms for victim selection. Set ro.lmk.kill_heaviest_task default
value to false in order to keep it compatible with previous versions
of lmkd (killing the heaviest task is a new mechanism).

Bug: 77299493
Bug: 75322373
Change-Id: I78d2dc79d9c54e636c26665605518d9c87b535b3
Merged-In: I78d2dc79d9c54e636c26665605518d9c87b535b3
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit 818b59b229)
2018-04-16 09:30:29 -07:00
Suren Baghdasaryan
39a22e751b lmkd: Rename is_go_device variable to better reflect its function
Rename is_go_device variable to low_ram_device to better reflect
its meaning and relation to ro.config.low_ram variable.

Bug: 77299493
Bug: 75322373
Change-Id: I6e2eaebe79cf2e6edf861f7c602e52a5b573ad0a
Merged-In: I6e2eaebe79cf2e6edf861f7c602e52a5b573ad0a
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit fe2be6cc44073b7ef09ca849004e5072bdf18857)
2018-04-16 09:27:32 -07:00
Suren Baghdasaryan
9dbd937b4c lmkd: Add lmkd README file
Add README file providing lmkd overview and description for its
properties.

Bug: 77299493
Bug: 75322373
Change-Id: I30236dd4ccaa2b48c31dfb80b63f0b82b49b5744
Merged-In: I30236dd4ccaa2b48c31dfb80b63f0b82b49b5744
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit 7e5dea82a5)
2018-04-16 09:26:40 -07:00
TreeHugger Robot
14eb61199e Merge "adb: fix adb reverse when adbd has multiple transports." into pi-dev 2018-04-14 15:33:14 +00:00
TreeHugger Robot
05d9ec9a8a Merge "adbd: increase oom_score_adj for adb shell" into pi-dev 2018-04-14 01:08:17 +00:00
Josh Gao
a98aab2a72 adb: fix adb reverse when adbd has multiple transports.
Plumb the transport that we received the adb reverse request on through
to reverse_service, instead of trying to get a unique transport on
devices that have multiple active transports (e.g. a device with USB
(even unplugged) connected via TCP).

Bug: http://b/37066218
Bug: http://b/71898863
Test: `echo foo | nc -l 12345 & adb reverse tcp:12345 tcp:12345; adb shell nc localhost 12345` on a device connected via TCP
Change-Id: Iae199ae787f2e344126bbcacca8544cfc9844a4c
(cherry picked from commit 44899eeb53)
2018-04-13 17:47:42 -07:00
Josh Gao
217b8fcf86 adbd: increase oom_score_adj for adb shell
Previously, processes started via `adb shell` have an oom_score_adj of
-1000, making them invisible to the oom killer. This makes running a
process that consumes all memory (e.g. by leaking in a loop) lead to
the entire rest of the system (including adbd, because of bad
heuristics in the kernel) being oom killed before getting to it.

Bug: http://b/63143027
Test: `adb shell cat /proc/self/oom_score_adj` with adb root
Change-Id: I59111134e36dc271adf4c1dd4bd4400d4fe6aee0
(cherry picked from commit 2de2ade387)
2018-04-13 15:47:53 -07:00
TreeHugger Robot
7b7901a849 Merge "storaged: lower capabilities in init" into pi-dev 2018-04-13 18:28:59 +00:00
David Anderson
ce135a67af storaged: lower capabilities in init
Lower storaged's capabilities to DAC_READ_SEARCH as an initial step
toward running it non-root.

Bug: 77634061
Test: storaged still runs and its /proc/pid/status has lower CapPrms
Exempt-From-Owner-Approval: stale OWNERS no longer in org
Change-Id: Ibfe0349fc059e2f37efba33f587176e8ce6be9fe
Merged-In: Ibfe0349fc059e2f37efba33f587176e8ce6be9fe
2018-04-13 11:27:48 -07:00
Logan Chien
c8014f7e54 Merge "Build /vendor/bin/logwrapper too." into pi-dev 2018-04-13 00:56:39 +00:00
Tom Cherry
125781255e init: do not impose vendor_init restrictions on old vendor images
Do not restrict vendor_init restrictions on vendor images that were
built before P, as they will not have the correct permissions.

Bug: 77732028
Test: test new devices and see vendor_init still works
Merged-In: I636a07b54fbfb248e1d1a68a8f3c4d047fd5a9e9
Change-Id: I636a07b54fbfb248e1d1a68a8f3c4d047fd5a9e9
(cherry picked from commit a1dbeb8d33)
2018-04-12 15:33:15 -07:00
Fernando Lugo
c43dd75194 fastboot: fix header_actual calculation
Bug: 77920157
Test: fastboot boot $OUT/kernel
Change-Id: Ibe2f4b9a6476ac11937448e6547b5159af011633
Merged-In: Ibe2f4b9a6476ac11937448e6547b5159af011633
Signed-off-by: Fernando Lugo <flugo@google.com>
(cherry picked from commit 91dfaecca7)
2018-04-12 17:20:53 +00:00
Elliott Hughes
5a4c20bc21 Build /vendor/bin/logwrapper too.
Bug: 77284669
Test: builds
Change-Id: Iaafc856f2a7441d318f7b9376caa6629e02a8e23
Merged-In: Iaafc856f2a7441d318f7b9376caa6629e02a8e23
(cherry picked from commit 0b539f3bcb)
2018-04-12 12:12:46 +00:00
Jaekyun Seok
65ce3b2cd8 Allow vendor-init-actionable for vold-related properties
Bug: 75987246
Bug: 73871799
Test: succeeded building and tested with taimen
Change-Id: Ifec879f07705a52501757b58b1562a97c668b8b0
2018-04-12 08:17:43 +09:00
Josh Gao
2e05dfa2f2 adb: properly calculate packet size on Mac.
OS X reports maxPacketSize as wMaxPacketSize * (bMaxBurst + 1) in the
deprecated GetPipeProperties function. Use the also-deprecated
GetPipePropetiesV2 API to get bMaxBurst and figure out what
wMaxPacketSize is. (This file is going to go away eventually, so don't
bother with switching to the recommended GetPipePropertiesV3, since
it would be a substantially larger charge.)

libusb is unaffected.

Bug: http://b/77733422
Test: python test_device.py
Change-Id: I66517d699a4f39b93ba5eb7882bd8ee6c70f3672
(cherry picked from commit 2ea46521f3)
2018-04-11 11:44:26 -07:00
Mathew Inwood
8aafb0d7f5 Merge "Add event log tag for hidden API access logging." into pi-dev 2018-04-11 16:45:27 +00:00
TreeHugger Robot
44fd93d0d3 Merge "fastboot, fs_mgr: set fsverity feature bit" into pi-dev 2018-04-11 03:59:58 +00:00
TreeHugger Robot
aeee02f290 Merge "Use the non-LTO, non-PGO version of libhwbinder" into pi-dev 2018-04-10 18:14:42 +00:00