Commit graph

45034 commits

Author SHA1 Message Date
Tim Murray
1504cb5b6e Set /proc/pressure/memory file permissions
Change access mode and ownership for /proc/pressure/memory file
to allow system components access memory pressure information.

Bug: 129476847
Change-Id: I25b6bc9d47aee857936f050b66e7bee6363b53be
Signed-off-by: Tim Murray <timmurray@google.com>
2019-03-28 22:12:06 +00:00
Elliott Hughes
720c1ecc90 BSD grep: sync with upstream.
No significant changes, but this does get rid of our local modifications.

Bug: http://b/129089665
Test: builds
Change-Id: Ie6e3cc2198c302fc998fe6fcf027661e5dca88f0
2019-03-28 14:29:00 -07:00
Nick Kralevich
b86e248e8b Merge "zip_writer.cc: update powerof2 and use it unconditionally" 2019-03-28 20:23:00 +00:00
Josh Gao
bfcb981b32 Merge "adbd: wait for FUNCTIONFS_BIND for up to a second, then retry." 2019-03-28 19:53:29 +00:00
Treehugger Robot
a896e2aee5 Merge "init: mount_handler: system-as-root (legacy)" 2019-03-28 18:25:27 +00:00
Julien Desprez
61dea3d154 Add the basic config to run through atest
Add basic config that can run through atest the remount
script.
Very first step before being able to run in infra.

Test: atest adb-remount-sh
Bug: 117670584
Change-Id: I399f79fb7d7cd1b8a832be23efb3b625be693f7e
2019-03-28 10:21:02 -07:00
Suren Baghdasaryan
81cfeb54fc Merge "libprocessgroup: restrict SetupCgroups to one-time usage and only by init" 2019-03-28 17:13:09 +00:00
Martin Stjernholm
60de348654 Merge "Apply the standard system linker config to all of /data." 2019-03-28 12:37:29 +00:00
dimitry
0c11941468 Add dependency on libdl_android
platform private symbols have been moved to libdl_android.so
since they are not intended to be accessible from apps.

Test: make
Bug: http://b/129387775
Change-Id: I883a6d2ca588a258dd43efa766fad4e07428594e
(cherry picked from commit e3d0383d38)
2019-03-28 12:52:27 +01:00
David Anderson
5aa37dc3dc Merge "init: Support booting off GSIs installed to non-userdata block devices." 2019-03-28 09:46:44 +00:00
Bernie Innocenti
7cb72c96b4 Disallow operator!() on unique_fd
This catches a common mistake where client code checks for errors using
the common idiom that works for std::iostream and other file-like
classes:

  unique_fd fd = open(...);
  if (!fd) {
  }

Test: atest libbase_test
Test: m droid
Change-Id: I9629a7795537ecb3b57be9c741c06f80967e4cc2
2019-03-28 15:56:07 +09:00
Suren Baghdasaryan
5b53573671 libprocessgroup: restrict SetupCgroups to one-time usage and only by init
SetupCgroups is called by init process during early-init stage and is not
supposed to be called again by anyone else. Ensure that the caller is the
init process, make sure cgroup.rc file is written only one time, keep the
file descriptor to cgroup.rc file open by the init process to ensure all
its further mappings stay valid even if the file is deleted.

Bug: 124774415
Test: build, run, verify no errors or warning in the logcat

Change-Id: Ib8822cf0112db7744e28d442182d54dcf06f46f2
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-03-28 01:25:22 +00:00
Mark Salyzyn
793f4b503e init: mount_handler: system-as-root (legacy)
On marlin, dev.mnt.blk.root is empty.  Issue is shared for all
devices that are system-as-root.

/dev/root /proc/mounts entry exists before the associated block device
is instantiated by ueventd.  As a result when the device shows up the
root mount is updated late when the next mount inotify trigger occurs,
delay which we will accept.  But the property entries are added before
removed in the loop which causes the ultimate property entry for root
to report empty. Add /dev/block/dm-0, remove /dev/root, for property
dev.mnt.blk.root.

Fix is to change to Remove before Adding.  Remove /dev/root, then add
/dev/block/dm-0.

On system-as-root as well, can not just use fstab.  Determine if a
dm-verity reference is wrapped around system and use that instead.

Add some additional filtration of loop and APEX mounts to reduce
property noise.

Fix issue with creating the std:string line holder from getline(3).

Test: manual on marlin
Bug: 124072565
Change-Id: Ief2e1a6f559cbcbc87273fc2db35c675bb972f43
2019-03-27 20:50:39 +00:00
Treehugger Robot
7f43e9fa40 Merge "Initialize fs-verity keys in shell script" 2019-03-27 20:31:19 +00:00
Yifan Hong
ee9ba3efe7 Merge "charger: android_get_control_file on last_kmsg" 2019-03-27 19:01:07 +00:00
Josh Gao
19dc296305 adbd: wait for FUNCTIONFS_BIND for up to a second, then retry.
Occasionally, after we open the functionfs endpoint and write our
descriptors to it, we end up in a state where we never receive any
events from ep0, presumably due to a race against some other part of
the system, since adding sleeps reduces the likelihood. Add an
(arbitrarily chosen) timeout for the initial FUNCTIONFS_BIND we read,
and retry on failure.

Bug: http://b/128679787
Test: unplug and replug a blueline 14,000 times with a usb switch board
Change-Id: I4b3d5d552179ee7f3fefcc15f9575f793926f784
2019-03-27 18:04:45 +00:00
Nick Kralevich
6d3c80b85a zip_writer.cc: update powerof2 and use it unconditionally
Update the powerof2 macro to one that is integer overflow safe.
This definition is the same one used by bionic, but cleaned up using
clang_format.

Unconditionally use this powerof2 macro, to ensure consistency across
all the build environments.

Test: compiles and boots
Change-Id: I21bfaf2360d1f77caf96365e20490b1deadfdfe0
2019-03-27 10:24:44 -07:00
Treehugger Robot
fdf70f1ba8 Merge "Remove links to libart(d).so in the runtime." 2019-03-27 17:12:27 +00:00
Elliott Hughes
3312ca7e04 Merge "libprocessgroup: add -Wexit-time-destructors." 2019-03-27 15:42:02 +00:00
Treehugger Robot
29d2b05194 Merge "Logtags for com.android.server.policy" 2019-03-27 14:41:12 +00:00
Treehugger Robot
80e72443d0 Merge "libziparchive: add integer checks" 2019-03-27 13:03:16 +00:00
Treehugger Robot
e346d03c2b Merge "lmkd: set PSI_POLL_PERIOD to 10ms" 2019-03-27 05:03:16 +00:00
Suren Baghdasaryan
5db6a84831 lmkd: set PSI_POLL_PERIOD to 10ms
Occasionally we see cases when 40ms polling is still too conservative.
Change to 10ms polling period. Since the polling happens only after PSI
signal and continues for 1sec this should not affect system performance.

Test: lmkd_unit_test
Bug: 129358844

Change-Id: Ib759b865b2104be23741fc0eacaa541e22d50dde
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-03-27 02:10:10 +00:00
Elliott Hughes
be87d447b4 libprocessgroup: add -Wexit-time-destructors.
Exit time destructors already caused trouble (see
dba6d44376), and without this warning,
it's too easy to reintroduce issues.

Bug: 129023204
Test: builds
Change-Id: If5fb4d0c11c74ba4971bb218059c6d37edeaf4df
2019-03-26 18:50:22 -07:00
Treehugger Robot
10533c57ed Merge changes Ia84ed9ec,I1c0fde72
* changes:
  fastboot: Avoid extra std::string copies
  adb: Avoid extra std::string copies
2019-03-27 00:33:05 +00:00
Christopher Ferris
3da5fcbf70 Merge "Add BuildId to frame information." 2019-03-27 00:26:03 +00:00
Josh Gao
49a8eecc5f Merge "liblog: don't return 0xFFFFFFFF as an invalid log id." 2019-03-27 00:24:47 +00:00
Josh Gao
2decb2fc3a Merge changes I80af5f4b,I2fd0034e
* changes:
  adbd: listen to all functionfs events.
  adbd: increment writes_submitted_ before submitting writes.
2019-03-27 00:24:43 +00:00
Yifan Hong
dc9c08b900 charger: android_get_control_file on last_kmsg
Call android_get_control_file on last_kmsg files if the file
descriptor is provided by init.

Also, uses base::Read(File|Fd)ToString functions to read the
files (because load_file doesn't support fd arguments).

Test: charger mode
Test: manual kernel panic, then start charger; seen last kmsg.

Bug: 129138950
Change-Id: Idd3376e349f29586a1e66faab2c0f1bf73e0eda5
2019-03-26 15:51:55 -07:00
Josh Gao
6933d54e09 adbd: listen to all functionfs events.
Monitor for FUNCTIONFS_UNBIND as well, so that in the case where we get
FUNCTIONFS_BIND, FUNCTIONFS_UNBIND, FUNCTIONFS_BIND, we don't trigger an
assertion failure from seeing two FUNCTIONFS_BINDs.

Bug: http://b/129134256
Test: manual
Change-Id: I80af5f4b833513e932262638b9f8d76bbcb35504
2019-03-26 13:38:41 -07:00
Yifan Hong
f959fffc1c Merge changes from topic "lpdumpd"
* changes:
  libbase: realpath is wrapped with TEMP_FAILURE_RETRY
  liblp: Replace open with GetControlFileOrOpen
  init: expand prop in 'file'
  libcutils: android_get_control_file uses realpath.
2019-03-26 20:35:36 +00:00
Josh Gao
63b52ec13b adbd: increment writes_submitted_ before submitting writes.
If we fail to submit writes for some reason (e.g. the USB cable was
unplugged), another thread that's waiting on the write mutex can enter
SubmitWrites and attempt to resubmit the writes that we already failed
to submit, leading to a failed assertion of !IoBlock::pending.

Increment writes_submitted_ before actually calling io_submit, so we
skip over these writes and fall through to exit.

Bug: http://b/129134256
Test: manually unplugged a blueline
Change-Id: I2fd0034e45db22c8f637c81039ce686b7aa6a03b
2019-03-26 13:06:38 -07:00
Siarhei Vishniakou
6bd71b979c Logtags for com.android.server.policy
The definitions for event log tags are currently in system/core. Instead
of keeping them there, reserve a range for these event tags and move
them into com.android.server.policy.

Currently it is only used by PhoneWindowManager.

Bug: 128933363
Test: build only
Change-Id: Ida903499e9af8650299e3965787b4ac966b66915
Merged-In: Ida903499e9af8650299e3965787b4ac966b66915
2019-03-26 12:36:53 -07:00
Greg Kaiser
b49d9e19dc fastboot: Avoid extra std::string copies
The function do_for_partitions() takes a const std::string
reference, so it's inefficient to pass a std::string::c_str().

Test: TreeHugger
Change-Id: Ia84ed9ec691ee2f524c61dd25a81b2995bb0bb33
2019-03-26 12:04:05 -07:00
Greg Kaiser
e2125fdeb1 adb: Avoid extra std::string copies
When a function argument takes a std::string, it's inefficient to
pass std::string::c_str(), since that creates an additional copy.
So we change these calling sites.

Test: TreeHugger
Change-Id: I1c0fde7275eb3ebd3baf05ec62581b0243655608
2019-03-26 12:00:19 -07:00
Martin Stjernholm
adf4503de1 Apply the standard system linker config to all of /data.
This is necessary to get the correct APEX namespace setup for apps that
executes binaries from there.

In older releases no linker config applied to binaries in /data, so the
fallback config in /system/bin/linker was used, which basically just looked
up libraries in /system/{lib,lib64}. With the introduction of APEXes that
location no longer contains the complete set of libraries, so this is
necessary to retain functional parity.

Strictly speaking this fallback rule should apply as last resort for a
binary in any location, but the linker does not accept "dir.system = /".

Test: Flash and boot
Test: The app regression in b/128569634
Bug: 128569634
Change-Id: Icfcd66f0a7d8d898618be1b6186bb1111d20d688
2019-03-26 18:10:51 +00:00
Martin Stjernholm
5c074e0ab9 Remove links to libart(d).so in the runtime.
They are not needed since the binaries and relevant exported libraries have
moved to the Runtime APEX.

Test: Flash and boot
Test: atest CtsJniTestCases CtsJdwpTestCases
Bug: 119867084
Change-Id: If416fbae7057aec02059bb31a4dcd8b63dcc0cad
2019-03-26 17:24:12 +00:00
Nick Kralevich
eac1220fba Merge "Revert "libprocessgroup: make sure SetupCgroups is called once and only by init"" 2019-03-26 15:28:31 +00:00
Christopher Ferris
7813345faa Add BuildId to frame information.
Update debuggerd to print BuildId information by default.

Bug: 120975492

Test: New unit tests pass.
Test: debuggerd -b <PID> shows build id information.
Test: tombstones include build id information.
Change-Id: I019b031113d0b77385516223c63455b868924440
2019-03-26 08:04:40 -07:00
Pete Bentley
d2c4eb0dae Merge "Tighten native API surface." 2019-03-26 09:19:37 +00:00
Luke Huang
5f890050b7 Merge "Enlarge cmd buffer size of FrameworkListener" 2019-03-26 05:44:10 +00:00
Suren Baghdasaryan
c8ac3b9152 Revert "libprocessgroup: make sure SetupCgroups is called once and only by init"
This reverts commit 798e805715.

Reason for revert: causes SELinux policy denials when vold calls KillProcessesWithOpenFiles.

Bug: 129298168
Change-Id: Ie00bfc2b743757209b40b55d2ee038d7d20c73ff
2019-03-26 02:49:13 +00:00
Josh Gao
c6ad69d1d4 liblog: don't return 0xFFFFFFFF as an invalid log id.
There are a bunch of branches that check "id >= LOG_ID_MAX", but because
C++ hates you, this does a promotion to signed int despite the
fact that both sides of the comparison are the same enum with an
underlying type of unsigned int. (C++17 §7.6.3)

Return LOG_ID_MAX instead of a value that gets promoted to signed -1, to
avoid this.

Bug: http://b/129272512
Test: /data/nativetest64/logcat-unit-tests/logcat-unit-tests
Change-Id: I4b3ee662d76d5cc80d9a9625d17f7e5b5980de41
2019-03-25 16:41:39 -07:00
Suren Baghdasaryan
eedd5f6855 Merge "lmkd: Fix meminfo logs missing SwapTotal and having wrong field order" 2019-03-25 22:17:21 +00:00
Treehugger Robot
8a5a918ef8 Merge "Add the two best build system janitors." 2019-03-25 20:35:13 +00:00
Suren Baghdasaryan
7b2187c372 Merge "libprocessgroup: make sure SetupCgroups is called once and only by init" 2019-03-25 20:24:51 +00:00
Yi Kong
9b1f1ee4cc Merge "[libbacktrace] Modernize code to use override keyword" 2019-03-25 19:56:48 +00:00
Treehugger Robot
3d2fb41f17 Merge "Fix parse_apex_configs doc in README.md" 2019-03-25 18:49:41 +00:00
Suren Baghdasaryan
5ce165ec2e lmkd: Fix meminfo logs missing SwapTotal and having wrong field order
Previous change If154dc364711bf7c86f32e24ddcd10be359386de called
"lmkd: Do not downgrade/ignore events when swap is full" added SwapTotal
into meminfo structure without adding the field into events.logtag file.
This results in logs which missing field and all fields starting with
"SwapFree" get reordered as a result. Fix this by adding the missing field
into events.logtag.

Bug: 129274901
Test: Confirm correct information in the logcat
Change-Id: Ia4de3790a7e9d49a0e4cba8b3161a715eaf6532e
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-03-25 11:04:11 -07:00
Elliott Hughes
d8a4f1463d Add the two best build system janitors.
Test: N/A
Change-Id: Ib5351b50652a7d1e0ab537aedfe6d4335f507cde
2019-03-25 10:25:13 -07:00