Commit graph

29742 commits

Author SHA1 Message Date
Elliott Hughes
e03caa00ef Merge "Clean up the partition name mapping in fastboot."
am: bdbcdf3a16

Change-Id: I424b6bd4141df78471fc2b51a02df96ece70059e
2017-05-05 00:08:48 +00:00
Elliott Hughes
bdbcdf3a16 Merge "Clean up the partition name mapping in fastboot." 2017-05-05 00:04:45 +00:00
Josh Gao
2ca23fa508 Merge changes from topic 'adb_thread_safety'
am: 9083ff1c24

Change-Id: I55e4d18648d3ceb915840ee5d25b2e8146a0bef6
2017-05-04 23:52:50 +00:00
Josh Gao
9083ff1c24 Merge changes from topic 'adb_thread_safety'
* changes:
  adb: wait for devices to come up instead of sleeping for 3s.
  adb: initialize mDNS asynchronously.
  adb: add fdevent_run_on_main_thread.
2017-05-04 23:47:32 +00:00
Elliott Hughes
5f865e5943 Merge "This code has moved to toybox proper."
am: c5dbd7134d

Change-Id: I653790cc381755645decbdfb2c57be0e61628b6e
2017-05-04 23:27:55 +00:00
Treehugger Robot
c5dbd7134d Merge "This code has moved to toybox proper." 2017-05-04 23:21:36 +00:00
Josh Gao
b80ef5e6fd Merge "adb: make darwin build with thread safety analysis."
am: 971e6585a6

Change-Id: I504a569348bcdbb3933cf8b5b1a793868feed035
2017-05-04 23:13:15 +00:00
Josh Gao
971e6585a6 Merge "adb: make darwin build with thread safety analysis." 2017-05-04 23:05:38 +00:00
Josh Gao
fd713e53e8 adb: wait for devices to come up instead of sleeping for 3s.
Replace a hard-coded 3 second sleep with logic to wait until we've
scanned USB devices once and they've all come online.

Before:
    adb shell true  0.00s user 0.00s system 0% cpu 3.047 total

After:
    adb shell true  0.00s user 0.00s system 9% cpu 0.041 total

Bug: http://b/37869663
Test: `time adb shell true` after adb kill-server
Change-Id: I251d42afb885908ed9d03167287594ea16650d3f
2017-05-04 16:03:12 -07:00
Josh Gao
04a8218f09 adb: make darwin build with thread safety analysis.
Test: mma on darwin
Change-Id: I44dfc53fc381e60de83f3bc503691cdb8179ca91
2017-05-04 16:03:12 -07:00
Josh Gao
6f46e6b912 adb: initialize mDNS asynchronously.
Use fdevent_run_on_main_thread to initialize mDNS in a thread and
register an fdevent from the main thread upon success.

This reduces the startup time of `adb server` by ~3 seconds when mDNS
can't be successfully started. With an already running adb server,
`time adb server nodaemon` goes from:

    adb server nodaemon  0.00s user 0.16s system 4% cpu 3.817 total

to:

    adb server nodaemon  0.00s user 0.01s system 1% cpu 0.665 total

Bug: http://b/37869663
Test: `adb server nodaemon` with an existing adb server
Change-Id: Ia5a1a2a138610f3bf6792400050ca68f95ae3734
2017-05-04 16:03:12 -07:00
Josh Gao
4c936397c1 adb: add fdevent_run_on_main_thread.
Add a function to run a function on the main thread, to allow fdevents
that depend on a blocking function to be registered.

Bug: http://b/37869663
Test: adb_test on linux
Change-Id: I84a0b372360420b7647057297b8f437e8afa874e
2017-05-04 16:03:12 -07:00
Mark Salyzyn
bfead93a3a Merge "libcutils: fs_config internal table alias test"
am: 8fad110bfa

Change-Id: I53835ad38965fd315b6463605d4cee5d580da154
2017-05-04 21:12:53 +00:00
Christopher Ferris
b34a9d11ec Merge "Move all logging to use the async safe logging."
am: d673da4bfb

Change-Id: I78783a8204b92404405c7bde6f4a0e7e92c72644
2017-05-04 21:12:34 +00:00
Treehugger Robot
8fad110bfa Merge "libcutils: fs_config internal table alias test" 2017-05-04 21:06:12 +00:00
Christopher Ferris
d673da4bfb Merge "Move all logging to use the async safe logging." 2017-05-04 21:00:07 +00:00
William Roberts
b46b61049b Merge "init: cleanup exec_service documentation"
am: 61559e491e

Change-Id: I0fa614975f5fbdf7f58be724e4cea4258eda79c3
2017-05-04 20:06:02 +00:00
Treehugger Robot
61559e491e Merge "init: cleanup exec_service documentation" 2017-05-04 19:54:17 +00:00
Mark Salyzyn
0f6a270d24 libcutils: fs_config internal table alias test
Private interface to permit testing only added to fs_config to
expose android_files and android_dirs.

Make sure that both paths to a partition are specified in fs_config
internal tables.

Test: gTest libcutils-unit-test --gtest_filter=fs_config.*
Bug: 37703469
Change-Id: Ida5fccdb786dc6d67325005d4fdd1fa1ffaef396
2017-05-04 11:41:17 -07:00
William Roberts
323d5791b4 init: cleanup exec_service documentation
The exec_service documentation was difficult to read, clarify it.

Tests:
Run grip.py to verify that the markdown still works correctly.
Run aspell to verify spelling.

Change-Id: I29bdd456f3d3ea2a91c9d4772bd09a5a195f97a9
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2017-05-04 11:14:23 -07:00
Elliott Hughes
8dd31c23ca Merge "Remove bogus _LARGEFILE_SOURCE."
am: 3d7ee068e0

Change-Id: Ifb7cc331b99a8d1260eec665d78ba347f91f2ff0
2017-05-04 17:39:19 +00:00
Treehugger Robot
3d7ee068e0 Merge "Remove bogus _LARGEFILE_SOURCE." 2017-05-04 17:33:54 +00:00
Elliott Hughes
be9024dfbb This code has moved to toybox proper.
Bug: http://b/36653902
Test: ran toybox tests
Change-Id: If0f858121fa29b49fe85c3c21eacd8d5c55fb57b
2017-05-03 22:56:10 -07:00
Elliott Hughes
45964a8e90 Clean up the partition name mapping in fastboot.
Also remove -p.

Bug: N/A
Test: builds
Change-Id: Iea55affc7262323c0d341003359d3175580efbfd
2017-05-03 22:45:37 -07:00
Elliott Hughes
92433d8af0 Remove bogus _LARGEFILE_SOURCE.
Bug: N/A
Test: builds
Change-Id: I145a521a58dc8f838ce188540b02bcda4e81b610
2017-05-03 22:21:16 -07:00
Jin Qian
06c1500a14 Merge "init: manually restorecon mke2fs tools on ramdisk"
am: e2629c5682

Change-Id: Iaa0683ce7931e7408fd836ee058ef4528fc07579
2017-05-04 02:12:18 +00:00
Treehugger Robot
e2629c5682 Merge "init: manually restorecon mke2fs tools on ramdisk" 2017-05-04 02:07:02 +00:00
Christopher Ferris
47dea71b16 Move all logging to use the async safe logging.
Also, add a link to the .clang-format-2 for this directory and clang
format the files that changed.

Bug: 31919199

Test: Boot bullhead.
Test: Run unit tests on bullhead. There are a few that fail, but they
Test: failed before and are not a result of this change.
Change-Id: I3d3b2111f6f6bf8a0d7039295d34d5168c191651
2017-05-03 18:04:18 -07:00
Josh Gao
ff9d6425d4 Merge "adb: use the actual wMaxPacketSize for usb endpoints."
am: c7988b1f68

Change-Id: Ia81c0e97857823759c7f71ecfca252259d41fee5
2017-05-04 00:16:41 +00:00
Josh Gao
c7988b1f68 Merge "adb: use the actual wMaxPacketSize for usb endpoints." 2017-05-04 00:12:23 +00:00
Yueyao Zhu
061003841e Merge "Add dtbo image support for device tree overlay"
am: 5eefcbdd3b

Change-Id: I9bc2bfd6f56482d8776e46da60d8b63d69f75ab5
2017-05-03 23:56:38 +00:00
Treehugger Robot
5eefcbdd3b Merge "Add dtbo image support for device tree overlay" 2017-05-03 23:48:25 +00:00
Tom Cherry
c43da33005 Merge "Make /data/data a symlink to /data/user/0"
am: 49bbe16447

Change-Id: I3af2449abd0b1bb4d839d7a17239fe574ed2e88c
2017-05-03 23:46:50 +00:00
Josh Gao
0c91897714 Merge "adb: enable -Wthread-safety on linux/darwin."
am: 2983d2710e

Change-Id: I0fcbadd46a16028b2e69cba1f82975e4e50fd4cf
2017-05-03 23:44:00 +00:00
Tom Cherry
49bbe16447 Merge "Make /data/data a symlink to /data/user/0" 2017-05-03 23:43:00 +00:00
Josh Gao
2983d2710e Merge "adb: enable -Wthread-safety on linux/darwin." 2017-05-03 23:38:59 +00:00
Mark Salyzyn
d8dc29df8e Merge changes Ieb44fa8f,I01b26fe5
am: e1e3e20337

Change-Id: I6181e1d699dd721030c2a9080b89b51ab441d185
2017-05-03 23:33:08 +00:00
Treehugger Robot
e1e3e20337 Merge changes Ieb44fa8f,I01b26fe5
* changes:
  init: setup keyring before ueventd starts
  logd: refine permissions to access /data/system/packages.list
2017-05-03 23:24:14 +00:00
Jin Qian
2d019f859b init: manually restorecon mke2fs tools on ramdisk
Files in the ramdisk by default have the rootfs label and must be
manually restoreconed.

Bug: 35219933
Change-Id: I2a749f128dc3a609907101ce703747f8990b4386
2017-05-03 16:15:45 -07:00
Tom Cherry
577c75e78c Merge "init: use do_exec() for init_user0"
am: 5ad06cbb1c

Change-Id: Id75cd629df7c73bdc2c7fe4fd8438f44a8c811b7
2017-05-03 22:25:36 +00:00
Treehugger Robot
5ad06cbb1c Merge "init: use do_exec() for init_user0" 2017-05-03 22:11:06 +00:00
Mark Salyzyn
4599627492 init: setup keyring before ueventd starts
Invent keyutils.h to supply capability to set session keyring.
The keyring will hold things like the FBE encryption keys.

Test: gTest logd-unit-tests --gtest_filter=logd.statistics
Bug: 37751120
Bug: 36645158
Change-Id: Ieb44fa8f53dda6cf506a6243498c72d7f7f3cde7
2017-05-03 21:51:04 +00:00
cjbao
d147cb5887 Make /data/data a symlink to /data/user/0
For legacy reason, /data/data is a real dir and /data/user/0 is a
symbolic link to it.  Overhead for linux kernel to walk through
symbolic link is not negligible. This is unnessary overhead to
carry over.  This patch is to make /data/user/0 a a real dir and
make legacy folder /data/data a symbolic link.  OTAed system does
not get impacted.

Test: Manual test
Change-Id: I419564a75f6ebf3154badb8725ba9831164592b6
Signed-off-by: cjbao <cathy.bao@intel.com>
2017-05-03 21:38:31 +00:00
Yueyao Zhu
e67da71dc1 Add dtbo image support for device tree overlay
Test: Used the built fastboot tool to run flashall on a device
Bug: 32969430
Bug: 36813951
Change-Id: If2db3055bb7250a57d9a78b0534df491b68b6224
2017-05-03 14:36:43 -07:00
Mark Salyzyn
d392ac160c logd: refine permissions to access /data/system/packages.list
Refine DAC security surrounding logd.daemon worker thread and add a
positive test for logd failure to access /data/system/packages.list.

- Add AID_PACKAGE_INFO to groups of worker thread.
- Move AID_SYSTEM to groups, setgid to AID_LOGD.
- Do not drop capabilities until after setting the uid and gids.
- Add a test that is part of logd.statistics test to check when
  packagelistparser appears broken.
- If /data/system/packages.list is encrypted, ensure we do not pick
  up the existing inode to ensure strong positive when finding access
  problems.
- Replace all occurrences of NULL with nullptr in gTest code for
  compliance with best practices.

Test: gTest logd-unit-tests --gtest_filter=logd.statistics
      (expect consistent failure, later CLs fix)
Bug: 37751120
Bug: 36645158
Change-Id: I01b26fe5e25203246ae432d272c8daa9c07cab54
2017-05-03 14:35:14 -07:00
Josh Gao
68f679c35b adb: enable -Wthread-safety on linux/darwin.
Delete the sysdeps/mutex tests that -Wthread-safety complains about.
We're using the standard library's std::mutex on all platforms now,
anyway.

Test: mma
Change-Id: I3bf958c72604b29dfb1d9c898d3c9aa34aed2685
2017-05-03 14:28:21 -07:00
Tom Cherry
5a86cb7694 init: use do_exec() for init_user0
Similar to what installkey used to do, init_user0 forks and
synchronously waits for vdc to return.  This is dangerous to do in
init however as init also processes properties from a single thread.

I'm not aware of any specific issues that this is currently causing,
but it's a good preventative measure to match what installkey does and
use do_exec().

Test: Boot bullhead, see that init_user0 still happens
Change-Id: I853c61594fe3d97e91bbb2319ebddf2bbe80d457
2017-05-03 13:25:08 -07:00
Josh Gao
ef3d343254 adb: use the actual wMaxPacketSize for usb endpoints.
Previously, adb was assuming a fixed maximum packet size of 1024 bytes
(the value for an endpoint connected via USB 3.0). When connected to an
endpoint that has an actual maximum packet size of 512 bytes (i.e.
every single device over USB 2.0), the following could occur:

    device sends amessage with 512 byte payload
    client reads amessage
    client tries to read payload with a length of 1024

In this scenario, the kernel will block, waiting for an additional
packet which won't arrive until something else gets sent across the
wire, which will result in the previous read failing, and the new
packet being dropped.

Bug: http://b/37783561
Test: python test_device.py on linux/darwin, with native/libusb
Change-Id: I556f5344945e22dd1533b076f662a97eea24628e
2017-05-03 12:32:39 -07:00
Tom Cherry
e4988c9a34 Merge "ueventd: do not reference init's sehandle"
am: 672dd970f4

Change-Id: I12378e6f1917cd31b42db6cde78d2f959bb6e4f5
2017-05-03 18:20:46 +00:00
Tom Cherry
672dd970f4 Merge "ueventd: do not reference init's sehandle" 2017-05-03 18:14:38 +00:00