Commit graph

951 commits

Author SHA1 Message Date
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
Wei Wang
66f44d823f Merge "init.rc: set initial cpuset to all cores" 2017-04-17 20:01:43 +00:00
Wei Wang
2e83b86a8a init.rc: set initial cpuset to all cores
Starting zygote early requires cpuset to be initialized to all cores for
foreground cpuset. Change to expolit all cores by default at boot and
let device manufacturers override to proper values in device specific
init script.

Bug: 36576280
Test: marlin boot fast and checked cpuset during early boot
Change-Id: I2c1ce0630e58a7b04d1a453c6740d3f0bce9de9f
2017-04-14 15:03:29 -07:00
Todd Poynor
e092b72bf4 init.rc: create /data/misc/reboot owned by system
Directory will be read and modified by system uid.

Bug: 37251463
Test: Manual: reboot and inspect
Change-Id: I76212f65af991ff9ad0969b9c0b8460b80fb9cd2
2017-04-13 18:01:13 -07:00
Jaesoo Lee
dcf4d19dd9 disable module loading after BOOT_COMPLETED broadcast
This CL disables module loading by writing 1 to
/proc/sys/kernel/modules_disabled when the property sys.boot_completed
is set to 1 by ActivityManagerService (at the broadcast of
PHASE_BOOT_COMPLETED).

Bug: 36515654
Test: tested on sailfish and verified that module loading is disabled in
userdebug and enabled in eng mode
Merged-In: Id38d34a6395966ab21e440614337c0cfca791ad0
(cherry picked from commit 6ed19d1675)

Change-Id: I2faa459b450b3a64f854c832c6b91cbf682bbffa
2017-04-12 10:08:26 +09:00
Janis Danisevskis
ec0ab6524e Move early_hal start to late-fs trigger action
The class early_hal is essentially for the keymaster hal which needs
to be up before vold tries to unlock a storage encryption key (FDE or
FBE). The current position is too early in the boot process, because
on devices with legacy HAL the wrapper service uses system properties
to find the legacy HAL.

This patch moves the start of the early_hal class to the late-fs trigger
action which runs right after the system property action.

Test: Manually tested and update tested on bullhead, sailfish, and
      another device.
Bug: 35764921

Change-Id: I34b45b85f8450e9ef18861535fdb2ee963df8c9b
(cherry picked from commit 1ad8d21947)
2017-04-07 15:28:56 -07:00
Steven Moreland
5d56bad4bd init.rc: add class_start early_hal
This class is used to start hals which are required in order to mount
data (for instance keymaster).

Test: works to start early_hal in internal
Bug: 36278706
Change-Id: If06908135e59b187683d8cf4cc4a00b490559081
2017-04-04 21:22:47 +00:00
Tom Cherry
1e2d8c7fce init.rc: launch update_verifier with exec_start
This allows update_verifier to raise it's priority and ioprio.

Bug: 36511808
Bug: 36102163
Test: Boot bullhead
Test: Verify boottime decrease on sailfish
Change-Id: I5710c6a98dc7acee9063d1fa1d1c80668f0f1528
2017-03-28 15:54:45 -07:00
Steven Moreland
d627502bb0 Revert "Revert "Start hwservicemanager earlier.""
This reverts commit 5011270225.

Now starting even earlier.

Reason for revert: Needed change, reverted b/c broken device.

Bug: 36278706
Test: original DOA device boots
Test: angler, bullhead, fugu, marlin, ryu
Test: all these devices boot with wipe
Test: all these devices boot with w/o wipe
Test: lshal shows all included services

Change-Id: Ic639aedf7834b1bd3a26d23d109727f5559317e9
2017-03-24 20:52:44 -07:00
Thierry Strudel
3ba313597d Merge "Revert "Start hwservicemanager earlier."" 2017-03-24 14:33:18 +00:00
Steven Moreland
5011270225 Revert "Start hwservicemanager earlier."
This reverts commit 9e36331174.

Reason for revert: a DOA device

Bug: 36546734

Change-Id: I0456247d362fe43b8c37623d04432eb494f68f68
2017-03-24 06:05:41 +00:00
Treehugger Robot
c39a31f002 Merge "Create dir in /data for vendor customization" 2017-03-23 19:36:52 +00:00
Jeff Vander Stoep
61efb0dab8 Create dir in /data for vendor customization
Vendor owns /data/vendor.

HAL data must go in /data/vendor/hardware/.

Bug: 34980020
Test: build and boot AOSP Marlin. Observe /data/vendor and
      /data/vendor/hardware exist and are empty.
Change-Id: I6fe96e3c76a10a5eb480ba10e10d4d006de56c12
2017-03-23 10:30:34 -07:00
Treehugger Robot
fcd509298d Merge "Start hwservicemanager earlier." 2017-03-23 03:39:40 +00:00
Steven Moreland
9e36331174 Start hwservicemanager earlier.
Also start hals where hwservicemanager was started before.

Bug: 36278706
Test: internal marlin+angler boots
Change-Id: Ia55d2ef747fcbd086a09e1bb856824b14343118b
2017-03-22 11:19:31 -07:00
Wei Wang
a27a91a5fd init.rc: remove bg_non_interactive cgroup
We have seen cases when threads in this cgroup not scheduled for more than
a few seconds in heavy workload situation and causing device freeze.
In Linux, multiple threads placed in ROOT cgroup cause the CPU resource to
be split per thread, rather than per group.
Currently we have many threads in ROOT cgroup, which makes threads in
bg_non_interactive cgroup to have "tiny" CPU resource other than 5%
quota defined.

Bug: 34193533
Test: on marlin
Change-Id: I7721f6196560fbedf6265e8b6db130cec9edefd7
2017-03-20 22:13:07 -07:00
Treehugger Robot
75b66a6f2a Merge "init.rc: enable ledtrig-transient support for vibrator" 2017-03-11 01:23:18 +00:00
Wei Wang
bae9ba3402 init.rc: make sure netd start after post-fs-data
Current init doesn't order the triggeres it scaned, and there is no
guarantee that general event trigger exec first and then event+property
triggers.

This CL will make sure netd started after post-fs-data trigger is done.

Bug: 35110957
Test: marlin boots
Change-Id: I7bb55af4e00f336682388abfa8a06eac2136b7d4
2017-03-09 13:53:39 -08:00
David Lin
27b2c1e678 init.rc: enable ledtrig-transient support for vibrator
This change makes the init process to always attempts to enable
transient trigger for vibrator. This allows the exported properties to
change the ownership later at the on boot stage.

Test: device vibrates with the driver supports ledtrig-transient

Change-Id: If5eb7b7feaefe803f2ead634fbe4fc7b48da84ea
Signed-off-by: David Lin <dtwlin@google.com>
2017-03-09 18:42:33 +00:00
Wei Wang
7f32aa4d04 init.rc: start netd and zygote early for file based encryption devices
Bug: 35110957
Test: marlin boots
Change-Id: Ibe4c413e41fcf25a68b50d99ee66d9b70706a6a1
2017-03-08 14:48:53 -08:00
Treehugger Robot
4e5e797d26 Merge "init.rc: add a new zygote-start trigger" 2017-03-08 22:18:11 +00:00
Wei Wang
a2058036ed init.rc: add a new zygote-start trigger
Bug: 35110957
Test: marlin boots
Change-Id: I12b41588371486e79938df2f7a2152cda18530d1
2017-03-08 12:39:41 -08:00
David Lin
489450abe3 init.rc: remove duplicated chown entry for timed_output
Test: build

Change-Id: Ib15be4188cdce270a15bd90304be0704d9e54cbf
Signed-off-by: David Lin <dtwlin@google.com>
2017-03-07 21:31:42 -08:00
Ryan Campbell
0b36473272 Add global GCOV_PREFIX option.
When native coverage is enabled, add a global GCOV_PREFIX
environment variable specifying that gcda files be output
with path prefix /data/local/tmp.

Bug: 35635587
Test: make NATIVE_COVERAGE=true; check init.environ.rc
Change-Id: I40972aea3ca3168d0687bdc93e9d4b7b3a1071b9
2017-02-27 15:00:18 -08:00
Todd Poynor
44ee2b0ef8 init.rc: create /data/misc/reboot for storing reboot reason
Create /data/misc/reboot if not already.

Bug: 30994946
Test: manual: reboot command; modified thermal-engine.conf
Change-Id: I66418beba539f76759b44742af7700f26a2c1f87
2017-02-10 19:26:13 +00:00
Steven Moreland
f38aab4621 init.rc, typo: fs-post-data -> post-fs-data
Test: pass
Change-Id: Icafdb7ec61935b35db85096b49e7f232a456f620
2017-01-25 10:52:40 -08:00
Josh Gao
0ad5107e51 Actually don't start tombstoned until /data is mounted.
Bug: http://b/34461270
Test: boot is actually faster
Test: tombstoned still started by init
Change-Id: I4976abef108bbb6fad264f9b68cbc1fba711085b
2017-01-23 16:01:14 -08:00
Treehugger Robot
b479a5002e Merge "init: don't start tombstoned until /data is mounted." 2017-01-20 22:13:38 +00:00
Josh Gao
42a0fed78b init: don't start tombstoned until /data is mounted.
When vold mounts the encrypted /data partition, it first checks for and
kills processes that have open fds to the tmpfs placeholder at /data.
This resulted in a 20 second boot-time regression (vold's timeout period)
when tombstoned was started before vold.

Bug: http://b/34461270
Test: boot is faster, no messages from vold in console spew
Test: tombstoned still started by init
Change-Id: Ib5e9ddb05f40c9da852f00e103861c6ff2d94888
2017-01-20 13:18:51 -08:00
Dave Weinstein
44f7e4f421 Move the kptr_restrict setting from init.rc to init.cpp.
Also ensure that it uses the highest supported value, and
abort if the value is not above a minimum threshold.

Test: Tested against the curent kernel (maximum value of 2,
      set to 0 by the kernel initially) and against a
      modified kernel (maximum value of 4, set to 4 by the
      kernel initially)

Bug: 30368199
Change-Id: I608db577258b68b390ffe96f452e1f7c0bc9ad8a
2017-01-20 09:40:43 -08:00
Paul Lawrence
3d8ade3f24 Set right attributes on tracing folder
Since splitting tracefs out from debugfs, we now need to set the
attributes explicitly on tracing folder.

Test: Run adb shell atrace -c -b 16000 -t 5 gfx
Bug: 34197733
Change-Id: If2a962332b6d1ec227e289bdf952213756e26186
2017-01-11 15:51:25 -08:00
Elliott Hughes
4ee7861ee1 Merge "Improve init bootcharting." 2016-12-16 17:32:27 +00:00
Sandeep Patil
5fee496e62 socket: uevent: use SO_RCVBUF instead of SO_RCVBUFFORCE
The SO_RCVBUFFORCE option requires the caller of uevent_create_socket()
to have net_admin capabilities.

Set platform default rcv/snd buffer sizes to 256kb that will always be
overridden by the device/target. However, it will allow
ueventd / healthd to use the uevent_create_socket() API w/o requiring
the net_admin capability.

Note: All devices override the buffer sizes according to the technology
maximum to at least ~8MB. So, the init.rc change here is to make sure
platform code can work w/o any overrides.

Test: no SELinux failures for healthd with 'net_admin' removed.

Bug: https://b/32733887

Change-Id: Ida346468cd550ad07901bf3a78ad508939849906
Signed-off-by: Sandeep Patil <sspatil@google.com>
2016-12-09 15:16:28 -08:00
Elliott Hughes
a3641af22f Improve init bootcharting.
Most notably, there's no longer any need to guess an end time.

Bug: http://b/23478578
Bug: http://b/33450491
Test: rebooted with bootcharting on/off
Change-Id: Icb7d6859581da5526d77dfc5aa4d57c9bfbfd7e2
2016-12-08 17:35:45 -08:00
Nick Kralevich
5fae86b5fa Merge "change /data/bugreports to /bugreports"
am: 1b2e6abf3b

Change-Id: I7de15de91a688f8fe4a203a84b54e7dcfa106782
2016-11-23 00:11:13 +00:00
Nick Kralevich
c4084c6694 change /data/bugreports to /bugreports
It's 5 characters shorter, has no runtime costs, can be stored on a
read-only partition, and avoids problems like b/27262109 and b/27204904.
It allows makes some security hardening easier.

Bug: 27262109
Bug: 27204904
Bug: 32799236
Test: verified new symlink created and old one not present
Change-Id: Ief362e13569ad9c868a7f0f9c4dbd6a328c96c6b
2016-11-22 08:57:25 -08:00
Nick Kralevich
715e33452e init.rc: delete extra whitespace
causes merge conflicts.

Test: none
Change-Id: Ic83db2b3e2f972955efadfc8df8fe8ec918a7609
2016-11-19 16:07:40 -08:00
Paul Lawrence
ffa3689107 Merge "Add flags to restorecon_recursive to traverse filesystems"
am: 5fbd1cfd34

Change-Id: I539d7e9d441c7bb3f5602b892408a85436b857e8
2016-11-17 17:55:06 +00:00
Paul Lawrence
a8d8434c42 Add flags to restorecon_recursive to traverse filesystems
Use to solve the problem of tracefs conditionally being mounted
under debugfs and needing restorecon'd without boot performance
penalty.

Also move skip-ce to a flag for consistency.

Test: Check that trace_mount has correct attributes after boot
Bug: 32849675
Change-Id: Ib6731f502b6afc393ea5ada96fa95b339f14da49
2016-11-16 22:27:45 +00:00
Tianjie Xu
c488087aa0 Start update_verifier in cache group
Start update_verifier in cache group to avoid dac_override

Bug: 30020920
Change-Id: I227b4a0e1c07e7b9bf209b432e9db02275ffe660
Test: mma
(cherry picked from commit 1e4635f0a8)
2016-11-09 11:57:26 -08:00
Paul Lawrence
3915012a46 Merge "Fix selinux warning on tracefs systems"
am: 0ad600bdc6

Change-Id: Ibaab6580caf0fe216cfae72bf5d2560fec02afdf
2016-11-07 15:07:22 +00:00
Paul Lawrence
d2abcbd0ab Fix selinux warning on tracefs systems
restorecon_recursive doesn't traverse filesystem boundaries. On
tracefs systems, tracing is a separate filesystem, so restorecon
this as well

Bug: 30963384
Test: Boot hikey, and check that there are no debugfs_tracing denials in dmesg
Change-Id: I24abd3ad80d2cfdab4f64fecee799fc0c24ed238
2016-11-04 10:56:06 -07:00
Steven Moreland
82c67f5662 Merge "Update for hidlized hwservicemanager."
am: 480af3f633

Change-Id: I2c11b0249ab77e9dc22a76f6aa66026ebf3ed00d
2016-11-02 22:23:56 +00:00
Steven Moreland
ba825ac33f Update for hidlized hwservicemanager.
Bug: 32313592
Test: end to end
Change-Id: I76a7ee01413b28e95e9f19fcde90f6372502ec67
2016-11-02 13:29:34 -07:00
Iliyan Malchev
121fe849e8 init.rc: have hwservicemanager start the HAL class am: 57d66b8447 am: ad0cbcf21c
am: f0099ccb23

Change-Id: I5c24ecbf89d723c478a02bcab8cffc4e9e4385e9
2016-09-27 00:16:50 +00:00
Iliyan Malchev
57d66b8447 init.rc: have hwservicemanager start the HAL class
b/31458381
Test: passing build and runtime tests

Change-Id: I1d26af5ca1d0e9c7bbd97cfd88d0b432b50b7216
Signed-off-by: Iliyan Malchev <malchev@google.com>
2016-09-26 00:23:51 -07:00
Ajay Panicker
531b201eb6 Merge "Remove net_bt_stack group and replace it with bluetooth" am: 7875407bb7 am: f924c252bd
am: b0db9714bb

Change-Id: I025c5301fecf0566d8184efce099a195fdbfc460
2016-09-22 21:58:27 +00:00
Ajay Panicker
604208e957 Remove net_bt_stack group and replace it with bluetooth
Bug: 31549206
Change-Id: I667963e5f9fd1a5dc9ad74378b318e3b782e6883
2016-09-20 12:01:33 -07:00
Ajay Panicker
bf2b7a93b2 Merge "Allow bluetooth service to access bluetooth directory and add /logs (1/6)" am: 2c2a3f7a95 am: 3a9a16ee79
am: f5ffb20e6f

Change-Id: Ied3f4a26681d0c1e3bd72d4f1d0de77fa9e7803a
2016-09-19 20:26:21 +00:00