Commit graph

38688 commits

Author SHA1 Message Date
Josh Gao
7a223584c5 Merge changes I465804fd,Ib5a684bb,If5e66570,I8471cc00,I8ba0a70a
* changes:
  adb: convert fdevent over to unique_fd.
  adb: move towards using unique_fd.
  adb: delete FDEVENT_DONTCLOSE.
  adb: remove fdevent_install, fdevent_remove.
  adb: fix uninitialized variable in AsyncServiceRef.
2018-05-23 00:01:29 +00:00
Treehugger Robot
2a1c0dd6df Merge "Simplify code" 2018-05-22 22:44:56 +00:00
Josh Gao
3b37fa256f adb: convert fdevent over to unique_fd.
This adds fdsan deallocation sanitization to all fds monitored by
fdevent, which is most of the ones in adb.

Bug: http://b/79786774
Test: python test_device.py
Change-Id: I465804fdb0fd0ac019445900a30ba3403f5bf711
2018-05-22 14:55:36 -07:00
Josh Gao
ae9c1dc44a adb: move towards using unique_fd.
Bug: http://b/79786774
Test: treehugger
Change-Id: Ib5a684bba88e87e1aad9da452dcdd5edd11f18f4
2018-05-22 14:55:36 -07:00
Josh Gao
e5353021ba adb: delete FDEVENT_DONTCLOSE.
The only existing usage of this doesn't actually need it.

Bug: http://b/79786774
Test: mma
Change-Id: If5e665705393e938cfdbf1526beb5496a8b99a9b
2018-05-22 14:55:36 -07:00
Treehugger Robot
931a840e8c Merge "Add OWNERS file for libstats/" 2018-05-22 21:54:55 +00:00
Treehugger Robot
762b0a3b9c Merge "Move libstatssocket from frameworks/base to system/core/" 2018-05-22 21:54:50 +00:00
Josh Gao
71f775a944 adb: remove fdevent_install, fdevent_remove.
Remove fdevent_install and fdevent_remove in favor of using
fdevent_create and fdevent_destroy, so that we can put RAII types (i.e.
unique_fd) into fdevent without worrying about -Wexit-time-destructors
or structs that are freed instead of deleted.

Bug: http://b/79786774
Test: python test_device.py
Change-Id: I8471cc00574ed492fe1b196944976cdaae8b7cff
2018-05-22 14:54:49 -07:00
Treehugger Robot
827de19932 Merge "lmkd: Do not set soft_limit_in_bytes on high-end devices" 2018-05-22 19:09:03 +00:00
Elliott Hughes
9971005cd3 Merge "fastboot: better temporary file errors." 2018-05-22 17:52:18 +00:00
Treehugger Robot
59976b9bed Merge "Property: Log errno for socket connect" 2018-05-22 17:37:23 +00:00
Suren Baghdasaryan
fe26dfb3bf lmkd: Do not set soft_limit_in_bytes on high-end devices
Setting memory.soft_limit_in_bytes on high-end devices with large memory
reserves affects performance of memory-hungry applications that have
large workingsets and keep thrashing because of the memory limits imposed.
Limit the usage of memory.soft_limit_in_bytes to low-memory devices only.
Add debug messages for future troubleshooting to capture cases when
vmpressure events are being ignored.

Bug: 78916015
Test: collect vmstat while running a heavy app
Change-Id: Ib4434b96d2be802ef89960b573486eae8d12f198
Merged-In: Ib4434b96d2be802ef89960b573486eae8d12f198
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-05-22 10:25:38 -07:00
Tom Cherry
c5fbf494e7 Merge "init: separate out epoll into a class" 2018-05-22 15:01:08 +00:00
Elliott Hughes
da1dbd6e6a fastboot: better temporary file errors.
Bug: http://b/80082652
Test: N/A
Change-Id: Ib9f34342157ea3a15fd48504d03f4f3a2c710579
2018-05-21 23:02:26 -07:00
Treehugger Robot
9f6f8bf0dc Merge "Mark as recovery_available: true" 2018-05-22 05:16:20 +00:00
Logan Chien
dda4678a11 Merge "Always use versioned VNDK directory" 2018-05-22 04:04:07 +00:00
DuXiao
4053359c7f Property: Log errno for socket connect
It's currently not clear that the error no indicating the
failure to invoke the library function. This change introduces
logs at the failing of socket connect, that could be clearly
get the true reason.

Test: Set system property with failed, and socket recv errno
      log will show

Change-Id: I36bf66988811f953e679d1c5a468de0bf1ab0a05
Signed-off-by: Jinguang Dong <dongjinguang@huawei.com>
2018-05-22 10:54:34 +08:00
Treehugger Robot
2fa9770c3a Merge changes I4d6da40d,I91c7ced5,I7b9f6d18
* changes:
  adb: Add a test for emulator connection
  adb: Improve test_adb a bit more
  adb: Add a way to reconnect TCP transports
2018-05-21 22:37:21 +00:00
Mark Salyzyn
6c6ec7240c init: separate out epoll into a class
Test: init_tests
Bug: 64114943
Change-Id: I5f03314773b02b9e30e8e21895b6bdcfd4909e88
2018-05-21 14:58:03 -07:00
Jordan Liu
e0a52774b4 Merge "Add a new directory to store downloaded apns" 2018-05-21 19:06:54 +00:00
Yao Chen
bc586d15d3 Add OWNERS file for libstats/
Test: N/A
Change-Id: Ic16b0e1330ff46bfea9524eacf109c4ded430c67
2018-05-21 10:12:49 -07:00
Yao Chen
b3be9eaff5 Move libstatssocket from frameworks/base to system/core/
So that lmkd can build on PDK.

Bug: 79349329
Test: builds locally
Merged-In: I981e6ef9f9769b873640e5f169a9495ccea2f25c
Change-Id: I981e6ef9f9769b873640e5f169a9495ccea2f25c
(cherry picked from commit b13a102c0a)
2018-05-21 10:06:25 -07:00
Niklas Lindgren
fd66538ef3 Add a new directory to store downloaded apns
downloaded apns-conf.xml will be stored in the folder
/data/misc/apns/ to make sure TelephonyProvider gets
access.

Bug: 79948106
Test: Manual
Change-Id: I4ba0596fa6523c0eb96328dbe46ead02587bd9b8
2018-05-21 18:48:28 +02:00
Treehugger Robot
74bf81443f Merge "debuggerd: fix CrasherTest.seccomp_crash_oom." 2018-05-19 02:14:33 +00:00
Treehugger Robot
98214c81d1 Merge "Adds /dev/block/by-name/<partition> symlinks" 2018-05-19 01:45:21 +00:00
Tom Cherry
4bfbd8e9a5 Merge "init: allow entering of network namespaces" 2018-05-19 00:22:58 +00:00
Tom Cherry
aead51b418 init: allow entering of network namespaces
Add the ability to enter a network namespace when launching a service.
Typical usage of this would be something similar to the below:

on fs
  exec ip netns add namespace_name

service vendor_something /vendor/...
  capabilities <lower than root>
  user not_root
  enter_namespace net /mnt/.../namespace_name

Note changes to the `ip` tool are needed to create the namespace in
the correct directory.

Bug: 73334854
Test: not yet
Change-Id: Ifa91c873d36d69db399bb9c04ff2362518a0b07d
2018-05-18 17:19:36 -07:00
Bowgo Tsai
8eec38f4e4 Adds /dev/block/by-name/<partition> symlinks
During uevent processing, some "by-name" symlinks will be created.
    /dev/block/<type>/<device>/by-name/<partition>

<type> can be: platform, pci or vbd.
<device> might be: soc.0/f9824900.sdhci, soc.0/f9824900.sdhci, etc.
<partition> might be: system, vendor, system_a, system_b, etc.

e.g., on a non-A/B device:
    /dev/block/platform/soc.0/f9824900.sdhci/by-name/system
    /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor

On a A/B device:
    /dev/block/platform/soc/1da4000.ufshc/by-name/system_a
    /dev/block/platform/soc/1da4000.ufshc/by-name/system_b
    /dev/block/platform/soc/1da4000.ufshc/by-name/vendor_a
    /dev/block/platform/soc/1da4000.ufshc/by-name/vendor_b

However, those symlinks are "device-specific".

This change adds the "generic" symlinks in ueventd, in addition to
the existing symlinks, when the possible "boot devices" are specified
in device tree. e.g.,

    &firmware_android {
	compatible = "android,firmware";
	boot_devices ="soc/1da4000.ufshc,soc.0/f9824900.sdhci";
    }

The following symlinks will then be created on the aforementioned non-A/B
and A/B devices, respectively.

    /dev/block/by-name/system
    /dev/block/by-name/vendor

    /dev/block/by-name/system_a
    /dev/block/by-name/system_b
    /dev/block/by-name/vendor_a
    /dev/block/by-name/vendor_b

Note that both <type> and <device> are skipped in the newly create symlinks.
It assumes there is no more than one devices with the same <partition>,
which is the assumption of current first stage mount flow.

Finally, when 'boot_devices' in DT is absent, it fallbacks to extract
'boot_devices' from fstab settings. e.g., using 'soc/1da4000.ufshc',
'soc.0/f9824900.sdhci' for a fstab with the following content:

   /dev/block/platform/soc/1da4000.ufshc/by-name/system
   /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor

Bug: 78613232
Test: adb shell ls /dev/block/by-name
Change-Id: Iec920b5a72409b6a2bdbeeb290f0a3acd2046b5d
2018-05-19 07:57:35 +08:00
Christopher Ferris
9e1514f1d7 Merge "Fix bug when doing signal handler lookup." 2018-05-18 20:04:15 +00:00
Christopher Ferris
239425b9fa Fix bug when doing signal handler lookup.
The new lld linker uses all non-zero offset executable maps. There was
a bug when trying to find if the stack is in a signal handler that caused
the code to read the wrong place in the elf. Fixed by not adding the elf
offset to the relative pc.

Also fixed the unwind_for_offline tool to dump multiple stacks if necessary.

Added new offline unit test that would have failed with the old code.

Bug: 79936827

Test: Ran unit tests and libbacktrace unit tests.
Test: Dumped backtraces of system pids.
Test: Ran 137-cfi art test.
Change-Id: Iaca8c18c2a314902e64c3f72831234297e8dcb1b
2018-05-17 18:58:42 -07:00
Treehugger Robot
60fab88ecc Merge "Document using libmemunreachable on an app" 2018-05-18 01:46:30 +00:00
Treehugger Robot
6aaa3beb39 Merge "Removing block device by-num symlinks" 2018-05-18 01:16:02 +00:00
Colin Cross
18f3685600 Document using libmemunreachable on an app
Document dumpsys meminfo --unreachable, and how to enable
malloc_debug backtraces on a single app.

Test: none
Change-Id: I649afdfff1c7438f74950395639b06c39cae3ca0
2018-05-17 16:17:28 -07:00
Bowgo Tsai
95591bd00e Removing block device by-num symlinks
The uevent.partition_num easily collides between partitions, for
example:

  Both /dev/block/sda3 and /dev/block/sdd3 will generate the same symlink:
    /dev/block/platform/soc/1da4000.ufshc/by-num/p3

This change remove those by-num symlinks as there seems no effective
user of it.

Bug: 78613232
Test: m init_tests && \
      adb push $OUT/data/nativetest64/init_tests/init_tests /data/. && \
      adb shell /data/init_tests

Change-Id: I8dfa8dc1a2f9fc9296aa30f33e905bf158b501de
2018-05-17 16:29:25 +08:00
Logan Chien
5a35d12e62 Always use versioned VNDK directory
Bug: 78605339
Test: sailfish-userdebug builds and boots
Test: sailfish boots with GSI
Change-Id: I7da5845b5c1caed3b73d7665f1db672f2764c2a8
(cherry picked from commit 6a145749be)
2018-05-17 14:29:44 +08:00
Treehugger Robot
93e4501611 Merge "adb: Retry io in case of interrupt" 2018-05-17 01:17:11 +00:00
Treehugger Robot
adf07c5428 Merge "adb: Move io_setup to usb_handle init" 2018-05-16 23:25:15 +00:00
Treehugger Robot
e619ebc151 Merge "adb: warn on remount if undoing deduplication is impossible" 2018-05-16 22:57:58 +00:00
Luis Hector Chavez
3255974169 adb: Add a test for emulator connection
This should prevent regressions in the future.

Bug: 78991667
Test: python system/core/adb/test_adb.py
Change-Id: I4d6da40da82c6d79797cec82ffaf071d4b56ddc7
2018-05-16 15:20:48 -07:00
Luis Hector Chavez
fbee0a9133 adb: Improve test_adb a bit more
This change:

* uses unittest.main(), which allows for a subset of the tests to be
  selected.
* drops the requirement to have a device already connected since all the
  tests that need a device now spin their own mock device.
* Splits the monolithic test class into more granular classes.
* Makes this file be pylint-compliant.

Bug: None
Test: python system/core/adb/test_adb.py
Test: pylint system/core/adb/test_adb.py
Change-Id: I91c7ced520c3c69f855d639e0dbf7e57bb690e97
2018-05-16 15:20:48 -07:00
Luis Hector Chavez
454bc7c0be adb: Add a way to reconnect TCP transports
This change adds a reconnect handler that tracks all TCP transports that
were connected at some point, but became disconnected. It does so by
attempting to reconnect every 10s for up to a minute.

Bug: 74411879
Test: system/core/adb/test_adb.py
Test: adb connect chromebook:22  # This runs with sslh
Test: CtsBootStatsTestCases
Test: emulator -show-kernel ; adb -s emulator-5554 shell

Change-Id: I7b9f6d181b71ccf5c26ff96c45d36aaf6409b992
2018-05-16 15:20:48 -07:00
Jerry Zhang
d8c1ae910f adb: Move io_setup to usb_handle init
Remove some redundancy by moving io_setup
into aio_block_init. The io_contexts will
now live till the end of the program, similar
to the rest of usb_handle

Test: adb works
Bug: 78793464
Change-Id: I910a39d4395645f1ff231f265c285a72893a0ac6
2018-05-16 21:47:11 +00:00
Jerry Zhang
5ba6802e9a adb: Retry io in case of interrupt
io_submit sleeps waiting for the gadget
to be enabled. Currently if that sleep
is interrupted it will shut down adb,
causing it to have to start back up again.

Rather than return EINTR if interrupted,
io_submit actually completes and the EINTR
is found later when looking through events.
Since an io that is interrupted will be
small anyway, add a loop to retry small ios.

Also upgrade aio logs in accordance with
their importance.

Fixes: 75981904
Test: adb works, logs show successful interrupt handling
Change-Id: I35973fce130ee849ce59fef80d15b65afb816ba4
(cherry picked from commit 6e9a327504)
2018-05-16 21:44:46 +00:00
David Anderson
570426aadd adb: warn on remount if undoing deduplication is impossible
A deduplicated filesystem might not have enough free space to undo its
block sharing. In this case "adb remount" should give a more precise
error message.

Bug: 64109868
Test: adb remount on deduplicated filesystem with no free space
Change-Id: I2beb67aa3dfc807cb8493b9c622e7b14174dc9c6
2018-05-16 14:18:59 -07:00
Josh Gao
d2b15dd674 debuggerd: fix CrasherTest.seccomp_crash_oom.
Switch from _exit to raising SIGABRT when we recurse in the fallback
handler, so that waiters see an abort instead of a regular exit.

Bug: http://b/79717060
Test: debuggerd_test32
Test: debuggerd_test64
Change-Id: Iddee1cb1b759690adf07bbb8cd0fda2faac87571
2018-05-16 00:16:09 -07:00
Josh Gao
2744084981 adb: fix uninitialized variable in AsyncServiceRef.
Bug: none
Test: treehugger
Change-Id: I8ba0a70a772f88bfd701730a48d4eb32c6677b9e
2018-05-15 23:43:50 -07:00
George Burgess IV
487de27345 Simplify code
The static analyzer is concerned about the strcpys below this, since it
apparently doesn't try to model snprintf's potential behaviors. (In
particular, it was concerned that suffixLen might be >=
sizeof(suffixBuf)). While that's clearly suboptimal, this code can also
be simplified to make it more obvious what's happening and to appease
the analyzer.

No functionality change is intended.

Bug: None
Test: Ran the analyzer. It's no longer angry about strcpy overflows.

Change-Id: I4aa812144c90f6d3e833bbcb23c0694476a0e53e
2018-05-16 03:06:59 +00:00
Yabin Cui
3464bc4b43 Merge "libprocinfo: fix mac build." 2018-05-15 19:58:06 +00:00
Yabin Cui
edac5e3b25 libprocinfo: fix mac build.
Bug: none
Test: build.
Change-Id: Ic25d873d9d74edc8320b75d077536055f176c0dd
2018-05-15 12:51:57 -07:00
David Anderson
3e946da535 Merge "init/fs_mgr: prototype first-stage dm-linear support" 2018-05-15 18:57:08 +00:00