Commit Graph

1573 Commits

Author SHA1 Message Date
Tom Cherry 64b51491d3 Merge changes Ic446c026,I86568a5b am: 51b7cb006f am: 41dbec9791 am: fea35fc7e4
am: d0ea8a98cd

Change-Id: I4f8fe713f768748e521ad4d6c18edf0e4b382591
2017-04-24 19:52:47 +00:00
Tom Cherry d0ea8a98cd Merge changes Ic446c026,I86568a5b am: 51b7cb006f am: 41dbec9791
am: fea35fc7e4

Change-Id: Ia5e7465015618317132c63cdfaddd8cb63c2425a
2017-04-24 19:23:38 +00:00
Bowgo Tsai fd18a452be init: set ro.boot.avb_version in recovery mode
Previously we set ro.boot.avb_version during the first stage mount in normal mode:
  - https://android-review.googlesource.com/#/c/371774/

As the first stage mount is not performed in recovery mode, we need to set the
property separately in recovery mode.

Bug: 37414003

Test: first stage mount /vendor with vboot 2.0 (avb) on bullhead in normal mode
Test: first stage mount /system with without verity on bullhead in normal mode
Test: checks ro.boot.avb_version is 1.0 on bullhead in recovery mode

Test: first mount /vendor with with vboot 1.0 on sailfish in normal mode
Test: checks ro.boot.avb_version doesn't exist on sailfish in recovery mode

Change-Id: I262e75b8b557c4de7609b4049ccb01793644245e
2017-04-24 23:10:59 +08:00
Bowgo Tsai d262017fef init: moving early mount logic into init_first_stage.cpp
Also renames "early mount" to "first stage mount" to prevent confusion
with "mount_all --early", which is run in the init second stage.

Also creates a base class: FirstStageMount and two derived classes:
FirstStageMountVBootV1 and FirstStageMountVBootV2 to replace/refactor
existing functions:

   - early_mount() -> DoFirstStageMount() and FirstStageMount::DoFirstStageMount()

   - vboot_1_0_early_partitions -> FirstStageMountVBootV1::GetRequiredDevices()
   - vboot_2_0_early_partitions -> FirstStageMountVBootV2::GetRequiredDevices()

   - vboot_1_0_mount_partitions ->
       FirstStageMount::MountPartitions() and
       FirstStageMountVBootV1::SetUpDmVerity()

   - vboot_2_0_mount_partitions ->
       FirstStageMount::MountPartitions() and
       FirstStageMountVBootV2::SetUpDmVerity()

Bug: 37413399
Test: first stage mount /vendor with vboot 2.0 (avb) on bullhead
Test: first stage mount /system with without verity on bullhead
Test: first stage mount /vendor with with vboot 1.0 on sailfish
Change-Id: I6584bdf7d832c9fbc8740f97c9b8b94e68a90783
2017-04-24 23:10:10 +08:00
Tom Cherry ad54d094cd init: create init_tests.cpp
Start a init_tests.cpp file for end-to-end tests that parse small init script
segments and verify that they act as expected.

The first tests ensure that the execution order of event triggers
happens appropriately.

Test: Boot bullhead, run unit tests

Change-Id: Ic446c02605ab796fd41e0596ce1fd381aee80ce0
2017-04-21 18:27:42 -07:00
Tom Cherry 30a6f276fd init: clean up the SectionParser interface and Parser class
Remove the dependency on Action and Service from what should be a
generic Parser class.

Make ActionParser, ImportParser, and ServiceParser take a pointer to
their associated classes instead of accessing them through a
singleton.

Misc fixes to SectionParser Interface:
1) Make SectionParser::ParseLineSection() non-const as it always should
have been.
2) Use Rvalue references where appropriate
3) Remove extra std::string& filename in SectionParser::EndFile()
4) Only have SectionParser::ParseSection() as pure virtual

Document SectionParser.

Make ImportParser report the filename and line number of failed imports.

Make ServiceParser report the filename and line number of duplicated services.

Test: Boot bullhead

Change-Id: I86568a5b375fb4f27f4cb235ed1e37635f01d630
2017-04-21 18:26:40 -07:00
Paul Lawrence 9dbe97b4d5 Support metadata encryption
Bug: 29189559
Test: Angler, Marlin build and boot
Change-Id: Ia7b070781f5f16ff8bfd934569a2209c80c28385
2017-04-21 14:26:00 -07:00
Tom Cherry b6e038efc6 Merge "init: fix errno handling on KillProcessGroup" am: f890ca9a1f am: db9f2cb46d am: c7e559ca40
am: 01d9b0e11c

Change-Id: I0b2f5c4992a736c0416b2ebbe576d57f8dbe58da
2017-04-20 21:02:42 +00:00
Tom Cherry 01d9b0e11c Merge "init: fix errno handling on KillProcessGroup" am: f890ca9a1f am: db9f2cb46d
am: c7e559ca40

Change-Id: I297778909c6b134178928462cb995f3e65d44b9a
2017-04-20 21:00:43 +00:00
William Roberts e6ec2661b7 init: fix errno handling on KillProcessGroup
KillProcessGroup can return -1 without errno set, which produces error
messages like this:

init: Sending signal 15 to service 'vold' (pid 1806) process group...
init: failed to kill 2 processes for processgroup 1806
init: killProcessGroup(0, 1806, 15) failed: Success

Test: boot and reboot hikey.

Change-Id: I51f242da234daee84795a3fbdffe9ad1f4567140
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2017-04-19 17:21:44 -07:00
Keun-young Park e2b04b71ae do not start shutdown animation from init
- init will only keep animation related services as shutdown critical.
- external component like system server can start shutdown animation.

bug: 37500823
Test: reboot
Change-Id: Ief328306eba7e3b15402ae27e6236767095f508c
2017-04-19 14:30:25 -07:00
Tom Cherry 16df0f1336 Merge "init: Stop combining actions" am: 8d644d2c96 am: a0b0c8a18e am: 779e922866
am: d949df5f57

Change-Id: I2b8b3e244089ea45a7b80fa7b88a8cd9d41e6896
2017-04-19 20:17:57 +00:00
Tom Cherry d949df5f57 Merge "init: Stop combining actions" am: 8d644d2c96 am: a0b0c8a18e
am: 779e922866

Change-Id: I83cb780715d5949a47155b98be8714604ddacb72
2017-04-19 20:10:00 +00:00
Tom Cherry 012c573e26 init: Stop combining actions
In the past, I had thought it didn't make sense to have multiple
Action classes with identical triggers within ActionManager::actions_,
and opted to instead combine these into a single action.  In theory,
it should reduce memory overhead as only one copy of the triggers
needs to be stored.

In practice, this ends up not being a good idea.

Most importantly, given a file with the below three sections in this
same order:

on boot
  setprop a b

on boot && property:true=true
  setprop c d

on boot
  setprop e f

Assuming that property 'true' == 'true', when the `boot` event
happens, the order of the setprop commands will actually be:

setprop a b
setprop e f
setprop c d

instead of the more intuitive order of:

setprop a b
setprop c d
setprop e f

This is a mistake and this CL fixes it.  It also documents this order.

Secondly, with a given 'Action' now spanning multiple files, in order
to keep track of which file a command is run from, the 'Command'
itself needs to store this.  Ironically to the original intention,
this increases total ram usage.  This change now only stores the file
name in each 'Action' instead of each 'Command'.  All in all this is a
negligible trade off of ram usage.

Thirdly, this requires a bunch of extra code and assumptions that
don't help anything else.  In particular it forces to keep property triggers
sorted for easy comparison, which I'm using an std::map for currently,
but that is not the best data structure to contain them.

Lastly, I added the filename and line number to the 'processing
action' LOG(INFO) message.

Test: Boot bullhead, observe above changes
Test: Boot sailfish, observe no change in boot time
Change-Id: I3fbcac4ee677351314e33012c758145be82346e9
2017-04-19 11:26:29 -07:00
Tom Cherry 4abeb2b01b Merge "init: add warning that `start` is not synchronous" am: 06039e58d8 am: 2b78f9c0a9 am: 0a4ff0fb31
am: 0a03f5cb59

Change-Id: Ifbddec02bf5527dab86af605a619b6e74eb0c6df
2017-04-19 18:24:37 +00:00
Tom Cherry 0a03f5cb59 Merge "init: add warning that `start` is not synchronous" am: 06039e58d8 am: 2b78f9c0a9
am: 0a4ff0fb31

Change-Id: I32cd3f13e4f7b63da66332ff616fefa23cb5cab8
2017-04-19 18:21:51 +00:00
Wei Wang 0af7ee4a1f Merge changes from topic 'cpuset_setall' into oc-dev
* changes:
  init: use read_file and write_file to implement do_copy builtin
  init: Use std::string for write_file()
2017-04-19 16:49:59 +00:00
Yongqin Liu 67f6a530ba init: use read_file and write_file to implement do_copy builtin
this will make the implementation more cleaner,
and has error message output when failed on some operations

also add the O_TRUNC flag explicitly for the open function
called in write_file.

And add more test on read_file and write_file functions

Bug: 36726045
Bug: 36576280
Test: manual with hikey
Test: boot and init tests on bullhead
Test: cast with fugu, per b/36726045
Merged-In: If3c30a2fff58cfece2fcd27e69c30382146e6808

Change-Id: If3c30a2fff58cfece2fcd27e69c30382146e6808
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
(cherry picked from commit dbe88e7953)
2017-04-19 16:49:39 +00:00
Tom Cherry ef52ae14ab init: Use std::string for write_file()
The content parameter of write_file() previously took a char* that was
then converted to a std::string in WriteStringToFd().  One unfortunate
effect of this, is that it is impossible to write data that contains
'\0' within it, as the new string will only contain characters up
until the '\0'.

This changes write_file() to take an std::string, such that
std::string::size() is used to determine the length of the string,
allowing it to contain null characters.

Also change the path parameter of read_file() and write_file() for
consistency.

Lastly, add a test for handling strings with '\0' in them.

Bug: 36726045
Bug: 36576280
Test: Boot bullhead, run unit tests
Change-Id: Idad60e4228ee2de741ab3ab6a4917065b5e63cd8
(cherry picked from commit 53089aa25c)
2017-04-19 16:39:08 +00:00
Bowgo Tsai a190551d2e Merge "Set libavb version into system property for Treble OTA" into oc-dev 2017-04-19 06:13:56 +00:00
Tom Cherry 19866bf19f init: add warning that `start` is not synchronous
Bug: 36571736
Bug: 37481363
Change-Id: I5d360cbb3635f00453a492ee4e3650fb80f390f5
2017-04-19 00:46:44 +00:00
Tom Cherry 5ceb7b3ebd init: handle sys.powerctl immediately
Currently if a process sets the sys.powerctl property, init adds this
property change into the event queue, just like any other property.
The actual logic to shutdown the device is not executed until init
gets to the action associated with the property change.

This is bad for multiple reasons, but explicitly causes deadlock in
the follow scenario:

A service is started with `exec` or `exec_start`
The same service sets sys.powerctl indicating to the system to
shutdown
The same service then waits infinitely

In this case, init doesn't process any further commands until the exec
service completes, including the command to reboot the device.

This change causes init to immediately handle sys.powerctl and reboot
the device regardless of the state of the event queue, wait for exec,
or wait for property conditions.

Bug: 37209359
Bug: 37415192

Test: Init reboots normally
Test: Update verifier can reboot the system
Change-Id: Iff2295aed970840f47e56c4bacc93001b791fa35
(cherry picked from commit 98ad32a967)
2017-04-18 12:24:58 -07:00
Tom Cherry 3b6367af46 Merge "init: handle sys.powerctl immediately" am: 14ed55bae8 am: e6bfb53196 am: 8972f887d2
am: 1f49801ab1

Change-Id: I6af3f4e1850593f13f27a3fd48f1310e0c3e369c
2017-04-18 18:39:20 +00:00
Tom Cherry 1f49801ab1 Merge "init: handle sys.powerctl immediately" am: 14ed55bae8 am: e6bfb53196
am: 8972f887d2

Change-Id: I3af0841fc3c23e2758ec5f330e9ba03f7695d50f
2017-04-18 18:33:17 +00:00
Tom Cherry 14ed55bae8 Merge "init: handle sys.powerctl immediately" 2017-04-18 18:14:18 +00:00
Tom Cherry 98ad32a967 init: handle sys.powerctl immediately
Currently if a process sets the sys.powerctl property, init adds this
property change into the event queue, just like any other property.
The actual logic to shutdown the device is not executed until init
gets to the action associated with the property change.

This is bad for multiple reasons, but explicitly causes deadlock in
the follow scenario:

A service is started with `exec` or `exec_start`
The same service sets sys.powerctl indicating to the system to
shutdown
The same service then waits infinitely

In this case, init doesn't process any further commands until the exec
service completes, including the command to reboot the device.

This change causes init to immediately handle sys.powerctl and reboot
the device regardless of the state of the event queue, wait for exec,
or wait for property conditions.

Bug: 37209359
Bug: 37415192

Test: Init reboots normally
Test: Update verifier can reboot the system
Change-Id: Iff2295aed970840f47e56c4bacc93001b791fa35
2017-04-17 16:40:06 -07:00
Tom Cherry c54a16e36c Merge "ueventd: create classes for dev and sys permissions" am: ffa38cfc1e am: e29fa61725 am: b7ef4726ff
am: c4b1a2f230

Change-Id: I28f4213dc1459b02c3929101b7b781eb8c024030
2017-04-17 22:42:26 +00:00
Tom Cherry c4b1a2f230 Merge "ueventd: create classes for dev and sys permissions" am: ffa38cfc1e am: e29fa61725
am: b7ef4726ff

Change-Id: I2b64de1007adb68ef3364f0ed6bbd51b297d292e
2017-04-17 21:56:27 +00:00
Tom Cherry cc054c9da8 ueventd: create classes for dev and sys permissions
Create classes for dev and sys permissions and store these permissions
in std::vector instead of the C list.

Test: boot bullhead
Test: init unit tests

Change-Id: I874039a3db29b4c70149506da8e407123ab7eca2
2017-04-17 19:33:04 +00:00
TreeHugger Robot 29ab67b0c1 Merge "Revert "Send property_service AVC messages to the kernel audit system"" into oc-dev 2017-04-15 07:37:38 +00:00
Bowgo Tsai 698384ef10 Merge "Set libavb version into system property for Treble OTA" am: e8311491da am: 7b08869382 am: 6f3ec3d759
am: 6e69b2ea2a

Change-Id: I1a6acaf7f42140a7a31dd95006a876dfd4919d9b
2017-04-15 06:11:02 +00:00
Bowgo Tsai 6e69b2ea2a Merge "Set libavb version into system property for Treble OTA" am: e8311491da am: 7b08869382
am: 6f3ec3d759

Change-Id: I2c97b605e75c479e485ac36e1e90c039467df04e
2017-04-15 06:07:10 +00:00
Bowgo Tsai 451801223b Set libavb version into system property for Treble OTA
Set ro.boot.avb_version to "AVB_VERSION_MAJOR.AVB_VERSION_MINOR".
During Treble OTA match, the major version must be the same as that in
the avb metadata on disk, while the minor version can be equal or
greater to that in the avb metadata on disk.

See how avb versioning work on the following link:

  https://android-review.googlesource.com/#/c/342757/

Also renames AvbHashtreeDisabled() -> hashtree_disabled().

Bug: 35322304
Test: Early mount with AVB, checks [ro.boot.avb_version]: [1.0] exists.
Test: Not enable AVB, checks [ro.boot.avb_version] doesn't exists.

Change-Id: I5aaf476ca53c4fe817779518ba14b68ebcfdc6d6
Merged-In: I5aaf476ca53c4fe817779518ba14b68ebcfdc6d6
(cherry picked from commit 1a898c25f9)
2017-04-15 14:01:06 +08:00
Bowgo Tsai 1a898c25f9 Set libavb version into system property for Treble OTA
Set ro.boot.avb_version to "AVB_VERSION_MAJOR.AVB_VERSION_MINOR".
During Treble OTA match, the major version must be the same as that in
the avb metadata on disk, while the minor version can be equal or
greater to that in the avb metadata on disk.

See how avb versioning work on the following link:

  https://android-review.googlesource.com/#/c/342757/

Also renames AvbHashtreeDisabled() -> hashtree_disabled().

Bug: 35322304
Test: Early mount with AVB, checks [ro.boot.avb_version]: [1.0] exists.
Test: Not enable AVB, checks [ro.boot.avb_version] doesn't exists.

Change-Id: I5aaf476ca53c4fe817779518ba14b68ebcfdc6d6
2017-04-15 09:47:31 +08:00
Elliott Hughes a39515ce8d Revert "Send property_service AVC messages to the kernel audit system"
This reverts commit 8adb4d9d12.

(cherrypick of d8f9356bec)

Change-Id: I0db29617f323ef31ca5a270d02b7668092e9c9e1
2017-04-14 17:44:22 -07:00
Elliott Hughes 1abf533ae8 Merge "Revert "Send property_service AVC messages to the kernel audit system"" am: eea60804f6 am: aee26df200 am: 246a7e57b8
am: 77fc053638

Change-Id: I1edd70a8b2ec0dab7f72d2797bafcf39520a0984
2017-04-15 00:32:19 +00:00
Elliott Hughes 77fc053638 Merge "Revert "Send property_service AVC messages to the kernel audit system"" am: eea60804f6 am: aee26df200
am: 246a7e57b8

Change-Id: Ibf1c376d96c1d9000b44b89432d6c959d050309b
2017-04-15 00:29:22 +00:00
Elliott Hughes eea60804f6 Merge "Revert "Send property_service AVC messages to the kernel audit system"" 2017-04-15 00:13:47 +00:00
Tom Cherry 3ea6245ad5 Merge changes I9d0482d1,Ib82833be am: b87f1c1728 am: 43473d3a54 am: dfb81ce15a
am: d374d59c09

Change-Id: Icf73dd711aef2bd6a20828b4df30dcc7265ad766
2017-04-14 22:00:08 +00:00
Tom Cherry d374d59c09 Merge changes I9d0482d1,Ib82833be am: b87f1c1728 am: 43473d3a54
am: dfb81ce15a

Change-Id: Iadacb505e72b41ee3845ad48dda192094ca6f53e
2017-04-14 21:56:25 +00:00
Elliott Hughes d8f9356bec Revert "Send property_service AVC messages to the kernel audit system"
This reverts commit 8adb4d9d12.

Change-Id: I0db29617f323ef31ca5a270d02b7668092e9c9e1
2017-04-14 12:53:19 -07:00
Tom Cherry 1ab8f55344 ueventd: convert platform_names from C list to std::vector
Also simplify this code a bit.

There's only one consumer that removes the /devices/platform prefix,
so have them handle it instead of storing two copies of the string.

Remove an unneeded search for '/' in get_character_device_symlinks()
as a / will always be the next character after a parent path, by
nature of FindPlatformDevice().

Test: boot bullhead
Test: init unit tests

Change-Id: I9d0482d137b1342ae7509ae993ff99198be814f0
2017-04-14 10:23:52 -07:00
Tom Cherry e3e48214b7 ueventd: replace char* with std::string in struct uevent
Bug: 36250207

Test: Boot bullhead
Test: Boot sailfish, observe no boot time regression
Test: init unit tests

Change-Id: Ib82833bea56bdafbe1d7a045126aaa91a8725d98
2017-04-14 10:23:52 -07:00
Treehugger Robot e771b69e72 Merge changes I6a29c678,I76212f65
* changes:
  reboot: fix owner and permissions of last_reboot_reason file
  init.rc: create /data/misc/reboot owned by system
2017-04-14 14:16:20 +00:00
Bowgo Tsai 92ca58b5bd fs_mgr: support AVB in fs_mgr_update_verity_state()
fs_mgr_update_verity_state() is invoked by 'verity_update_state' in
init.rc. It will then set property "partition.system.verified" and
"partition.vendor.verified" to verify_mode. We should support this for
AVB as well.

Also change the order of static libs in init to fix the build error
after this change:
  system/extras/ext4_utils/ext4_crypt.cpp:69: error: undefined reference to 'property_get'

Bug: 35416769
Test: Mount /system and /vendor with vboot 2.0 (AVB), check the following properties exist.
      - [partition.system.verified]: [2]
      - [partition.vendor.verified]: [2]
Test: Mount /system and /vendor with vboot 1.0, check the following properties exist.
      - [partition.system.verified]: [0]
      - [partition.vendor.verified]: [0]

Change-Id: I4328d66a8cb93f26e7960e620a0b2292d5f15900
Merged-In: I4328d66a8cb93f26e7960e620a0b2292d5f15900
(cherry picked from commit aaf70e77dc)
2017-04-14 21:53:49 +08:00
Bowgo Tsai 51c027285b init: support early_mount with vboot 2.0 (external/avb/libavb)
libavb requires verifying AVB metadata on all verified partitions at
once. For example, /vbmeta, /boot, /system and /vendor. We need to
invoke device_init() for those partitions even if we only want to early
mount some of them, like /vendor and /system.

This CL gets all AVB partitions and the early mount partitions from
device tree through "firmware/android/vbmeta" and "firmware/fstab",
respectively. The following is an example to early mount /vendor
partition on bullhead:

firmware {
    android {
        compatible = "android,firmware";
        vbmeta {
            compatible = "android,vbmeta";
            parts = "boot,system,vendor";
            by_name_prefix="/dev/block/platform/soc.0/f9824900.sdhci/by-name"
        };
        fstab {
            compatible = "android,fstab";
            vendor {
                compatible = "android,vendor";
                dev = "/dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor";
                type = "ext4";
                mnt_flags = "ro,barrier=1,inode_readahead_blks=8";
                fsmgr_flags = "wait,avb";
            };
        };
    };
};

Bug: 33254008
Test: early mount /vendor with vboot 2.0 (AVB) on bullhead
Test: early mount /system without dm-verity on bullhead
Test: early mount /vendor with vboot 1.0 on sailfish

Change-Id: I89a1f77c97124f309346b33d9e700544b92ecf05
Merged-In: I89a1f77c97124f309346b33d9e700544b92ecf05
(cherry picked from commit 8bba52fc4b)
2017-04-14 21:53:39 +08:00
Bowgo Tsai 2f374cbe26 Merge changes from topic 'avb-early-mount' am: d7381375bb am: 04989a7a4b am: 0b2d83a64b
am: 4d70aa5541

Change-Id: If96228c7c72876d698bfb30867268dda9c616773
2017-04-14 07:25:54 +00:00
Bowgo Tsai 4d70aa5541 Merge changes from topic 'avb-early-mount' am: d7381375bb am: 04989a7a4b
am: 0b2d83a64b

Change-Id: I3911b1be010b7f79f2b3975a9264eb914044392f
2017-04-14 06:40:58 +00:00
Treehugger Robot d7381375bb Merge changes from topic 'avb-early-mount'
* changes:
  fs_mgr: support AVB in fs_mgr_update_verity_state()
  init: support early_mount with vboot 2.0 (external/avb/libavb)
2017-04-14 06:20:42 +00:00
Bowgo Tsai aaf70e77dc fs_mgr: support AVB in fs_mgr_update_verity_state()
fs_mgr_update_verity_state() is invoked by 'verity_update_state' in
init.rc. It will then set property "partition.system.verified" and
"partition.vendor.verified" to verify_mode. We should support this for
AVB as well.

Also change the order of static libs in init to fix the build error
after this change:
  system/extras/ext4_utils/ext4_crypt.cpp:69: error: undefined reference to 'property_get'

Bug: 35416769
Test: Mount /system and /vendor with vboot 2.0 (AVB), check the following properties exist.
      - [partition.system.verified]: [2]
      - [partition.vendor.verified]: [2]
Test: Mount /system and /vendor with vboot 1.0, check the following properties exist.
      - [partition.system.verified]: [0]
      - [partition.vendor.verified]: [0]

Change-Id: I4328d66a8cb93f26e7960e620a0b2292d5f15900
2017-04-14 12:10:49 +08:00
Bowgo Tsai 8bba52fc4b init: support early_mount with vboot 2.0 (external/avb/libavb)
libavb requires verifying AVB metadata on all verified partitions at
once. For example, /vbmeta, /boot, /system and /vendor. We need to
invoke device_init() for those partitions even if we only want to early
mount some of them, like /vendor and /system.

This CL gets all AVB partitions and the early mount partitions from
device tree through "firmware/android/vbmeta" and "firmware/fstab",
respectively. The following is an example to early mount /vendor
partition on bullhead:

firmware {
    android {
        compatible = "android,firmware";
        vbmeta {
            compatible = "android,vbmeta";
            parts = "boot,system,vendor";
            by_name_prefix="/dev/block/platform/soc.0/f9824900.sdhci/by-name"
        };
        fstab {
            compatible = "android,fstab";
            vendor {
                compatible = "android,vendor";
                dev = "/dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor";
                type = "ext4";
                mnt_flags = "ro,barrier=1,inode_readahead_blks=8";
                fsmgr_flags = "wait,avb";
            };
        };
    };
};

Bug: 33254008
Test: early mount /vendor with vboot 2.0 (AVB) on bullhead
Test: early mount /system without dm-verity on bullhead
Test: early mount /vendor with vboot 1.0 on sailfish

Change-Id: I89a1f77c97124f309346b33d9e700544b92ecf05
2017-04-14 12:10:20 +08:00
Todd Poynor 4224f030c4 Merge changes I76212f65,I6a29c678 into oc-dev am: 5975d4e337
am: a03b4dc574

Change-Id: Ib202914daeb62057d4575e4815329f5a7bee80f0
2017-04-14 02:05:13 +00:00
Todd Poynor a03b4dc574 Merge changes I76212f65,I6a29c678 into oc-dev
am: 5975d4e337

Change-Id: I0441dc1f8a9ff11429a253d0510790b20b42e3b4
2017-04-14 01:37:03 +00:00
Todd Poynor fc827be3f9 reboot: fix owner and permissions of last_reboot_reason file
Default signature WriteStringToFile creates world-writeable files.
Set owner and group system and remove read/write for non-owner.

Bug: 37251463
Test: Manual: reboot, inspect
Change-Id: I6a29c678168dcae611b120dc52170f4eee7069a9
2017-04-13 18:03:59 -07:00
Todd Poynor dff584659c reboot: fix owner and permissions of last_reboot_reason file
Default signature WriteStringToFile creates world-writeable files.
Set owner and group system and remove read/write for non-owner.

Bug: 37251463
Test: Manual: reboot, inspect
Change-Id: I6a29c678168dcae611b120dc52170f4eee7069a9
2017-04-13 15:48:11 -07:00
Tom Cherry ec1d24f522 Merge changes Ie5ec609a,I5a2ac369,I690137b5 am: 659b78ed10 am: 01b87aac9c am: 8d9eee4f2b
am: aa85663027

Change-Id: I69be112c0020f7b4ce1a9a92c1e60e8f2941c5a9
2017-04-13 22:25:29 +00:00
Tom Cherry aa85663027 Merge changes Ie5ec609a,I5a2ac369,I690137b5 am: 659b78ed10 am: 01b87aac9c
am: 8d9eee4f2b

Change-Id: I5cd7d00f71bfd3970189481f381629cedc358c9b
2017-04-13 21:45:58 +00:00
Tom Cherry 659b78ed10 Merge changes Ie5ec609a,I5a2ac369,I690137b5
* changes:
  ueventd: Fix up string handling in handle_*_device_event()
  ueventd: convert mkdir_recursive() to std::string
  ueventd: move subsystem logic from code to ueventd.rc
2017-04-13 21:22:45 +00:00
Jeffrey Vander Stoep 52ae5ce19e Merge "init: expand generated attributes on sepolicy compile" into oc-dev am: 57d4c59559
am: be2bfc55f7

Change-Id: I85b3cc759756f3df399c913eb98887cc7c6abccf
2017-04-13 18:45:43 +00:00
Jeffrey Vander Stoep be2bfc55f7 Merge "init: expand generated attributes on sepolicy compile" into oc-dev
am: 57d4c59559

Change-Id: If3230f31ab3d680c411351d61dc68e5963355d33
2017-04-13 18:37:43 +00:00
Jeffrey Vander Stoep 57d4c59559 Merge "init: expand generated attributes on sepolicy compile" into oc-dev 2017-04-13 18:11:08 +00:00
Jeff Vander Stoep d278253378 init: expand generated attributes on sepolicy compile
Expand auto generated attributes in selinux policy when doing
on-device compile of platform + vendor selinux policy.

Bug: 3650825
Test: Build and boot Marlin
Change-Id: Icc1c3af0b504236ae13fd8a5155c2109befd7688
2017-04-13 17:32:51 +00:00
Martijn Coenen 6b477beec9 Merge "restorecon hwservice_contexts." into oc-dev am: f8952a196c
am: 30ec708335

Change-Id: I3689132a9536852a6458c282041aad04d1d77059
2017-04-13 03:49:49 +00:00
Martijn Coenen 30ec708335 Merge "restorecon hwservice_contexts." into oc-dev
am: f8952a196c

Change-Id: If828fe3afd399f15fcc351f39dc0cdc7531ed635
2017-04-13 03:43:51 +00:00
Martijn Coenen f8952a196c Merge "restorecon hwservice_contexts." into oc-dev 2017-04-13 03:34:48 +00:00
Martijn Coenen 6887273a28 restorecon hwservice_contexts.
Test: marlin boots, angler boots
Bug: 34454312
Change-Id: I5da8b0b10a7a4c0e6e0c9aea39004852889e8d97
2017-04-12 18:02:33 -07:00
Dmitri Plotnikov f9cb319dbc Merge "Passing additional parameter to powerctl" am: e0ab2557d4 am: 0c146e6572 am: cff6544e2e
am: bcb5e5008c

Change-Id: I82af77457e13bd0d5a56099c80987d37c79ce752
2017-04-13 01:01:06 +00:00
Dmitri Plotnikov bcb5e5008c Merge "Passing additional parameter to powerctl" am: e0ab2557d4 am: 0c146e6572
am: cff6544e2e

Change-Id: I6e21babe911996ac0f91e9a61aeb46499c4949c0
2017-04-13 00:52:00 +00:00
Tom Cherry 3fa467338f ueventd: Fix up string handling in handle_*_device_event()
Bug: 36250207

Test: Boot bullhead
Test: Boot sailfish, observe no boot time regression
Test: init unit tests

Change-Id: Ie5ec609a3f74bb03f5920734ada4d7de57508de4
2017-04-12 16:36:53 -07:00
Tom Cherry 060b74baad ueventd: convert mkdir_recursive() to std::string
Bug: 36250207

Test: Boot bullhead
Test: Boot sailfish, observe no boot time regression
Test: init unit tests

Change-Id: I5a2ac369d846e044230b709fd07eb21ad12d47bb
2017-04-12 16:36:44 -07:00
Tom Cherry 780a71e779 ueventd: move subsystem logic from code to ueventd.rc
Test: Boot bullhead
Test: Boot sailfish, observe no boot time regression
Test: init unit tests

Change-Id: I690137b584fcc2b9cd2dd932a2678f75a56d6737
2017-04-12 16:36:20 -07:00
Dmitri Plotnikov 00e1c4f330 Passing additional parameter to powerctl
Test: adb reboot recovery,foo and verify that the parameter reaches bootloader
Change-Id: I9690cf96cf9730e5324b9f5310c3d0341fe25fe2
2017-04-12 14:38:23 -07:00
Dan Cashman 6642d45fdb init: use platform sepolicy version indicated by /vendor. am: 692c3e4d38
am: 18ff05146f

Change-Id: Idae465ee6ba9671245d677c451b182b926f9c534
2017-04-12 20:59:04 +00:00
Dan Cashman 18ff05146f init: use platform sepolicy version indicated by /vendor.
am: 692c3e4d38

Change-Id: I81874aea3896c1156295616f12c211e9423d5ca7
2017-04-12 20:43:31 +00:00
Dan Cashman 692c3e4d38 init: use platform sepolicy version indicated by /vendor.
It's possible, in the event of a platform update, for the platform
SELinux policy to change from the policy on which the vendor SELinux
policy was originally based.  In this case, a different mapping file
to bridge the differences between the new policy and the old needs to
be selected.

Make init choose which mapping policy file to use based on the version
reported in /vendor/etc/selinux/plat_sepolicy_vers.txt.

Bug: 36783775
Test: Force compilation of sepolicy on-device with mapping file changed
to new location and name, using the value reported on /vendor.

Change-Id: I63c883ccb79dd31c92dabe44a55c4ab50a3735e6
2017-04-12 10:45:08 -07:00
Tom Cherry a72518f588 Merge "ueventd: remove /dev/log" am: 120add07ab am: 9ae606d659 am: 6c2e8b10fe
am: 6289bb1341

Change-Id: I688c8cca7ebca7f4cd86ac8d3595b6ba01be9221
2017-04-12 08:23:22 +00:00
Tom Cherry 6289bb1341 Merge "ueventd: remove /dev/log" am: 120add07ab am: 9ae606d659
am: 6c2e8b10fe

Change-Id: Ic257774710a74e72a97f4187e48587150ee3d613
2017-04-12 08:17:29 +00:00
Treehugger Robot 120add07ab Merge "ueventd: remove /dev/log" 2017-04-12 07:58:33 +00:00
Tom Cherry 547813bb0c Merge "ueventd: replace char** links with std::vector<std::string>" am: 162118928e am: a778c81e11 am: ed5f8ca6e9
am: 420a937e3e

Change-Id: Ie0f8b248fc4d095b38c6ded8b0e3451851e06ae6
2017-04-12 01:39:07 +00:00
Tom Cherry 420a937e3e Merge "ueventd: replace char** links with std::vector<std::string>" am: 162118928e am: a778c81e11
am: ed5f8ca6e9

Change-Id: Ie64fbebc87bd419f9aba5655a5c223d08b0424e9
2017-04-12 01:15:46 +00:00
Treehugger Robot 162118928e Merge "ueventd: replace char** links with std::vector<std::string>" 2017-04-12 00:57:35 +00:00
Tom Cherry d4ff8d83d3 ueventd: remove /dev/log
This was marked deprecated in 2014 and removed in 2015, let's remove
the uevent rule now too.

Test: see that logging still works on bullhead
Change-Id: Idaf3f49a1afe7046eba6c976628b9f1c8b3ec094
2017-04-11 21:35:46 +00:00
Keun-young Park 9afad9f202 Merge "poll umount completion from /proc/mounts" am: 625a098573 am: cb4dadfb08 am: 4c44243c45
am: ae56bc7efa

Change-Id: I2240b1e31c6c0b92a7fc6e3da271a1d00738efa8
2017-04-11 01:09:22 +00:00
Keun-young Park ae56bc7efa Merge "poll umount completion from /proc/mounts" am: 625a098573 am: cb4dadfb08
am: 4c44243c45

Change-Id: Iee3fac59672d5f7f6bfdad35e374fec3f5a29f29
2017-04-11 01:04:55 +00:00
Keun-young Park 0e90dee9e0 poll umount completion from /proc/mounts
- umount operation is asynchronous except for root partition.
  Returning from umount does not guarantee completion of
  umount. Poll /proc/mounts to confirm completion of umount.
- Treat all devices mounting to /data as emulated devices. This is
  future proof when fs other than sdcardfs is used.
- Drop quota sync from sync step. There is no differences in
  frequencies of quota error.
- Run umount in reverse order from mounting order so that any
  hidden dependency can be auto-resolved.
- Add dump of lsof and /proc/mounts when umount fails. lsof only runs
  when selinux is toggled into permissive mode. The dump is enabled
  only for non-user build.
- Keep logcat until vold shutdown in case vold has any error to report.

bug: 36551218
Test: python packages/services/Car/tools/bootanalyze/bootanalyze.py -r -c packages/services/Car/tools/bootanalyze/config.yaml -n 1000 -f -e 20 -w 30

Change-Id: I87b17b966d7004c205452d81460b02c6acf50d45
(cherry picked from commit 2ba5c8103d)
2017-04-10 17:48:19 -07:00
Keun-young Park 2ba5c8103d poll umount completion from /proc/mounts
- umount operation is asynchronous except for root partition.
  Returning from umount does not guarantee completion of
  umount. Poll /proc/mounts to confirm completion of umount.
- Treat all devices mounting to /data as emulated devices. This is
  future proof when fs other than sdcardfs is used.
- Drop quota sync from sync step. There is no differences in
  frequencies of quota error.
- Run umount in reverse order from mounting order so that any
  hidden dependency can be auto-resolved.
- Add dump of lsof and /proc/mounts when umount fails. lsof only runs
  when selinux is toggled into permissive mode. The dump is enabled
  only for non-user build.
- Keep logcat until vold shutdown in case vold has any error to report.

bug: 36551218
Test: python packages/services/Car/tools/bootanalyze/bootanalyze.py -r -c packages/services/Car/tools/bootanalyze/config.yaml -n 1000 -f -e 20 -w 30

Change-Id: I87b17b966d7004c205452d81460b02c6acf50d45
2017-04-10 15:41:15 -07:00
Josh Gao 9c997cfa00 Merge "crash_dump: during early boot, output to kmsg on userdebug." am: 72ca48e5cb am: 35b7a274ac am: e80f6668f5
am: a0ff3d7b6b

Change-Id: Ib396d9d3af46d775306e8fd5801bd68a3b17fd50
2017-04-10 21:17:07 +00:00
Josh Gao a0ff3d7b6b Merge "crash_dump: during early boot, output to kmsg on userdebug." am: 72ca48e5cb am: 35b7a274ac
am: e80f6668f5

Change-Id: Ic9b44bd3cf50240c1f34edb8aa35a821a75e202c
2017-04-10 21:13:05 +00:00
Josh Gao 72ca48e5cb Merge "crash_dump: during early boot, output to kmsg on userdebug." 2017-04-10 20:51:59 +00:00
Tom Cherry 2e344f9d22 ueventd: replace char** links with std::vector<std::string>
Additionally replace the associated C string parsing with C++ and write
unit tests.

Bug: 33785894
Bug: 36250207
Test: Boot bullhead + unit tests
Change-Id: Iee1f72d248bca3bd2e1227045628935b3dd6195a
2017-04-08 00:05:50 +00:00
Tom Cherry 7b871994b1 Merge "init: clean up more headers" am: 4f6feec25b am: a7d0718907 am: 99b26e5ab1
am: 7dd593a887

Change-Id: Ia909afc584ce37ff8859c3fe2d4f0b3ee6aa33f6
2017-04-07 23:20:19 +00:00
Tom Cherry 7dd593a887 Merge "init: clean up more headers" am: 4f6feec25b am: a7d0718907
am: 99b26e5ab1

Change-Id: I6cfffc3c756dd02263adfe1aac1456a70d76ce03
2017-04-07 23:14:51 +00:00
Treehugger Robot 4f6feec25b Merge "init: clean up more headers" 2017-04-07 22:56:32 +00:00
Tom Cherry f57c0bfab2 init: clean up more headers
We don't need everyone including <sys/system_properties.h>

Test: boot bullhead
Change-Id: I73d507e4f273678eaf15947725741e1e3b966cc6
2017-04-07 13:49:12 -07:00
Treehugger Robot a74635d33e Merge "Reflect move of mapping file to /system." 2017-04-07 14:25:33 +00:00
Tom Cherry 5d2397d6f9 Merge "init: more header cleanup" am: ab5ab1ebd4 am: 6510908bd1 am: d93ffe7260
am: 25c351ccb8

Change-Id: I84b531c60d5ef9b0d63591c38ad183876d4b5674
2017-04-07 03:03:01 +00:00
Tom Cherry 25c351ccb8 Merge "init: more header cleanup" am: ab5ab1ebd4 am: 6510908bd1
am: d93ffe7260

Change-Id: I987514d698ac2c67036ad8dc084ca36c8a300767
2017-04-07 02:59:38 +00:00
Treehugger Robot ab5ab1ebd4 Merge "init: more header cleanup" 2017-04-07 02:44:07 +00:00
Tom Cherry 3f5eaae526 init: more header cleanup
Remove includes of "log.h" that really want <android-base/logging.h>
Fix header include order
Remove headers included in .cpp files that their associated .h already includes
Remove some unused headers

Test: boot bullhead
Change-Id: I2b415adfe86a5c8bbe4fb1ebc53c7b0ee2253824
2017-04-06 18:06:34 -07:00
Tom Cherry 1a06456f38 Merge "ueventd: Write tests for the get_*_symlinks() functions" am: e7fbd6a2b4 am: e6b70f5913 am: 9cf2cd358c
am: f2cb84724b

Change-Id: I0dd8ab5f5690747d0ecfa17c5709c308baa6010a
2017-04-07 00:33:53 +00:00