Commit Graph

39096 Commits

Author SHA1 Message Date
Tom Cherry 81101cb216 Merge "Don't check permissions bits on init scripts for host_init_verifier" 2018-06-20 17:06:11 +00:00
Pirama Arumuga Nainar 7982178b7b Update cflags for building Windows modules with Clang
Bug: http://b/69933068

- Add -Wexit-time-destructor globally after fixing one warning
- Enable -Wthread-safety only for non-windows targets.  The version of
libstdc++ we use for Windows doesn't have the correct thread-safety
annotations.

Test: Run Clang-built adb_test.exe under wine
Change-Id: I76a43060342e7d1dc370ce3e117f3563c82b7751
2018-06-19 20:27:37 -07:00
David Anderson b6181e3e46 libdm: Clean up error messages and dm_ioctl use.
This change removes unnecessary malloc() calls for dm_ioctls. It also
simplifies and fixes line endings on some error messages.

Bug: 110035986
Test: N/A
Change-Id: I2f56e5dab7f25cd9b2f80896f80101db56228981
2018-06-19 18:15:14 -07:00
Treehugger Robot 08839ff904 Merge "init: Create logical partitions via liblp." 2018-06-20 01:09:35 +00:00
Treehugger Robot dc0f5bc4f4 Merge "logd: remove failing test." 2018-06-20 00:00:58 +00:00
Treehugger Robot 20480a22a1 Merge "libselinux is dynamically linked from init" 2018-06-20 00:00:38 +00:00
Treehugger Robot c86d3110be Merge "fs_mgr: Add a library for managing logical partitions." 2018-06-19 23:20:16 +00:00
Tom Cherry d72432de93 Don't check permissions bits on init scripts for host_init_verifier
Also get rid of the copy in parser.  There's no incentive to switch to
a tokenizer that doesn't modify the input, nor is there a reason to
waste cycles making a copy of every init script as its processed.

Bug: 36970783
Test: boot
Change-Id: I8aca9c9d6f1961e1ab35dee50691a6791fc6ec66
2018-06-19 15:18:40 -07:00
Elliott Hughes 6427c363df logd: remove failing test.
Bug: N/A
Test: ran tests manually
Change-Id: I3ebb97d757077acaab1b51809a1c2be90ceb1ad9
2018-06-19 15:06:53 -07:00
Treehugger Robot 2bf8328c54 Merge "Determine product partition path on build time" 2018-06-19 21:36:10 +00:00
David Anderson 6590df2763 init: Create logical partitions via liblp.
Currently, init can create logical partitions by hardcoding them in
fs_mgr or by specifying them in device-tree. This change allows init to
also create logical partitions by using liblp, which stores partition
tables in a physical partition. The current name for this partition is
"android".

Two aspects of this code will change long-term. One, the prototype code
using device-tree will be deleted once fastboot supports logical
partitions. Two, libdm will obsolete most of the code in
fs_mgr_dm_linear.cpp. For now however we preserve how the prototype code
functions and we layer liblp on top of the existing dm_linear logic.

Bug: 79173901
Test: N/A
Change-Id: If014a109da78fa12269bf0df0dda39028ac2d1aa
2018-06-19 14:03:58 -07:00
David Anderson ea3b8ac9ff fs_mgr: Add a library for managing logical partitions.
This library has methods to build, read, and modify logical partition tables
based on device-mapper targets. Targets currently supported are
dm-linear and dm-zero.

Note: this is a revert of a revert, with changes to fix Mac build
bustage.

Bug: 79173901
Test: N/A
Change-Id: If89a788d1919ce8ddc6eedaecc9687a92f111dfa
2018-06-19 14:03:57 -07:00
Doheon Lee cccad0bf84 Determine product partition path on build time
Path of product partitoin can be set as /product or /system/product
whether generate extra product partition or not.
Substitute %PRODUCT% to relevant path to know linker which path should
search and permit.

Bug: 110286945
Test: m -j # Check /system/etc/ld.config.$(PLATFORM_VNDK_VERSION).txt
Change-Id: I6ca177d0c9c5af00ad821879fece40848331fc8d
2018-06-19 08:10:14 +00:00
Jiyong Park 012171d3af libselinux is dynamically linked from init
init is now dynamically linked to libselinux. This gives us about 100KB
extra space, which is valuable in the recovery partition.

Bug: 63673171
Test: m -j
Test: adb reboot recovery
Change-Id: I72c4f886cbbb9ce54f8221f05547f5b9f0e1adb0
2018-06-19 16:55:05 +09:00
Treehugger Robot 9674bcbd23 Merge changes Ibfa5e7e6,I706b57a9,I53d21134,I69d4d585
* changes:
  adb: detect some spin loops and abort.
  adb: add an id field to fdevent.
  adb: delete unused members in fdevent.
  adb: add `adb raw` to connect to an arbitrary service.
2018-06-19 02:39:28 +00:00
Josh Gao 3bbc8164b1 adb: detect some spin loops and abort.
Track pending fdevents, and abort if we see an fdevent ready for
read/write for 5 minutes continuously.

Also, add a service that intentionally starts spinning, to test this.

Test: manually changed timeout to a minute, `adb raw spin`
Change-Id: Ibfa5e7e654996587f745887cb04987b982d79bed
2018-06-18 17:46:34 -07:00
Treehugger Robot 812ba6a469 Merge "adb: add nonblocking fd Connection." 2018-06-18 21:59:12 +00:00
Josh Gao ded557fa58 adb: add an id field to fdevent.
Tracking fdevents by pointer is dangerous because an fdevent can be
destroyed and recreated at the same address. Add a monotonically
increasing id field to fdevent for this purpose.

Test: treehugger
Change-Id: I706b57a9e669290ef2db258f85489a5155fc1152
2018-06-18 14:55:27 -07:00
Josh Gao e44d38d680 adb: delete unused members in fdevent.
Forgot to clean this up after removing fdevent_install...

Test: treehugger
Change-Id: I53d21134a4bc8bf7b16210318c6fac5075445b39
2018-06-18 14:54:40 -07:00
Josh Gao 172d0d44bc adb: add `adb raw` to connect to an arbitrary service.
Add a command to connect to an arbitrary service, for debugging
purposes.

Test: `adb raw shell:ls`
Change-Id: I69d4d585e5ecfa7cb8c7a543a2a27df7033b26c7
2018-06-18 14:51:56 -07:00
David Anderson b9a2243eb3 Merge "Revert "fs_mgr: Add a library for managing logical partitions."" 2018-06-18 21:25:21 +00:00
David Anderson 89a1dca721 Revert "fs_mgr: Add a library for managing logical partitions."
This reverts commit e238358b76.

Reason for revert: Broke mac build.

Change-Id: I93390aa839d4471f328529fe5b86a498b3583d8a
2018-06-18 21:13:24 +00:00
Treehugger Robot 9040b888a6 Merge "logcat: tidy "logcat.h"." 2018-06-18 18:58:16 +00:00
Treehugger Robot 169aa989e3 Merge "fs_mgr: Add a library for managing logical partitions." 2018-06-18 18:31:30 +00:00
Elliott Hughes 66680bd8a8 logcat: tidy "logcat.h".
Bug: N/A
Test: builds
Change-Id: Ibe434221060b2e1fb0973d1c840d943ad3a4ee8d
2018-06-18 10:16:46 -07:00
Elliott Hughes 28a3160c07 Merge "Remove liblogcat." 2018-06-18 16:51:41 +00:00
Tom Cherry fe80d069a0 Merge "Support oem_#### users/groups for host_init_verifier" 2018-06-18 15:50:52 +00:00
Treehugger Robot c733e5af3c Merge "Add /system/product/* paths to permitted paths" 2018-06-18 07:18:59 +00:00
Inseob Kim 3918936b9e Add /system/product/* paths to permitted paths
As linker doesn't resolve paths in permitted paths, /system/product
variants should be added to support devices having product partition
under /system.

Bug: 110286945
Test: m -j succeeds on taimen and libraries under /system can dlopen
libraries under /system/product/apps

Change-Id: Icd102d44511702e4ec66c07a367b59c3d9700a44
2018-06-18 14:16:49 +09:00
Kihyung Lee d9ad02e3e0 Fix memory leak when GateKeeperProxy.verify() returns
After verify() calls verifyChallenge(), the caller acquires the ownership of
returned memory block pointed by *auth_token.
However, the current implementation directly returns and lost the reference
of auth_token without freeing it from heap memory.

This patch solves this problem by explicitly deleting the auth_token array.

Change-Id: I6cfe8427174aa36fbb208e2fff8904095f468ec6
2018-06-18 11:05:42 +09:00
Elliott Hughes 61b580e15e Remove liblogcat.
Parsing logs isn't an API, and even if you want to do that, popen(3)
already exists.

Bug: N/A
Test: ran tests
Change-Id: I53c40be49141483da0a844a7af47da0b38d29781
2018-06-15 15:32:52 -07:00
Elliott Hughes 8c6f7ec060 Merge "bootstat: remove the only caller of liblogcat." 2018-06-15 21:44:23 +00:00
Elliott Hughes 50a24eb3bc bootstat: remove the only caller of liblogcat.
We need to make progress both on adding the real interface for battery
level and cleaning up logging. This stands in the way of both.

Bug: http://b/77725702
Test: builds
Change-Id: Ia457e497606c2c7965d6895baebb26eef17857c9
Merged-In: Ia457e497606c2c7965d6895baebb26eef17857c9
2018-06-15 12:36:46 -07:00
Tom Cherry 4632f4e868 Merge "Relax host init parser to work with the build system" 2018-06-15 17:03:42 +00:00
Elliott Hughes 9d9c91acdc Merge "libsync: add __INTRODUCED_IN annotations." 2018-06-15 16:08:51 +00:00
Treehugger Robot 60e9dad71e Merge "debuggerd: add support for Java traces." 2018-06-15 00:40:41 +00:00
David Anderson e238358b76 fs_mgr: Add a library for managing logical partitions.
This library has methods to build, read, and modify logical partition tables
based on device-mapper targets. Targets currently supported are
dm-linear and dm-zero.

Bug: 79173901
Test: N/A
Change-Id: I194c6832cb53f781c396016d961386d3ca833f87
2018-06-14 17:17:23 -07:00
Josh Gao 24113ae641 debuggerd: add support for Java traces.
Test: `debuggerd -j $(pidof com.android.settings)`
Change-Id: I051c9b6d313e5350416b3d0743c3fc75f43fbd0c
2018-06-14 15:40:06 -07:00
Elliott Hughes 2a358106b7 libsync: add __INTRODUCED_IN annotations.
Bug: https://github.com/android-ndk/ndk/issues/706
Test: N/A
Change-Id: I8a4f98f2c929e28d81672d7e2e0d5dd63d27c7a6
2018-06-14 15:27:26 -07:00
Tom Cherry 290427b442 Support oem_#### users/groups for host_init_verifier
Bug: 36970783
Test: oem_#### users and groups no longer fail in host_init_verifier
Change-Id: I48174f528994d1b225ed897328cc207bdebf07a8
2018-06-14 21:12:02 +00:00
Tom Cherry 863d808c2e Relax host init parser to work with the build system
It's not going to be possible to safely assume $OUT has the right init
scripts to be parsed at a given point, so instead we fall back to
parsing init scripts individually.

This isn't a full revert of the previous commits.  We retain parsing
correctness of the 'import' statements and we retain using the new
host side property functionality.

Also, fix a bug where main was not actually returning -1 on failure

Bug: 36970783
Test: testing individual files still works correctly
Change-Id: I4ae5620f234caa08993deb2c30825904a75f6654
2018-06-14 14:08:33 -07:00
Treehugger Robot ca57890a80 Merge "bootstat: clear persist.sys.boot.reason once read" 2018-06-14 20:58:25 +00:00
Treehugger Robot 62dbf90225 Merge "Revert "init: Add warning in init first stage mount"" 2018-06-14 20:40:17 +00:00
Treehugger Robot fd342497a3 Merge "mkbootimg: add hridya@ to OWNERS." 2018-06-14 19:43:28 +00:00
Elliott Hughes 5587aba58d Merge "Fix `adb logcat` return code." 2018-06-14 19:38:08 +00:00
Wei Wang 37acac49e2 Revert "init: Add warning in init first stage mount"
This reverts commit fdafb3d0ec.

Reason for revert: coldboot time increase
 
Bug: 110210279
Test: Boot

Change-Id: Ibb92c1856f3fc114685c40df67556131409a9231
2018-06-14 18:51:43 +00:00
Elliott Hughes 31f0f1bcee Fix `adb logcat` return code.
`adb shell logcat` works, and `adb logcat` should too.

Bug: http://b/110202648
Test: suspended the logd process and manually removed the socket
Change-Id: If14de7c2eb178c7b4210d6bdb44df084615db33a
2018-06-14 10:47:00 -07:00
Elliott Hughes cab23382f4 mkbootimg: add hridya@ to OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ib6a7c74c95855f41b0fe9ad5a4fe5df8c4097450
2018-06-14 10:27:36 -07:00
Treehugger Robot 445eacd326 Merge "fs_mgr: dmctl: fix 'dmctl help' output" 2018-06-14 16:09:23 +00:00
Mark Salyzyn adc433d3ea bootstat: clear persist.sys.boot.reason once read
To ensure a surprise reboot does not take the last boot reason on
face value especially if coming from more than one boot sessions ago.
We shift and clear the value from persist.sys.boot.reason to
sys.boot.reason.last and establish a correct last reboot reason in
the canonical sys.boot.reason property.

This effectively deprecates persist.sys.boot.reason as an API.  They
should have been using sys.boot.reason instead for a correctly
determined reasoning.

Test: boot_reason_test.sh
Bug: 86671991
Merged-In: If85750704445088fd62978679ab3a30744c46abb
Change-Id: If85750704445088fd62978679ab3a30744c46abb
2018-06-14 15:36:56 +00:00