Commit graph

2247 commits

Author SHA1 Message Date
Paul Crowley
5872cbdf02 Set property for metadata encryption on first boot
Bug: 77335096
Test: device boots twice with and without metadata encryption
Change-Id: Iaed78288cb37865ba23833721b73b11414e7e862
2018-04-18 14:40:54 -07:00
TreeHugger Robot
e58d713e47 Merge "Re-land "If enablefilecrypto or init_user0 fails, reboot into recovery."" into pi-dev 2018-04-17 20:34:14 +00:00
TreeHugger Robot
b35c019d5c Merge "Add /mnt/vendor rw mount point for vendor partitions." into pi-dev 2018-04-17 19:16:55 +00:00
Tri Vo
b511475664 Add /mnt/vendor rw mount point for vendor partitions.
Changes to init's behavior during early mount:
1. Mounting of tmpfs on /mnt is moved from init stage to early mount.
2. init creates /mnt/vendor used to mount vendor partitions.
3. If a device tree fstab entry for early mount specifies a mount point
under /mnt/vendor e.g. /mnt/vendor/foo, init will create
/mnt/vendor/foo mount point.

Bug: 64905218
Test: change dt fstab entry to mount persist to /mnt/vendor/persist;
mount point is created correctly, and partition is mounted in early
mount. See go/pag/1069774
Test: device boots with /mnt/vendor and previous contents of /mnt present,
and selinux label "mnt_vendor_file" is applied correctly.
Test: cts-tradefed run commandAndExit cts --skip-all-system-status-check
--primary-abi-only --skip-preconditions -m CtsAppSecurityHostTestCases
-t android.appsecurity.cts.PermissionsHostTest
Change-Id: I3739130739eadf508355c7f2531366fcaed74175
2018-04-17 10:15:07 -07:00
Paul Crowley
dc97e3e091 Re-land "If enablefilecrypto or init_user0 fails, reboot into recovery."
An earlier such change was reverted in commit e242a97db5.

Bug: 70487538
Test: ensure that angler can boot
Merged-In: Id5f57fce1c9b817a2650e0c848143d8a0d286bf0
Change-Id: Id5f57fce1c9b817a2650e0c848143d8a0d286bf0
2018-04-17 09:05:39 -07:00
Tom Cherry
125781255e init: do not impose vendor_init restrictions on old vendor images
Do not restrict vendor_init restrictions on vendor images that were
built before P, as they will not have the correct permissions.

Bug: 77732028
Test: test new devices and see vendor_init still works
Merged-In: I636a07b54fbfb248e1d1a68a8f3c4d047fd5a9e9
Change-Id: I636a07b54fbfb248e1d1a68a8f3c4d047fd5a9e9
(cherry picked from commit a1dbeb8d33)
2018-04-12 15:33:15 -07:00
Jaekyun Seok
65ce3b2cd8 Allow vendor-init-actionable for vold-related properties
Bug: 75987246
Bug: 73871799
Test: succeeded building and tested with taimen
Change-Id: Ifec879f07705a52501757b58b1562a97c668b8b0
2018-04-12 08:17:43 +09:00
Jaekyun Seok
66797804c6 Allow vendor-init-actionable for wlan.driver.status and init.svc.surfaceflinger
They are being used as action triggers in some devices including Pixels.
So vendor-init-actionable should be allowed for them.

Bug: 74266614
Test: building succeeded and tested on a Pixel with
PRODUCT_COMPATIBLE_PROPERTY=true

Change-Id: I713c5c1a50053f8d64e1cecd1f7ab5dc18201da1
Merged-In: I713c5c1a50053f8d64e1cecd1f7ab5dc18201da1
(cherry picked from commit 167ec7f1d2)
2018-04-05 23:08:39 +09:00
Jayant Chowdhary
f4bda9a188 Add dummy vndk library libmkbootimg to enable abi checks on boot_img_hdr.
Bug: 74763691

Test: m -j libmkbootimg creates libmkbootimg.so.lsdump.

Test: make -j64

Merged-In: I8d716c560467aaf090f4f7ee9cfbc53a9405f05d
Change-Id: I8d716c560467aaf090f4f7ee9cfbc53a9405f05d
(cherry picked from commit 4cc755dce5)
2018-04-02 17:32:23 -07:00
Jaekyun Seok
f328b0d935 Allow vendor-init-actionable for ro.board.platform and sys.boot_from_charger_mode
ro.board.platform and sys.boot_from_charger_mode are already
public-readable, but they should be used as action triggers as well for
some products including Android Go devices.

Bug: 75987246
Test: succeeded building and tested with taimen
Change-Id: I140a8f7ef3fa9823ceced94b00a413800518c240
Merged-In: I140a8f7ef3fa9823ceced94b00a413800518c240
(cherry picked from commit 1f90ccefb6)
2018-03-30 06:13:12 +09:00
Jaekyun Seok
fce960cdf4 Allow vendor-init-actionable for ro.debuggable
Some partners are using ro.debuggable as action trigger to config a
product differently according to its value.

Bug: 75987246
Test: succeeded building and tested taimen
Change-Id: I4cc57e7b52e17fc89e585afa0a8a10925e47fac8
Merged-In: I4cc57e7b52e17fc89e585afa0a8a10925e47fac8
(cherry picked from commit 4f214c5179)
2018-03-29 04:21:22 +09:00
Tom Cherry
16e2e9d4da Merge "Revert "init: Reboot after timeout passes during reboot"" into pi-dev 2018-03-20 18:42:43 +00:00
Tom Cherry
ea31ac2514 Revert "init: Reboot after timeout passes during reboot"
This reverts commit c9fec9d2be.

Looks like ext4 can't handle a system reboot happening in the middle
of an unmount.  We'll have to find another way to handle this.

Bug: 74817735
Bug: 75310371
Test: reboot device
Merged-In: Ib4f7f7fd29988a31a99f146c40f6d987c1fef15e
Change-Id: I7c097ba5734e2e4ff320c8b02fb58324d9380513
2018-03-20 13:39:00 +00:00
Jaekyun Seok
56f832e561 Allow vendor_init_actionable to persist.sys.usb.usbradio.config
persist.sys.usb.usbradio.config can be used as an action trigger in
vendor init scripts.

Bug: 75202311
Bug: 74266614
Test: succeeded building and tested on pixels
Change-Id: I123b5ebce4bbf33f41222c2e11137d52e38ff9f8
2018-03-20 07:40:16 +09:00
Jaekyun Seok
3b613ccedc Export init.svc.console as an actionable property
The state of console can be used to set up a device for debugging.

Bug: 74266614
Test: succeeded building and tested with Pixels
Change-Id: I3691fa2819594a521e05dad150550ab309a78c68
Merged-In: I3691fa2819594a521e05dad150550ab309a78c68
(cherry picked from commit cba467eeda)
2018-03-14 06:12:43 +09:00
Daniel Mentz
bd93ad50ac ueventd: Increase uevent buffer size to 2MB
Let's increase the receive buffer size for the NETLINK_KOBJECT_UEVENT
socket to 2MB. Unless a large number of uevents queue up, that memory is
not allocated anyways. The receive buffer size serves only as an upper
limit for the total amount of memory consumed by all skbs queued to a
specific socket.

We experienced situations where ueventd got blocked for multiple seconds
while writing to /dev/kmsg, and the receive buffer overflowed in the
meantime.

Bug: 72648767
Change-Id: Ice6d7b9c5ed9c83efbad6111086ce95ac6432561
2018-03-13 05:35:44 +00:00
Treehugger Robot
b9ee9abebe Merge "Revert "If enablefilecrypto or init_user0 fails, reboot into recovery."" 2018-03-02 01:26:32 +00:00
Paul Crowley
e242a97db5 Revert "If enablefilecrypto or init_user0 fails, reboot into recovery."
This reverts commit 959b055535.

Reason for revert: b/73968735
Bug: 73968735
Test: b/73968735#comment5

Change-Id: Ifce4c029bab7380c60e20cc2b2885beb4a097456
2018-03-01 23:24:20 +00:00
Tom Cherry
dc375869ab Restrict setting platform properties from vendor .prop files
We should only allow vendor-init-settable properties to be set from
.prop files on /vendor and /odm.

Bug: 73905119
Test: test on walleye that disallowed properties are rejected
Change-Id: I2a5d244fdc71060ddda3e3d87442e831e6b97831
2018-03-01 11:17:07 -08:00
Tom Cherry
69d47aa829 Clean up property set error handling
Currently we only report why a property set call has failed but drop
the context of what was trying to set the property.  This change
adds information about why a property was trying to be set when it
fails.

It also unifies property_set() within init to go through the same
HandlePropertySet() function as normal processes do, removing unneeded
special cases.

Test: boot bullhead
Test: attempt to set invalid properties and see better error messages
Change-Id: I5cd3a40086fd3b226e9c8a5e3a84cb3b31399c0d
2018-03-01 11:14:02 -08:00
Tom Cherry
547f7318c2 Don't build host_init_verifier on Android either
Also fixes another mac build issue...

Test: linux builds still work...
Change-Id: I549891c7e38729bd5fbe79f79b7345dabd9b4b28
2018-02-28 21:43:59 -08:00
Tom Cherry
96ff0fed82 Don't build host_init_verifier for darwin
And therefore fix the mac build break.

Test: none
Change-Id: Ice28780abc62fc3e46119497d23bcbc124354159
2018-02-28 17:21:14 -08:00
Tom Cherry
de6bd50d42 init: add host side parser for init
Create a host side parser for init such that init rc files can be
verified for syntax correctness before being used on the device.

Bug: 36970783
Test: run the parser on init files on host

Change-Id: I7e8772e278ebaff727057308596ebacf28b6fdda
2018-02-28 10:45:45 -08:00
Tom Cherry
89063827b1 Merge "init: Reboot after timeout passes during reboot" 2018-02-26 17:41:11 +00:00
Treehugger Robot
a4644c9bc4 Merge "Document property expansion." 2018-02-23 20:41:36 +00:00
Tom Cherry
c9fec9d2be init: Reboot after timeout passes during reboot
There is currently a timeout for reboot, however if the system gets
stuck, particularly during file system operations, there is no safety
mechanism that guarantees the system will still reboot.

This change does all of the optional reboot steps in a separate thread
and waits for this thread with a timeout, such that if the reboot
steps get hung, the system is guaranteed to still reboot.

This is specific to 'reboot'.  Shutdown continues to run unbounded to
run fsck.

Bug: 72781711
Test: Reboot devices hitting and not hitting this timeout
Change-Id: Id5e1b3693bab00602177e28b9b662e1499c32961
2018-02-23 11:03:01 -08:00
Elliott Hughes
7e469ce60c Document property expansion.
Bug: N/A
Test: N/A
Change-Id: I54b9d2d08d98d83060b54981b1c5dc9660b93e8f
2018-02-23 10:40:53 -08:00
Tom Cherry
6f2d56d584 init: log control messages along with the process that sent them
It's currently not clear that init stops processes due to being sent a
control message nor who sent that message.

Bug: 73343913
Test: send control messages and see the logs
Change-Id: I9e9eff2001e649814107ea961b3b747a1f6da598
2018-02-21 16:36:03 -08:00
Treehugger Robot
ca26cbc5d3 Merge "Fix intermittent crash in property_service_test" 2018-02-20 20:52:31 +00:00
Tom Cherry
b7ef7e7aff Fix intermittent crash in property_service_test
There is a race in the very_long_name_35166374 test of
property_service.  The test first sends a size value that is beyond
the limit that init will handle, then sends a dummy data value.
However, init closes the socket upon seeing the faulty size, and if
this happens before the test sends the dummy data, the test will crash
due to SIGPIPE.

Since there is no reason to send the dummy data at all, this change no
longer sends it to prevent the crash.  It also now checks explicitly
that init returns an error through the socket.

Bug: 73619375
Test: the unit test in question
Change-Id: I2565a69fa54910cee0e15fc798445e18c91156ec
2018-02-20 10:47:55 -08:00
Elliott Hughes
dc699a269f bpfmt.
Bug: N/A
Test: builds
Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
2018-02-16 17:58:14 -08:00
Treehugger Robot
851803d3cf Merge "If enablefilecrypto or init_user0 fails, reboot into recovery." 2018-02-15 21:16:42 +00:00
Paul Crowley
959b055535 If enablefilecrypto or init_user0 fails, reboot into recovery.
Test: Roll back PLATFORM_SECURITY_PATCH, ensure recovery dialog is seen
Bug: 70487538
Change-Id: Iceb6af3f9d6aea6bc646dbb4b5d29dffcb284736
2018-02-15 10:23:52 -08:00
Tom Cherry
9cbf57048c Move all Action parsing into ActionParser
Bug: 36970783
Test: Build
Change-Id: Iea2d97fb45c3e88bc83fb72d6fa67049be42cfa9
2018-02-14 16:37:17 -08:00
Tom Cherry
7fd3bc27ec Move ActionManager to its own file
Bug: 36970783
Test: build
Change-Id: I08fa39052236b462249f79de1d02bf02bdbf4c84
2018-02-14 16:37:09 -08:00
Tom Cherry
0f6417f232 Move ActionParser to its own file
Bug: 36970783
Test: build
Change-Id: Idd5b923e4789760bb9ef67c10982b2642bc6a31a
2018-02-13 15:26:14 -08:00
Greg Hartman
886474994a Add support for non-partitioned devices for system
BUG: 69071989
BUG: 71707530
Test: Local build and boot
Change-Id: I0cb7d61634be6a694ceb51cb06901c466eae1c35
2018-02-06 06:34:40 +00:00
Treehugger Robot
94e9305511 Merge "init: add TODO for mount operations." 2018-02-05 18:08:10 +00:00
Tom Cherry
880d566400 init: add TODO for mount operations.
mount operations should be done in vendor init context, but their
complexity currently limits this.  Add a TODO to make this reason
clear to those viewing the code.

Bug: 72488820
Test: N/A
Change-Id: I8b6dd92aa79f31dc24603559ed6de0815facfcba
2018-02-05 08:01:54 -08:00
Treehugger Robot
176afbbedf Merge "Do not block SIGTERM in init's child processes" 2018-02-03 01:31:45 +00:00
yusukes
4a4ec14e42 Do not block SIGTERM in init's child processes
Previously, unless the process unblocks the signal by itself,
the signal was never delivered to the process. This caused at
least one CTS test failure.

Bug: 72453675
Test: 'kill -TERM app_pid' terminates the app process

Change-Id: I3977cac75e2673b52c5cf91d34d7a9c258c1a0e4
2018-02-02 15:28:03 -08:00
Paul Crowley
c684696a96 Use vold's mount with metadata encryption service.
Don't use the FDE flow to support metadata encryption; just use the
vold service which directly mounts the volume.

Bug: 63927601
Test: Boot Taimen to SUW with and without metadata encryption.
Change-Id: Idf9c27a69872cd7a9e2fb76df09a91d8e5ef4896
2018-02-01 14:54:04 -08:00
Jaekyun Seok
cf2da29d66 Update stable_properties.h
ro.boot.* are from kernel cmdline, and kernel is usually owned by SoC
vendor or ODM.
So those properties should be allowed as action triggers of
vendor/odm init scripts.

Additionally the state of mediadrm (/system/bin/mediadrmserver) should
be used to operate the state of drm HAL.
So init.svc.mediadrm should be whitelisted as an action trigger as well.

Bug: 36796459
Test: tested with walleye
Change-Id: Ic9f68162c577cc190f193063988ad04e42478e6e
2018-01-31 21:47:09 +09:00
Treehugger Robot
8abe4e2638 Merge "sepolicy: renames nonplat_* to vendor_*" 2018-01-28 02:39:28 +00:00
Jaekyun Seok
dff165d3a2 Support /product partition
This CL will enable reading /product/build.prop and add product paths
into ld.config.txt.in.

Bug: 64195575
Test: tested with 'PRODUCT_PRODUCT_PROPERTIES := ro.product.abc=abc' on
sailfish

Change-Id: Ie996def20e25dc1afe0c74af2096af844934b2dc
2018-01-25 09:37:20 +09:00
Tom Cherry
af0a1f87b9 Label /vendor_file_contexts as file_contexts_file
vendor_init doesn't have permissions to read rootfs labeled files, but
needs to read /vendor_file_contexts to do restorecon correctly.  This
file is a file_contexts file, so labeling it as such seems appropriate.

Test: bullhead + vendor_init doesn't hit this audit
Change-Id: I475e9735616c2426b9c7073700272f878ced2135
2018-01-23 12:40:31 -08:00
Tom Cherry
f09649c231 Merge "Make vendor_init check SELinux before setting properties" 2018-01-23 18:34:34 +00:00
Treehugger Robot
17b959c9ed Merge "Init remove direct calls to light sys nodes." 2018-01-22 20:27:17 +00:00
Tom Cherry
32228485ff Make vendor_init check SELinux before setting properties
Finishing a TODO from vendor_init, check SELinux permissions before
setting properties in vendor_init.

Bug: 62875318
Test: N/A
Change-Id: I3cb6abadd2613ae083705cc6b9c970587b6c6b19
2018-01-22 18:20:56 +00:00
Steven Moreland
d5eccfd417 Init remove direct calls to light sys nodes.
These are halified. Instead launch blank_screen which
does the same task w/o init itself having binder
dependencies.

Bug: 70846424
Test: manual + reboot appears similar
Change-Id: If8b2a56cbc31077122ea81406721b06034e4498f
2018-01-19 14:45:10 -08:00