Commit graph

38910 commits

Author SHA1 Message Date
Mark Salyzyn
e40838d37a Merge "llkd: add live-lock daemon"
am: 656bc24630

Change-Id: I3c5e84cf992488f8d077c3a656cf3f0620d1f060
2018-04-20 13:58:05 -07:00
Treehugger Robot
656bc24630 Merge "llkd: add live-lock daemon" 2018-04-20 20:46:41 +00:00
Elliott Hughes
4a9a08183e Merge changes I1f55c6e1,Ib2adcf0a
am: 395131df7b

Change-Id: Ib0b871e1982828016cefc71976a0e5421388d004
2018-04-20 13:27:17 -07:00
Elliott Hughes
395131df7b Merge changes I1f55c6e1,Ib2adcf0a
* changes:
  Move fastboot over to ParseByteCount.
  Add android::base::ParseByteCount.
2018-04-20 20:15:30 +00:00
Elliott Hughes
542370dead Move fastboot over to ParseByteCount.
Bug: N/A
Test: `fastboot flashall` and `fastboot -S 100m flashall`
Change-Id: I1f55c6e10be74780bbf8dc30b2d4be3f362ac662
2018-04-19 19:49:44 -07:00
Elliott Hughes
955b6a4792 Add android::base::ParseByteCount.
Bug: N/A
Test: ran tests
Change-Id: Ib2adcf0a5b9494fcf8259b29974303e8516a9ad9
2018-04-19 19:49:16 -07:00
Luis Hector Chavez
2c3f1d6c43 Merge changes I722d2c41,Ic216ddef
am: c4ad6b6adc

Change-Id: I773f941918a21118eddc09d59cdc667fe22833eb
2018-04-19 19:23:53 -07:00
Treehugger Robot
c4ad6b6adc Merge changes I722d2c41,Ic216ddef
* changes:
  Improve test_adb.py
  adb: Distinguish betwen already-connected and connection failure
2018-04-20 02:13:09 +00:00
Josh Gao
22bce1788e Merge "adb: don't error in handle_host_request if we can't acquire a transport."
am: 224d965be0

Change-Id: If1d8207916095c9fbca83c716f51846f125897b9
2018-04-19 14:52:57 -07:00
Treehugger Robot
224d965be0 Merge "adb: don't error in handle_host_request if we can't acquire a transport." 2018-04-19 21:40:57 +00:00
Josh Gao
78f133d7d4 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
2018-04-19 13:09:18 -07:00
Tom Cherry
76b17047de Merge "Add a dummy entry for the 70220 event tag"
am: 3152c540b4

Change-Id: I1f658a8a09a6a72457069fc109f13040f372dfd9
2018-04-19 11:19:14 -07:00
Tom Cherry
3152c540b4 Merge "Add a dummy entry for the 70220 event tag" 2018-04-19 18:02:30 +00:00
Luis Hector Chavez
c12004dd23 Merge "init: Use android::base::boot_clock instead of /proc/uptime"
am: 8e73e6f242

Change-Id: I32c0ee2092a39af494126b7fbe3f42e0f6c0a2d1
2018-04-19 10:55:15 -07:00
Treehugger Robot
8e73e6f242 Merge "init: Use android::base::boot_clock instead of /proc/uptime" 2018-04-19 17:43:07 +00:00
Paul Crowley
533870c48f Merge "Set property for metadata encryption on first boot"
am: def249956c

Change-Id: I233286b4275d82be930683ca86147273f3b8c5dd
2018-04-18 17:28:35 -07:00
Treehugger Robot
def249956c Merge "Set property for metadata encryption on first boot" 2018-04-19 00:17:42 +00:00
Tom Cherry
dcc4b2bb4a 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
Change-Id: If117e1c0cfa678af4190913f0ca87f4e92c54373
2018-04-18 16:25:56 -07:00
Jeff Vander Stoep
b0918bfa47 Merge "init.rc: create /data/system/dropbox"
am: c629131c26

Change-Id: I5ee32c5b8c66a3a4f8079456efcf8c711b025ccc
2018-04-18 15:02:21 -07:00
Treehugger Robot
c629131c26 Merge "init.rc: create /data/system/dropbox" 2018-04-18 21:48:39 +00:00
Paul Crowley
e383334457 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:42:45 -07:00
Mark Salyzyn
f089e1403b llkd: add live-lock daemon
Introduce a standalone live-lock daemon (llkd), to catch kernel
or native user space deadlocks and take mitigating actions.  Will
also configure [khungtaskd] to fortify the actions.

If a thread is in D or Z state with no forward progress for longer
than ro.llk.timeout_ms, or ro.llk.[D|Z].timeout_ms, kill the process
or parent process respectively.  If another scan shows the same
process continues to exist, then have a confirmed live-lock condition
and need to panic.  Panic the kernel in a manner to provide the
greatest bugreporting details as to the condition.  Add a alarm self
watchdog should llkd ever get locked up that is double the expected
time to flow through the mainloop.  Sampling is every
ro.llk_sample_ms.

Default will not monitor init, or [kthreadd] and all that [kthreadd]
spawns.  This reduces the effectiveness of llkd by limiting its
coverage.  If in the future, if value in covering kthreadd spawned
threads, the requirement will be to code drivers so that they do not
remain in a persistent 'D' state, or that they have mechanisms to
recover the thread should it be killed externally.  Then the
blacklists can be adjusted accordingly if these conditions are met.

An accompanying gTest set have been added, and will setup a persistent
D or Z process, with and without forward progress, but not in a
live-lock state because that would require a buggy kernel, or a module
or kernel modification to stimulate.

Android Properties llkd respond to (*_ms parms are in milliseconds):
- ro.config.low_ram default false, if true do not sysrq t (dump
  all threads).
- ro.llk.enable default false, allow live-lock daemon to be enabled.
- ro.khungtask.enable default false, allow [khungtaskd] to be enabled.
- ro.llk.mlockall default true, allow mlock'd live-lock daemon.
- ro.khungtask.timeout default 12 minutes.
- ro.llk.timeout_ms default 10 minutes, D or Z maximum timelimit,
  double this value and it sets the alarm watchdog for llkd.
- ro.llk.D.timeout_ms default ro.llk.timeout_ms, D maximum timelimit.
- ro.llk.Z.timeout_ms default ro.llk.timeout_ms, Z maximum timelimit.
- ro.llk.check_ms default 2 minutes sampling interval
  (ro.llk.timeout_ms / 5) for threads in D or Z state.
- ro.llk.blacklist.process default 0,1,2 (kernel, init and
  [kthreadd]), and process names (/comm or /cmdline) init,[kthreadd],
  lmkd,lmkd.llkd,llkd,[khungtaskd],watchdogd,[watchdogd],
  [watchdogd/0] ...
- ro.llk.blacklist.parent default 0,2 (kernel and [kthreadd]) and
  "[kthreadd]".  A comma separated lists of process ids, /comm names
  or /cmdline names.
- ro.llk.blacklist.uid default <empty>, comma separated list of
  uid numbers or names from getpwuid/getpwnam.

Test: llkd_unit_test
Bug: 33808187
Bug: 72838192
Change-Id: I32e8aa78aef10834e093265d0f3ed5b4199807c6
2018-04-18 14:01:56 -07:00
Tri Vo
9c0825051a Merge "Add /mnt/vendor rw mount point for vendor partitions."
am: 4640149fd5

Change-Id: I291f4e8d5900a2b277d341859ecbf73c51bf1d47
2018-04-18 12:45:08 -07:00
Tri Vo
4640149fd5 Merge "Add /mnt/vendor rw mount point for vendor partitions." 2018-04-18 19:32:32 +00:00
Jeff Vander Stoep
148dea71a5 init.rc: create /data/system/dropbox
Ensure dropbox has the new dropbox_data_file label.

Bug: 31681871
Test: ls -dZ /data/system/dropbox
    u:object_r:dropbox_data_file:s0 /data/system/dropbox

Change-Id: Ia67646f4a789155e20650c33fe4412cae7f930d2
2018-04-18 07:15:37 -07:00
Tom Cherry
f0d28c85b6 Merge "init: add sigstop option for debugging services from their start"
am: b41879111d

Change-Id: I9cb445303110f7e2be680b82617aa7517824cd7c
2018-04-18 06:57:32 -07:00
Tom Cherry
b41879111d Merge "init: add sigstop option for debugging services from their start" 2018-04-18 13:51:15 +00:00
Luis Hector Chavez
8b67c52099 Improve test_adb.py
This change uses a context manager to create the fake ADB servers (and
cleanly tear them down.

Bug: 74411879
Test: python system/core/adb/test_adb.py

Change-Id: I722d2c4135259b1b0ef00a1510aa8402e87ecf72
2018-04-17 21:49:43 -07:00
Mark Salyzyn
c2d4d08be2 Merge "lmkd: limit capability set to minimum"
am: 01ce44b734

Change-Id: If5f392f53892716c1e3d883ef5d77251806bb29d
2018-04-17 15:28:35 -07:00
Treehugger Robot
01ce44b734 Merge "lmkd: limit capability set to minimum" 2018-04-17 22:16:53 +00:00
Tom Cherry
8f38048f7d init: add sigstop option for debugging services from their start
Test: the examples in README.md
Change-Id: Idb528ea4017f8f4ce62911928c040f4bc558d196
2018-04-17 14:52:49 -07:00
Luis Hector Chavez
5d39585255 adb: Distinguish betwen already-connected and connection failure
This change returns a different value (-EALREADY) when a connection has
already been established, as opposed to a real connection failure (which
still returns -1).

Bug: 74411879
Test: Opened a socket, tried to adb connect to it,
      got "failed to connect to localhost:1337"

Change-Id: Ic216ddef7f28eb43ca750f9e51d068c077d54b07
2018-04-17 14:36:33 -07:00
Tri Vo
0b66969ba0 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
Merged-In: I3739130739eadf508355c7f2531366fcaed74175
(cherry picked from commit b511475664)
2018-04-17 11:19:44 -07:00
Paul Crowley
e72619c947 Merge "Re-land "If enablefilecrypto or init_user0 fails, reboot into recovery.""
am: ca10ecb3ae

Change-Id: Ib906e393d8d2226083f23503c7eb1f96c58bbcf1
2018-04-17 10:07:39 -07:00
Treehugger Robot
ca10ecb3ae Merge "Re-land "If enablefilecrypto or init_user0 fails, reboot into recovery."" 2018-04-17 16:53:30 +00:00
Luis Hector Chavez
c83ea69db8 Merge "Make bootstat container-friendly"
am: 0eee579fa2

Change-Id: Iee8145ade4ae97af3d5738ecfad7c3121b7e3c56
2018-04-17 09:07:59 -07:00
Paul Crowley
c73b21558b 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:03:57 -07:00
Treehugger Robot
0eee579fa2 Merge "Make bootstat container-friendly" 2018-04-17 16:01:06 +00:00
Elliott Hughes
aeaade106d Merge "Remove out of date comment."
am: 8a34e636ca

Change-Id: Ib185f7f069dfd85548479631ed105ea207d01fa3
2018-04-16 18:44:53 -07:00
Hridya Valsaraju
72a1a812ad Merge "Remove header version check for command "fastboot boot boot.img""
am: b245377f0e

Change-Id: Ibbb42dd2cc376874a518a5082aa2e1316c01ec87
2018-04-16 18:44:15 -07:00
Treehugger Robot
8a34e636ca Merge "Remove out of date comment." 2018-04-17 01:38:11 +00:00
Treehugger Robot
b245377f0e Merge "Remove header version check for command "fastboot boot boot.img"" 2018-04-17 01:31:06 +00:00
Chih-Hung Hsieh
f5f128ea90 Merge "Use ld when lld fails"
am: e3b149c754

Change-Id: Ic145eb368b83d9ea7996737f431f81e2ecf5d608
2018-04-16 17:44:54 -07:00
Treehugger Robot
e3b149c754 Merge "Use ld when lld fails" 2018-04-17 00:31:05 +00:00
Hridya Valsaraju
d016ee4dbe 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-16 16:55:58 -07:00
Chih-Hung Hsieh
29e54f8e75 Use ld when lld fails
* Android's clang lld link rules do not work with the special link order of
  libunwind_llvm yet.

Bug: 78118944
Test: make checkbuild and boot
Change-Id: Ife9707f111dfd24cb84b56754a4fc3f826f722c4
2018-04-16 16:00:15 -07:00
Elliott Hughes
77561c1f28 Remove out of date comment.
Bug: https://code.google.com/p/android/issues/detail?id=189821
Test: N/A
Change-Id: I25e64611d0c2db75a9caf0f19e7dd17c725d98a1
2018-04-16 15:22:33 -07:00
Mark Salyzyn
64d97d8761 lmkd: limit capability set to minimum
Set F() capability set and 'drop' lmkd from AID_ROOT to AID_LMKD uid
and from AID_ROOT to AID_LMKD and AID_SYSTEM gid.

/dev/memcg/memory.pressure defaults to root.root mode 0000, set it up
as root.system mode 0040 to allow lmkd read access.

Instrument failure to set SCHED_FIFO.

Annotate access points that require elevated capabilities.

Test: check /proc/`pidof lmkd`/status for capability set
Test: lmkd_unit_test
Bug: 77650566
Change-Id: I986081a0434cf6e842b63a55726380205b30a3ea
2018-04-16 14:51:56 -07:00
Luis Hector Chavez
03aae156b8 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
Merged-In: Ifb792864394be0b4686cc9d555c0afced856f4b4
2018-04-16 11:17:42 -07:00
Suren Baghdasaryan
6575d86d3d Merge "lmkd: Introduce support for legacy kill algorithm that uses minfree levels"
am: 22dc27b9fa

Change-Id: If597afe2980eea27e80903ba37fe62382ba3d4d3
2018-04-15 10:46:20 -07:00