Commit graph

52771 commits

Author SHA1 Message Date
Eric Biggers
d964376a92 fs_mgr_fstab: support specifying encryption policy version in fstab
Allow the encryption policy version to be specified as a third field in
the "fileencryption=" fstab option, and expose it through the fstab
record so that vold can use it.

Bug: 140500999
Test: tested as series; see If64028d8580584b2c33c614cabd5d6b93657f608.
      Also updated and ran the fs_mgr unit tests.
Change-Id: If5d56f4c84c4cd51e3f14c0a861c3e3ab6ff903f
2019-09-30 10:27:38 -07:00
Suren Baghdasaryan
17e920dbe4 Merge "libmeminfo: Report VMA flags in procmem report" 2019-09-30 17:25:34 +00:00
Suren Baghdasaryan
4b75088810 lmkd: Prevent killing foreground processes due to thrashing
Page cache thrashing affects device performance and by killing a process
we try to stop it. However if the thrashing application is the one which
user is interacting with then lmkd should not kill it even though it might
affect device performance.

Bug: 141286980
Test: SequentialRWTest CTS test
Change-Id: If86c0e7e8ad9adf1816659562151ca083eaa65c4
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:54:55 +00:00
Suren Baghdasaryan
fd7518f8c1 lmkd: Add optional kill reason description into kill reports
Allow kill report to be appended with the explanation of the reasons
killing has been done. This would help identify kill reasons while
troubleshooting lmkd kills.

Change-Id: Ie5dd7a44e51d04c43c2492be8c1bc964d1b03555
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:54:39 +00:00
Suren Baghdasaryan
844f26bc24 lmkd: Enable new kill strategy, add and adjust required system properties
Enable new kill strategy when PSI mode is used in combination with
ro.lmk.use_minfree_levels=false. Adjust ro.lmk.swap_free_low_percentage,
introduce ro.lmk.psi_partial_stall_ms and ro.lmk.psi_complete_stall_ms
system properties to support two levels of PSI events measuring partial
and complete stalls. Add ro.lmk.use_new_strategy system property to switch
to the old strategy if necessary.

Bug: 132642304
Test: lmkd_unit_test, ACT memory pressure tests
Change-Id: I6f1b65e19dbe9b58c862e5e4255270c82f0afb9a
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:54:27 +00:00
Suren Baghdasaryan
4787ab452f lmkd: Use aggregate zone watermarks as low memory threshold
Parsing /proc/zoneinfo is expensive and zone watermarks normally do no
change often. Instead of checking free memory per each zone we aggregate
zone watermarks and compare them with MemFree from meminfo as an
approximation of memory being under a given watermark.
zoneinfo parsing is rate limited to once per minute to detect a possible
change of the memory margins from userspace.

Bug: 132642304
Test: lmkd_unit_test, ACT memory pressure tests
Change-Id: If4a8154c004e24324e6de44359de416766139df6
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:54:16 +00:00
Suren Baghdasaryan
561cfd9478 lmkd: Introduce kill strategy based on zone watermarks, swap and thrashing
Add new kill strategy which makes kill decisions based on which zone
watermark is breached, how much free swap space is still available and
what percentage of the file-backed page cache has been refaulted. This mode
is designed to be used only with PSI signals. It kills unconditionally when
a critical pressure event is received, therefore PSI stall for that event
should be set to a value representing a truly non-responding system
(currently set to 700ms out of 1sec spent in complete stall). New event
handler also controls polling interval based on current memory conditions.

Bug: 132642304
Test: lmkd_unit_test, ACT memory pressure tests
Change-Id: Ia213ef2bb06b245d651ebf2d813e944b4ae7565f
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:54:05 +00:00
Suren Baghdasaryan
ef3650f8a0 lmkd: Support variable polling intervals set by event handlers
After a memory event happens event handler can assess current memory
condition and decide if and when lmkd should re-check memory metrics in
order to respond to changing memory conditions. Change the event handler
interface to allow control over polling period and ability to start/extend
polling session.

Bug: 132642304
Test: lmkd_unit_test
Change-Id: Ia74011e943140b6cffbf452ff8e1744b7336eacf
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:53:46 +00:00
Suren Baghdasaryan
94ce3dd573 lmkd: Change zoneinfo parsing to retrieve zone watermarks
/proc/zoneinfo contains per-node data and each node contains per-zone
section for each zone. Current parser does not recognize this hierarchy
and useful per-zone information like zone watermarks cannot be retrieved.
Change the parser to parse zoneinfo into a hierarchical structure. New
parser also handles up to 2 nodes and can be easily extended to handle
more if needed by changing MAX_NR_NODES.

Bug: 132642304
Test: lmkd_unit_test
Change-Id: I9306289ea6d30d78a261c5d5c29f4f6ea167807d
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:53:34 +00:00
Suren Baghdasaryan
a77b327bb9 lmkd: Change procfs read routine to handle files larger than 1 page in size
Files like /proc/zoneinfo or /proc/<pid>/status can be larger than 4KB
page size. Change reread_file routine to resize read buffer whenever
it is not big enough to read the entire file. Start with 1-page buffer
and double its size until it's big enough to read the entire file.
Read /proc/zoneinfo during initialization to initialize the buffer
to a big enough size and avoid re-allocations when under memory pressure.

Bug: 137010962
Test: lmkd_unit_test
Change-Id: If9a5b0d27c2f4de9063f0fd0f36f908ece87dcce
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:53:18 +00:00
Suren Baghdasaryan
7c2f94bdf0 Merge "lmkd: Fix killed process name reporting" 2019-09-30 16:53:05 +00:00
Suren Baghdasaryan
9e359dbe61 lmkd: Fix killed process name reporting
Fix termination of killed process name in proc_get_name function. While at
it also fix the coding style in the function.

Test: lmkd_unit_test
Bug: 141780598
Change-Id: I3f99b3e37b9a9d0750ece94f08f0b50ac839dacb
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:02:35 +00:00
Florian Mayer
922eecc5a0 Further document MapInfo::elf_offset.
Change-Id: I291d8a61cb400fdf5795a85c4e9a65406124717e
2019-09-30 16:23:39 +01:00
Rick Yiu
0b211fa8b3 libprocessgroup: add support to set aggregate profiles
To support setting multiple profiles with one call. The json format
is as below example.

  "AggregateProfiles": [
    ...
    {
      "Name": "SCHED_SP_BACKGROUND",
      "Profiles": [ "HighEnergySaving", "LowIoPriority", "TimerSlackHigh" ]
    },
    ...
  }

Bug: 139521784
Test: SetProfile works as expected
Change-Id: Ibe14ed57d5169cafcbcbbdb054df3ed171a2f6a2
2019-09-30 08:35:28 +00:00
Orion Hodson
2c392b6d0a Merge "Add temporary CPPLINT.cfg files to libnative{bridge,loader}" 2019-09-30 06:43:39 +00:00
Treehugger Robot
a18907da54 Merge "[vts-core] Remove extra folder for vts_core_liblp_test and vts_libdm_test" 2019-09-30 05:34:15 +00:00
Jooyung Han
0839e5afdc libnativeloader: fix typo in README.md
Test: N/A
Change-Id: I7766ebaafa193b90096c5061adbf67eaf26e651c
2019-09-30 13:20:04 +09:00
Kiyoung Kim
e99728fcf2 Merge "Add library list for VNDK using core variant" 2019-09-30 01:51:26 +00:00
Tom Cherry
a0e4af67eb logwrapper: update benchmark and remove old functions
All of the previous callers have been updated, so we can remove these
old functions.

Test: build
Change-Id: I31597a69635795bacf9bb8054ccf5ffa8089e481
2019-09-28 07:27:26 -07:00
Vic Yang
5a141424e6 Fix memory leak in String16
Newly allocated SharedBuffer already has reference count 1, so we
should not call acquire().

Bug: 141764153
Test: Run String16Test.* with ASan that was able to detect the leak
      without this change.
Change-Id: Ib8b1b707b028386d717414d8c5ec5ea7b4b59464
2019-09-27 21:07:00 -07:00
Treehugger Robot
34aba6a690 Merge "Separate system_ext_sepolicy.cil out of system sepolicy" 2019-09-28 00:28:57 +00:00
Yifan Hong
a171ef38aa libsnapshot: Return path if snapshot is already merged
If snapshot is already merged, MapUpdateSnapshot
will only map the base device, but it doesn't return
the path. Now, it returns the path of the base device as well.

Test: libsnapshot_test

Change-Id: Ic56bc1a624651f24185c52401a3a01e8942d5d57
2019-09-27 16:11:39 -07:00
Orion Hodson
efb669efb9 Add temporary CPPLINT.cfg files to libnative{bridge,loader}
This is just to permit moving under art/. We'll back these out after
the move (assuming it's not too much gratuitous churn).

Bug: 141749154
Test: symlink libraries under art/, m cpplint-art-all
Change-Id: Ibd4882f416072076d4605bc329192f0bc1b196fb
2019-09-27 17:32:43 +00:00
Tom Cherry
3699dbe2e0 Merge "init: add tips for debugging linker errors when launching init services" 2019-09-27 15:31:42 +00:00
Tom Cherry
aef269f11b Merge changes from topic "logwrapper-api-update"
* changes:
  Update init/fs_mgr for new logwrapper function
  logwrap: convert to C++, rename function logwrap_fork_execvp().
2019-09-27 15:31:04 +00:00
Suren Baghdasaryan
e36ae49985 Merge "lmkd: Maintain pid to taskname mapping to amend kill reports." 2019-09-27 15:22:44 +00:00
Treehugger Robot
6854bd9c32 Merge "[vts-core] Add vts_core_meminfo_test to vts-core" 2019-09-27 07:11:41 +00:00
nelsonli
3beec54bf1 [vts-core] Remove extra folder for vts_core_liblp_test and vts_libdm_test
Remove the extra folder of vts_core for vts_core_liblp_test and
vts_libdm_test since we have a better auto-gen option of auto_gen_config.

Bug: 141684102
Test: 1. m -j vts_core_liblp_test
      2. m -j vts_libdm_test
      3. check out/.../vts_core_liblp_test.config
         and
         out/.../vts_libdm_test.config

Change-Id: Ibcdf96104205b50b3da522364199330ad0190c70
2019-09-27 15:00:12 +08:00
Kiyoung Kim
862c07f22b Add library list for VNDK using core variant
Some device requires VNDK_USING_CORE_VARIANT list, but it was not
implemented in previous. Adding this library list to the build target so
it can be added to system image.

Bug: 141695559
Test: m -j passed & Tested from Cuttlefish
Change-Id: I52750583050401098ca8dacee9cf84e8c5727e36
2019-09-27 14:11:19 +09:00
nelsonli
745a306f71 [vts-core] Add vts_core_meminfo_test to vts-core
Add vts_core_meminfo_test to vts-core suite and transfer to test it
by using base GTest.

Bug: 132702215
Test: atest vts_core_meminfo_test
Change-Id: Ia7924179cde0b79a6787b3533259ea8e90594585
2019-09-27 09:43:51 +08:00
Yifan Hong
3edff134ef Merge "libsnapshot: refactor CreateUpdateSnapshots" 2019-09-27 01:11:22 +00:00
Elliott Hughes
458f221ef1 Merge "debuggerd: increase the default limit on tombstones to 32." 2019-09-27 00:37:21 +00:00
Jim Blackler
d2da814d1f lmkd: Maintain pid to taskname mapping to amend kill reports.
Required because the kernel cannot always get the taskname safely at
the time the process is killed (due to competition for mm->mmap_sem).

Test: manually
Bug: 130017100
Signed-off-by: Jim Blackler <jimblackler@google.com>
Change-Id: I27a2c3340da321570f0832d58fe9e79ca031620b
2019-09-26 16:27:03 -07:00
Tom Cherry
9328021ce7 init: add tips for debugging linker errors when launching init services
Test: we can see linker errors in dmesg when following these tips
Change-Id: I86b65e01d06ed7c0b908c4512d55872cd5595eca
2019-09-26 15:24:40 -07:00
Suren Baghdasaryan
fc867c9cb1 libmeminfo: Report VMA flags in procmem report
Add VMA flags into procmem report so that we can distinguish different
sections of an executable or a library.

Bug: 138148041
Test: procmem -h <PID>
Change-Id: I062464aa1f1c508bcc8ef05a6d9cfad9a4318d95
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-26 14:51:40 -07:00
Elliott Hughes
ec220cd877 debuggerd: increase the default limit on tombstones to 32.
We're missing useful crashes, especially on hwasan builds.

Bug: http://b/140580637
Test: run crasher
Change-Id: Ib5d8d3bd3fc4d7fec77d0b10302e5595f97a3515
2019-09-26 14:36:01 -07:00
Treehugger Robot
f0d17fb50e Merge changes from topic "remove_ashmemd"
* changes:
  libcutils: route to /dev/ashmem<boot_id> instead of ashmemd
  ueventd: duplicate /dev/ashmem
2019-09-26 17:56:53 +00:00
Victor Hsieh
f0a242f73d Refactor mini-keyctl and split a static library
Test: mini-keyctl still works in command line
Bug: 112038744
Change-Id: I08006d8befa69e4bf416a2bed9e1813725877147
2019-09-26 10:45:38 -07:00
Tom Cherry
3a803eb2d4 Update init/fs_mgr for new logwrapper function
Test: cuttlefish boots, fsck logs seen
Change-Id: Icbc01161b44e097be813f4af648fa671739078b9
2019-09-26 10:29:57 -07:00
Tom Cherry
ff7d067ffa logwrap: convert to C++, rename function logwrap_fork_execvp().
Call the function now logwrap_fork_execvp() and fix const correctness
issues, so no longer do callers need to const_cast<> their args.

Test: logwrapper still works
Change-Id: Iea34f5cae90a06a37d395bf9a91e01fb38c35fa6
2019-09-26 10:29:57 -07:00
Colin Cross
2a62d42704 Merge "Use libcrypto_static instead of libcrypto" 2019-09-26 14:32:33 +00:00
Martin Stjernholm
4cbf095493 Merge "Must use libdexfile_support_static in a static executable." 2019-09-26 14:24:46 +00:00
Tom Cherry
7d91385cf5 Merge "logwrapper: open child_ptty in child process and remove ignore_int_quit" 2019-09-26 13:52:25 +00:00
Kiyoung Kim
4b45eab15b Merge "Find or guess installed libraries for VNDK library list" 2019-09-26 00:58:15 +00:00
Hamzeh Zawawy
c7ea8817ea Merge "Add fuzzer for libsparse" 2019-09-25 23:56:09 +00:00
Treehugger Robot
fb897dc1f5 Merge "logd: remove logd.both test" 2019-09-25 23:16:13 +00:00
Yifan Hong
98aa26fe69 libsnapshot: refactor CreateUpdateSnapshots
This function is too big. Refactor it a bit.

- Reorder checks / variable initializations a bit.
  They are independent of each other, so they can be
  safely reordered.
- Put snapshot creation and initialization to their own
  functions so that CreateUpdateSnapshots looks shorter.

Test: libsnapshot_test
Change-Id: I135b415d8e046dd91d31326fe7962ae44be4ccf8
2019-09-25 15:20:50 -07:00
Yifan Hong
ab09a1764b Merge changes Iab867ded,Id37e34b4
* changes:
  libsnapshot: CreateUpdateSnapshots reuse COW space
  libsnapshot: fix tests
2019-09-25 22:19:50 +00:00
Yifan Hong
bc71949dd7 Merge "libsnapshot: Fix mocked property fetcher" 2019-09-25 22:19:35 +00:00
Josh Gao
3a22e8cf73 Merge "adb: fragment host linux USB writes when needed." 2019-09-25 21:20:54 +00:00