Commit graph

970 commits

Author SHA1 Message Date
Nick Kralevich
f90b653667 init: add LOCAL_SANITIZE := integer
Call abort() on undefined or sketchy integer behavior.
Protects against integer overflow attacks.

Change-Id: If73e6b382f2ee645fec406805739f9684ddbb5f0
2015-08-15 15:24:23 +00:00
Nick Kralevich
38887c50c1 am 51ffedd2: am 1efef4c4: Merge "Revert "init: add LOCAL_SANITIZE := integer""
* commit '51ffedd264389730a76470408a122589f7ce3488':
  Revert "init: add LOCAL_SANITIZE := integer"
2015-08-13 18:27:42 +00:00
Nick Kralevich
1deb03179c am 51ffedd2: am 1efef4c4: Merge "Revert "init: add LOCAL_SANITIZE := integer""
* commit '51ffedd264389730a76470408a122589f7ce3488':
  Revert "init: add LOCAL_SANITIZE := integer"
2015-08-13 18:27:36 +00:00
Nick Kralevich
1efef4c49d Merge "Revert "init: add LOCAL_SANITIZE := integer"" 2015-08-13 18:15:11 +00:00
Nick Kralevich
c307b5b7f8 Revert "init: add LOCAL_SANITIZE := integer"
flounder isn't booting

This reverts commit aea73db1e3.

Bug: 23166814
Change-Id: I36c811d1ca30e2366066142d9282bb713dae315f
2015-08-13 18:10:50 +00:00
Nick Kralevich
864d4985ed am 4d74f2cb: am 0b973da5: Merge "init: add LOCAL_SANITIZE := integer"
* commit '4d74f2cb4c30aaf4dfd176b2f970dbf54e5c697d':
  init: add LOCAL_SANITIZE := integer
2015-08-12 19:22:11 +00:00
Nick Kralevich
9ec6fcfe09 am 4d74f2cb: am 0b973da5: Merge "init: add LOCAL_SANITIZE := integer"
* commit '4d74f2cb4c30aaf4dfd176b2f970dbf54e5c697d':
  init: add LOCAL_SANITIZE := integer
2015-08-12 19:21:58 +00:00
Nick Kralevich
0b973da532 Merge "init: add LOCAL_SANITIZE := integer" 2015-08-12 19:09:58 +00:00
Dan Albert
68ff9f2ca2 am e78292f2: am cef3508b: Merge "Add missing includes."
* commit 'e78292f2c5a1cffd9fdcb76e5be29f6d14445b93':
  Add missing includes.
2015-08-12 02:11:05 +00:00
Dan Albert
97a8cd957f am e78292f2: am cef3508b: Merge "Add missing includes."
* commit 'e78292f2c5a1cffd9fdcb76e5be29f6d14445b93':
  Add missing includes.
2015-08-12 02:10:16 +00:00
Dan Albert
cef3508bb6 Merge "Add missing includes." 2015-08-12 01:50:15 +00:00
Nick Kralevich
aea73db1e3 init: add LOCAL_SANITIZE := integer
Call abort() on undefined or sketchy integer behavior.
Protects against integer overflow attacks.

Change-Id: I5f542089753c8fcf7596fd70cfaa48a3caa5b140
2015-08-11 16:55:56 -07:00
Dan Albert
af9ba4dc6c Add missing includes.
Leaky header cleanup in libc++ means we don't get unistd.h
transitively any more.

Change-Id: I596c24eff418302b19afab6ad3caa55f52241e7c
2015-08-11 16:39:57 -07:00
Tom Cherry
9b005a328b am ba0f24c7: am 5573e3d8: Merge "init: replace strdup() in parse_config()"
* commit 'ba0f24c71767365ff730b763b9af257bad462809':
  init: replace strdup() in parse_config()
2015-08-11 21:05:59 +00:00
Tom Cherry
12e77877e6 am ba0f24c7: am 5573e3d8: Merge "init: replace strdup() in parse_config()"
* commit 'ba0f24c71767365ff730b763b9af257bad462809':
  init: replace strdup() in parse_config()
2015-08-11 21:05:53 +00:00
Tom Cherry
4ad60fbae5 init: replace strdup() in parse_config()
Previously, the action, command, and service structs contained char*s
that referenced memory within the buffer returned by the strdup() of
the input buffer of parse_config.  This prevented this entire memory
region from being freed, leaking contents that would never be referenced again.

The changes to convert the previous action, command, and service
structs to C++ classes created explicit ownership of the contents within
each class in the form of std::strings.  With these changes, there are
no remaining references to the memory allocated by this strdup(), which
can now be freed.

This commit replaces the strdup() with std::vector<char> to allow for
the copied string to be freed when it goes out of scope instead of
relying on the C strdup() and free() functions.

Change-Id: Id0a5f711e33363082ba201afda6b26043998cb1c
2015-08-10 14:26:03 -07:00
Tom Cherry
841066e778 am 4036f5ab: am 4bf3dc93: Merge "Create Service and ServiceManager classes"
* commit '4036f5ab2ffbe5a2e47d46aa376e9791385cc31b':
  Create Service and ServiceManager classes
2015-08-07 21:17:02 +00:00
Tom Cherry
2647d2e70e am 4036f5ab: am 4bf3dc93: Merge "Create Service and ServiceManager classes"
* commit '4036f5ab2ffbe5a2e47d46aa376e9791385cc31b':
  Create Service and ServiceManager classes
2015-08-07 21:13:04 +00:00
Tom Cherry
4bf3dc9345 Merge "Create Service and ServiceManager classes" 2015-08-07 19:29:58 +00:00
Tom Cherry
bac3299720 Create Service and ServiceManager classes
Change-Id: I363a5e4751ad83d2f4096882a6fbbeddca03acfe
2015-08-07 10:16:39 -07:00
Yasuhiro Matsuda
39ac947939 am b84e1f54: am 50de8224: Merge "Enable perfboot.py to install APKs before measurement."
* commit 'b84e1f540379c6af9ccfc22e779b67f67b8c210a':
  Enable perfboot.py to install APKs before measurement.
2015-08-06 12:40:27 +00:00
Yasuhiro Matsuda
fb35b7c463 am 9e2ed7b0: am 7f2e05e9: Merge "Fix incorrect exception handling in perfboot.py"
* commit '9e2ed7b080bbe0f01fb82d77b30f6d1df372490a':
  Fix incorrect exception handling in perfboot.py
2015-08-06 12:40:26 +00:00
Yasuhiro Matsuda
a25e258d65 am b84e1f54: am 50de8224: Merge "Enable perfboot.py to install APKs before measurement."
* commit 'b84e1f540379c6af9ccfc22e779b67f67b8c210a':
  Enable perfboot.py to install APKs before measurement.
2015-08-06 12:40:24 +00:00
Yasuhiro Matsuda
93e060e115 am 9e2ed7b0: am 7f2e05e9: Merge "Fix incorrect exception handling in perfboot.py"
* commit '9e2ed7b080bbe0f01fb82d77b30f6d1df372490a':
  Fix incorrect exception handling in perfboot.py
2015-08-06 12:40:22 +00:00
Yasuhiro Matsuda
50de8224a6 Merge "Enable perfboot.py to install APKs before measurement." 2015-08-06 03:55:04 +00:00
Yasuhiro Matsuda
c0822e83ad Enable perfboot.py to install APKs before measurement.
This CL adds --apk-dir option, which specifies the directory
that contains APK files to be installed before measuring
boot time.

BUG: 22207911
Change-Id: Ifeacf34c779248686443a9ef02485272c140a456
2015-08-06 11:02:17 +09:00
Yasuhiro Matsuda
f3d0d42f1a Fix incorrect exception handling in perfboot.py
RuntimeError used to be missed unintentionally.

BUG: 22207911
Change-Id: I69772350c22fac93d49745c3bc934dda7188bb77
2015-08-05 20:26:03 +09:00
Yasuhiro Matsuda
fdb80810a2 am ee640552: am 1ada513f: Merge "Fix perfboot.py to exit by Ctrl+C."
* commit 'ee6405527f11010e09a72c4eaf2c47bac170c49c':
  Fix perfboot.py to exit by Ctrl+C.
2015-08-05 02:41:02 +00:00
Yasuhiro Matsuda
75c09ba367 am ee640552: am 1ada513f: Merge "Fix perfboot.py to exit by Ctrl+C."
* commit 'ee6405527f11010e09a72c4eaf2c47bac170c49c':
  Fix perfboot.py to exit by Ctrl+C.
2015-08-05 02:39:00 +00:00
Yasuhiro Matsuda
1ada513f50 Merge "Fix perfboot.py to exit by Ctrl+C." 2015-08-05 02:26:27 +00:00
Yusuke Sato
056b97d509 am b57438c8: am e4154f46: Merge "perfboot.py: check 2 more event logs by default"
* commit 'b57438c848e377873aefd89f68afb7650a6043e9':
  perfboot.py: check 2 more event logs by default
2015-08-04 21:06:58 +00:00
Yusuke Sato
ba48c3f64a am b57438c8: am e4154f46: Merge "perfboot.py: check 2 more event logs by default"
* commit 'b57438c848e377873aefd89f68afb7650a6043e9':
  perfboot.py: check 2 more event logs by default
2015-08-04 21:05:59 +00:00
Yusuke Sato
43c4d998cf perfboot.py: check 2 more event logs by default
'sf_stop_bootanim' is useful for tracking the time wasted by
showing the 'outro' part of the boot animation.

'wm_boot_animation_done' is also useful for tracking user
perceived boot time.

(cherry-pick of cbcf2778c3)

Bug: 22207911
Change-Id: I3549338a2161fa29675993c239f57809270797f8
2015-08-04 12:06:36 -07:00
Yasuhiro Matsuda
59d32a7515 Fix perfboot.py to exit by Ctrl+C.
BUG: 22207911
Change-Id: I0cc41f834207efd2965483c8636bbc709e54358f
2015-08-04 17:48:41 +09:00
Yusuke Sato
9358ae91c9 am 69386e33: am 81fd50c3: Merge "perfboot.py: ignore tags not listed in /system/etc/event-log-tags"
* commit '69386e33b67eaee721b4e8d7bddbd4263302ff77':
  perfboot.py: ignore tags not listed in /system/etc/event-log-tags
2015-08-04 00:28:56 +00:00
Yusuke Sato
0ef97729c2 am 69386e33: am 81fd50c3: Merge "perfboot.py: ignore tags not listed in /system/etc/event-log-tags"
* commit '69386e33b67eaee721b4e8d7bddbd4263302ff77':
  perfboot.py: ignore tags not listed in /system/etc/event-log-tags
2015-08-04 00:28:44 +00:00
Yusuke Sato
e801cc0b4e perfboot.py: ignore tags not listed in /system/etc/event-log-tags
This is a follow-up CL for http://ag/739815/.

Bug: 22207911
Change-Id: Ie5f529abc4b18454cea8a75a1438a5ea65dd90ab
2015-08-03 15:56:53 -07:00
Yusuke Sato
f2a404b1f3 am 5e34b3ab: am 72488aa0: Merge "perfboot.py: warn if dm-verity is disabled"
* commit '5e34b3abdb3cbc167fa86dab7a746c94f2bd4c6f':
  perfboot.py: warn if dm-verity is disabled
2015-08-03 21:47:13 +00:00
Tom Cherry
087cd35b79 resolved conflicts for merge of 0070026c to mnc-dr-dev-plus-aosp
Change-Id: Ibc802572898b6913c1f5d94aaae19974bfc0eb85
2015-08-03 14:19:35 -07:00
Yusuke Sato
48f2879729 am 5e34b3ab: am 72488aa0: Merge "perfboot.py: warn if dm-verity is disabled"
* commit '5e34b3abdb3cbc167fa86dab7a746c94f2bd4c6f':
  perfboot.py: warn if dm-verity is disabled
2015-08-03 20:42:04 +00:00
Yusuke Sato
72488aa0fe Merge "perfboot.py: warn if dm-verity is disabled" 2015-08-03 20:26:47 +00:00
Yusuke Sato
b6c66dc0a3 perfboot.py: warn if dm-verity is disabled
Disabling the feature sometimes skews benchmark results.

Bug: 22207911
Change-Id: Idedc7eb14e3cc4e8687b0c0e2975f10a3c4154e5
2015-08-03 11:36:21 -07:00
Tom Cherry
b6545bf559 am 0070026c: am 4247ebfd: Merge "init: use std::vector<std::string> for argument passing"
* commit '0070026c1b87facf626042e8ba1e36877129af76':
  init: use std::vector<std::string> for argument passing
2015-08-03 18:11:16 +00:00
Yusuke Sato
adda8f7388 am 2f9e1db3: am b5d6ad81: Merge "Stop calling fsck on shutdown by default"
* commit '2f9e1db37416cdb580d870218b5fbfbed47a3758':
  Stop calling fsck on shutdown by default
2015-08-03 17:56:32 +00:00
Tom Cherry
4247ebfd2f Merge "init: use std::vector<std::string> for argument passing" 2015-08-03 17:51:39 +00:00
Lee Campbell
2fb050b893 am 150c05fe: am 0f918878: Merge "init: Adding header guard to tokenizer"
* commit '150c05feeb482de2b4026fc35e392fc8c0ecd2df':
  init: Adding header guard to tokenizer
2015-08-01 15:48:39 +00:00
Yusuke Sato
23ec3e468b am 2f9e1db3: am b5d6ad81: Merge "Stop calling fsck on shutdown by default"
* commit '2f9e1db37416cdb580d870218b5fbfbed47a3758':
  Stop calling fsck on shutdown by default
2015-07-31 23:30:07 +00:00
Yusuke Sato
b5d6ad81cb Merge "Stop calling fsck on shutdown by default" 2015-07-31 23:13:15 +00:00
Tom Cherry
96f67316a2 init: use std::vector<std::string> for argument passing
Change-Id: Ie7a64e65de3a20d0c7f7d8efc0f7c1ba121d07fe
2015-07-31 16:02:12 -07:00
Lee Campbell
7ff4bb7e47 am 150c05fe: am 0f918878: Merge "init: Adding header guard to tokenizer"
* commit '150c05feeb482de2b4026fc35e392fc8c0ecd2df':
  init: Adding header guard to tokenizer
2015-07-31 22:32:02 +00:00
Lee Campbell
06584400dd init: Adding header guard to tokenizer
Fixing missing header guard

BUG: 22843198
Change-Id: Ice5d29d343ffe093aae46d4ac3fd72de628fb12e
2015-07-30 18:48:50 -07:00
Tom Cherry
7da270df1d am a21d8562: am d548e30f: Merge "init: Create classes for Action and Command"
* commit 'a21d85620560896bbed0cd43db9ed3224ab4e974':
  init: Create classes for Action and Command
2015-07-30 21:31:38 +00:00
Tom Cherry
97d393bb2d am a21d8562: am d548e30f: Merge "init: Create classes for Action and Command"
* commit 'a21d85620560896bbed0cd43db9ed3224ab4e974':
  init: Create classes for Action and Command
2015-07-30 21:23:00 +00:00
Tom Cherry
d548e30f04 Merge "init: Create classes for Action and Command" 2015-07-30 21:03:48 +00:00
Lee Campbell
45bd7bcf37 am 1691d968: am 138c540f: Merge "init: Add C++ tokenizer."
* commit '1691d968f8ae5f25036251fd5978be637bbf0b4a':
  init: Add C++ tokenizer.
2015-07-30 20:45:25 +00:00
Lee Campbell
7158521377 am 1691d968: am 138c540f: Merge "init: Add C++ tokenizer."
* commit '1691d968f8ae5f25036251fd5978be637bbf0b4a':
  init: Add C++ tokenizer.
2015-07-30 20:43:55 +00:00
Tom Cherry
fa0c21c94c init: Create classes for Action and Command
This creates the concept of 'event_trigger' vs 'property_trigger'

Previously these were merged into one, such that 'on property:a=b &&
property:b=c' is triggered when properties a=b and b=c as expected,
however combinations such as 'on early-boot && boot' would trigger
during both early-boot and boot.  Similarly, 'on early-boot &&
property:a=b' would trigger on both early-boot and again when property
a equals b.

The event trigger distinction ensures that the first example fails to
parse and the second example only triggers on early-boot if
property a equals b.

This coalesces Actions with the same triggers into a single Action object

Change-Id: I8f661d96e8a2d40236f252301bfe10979d663ea6
2015-07-30 13:37:23 -07:00
Lee Campbell
138c540f53 Merge "init: Add C++ tokenizer." 2015-07-30 20:30:07 +00:00
Lee Campbell
220ca84223 init: Add C++ tokenizer.
Adds a C++ tokenizer along with unit tests.

This tokenizer will replace the current C implementation
which does a poor job of keeping track of pointers.

This CL is a prerequisite for up coming changes to
the parser. This CL does not wire up this tokenizer and
changes no exsiting code. All that builds is the unit tests.

Change-Id: Iec3740bce7153640adc5e5bbdc57e644cedf0038
TEST: Unit tests all pass. No leaks under valgrind
BUG: 22843198
2015-07-30 18:45:17 +00:00
Yasuhiro Matsuda
70ab38a570 am 102ead3a: am b10e562b: Merge "Introduce a mechanism to trace boot sequence."
* commit '102ead3ae187a007b8a90b61ea243197927b6ae2':
  Introduce a mechanism to trace boot sequence.
2015-07-30 08:05:46 +00:00
Yasuhiro Matsuda
6b802c4b95 am 102ead3a: am b10e562b: Merge "Introduce a mechanism to trace boot sequence."
* commit '102ead3ae187a007b8a90b61ea243197927b6ae2':
  Introduce a mechanism to trace boot sequence.
2015-07-30 08:05:13 +00:00
Yasuhiro Matsuda
b10e562b4c Merge "Introduce a mechanism to trace boot sequence." 2015-07-30 07:42:09 +00:00
Yasuhiro Matsuda
ea504bc084 am 1a1f9beb: am dcf89091: Merge "Add a script to record Android boot time."
* commit '1a1f9beb1dbd0da0f305ff44816661cc404ba877':
  Add a script to record Android boot time.
2015-07-30 05:48:08 +00:00
Yasuhiro Matsuda
eeea3fc1be am 1a1f9beb: am dcf89091: Merge "Add a script to record Android boot time."
* commit '1a1f9beb1dbd0da0f305ff44816661cc404ba877':
  Add a script to record Android boot time.
2015-07-30 05:47:39 +00:00
Yasuhiro Matsuda
ab3798399d Add a script to record Android boot time.
perfboot.py repeats the record of each event log during Android
boot specified times. By default, interval between measurements
is adjusted in such a way that CPUs are cooled down sufficiently
to avoid boot time slowdown caused by CPU thermal throttling.
This script also works around the issue of dropbox slowing down
boot time on userdebug build (http://b/20890386) by limiting
the number of files to be created by dropbox.
The result is output in a tab-separated value format.

BUG: 22207911
Change-Id: I0ddbac5d1c941efda87bc6db6388d8194d4bb3dd
2015-07-30 14:16:15 +09:00
Yasuhiro Matsuda
f93db4b827 Introduce a mechanism to trace boot sequence.
This CL adds a trigger and a service so that Systrace can be used
for tracing events during boot.
persist.debug.atrace.boottrace property is used for switching on
and off tracing during boot. /data/misc/boottrace/categories
file is used for specifying the categories to be traced.
These property and file are rewritten by Systrace when the newly
added option --boot is specified.

Here is an example of tracing events of am and wm catetories
during boot.

$ external/chromium-trace/systrace am wm --boot

This command will cause the device to reboot. Once the device has
booted up, the trace report is created by hitting Ctrl+C.

As written in readme.txt, this mechanism relies on persistent
property, so tracing events that are emitted before that are not
recorded. This is enough for tracing events after zygote is
launched though.
This only works on userdebug or eng build for security reason.

BUG: 21739901
Change-Id: I03f2963d77a678f47eab5e3e29fc7e91bc9ca3a4
2015-07-29 12:53:05 +09:00
Lee Campbell
42f669a144 am f75b5ff1: am fe39394e: Merge "init: Adding support to import directories"
* commit 'f75b5ff17529e3eb163b9c7c49fc49842d443126':
  init: Adding support to import directories
2015-07-28 00:17:15 +00:00
Lee Campbell
3d3401ac85 am f75b5ff1: am fe39394e: Merge "init: Adding support to import directories"
* commit 'f75b5ff17529e3eb163b9c7c49fc49842d443126':
  init: Adding support to import directories
2015-07-27 23:26:25 +00:00
Lee Campbell
f13b1b3139 init: Adding support to import directories
Support added so init scripts can now import directories.

BUG: 22721249
Change-Id: I02b566bfb50ea84469f1ea0c6ad205435a1df286
TEST: Tested importing a folder on arm64 emulator
2015-07-27 14:56:03 -07:00
Yabin Cui
9b09bf4aed am 10821da3: am 8a502000: Merge "init: expand_props for onrestart commands."
* commit '10821da3221ce4fe021c80956a5cac733c97ebb9':
  init: expand_props for onrestart commands.
2015-07-25 02:15:19 +00:00
Yabin Cui
a6d23bd6d2 am 10821da3: am 8a502000: Merge "init: expand_props for onrestart commands."
* commit '10821da3221ce4fe021c80956a5cac733c97ebb9':
  init: expand_props for onrestart commands.
2015-07-25 02:14:18 +00:00
Yabin Cui
57eb040ba9 am bd5f10ad: am 699be5f6: Merge "init: do expand_props before calling the builtins."
* commit 'bd5f10addfba8df40c8293d95c002044acbfa526':
  init: do expand_props before calling the builtins.
2015-07-25 01:21:31 +00:00
Yabin Cui
310851549b am bd5f10ad: am 699be5f6: Merge "init: do expand_props before calling the builtins."
* commit 'bd5f10addfba8df40c8293d95c002044acbfa526':
  init: do expand_props before calling the builtins.
2015-07-25 01:19:29 +00:00
Yabin Cui
ee53006564 init: expand_props for onrestart commands.
It is only a temporary fix. I hope the code can be moved into a member
function of class Command.

Bug: 22654233
Change-Id: I38c24fb624e54986a953f44d398b3b80c3795d24
2015-07-24 18:17:16 -07:00
Yabin Cui
00ede7d262 init: do expand_props before calling the builtins.
Also switch expand_props to std::string.

Bug: 22654233

Change-Id: I62910d4f74e2b1a5bd2b14aea440767a2a8462b7
2015-07-24 15:02:19 -07:00
Yabin Cui
62b3f91d14 am bff40697: am addf7a96: Merge "init: Let property_get return std::string."
* commit 'bff406978aad1a599d01f539d0a9b5718aaceca3':
  init: Let property_get return std::string.
2015-07-24 21:02:52 +00:00
Yabin Cui
0ff8590e78 resolved conflicts for merge of bff40697 to mnc-dr-dev-plus-aosp
Change-Id: I7d7a614a5eb987ef6aecd32ed15a6eaa43e93957
2015-07-24 13:58:03 -07:00
Yabin Cui
74edcea90e init: Let property_get return std::string.
Bug: 22654233

Change-Id: Id6091f58432f75e966b9871256049fbe17766c10
2015-07-24 11:14:08 -07:00
Elliott Hughes
dd7fb9af1f am 7f12fa27: am f5b46079: Merge "init: use init\'s property expansion code for mount_all"
* commit '7f12fa275604504ed874c08d6b7f906e8e522c73':
  init: use init's property expansion code for mount_all
2015-07-23 02:07:10 +00:00
Mark Salyzyn
3542f3dafa am 7b0bb824: am 93adb524: Merge "init: Fix logging stutter"
* commit '7b0bb82447af0c025ba769d2003f3b1514b9ec25':
  init: Fix logging stutter
2015-07-23 02:06:42 +00:00
Mark Salyzyn
f6aaed8020 am 18fc744f: am 6743dab5: Merge "init: Add additional logging levels"
* commit '18fc744f2ed22d772ca6f1ed69f69eecd9bf86a7':
  init: Add additional logging levels
2015-07-23 02:06:41 +00:00
Elliott Hughes
2694ad9ad9 am 7f12fa27: am f5b46079: Merge "init: use init\'s property expansion code for mount_all"
* commit '7f12fa275604504ed874c08d6b7f906e8e522c73':
  init: use init's property expansion code for mount_all
2015-07-22 18:05:02 +00:00
Nan Liu
12df1e118a init: use init's property expansion code for mount_all
Change-Id: I3bd00c74cd126b66927eca7812943f8427009356
Signed-off-by: Nan Liu <nan.liu619@gmail.com>
2015-07-22 10:36:49 -07:00
Yusuke Sato
f93d42933b Stop calling fsck on shutdown by default
Instead, run the command only when sys.powerctl is set to
"shutdown,userrequested". This way, we can avoid running
fsck when shutdown is triggered due to a low power state.

This is a follow-up CL for http://r.android.com/158525.

Bug: 21853106
Change-Id: Ie57c23cd25162cc2a8726f876a9ba212080105fb
2015-07-21 17:45:01 -07:00
Mark Salyzyn
02cb8dc57b am 7b0bb824: am 93adb524: Merge "init: Fix logging stutter"
* commit '7b0bb82447af0c025ba769d2003f3b1514b9ec25':
  init: Fix logging stutter
2015-07-22 00:25:52 +00:00
Mark Salyzyn
021485e566 am 18fc744f: am 6743dab5: Merge "init: Add additional logging levels"
* commit '18fc744f2ed22d772ca6f1ed69f69eecd9bf86a7':
  init: Add additional logging levels
2015-07-22 00:25:51 +00:00
Mark Salyzyn
636b1ebd38 init: Fix logging stutter
- Get rid of log stutter, tag (executable basename) is added by
  the logging routines

Bug: 17914575
Change-Id: If00eb1b915065fb52c9311648b7ada4c9e2696bd
2015-07-21 16:32:20 -07:00
Mark Salyzyn
692abc2b5f init: Add additional logging levels
- Add WARNING, DEBUG and VERBOSE levels

Bug: 17914575
Change-Id: Ia5ba03c164ea38fad4ab30356491741afc987116
2015-07-21 16:32:10 -07:00
Yusuke Sato
7954eb0a46 am ab64465d: am 0e3ce82b: Merge "Use fsck.f2fs -a instead of -f for faster boot"
* commit 'ab64465d1f16f414c0bde5e3c4707c32b8220bbc':
  Use fsck.f2fs -a instead of -f for faster boot
2015-07-21 18:28:40 +00:00
Yusuke Sato
7c842b57fe am ab64465d: am 0e3ce82b: Merge "Use fsck.f2fs -a instead of -f for faster boot"
* commit 'ab64465d1f16f414c0bde5e3c4707c32b8220bbc':
  Use fsck.f2fs -a instead of -f for faster boot
2015-07-21 18:25:57 +00:00
Yusuke Sato
0e3ce82b94 Merge "Use fsck.f2fs -a instead of -f for faster boot" 2015-07-21 16:06:40 +00:00
Elliott Hughes
1d8f0cd667 am 770b78bd: am 683790ae: Merge "init: Fix bootchart trigger for emulator"
* commit '770b78bd2384493f5b9b5c7a04b2fc10bdeed003':
  init: Fix bootchart trigger for emulator
2015-07-16 21:39:48 +00:00
Elliott Hughes
7e71d42701 am 770b78bd: am 683790ae: Merge "init: Fix bootchart trigger for emulator"
* commit '770b78bd2384493f5b9b5c7a04b2fc10bdeed003':
  init: Fix bootchart trigger for emulator
2015-07-16 21:39:47 +00:00
Elliott Hughes
683790ae54 Merge "init: Fix bootchart trigger for emulator" 2015-07-16 21:11:23 +00:00
Nick Kralevich
a498153c9b am d9bb7852: am c66e37b2: Merge "init: refuse to start process if domain transition not defined"
* commit 'd9bb7852441c3d9509c0a5e99821c69c55e62b58':
  init: refuse to start process if domain transition not defined
2015-07-16 19:49:57 +00:00
Nick Kralevich
64be168368 am d9bb7852: am c66e37b2: Merge "init: refuse to start process if domain transition not defined"
* commit 'd9bb7852441c3d9509c0a5e99821c69c55e62b58':
  init: refuse to start process if domain transition not defined
2015-07-16 19:49:31 +00:00
Nick Kralevich
4800dbf1da init: refuse to start process if domain transition not defined
When SELinux is in enforcing mode, any process executed by
init must have a domain transition defined. See
https://android-review.googlesource.com/108640 for details. This
prevents an executable spawned by init from remaining in init's
(very powerful) SELinux domain.

However, this is only enforced when SELinux is in enforcing mode.
During new device bringup, it's common to run an Android device
in globally permissive mode. In globally permissive mode, SELinux
denials are logged only, but otherwise ignored. If appropriate
SELinux domain transitions are not defined from init to init spawned
processes, this could cause misleading SELinux denials attributed
to init instead of the child process.

To help address these misleading denials, modify init to not spawn
processes unless a domain transition is defined. This essentially
enforces the rules in https://android-review.googlesource.com/108640
on both permissive and enforcing kernels.

While I'm here, change some "freecon()" calls to "free()", with the
long term goal of deleting freecon() entirely.

Change-Id: I3ef3a372bb85df61a3f6234cb1113cc25fc6506a
2015-07-16 11:32:19 -07:00
Yusuke Sato
0df08271fb Use fsck.f2fs -a instead of -f for faster boot
and run fsck with -f on clean shutdown instead.

With -f, fsck.f2fs always performs a full scan of the /data
partition regardless of whether the partition is clean or not.
The full scan takes more than 2 seconds on volantis-userdebug
and delays the OS boot.

With -a, the command does almost nothing when the partition
is clean and finishes within 20-30ms on volantis-userdebug.
When the partition has an error or its check point has
CP_FSCK_FLAG (aka "need_fsck"), the command does exactly the
same full scan as -f to fix it.

Bug: 21853106
Change-Id: I126263caf34c0f5bb8f5e6794454d4e72526ce38
2015-07-15 10:13:51 -07:00
Yu Ning
9136f38aab init: Fix bootchart trigger for emulator
When launched with "-bootchart <timeout>", the Android emulator appends
"androidboot.bootchart=<timeout>" to the kernel command line, which
signals /init to start bootcharting. However, the current implementation
of bootchart_init() in init/bootchart.cpp does not parse the timeout
value correctly, preventing bootcharting to be enabled on the emulator.

This bug was introduced by commit 841b263 ("Further refactoring of the
bootchart code"). Fix it to honor the "androidboot.bootchart" trigger.

Change-Id: I221fe2c2f40a3a04bd478c3a083f7723bc309c8c
Signed-off-by: Yu Ning <yu.ning@intel.com>
2015-07-15 16:41:51 +08:00
Paul Crowley
b7f1f61fbc am ee923139: Merge "Set up user directory crypto in init." into mnc-dr-dev
* commit 'ee923139c346e6751203fc7d2a341388e01c7b19':
  Set up user directory crypto in init.
  logd: switch to unordered_map from BasicHashtable
  rootdir: make sure the /oem mountpoint is always available
2015-07-14 00:27:56 +00:00
Paul Crowley
ee923139c3 Merge "Set up user directory crypto in init." into mnc-dr-dev 2015-07-13 20:52:45 +00:00
Paul Lawrence
c1fa34b9f6 am d5ef9841: Merge "Change init sequence to support file level encryption" into mnc-dr-dev
* commit 'd5ef984195779aa9e27d7baabdd751d641eea1a0':
  Change init sequence to support file level encryption
2015-07-13 17:53:08 +00:00
Paul Lawrence
948410a493 Change init sequence to support file level encryption
File level encryption must get the key between mounting userdata and
calling post_fs_data when the directories are created. This requires
access to keymaster, which in turn is found from a system property.

Split property loaded into system and data, and load in right order.

Bug: 22233063
2015-07-07 13:23:19 -07:00
Paul Lawrence
e8308f852c am 81046166: Merge "Revert "Change init sequence to support file level encryption"" into mnc-dev
* commit '8104616696ac5e806b16a393ea02c4f5d8efc328':
  Revert "Change init sequence to support file level encryption"
2015-07-07 18:20:27 +00:00
Paul Lawrence
c011b031c9 am 81046166: Merge "Revert "Change init sequence to support file level encryption"" into mnc-dev
* commit '8104616696ac5e806b16a393ea02c4f5d8efc328':
  Revert "Change init sequence to support file level encryption"
2015-07-07 17:39:03 +00:00
Paul Lawrence
437bc5dcec Revert "Change init sequence to support file level encryption"
This reverts commit d815178b75.

Change-Id: I7e3f55d3092fcd04ea9f62f1971c9d42570f096c
2015-07-07 17:05:58 +00:00
Paul Lawrence
22d0ee6a25 am a65e402b: Merge "Change init sequence to support file level encryption" into mnc-dev
* commit 'a65e402b613e927697d35e7936c6d80908d77e88':
  Change init sequence to support file level encryption
2015-07-06 20:34:05 +00:00
Paul Lawrence
d3669ff27f am a65e402b: Merge "Change init sequence to support file level encryption" into mnc-dev
* commit 'a65e402b613e927697d35e7936c6d80908d77e88':
  Change init sequence to support file level encryption
2015-07-06 19:52:40 +00:00
Paul Lawrence
d815178b75 Change init sequence to support file level encryption
File level encryption must get the key between mounting userdata and
calling post_fs_data when the directories are created. This requires
access to keymaster, which in turn is found from a system property.

Split property loaded into system and data, and load in right order.

Bug: 22233063
Change-Id: I8a6c40d44e17de386417a443c9dfc3b4e7fe59a5
2015-07-06 07:52:06 -07:00
Paul Crowley
749af8c08f Set up user directory crypto in init.
(cherry-picked from commit b94032b79c)

Bug: 19704432
Change-Id: Ife4928ffbee39c8ae69e6ba66d9ce5ef5a0beb76
2015-06-23 15:21:51 +00:00
Nick Kralevich
7cba866569 am 8d855ba9: am d2e7f002: Merge "init/util.cpp: don\'t return a negative unsigned value"
* commit '8d855ba983d7e794fd75a20557ee92f4f8db2465':
  init/util.cpp: don't return a negative unsigned value
2015-06-19 03:46:48 +00:00
Nick Kralevich
d2104df69b init/util.cpp: don't return a negative unsigned value
android_name_to_id() returns -1U on error, which causes a
crash when the following clang options are enabled:

  -fsanitize=signed-integer-overflow,unsigned-integer-overflow
  -ftrap-function=abort
  -fsanitize-undefined-trap-on-error

Rather than returning a negative unsigned value (which doesn't
make a lot of sense, IMHO), return a positive unsigned value.

While we're here, add logging on decode_uid failures.

Bug: 21880301
Change-Id: I652e4c1daa07c7494cceca2b4e1656b9158f2604
2015-06-18 20:11:06 -07:00
Elliott Hughes
be6a2a69b8 am f5a7ba9e: am 53d504f0: Merge "init support for cgroups."
* commit 'f5a7ba9eedb0cdca0198f44811f9aff092a54c7d':
  init support for cgroups.
2015-06-17 22:42:50 +00:00
Elliott Hughes
e79d0d556f init support for cgroups.
This adds the "writepid" option that instructs init to write the child's
pid to the given filenames (such as /dev/cpuctl/bg_non_interactive/cgroup.procs
and/or /dev/cpuset/foreground/cgroup.procs).

Bug: http://b/21163745
Change-Id: I121bb22aa208bc99c4fb334eb552fdd5bcc47c1a
(cherry picked from commit d62f0608d9)
2015-06-17 15:21:52 -07:00
Elliott Hughes
d62f0608d9 init support for cgroups.
This adds the "writepid" option that instructs init to write the child's
pid to the given filenames (such as /dev/cpuctl/bg_non_interactive/cgroup.procs
and/or /dev/cpuset/foreground/cgroup.procs).

Bug: http://b/21163745
Change-Id: I121bb22aa208bc99c4fb334eb552fdd5bcc47c1a
2015-06-17 14:42:40 -07:00
Nick Kralevich
2f2e6cd078 am 4c6269ce: am 106f92f5: Merge "Revert "init: Enable LOCAL_DETECT_INTEGER_OVERFLOWS""
* commit '4c6269ce280f33c7d080dbdbbfd3a8d9681d85ed':
  Revert "init: Enable LOCAL_DETECT_INTEGER_OVERFLOWS"
2015-06-17 00:09:45 +00:00
Nick Kralevich
21d605eff5 Revert "init: Enable LOCAL_DETECT_INTEGER_OVERFLOWS"
Shamu boots, but hammerhead doesn't. Likely cause is this change.

This reverts commit 18ae44bf3d.

Bug: 21880301
Change-Id: I490816060209c15aa07c783d05fe5b141c7c9023
2015-06-16 23:35:37 +00:00
Nick Kralevich
1bc2b09fd3 am 135b6b08: am 6b27b7d6: Merge "init: Enable LOCAL_DETECT_INTEGER_OVERFLOWS"
* commit '135b6b08cd9fec32c266f3981d4af101f6e270f9':
  init: Enable LOCAL_DETECT_INTEGER_OVERFLOWS
2015-06-16 20:58:27 +00:00
Nick Kralevich
18ae44bf3d init: Enable LOCAL_DETECT_INTEGER_OVERFLOWS
Call abort() if an integer overflow or underflow occurs.
See https://android-review.googlesource.com/154831

Change-Id: Icb6bdef55a5899144351b56d683f34f5da32a88d
2015-06-15 20:37:09 -07:00
Ben Cheng
c35fcddabe am 87678797: am 83be2fd7: Merge "Compare two bootcharts and list timestamps for selected processes."
* commit '87678797aabf182278bffb56e6af721371b126d4':
  Compare two bootcharts and list timestamps for selected processes.
2015-06-15 14:47:28 +00:00
Ben Cheng
83be2fd7b6 Merge "Compare two bootcharts and list timestamps for selected processes." 2015-06-15 14:27:01 +00:00
Ben Cheng
50bbde0e60 Compare two bootcharts and list timestamps for selected processes.
Usage: system/core/init/compare-bootcharts.py base_bootchart_dir
       exp_bootchart_dir

For example, here is the output where the bootanimation is changed
from "d 0 0 part2" to "c 0 0 part2":

--

process: baseline experiment (delta)
 - Unit is ms (a jiffy is 10 ms on the system)
------------------------------------
/init: 50 40 (-10)
/system/bin/surfaceflinger: 4320 4470 (+150)
/system/bin/bootanimation: 6980 6990 (+10)
zygote64: 10410 10640 (+230)
zygote: 10410 10640 (+230)
system_server: 15350 15150 (-200)
bootanimation ends at: 33790 31230 (-2560)

--

In this example bootanimation is finished (estimated) 2.56 seconds sooner.

Change-Id: I39d59897c8c53d7d662676813e884b9d58feec3c
2015-06-15 15:57:02 +08:00
Nick Kralevich
746d5cd66a am a27dca0f: am 60c5a460: Merge "Remove calls to is_selinux_enabled()"
* commit 'a27dca0f7a5d6c1f79aaf213a6b26428e4ad855e':
  Remove calls to is_selinux_enabled()
2015-06-13 10:30:52 +00:00
Nick Kralevich
4d87095ebf Remove calls to is_selinux_enabled()
d34e407aeb removed support for
running with SELinux completely disabled. SELinux must either be
in permissive or enforcing mode now.

Remove unnecessary calls to is_selinux_enabled(). It always returns
true now.

Change-Id: Ife3156b74b13b2e590afe4accf716fc7776567e5
2015-06-12 22:12:33 -07:00
Elliott Hughes
9371cf0e31 am 67917cf5: am 57bd480c: Merge "Make it clearer to grep that init is built with clang."
* commit '67917cf590ae497ce7700dc7a6b618b3a6700a39':
  Make it clearer to grep that init is built with clang.
2015-06-11 15:25:20 +00:00
Elliott Hughes
1115c25d5e Make it clearer to grep that init is built with clang.
Change-Id: Ic2abffd27e382cb691d772cdf088442645e59bf7
2015-06-10 22:43:51 -07:00
Jeff Sharkey
0498ea08e6 am 4d7f052a: Merge "New "selinux.restorecon" control property." into mnc-dev
* commit '4d7f052afbaf79c7324a2e9dd51168990b062647':
  New "selinux.restorecon" control property.
2015-06-09 23:53:33 +00:00
Jeff Sharkey
76417519ec New "selinux.restorecon" control property.
This new property is used as a control verb for running a recursive
restorecon at the path contained in the property value.

Shifts both SELinux actions to occur before the actual property set
occurs, so setters can watch for completion.

Bug: 21121357
Change-Id: I3db3eb876ae66e144b3bfd648349b66a028511fd
2015-06-09 13:39:17 -07:00
Mark Salyzyn
560515540d am e0e56563: am 0bda352f: Merge changes from topic \'logcatd\'
* commit 'e0e565635a7c6c36a05282622c01203afbec5ca5':
  init.rc: logd: Add logpersistd (nee logcatd)
  init: change exec parsing to make SECLABEL optional
  logcat: -f run in background
  logcat: -f flag to continue
2015-06-02 22:41:29 +00:00
Mark Salyzyn
cdb73b034d init: change exec parsing to make SECLABEL optional
(cherry pick from commit 17fff893c0)

Allow SECLABEL to be - to denote default

Change-Id: I58cdc6c805dc6e50dc42b7e13e72d0eaf4864f11
2015-06-02 15:26:02 -07:00
Mark Salyzyn
17fff893c0 init: change exec parsing to make SECLABEL optional
Allow SECLABEL to be - to denote default

Change-Id: I58cdc6c805dc6e50dc42b7e13e72d0eaf4864f11
2015-06-02 15:17:52 -07:00
Paul Lawrence
0a423d994a DO NOT MERGE Securely encrypt the master key
(chery-picked from commit 806d10be23)

Move all key management into vold
Reuse vold's existing key management through the crypto footer
to manage the device wide keys.

Use ro.crypto.type flag to determine crypto type, which prevents
any issues when running in block encrypted mode, as well as speeding
up boot in block or no encryption.

This is one of four changes to enable this functionality:
  https://android-review.googlesource.com/#/c/148586/
  https://android-review.googlesource.com/#/c/148604/
  https://android-review.googlesource.com/#/c/148606/
  https://android-review.googlesource.com/#/c/148607/

Bug: 18151196

Change-Id: I6a8a18f43ae837e330e2785bd26c2c306ae1816b
2015-05-29 17:39:16 +00:00
Mark Salyzyn
708db86525 am c5a55890: am 4cc6e2e3: Merge "init: expand_props on trigger"
* commit 'c5a558907a49dae3db6c40c2032a92841c93b2d6':
  init: expand_props on trigger
2015-05-28 17:19:36 +00:00
Mark Salyzyn
dd0e3162a5 init: expand_props on trigger
Bug: 19608716
Change-Id: Ifce8bfde04f8e6f707245e0b53400072d94447b2
2015-05-27 14:06:28 -07:00
Elliott Hughes
af02e2403a am 9fc83437: Don\'t use TEMP_FAILURE_RETRY on close in system/core.
* commit '9fc834377297cb2dcc418e4ce7e38e89dd09812b':
  Don't use TEMP_FAILURE_RETRY on close in system/core.
2015-05-27 20:51:25 +00:00
Elliott Hughes
9fc8343772 Don't use TEMP_FAILURE_RETRY on close in system/core.
Bug: http://b/20501816
Change-Id: I1839b48ee4f891b8431ecb809e37a4566a5b3e50
(cherry picked from commit 47b0134ec2)
2015-05-27 13:27:06 -07:00
Thierry Strudel
604e75449d am 91cf41cf: init: wait_for_file use smaller time resolution
* commit '91cf41cf43847930a8e55b3789d4943a8e22f73a':
  init: wait_for_file use smaller time resolution
2015-05-22 23:48:00 +00:00
Thierry Strudel
91cf41cf43 init: wait_for_file use smaller time resolution
As 1s timeout can be requested, using second resolution time to check
for timeout prevent from being accurate on the actual time we wait.
Use available gettime_ns instead.

Bug: 21374269
Change-Id: I8be1b69e02beacc7196427f97855e036addf54d1
Signed-off-by: Thierry Strudel <tstrudel@google.com>
2015-05-22 16:03:12 -07:00
Elliott Hughes
47b0134ec2 Don't use TEMP_FAILURE_RETRY on close in system/core.
Bug: http://b/20501816
Change-Id: I1839b48ee4f891b8431ecb809e37a4566a5b3e50
2015-05-15 19:16:40 -07:00
Elliott Hughes
651fae3cbc Reduce the coldboot timeout to 1s.
5s was already a ridiculously long time to delay booting, and some OEMs are
trying to make it even more insane:

  https://www.codeaurora.org/cgit/quic/la/platform/system/core/commit/?h=lp&id=fd23edd48272976d2fb333f377242173f92aa343

Let's at least ensure that Nexus and Android One devices don't take forever
to boot...

Bug: http://b/19899875
Change-Id: I9680c166a759360f34118e51cd0645e12b6bd5c8
(cherry picked from commit c7331d02d1)
2015-05-15 12:18:41 -07:00
Elliott Hughes
86920d80b6 am bca8dc6a: am 000c009b: Merge "Reduce the coldboot timeout to 1s."
* commit 'bca8dc6a44b3505e8d72b9247f813f8070211393':
  Reduce the coldboot timeout to 1s.
2015-05-14 20:34:32 +00:00
Elliott Hughes
c7331d02d1 Reduce the coldboot timeout to 1s.
5s was already a ridiculously long time to delay booting, and some OEMs are
trying to make it even more insane:

  https://www.codeaurora.org/cgit/quic/la/platform/system/core/commit/?h=lp&id=fd23edd48272976d2fb333f377242173f92aa343

Let's at least ensure that Nexus and Android One devices don't take forever
to boot...

Bug: http://b/19899875
Change-Id: I9680c166a759360f34118e51cd0645e12b6bd5c8
2015-05-14 12:03:14 -07:00
Elliott Hughes
2550355ceb resolved conflicts for merge of d410a9b3 to mnc-dev-plus-aosp
Change-Id: I2e8e6c9a2024e0a753d3912111ccd1c2bfbfef10
2015-05-12 20:16:40 -07:00
Tom Cherry
cce7e93b28 Fix insmod module size
read_file() used to append a new line character to the end of the buffer it
returns, because parse_config() isn't able to cope with input that's not
'\n'-terminated. Fix read_file() to be less insane, and push the workarounds
into the parse_config() callers.

Longer term we should rewrite parse_config().

Bug: http://b/21079470
Change-Id: Ie9d9a7adcd33b66621726aef20c4b8cc51c08be7
(cherry picked from commit eaa3b4ec6f)
2015-05-12 19:42:38 -07:00
Emmanuel Berthier
30cc3d7249 Enable property expansion for insmod
Useful for dynamic kernel module location.
This permits to use init rule like:

  insmod ${persist.modules.location}/<module_name>

Change-Id: If7479bdcb4e69ea7666f52a0075c785be025c2e9
Signed-off-by: Emmanuel Berthier <emmanuel.berthier@intel.com>
(cherry picked from commit ac41230cbc)
2015-05-12 15:01:02 -07:00
Tom Cherry
eaa3b4ec6f Fix insmod module size
read_file() used to append a new line character to the end of the buffer it
returns, because parse_config() isn't able to cope with input that's not
'\n'-terminated. Fix read_file() to be less insane, and push the workarounds
into the parse_config() callers.

Longer term we should rewrite parse_config().

Change-Id: Ie9d9a7adcd33b66621726aef20c4b8cc51c08be7
2015-05-12 14:18:49 -07:00
Andres Morales
b7f8b91040 am 86aeb11e: Merge "load ro.recovery_id property from recovery partition" into mnc-dev
* commit '86aeb11ed047b3698948c4eee8fbaccd20131ecb':
  load ro.recovery_id property from recovery partition
2015-05-09 00:46:52 +00:00
Andres Morales
cb3fce80fa load ro.recovery_id property from recovery partition
Change-Id: I9dc1f325e353375d9c1c8ed949636e2404601076
(cherry picked from commit db5f5d4367)
2015-05-08 17:35:13 -07:00
Andres Morales
db5f5d4367 load ro.recovery_id property from recovery partition
Change-Id: I9dc1f325e353375d9c1c8ed949636e2404601076
2015-05-08 17:23:24 -07:00
Andres Morales
d7f055bc76 am d34c722c: Merge changes Iac33dbaa,I18fcd37d into mnc-dev
* commit 'd34c722c59b13c80f89cfdeaf45ff38a3a12a6c5':
  pass in correct buffer to print_id
  stop including rootdir build.prop
2015-05-08 16:40:44 +00:00