Commit graph

971 commits

Author SHA1 Message Date
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
Andres Morales
dff18174d2 stop including rootdir build.prop
merged with default.prop

Change-Id: I18fcd37ddc63e3607278d0741181d0779118132d
2015-05-08 09:20:13 -07:00
Andres Morales
5147eacad1 stop including rootdir build.prop
merged with default.prop

Change-Id: I18fcd37ddc63e3607278d0741181d0779118132d
2015-05-07 15:18:20 -07:00
Elliott Hughes
fdf2546ae7 am a5aa7a11: am 55c2e1f4: Merge "Clean up init /proc/cmdline handling."
* commit 'a5aa7a11266f1d407275b78981fc864c6c863358':
  Clean up init /proc/cmdline handling.
2015-05-07 18:31:16 +00:00
Elliott Hughes
e5ce30fed8 Clean up init /proc/cmdline handling.
Helped debug a problem where the N9 bootloader incorrectly
concatenated the various command lines.

Bug: http://b/20906691
Change-Id: I0580b06f4185129c7eedf0bdf74b5ce17f88bf9c
2015-05-07 11:02:08 -07:00
Elliott Hughes
cf0a113811 am 950c6250: am 5138958c: Merge "Enable property expansion for insmod"
* commit '950c6250ad5c67700d4bffcaa0671b4c145fa563':
  Enable property expansion for insmod
2015-05-06 22:44:23 +00:00
Elliott Hughes
5138958cb3 Merge "Enable property expansion for insmod" 2015-05-04 22:54:10 +00:00
Paul Lawrence
b8fca94e81 Merge commit '2fe6a631' into manualmerge
Change-Id: Ib8d61ee25711e86a2df3705e87904a50c0ef5187
2015-04-29 09:56:26 -07:00
Paul Lawrence
806d10be23 Securely encrypt the master key
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-04-28 15:34:10 -07:00
Nick Kralevich
61c086e54e am 3ef42dd2: am f0d24737: Merge "init: remove support for disabled SELinux"
* commit '3ef42dd20f8d54d98cc5e95995761d2f6b5b4950':
  init: remove support for disabled SELinux
2015-04-28 21:33:36 +00:00
Paul Lawrence
658801ff9f resolved conflicts for merge of 6a5244bc to mnc-dev-plus-aosp
Change-Id: Ied1bbf09aeeed53daefb53c559498066abd9b767
2015-04-28 14:28:44 -07:00
Paul Lawrence
adc385c265 am 2306880f: am 6e8c8f54: Merge "Revert "Only run vold command when file encryption enabled""
* commit '2306880f07c01f39b9f6f5d3e3aee3e2ca945adf':
  Revert "Only run vold command when file encryption enabled"
2015-04-28 21:10:37 +00:00
Nick Kralevich
d34e407aeb init: remove support for disabled SELinux
Remove support for androidboot.selinux=disabled. Running with SELinux
disabled is not a supported configuration anymore. SELinux must be
in enforcing in shipping devices, but we also support permissive for
userdebug/eng builds.

Don't try security_setenforce() if we're already in enforcing mode.
A kernel compiled without CONFIG_SECURITY_SELINUX_DEVELOP does
not have a permissive mode, so the kernel will already be enforcing
once the policy is loaded.

Bug: 19702273
Change-Id: I07525a017ddb682020ec0d42e56a2702c053bdeb
2015-04-28 13:11:07 -07:00
Paul Lawrence
2b3a493946 Merge "Revert "Securely encrypt the master key"" 2015-04-28 19:15:40 +00:00
Paul Lawrence
7ac2807546 Revert "Securely encrypt the master key"
This reverts commit 4bf1887c78.

Change-Id: Ie6d1f39de530b99b50a27ddc45bcc900a24e04b5
2015-04-28 19:15:01 +00:00
Paul Lawrence
6e8c8f542d Merge "Revert "Only run vold command when file encryption enabled"" 2015-04-28 19:14:45 +00:00
Paul Lawrence
34276a1534 Revert "Only run vold command when file encryption enabled"
This reverts commit efe190e023.

Change-Id: Ib15af9a85b0b885a388bda28511a6fc39a777264
2015-04-28 19:12:35 +00:00
Paul Lawrence
e29c5b299c am 2088427c: am a71ef0d5: Merge "Only run vold command when file encryption enabled"
* commit '2088427c8c01c1cbc11496a73882df6264026f14':
  Only run vold command when file encryption enabled
2015-04-28 15:40:58 +00:00
Paul Lawrence
a71ef0d5b5 Merge "Only run vold command when file encryption enabled" 2015-04-28 15:24:10 +00:00
Paul Lawrence
7880f812f7 resolved conflicts for merge of 72fad66f to mnc-dev-plus-aosp
Change-Id: Ib6659a50ee3f1f1ac3719e5d3397c21f786b9afc
2015-04-27 14:44:15 -07:00
Paul Lawrence
9234b169e6 Merge "Securely encrypt the master key" 2015-04-27 20:08:53 +00:00
Emmanuel Berthier
ac41230cbc 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>
2015-04-27 13:50:09 +02:00
Nick Kralevich
eab1e21996 am ecf184c9: am 9c9280d8: Merge "init: get rid of the remaining double mounts"
* commit 'ecf184c901b78994773d687763c1478752e9375e':
  init: get rid of the remaining double mounts
2015-04-26 22:14:51 +00:00
Nick Kralevich
14adea307d am 45a49d0e: am ccac2be8: Merge "init: use SELinux /dev/null if available"
* commit '45a49d0eb7e2e9fc3d2c48884c84f6a6c7397720':
  init: use SELinux /dev/null if available
2015-04-26 22:14:47 +00:00
Nick Kralevich
ada332e4a0 am ecf184c9: am 9c9280d8: Merge "init: get rid of the remaining double mounts"
* commit 'ecf184c901b78994773d687763c1478752e9375e':
  init: get rid of the remaining double mounts
2015-04-26 02:11:28 +00:00
Nick Kralevich
ec9bd166cc am 45a49d0e: am ccac2be8: Merge "init: use SELinux /dev/null if available"
* commit '45a49d0eb7e2e9fc3d2c48884c84f6a6c7397720':
  init: use SELinux /dev/null if available
2015-04-26 01:39:13 +00:00
Nick Kralevich
f667a3247a init: get rid of the remaining double mounts
Don't double mount /dev and its subdirectories anymore. Instead, the
first stage init is solely responsible for mounting it.

Don't have init prepare the property space. This is the responsibility
of the second stage init.

Don't have SELinux use the property space to determine how we should
be running. Instead, create a new function and extract the data we
need directly from /proc/cmdline. SELinux needs this information in
the first stage init process where the property service isn't available.

Change-Id: I5b4f3bec79463a7381a68f30bdda78b5cc122a96
2015-04-25 18:29:26 -07:00
Nick Kralevich
e34577ce1b init: use SELinux /dev/null if available
SELinux provides it's own /dev/null character device at
/sys/fs/selinux/null. This character device is exactly the same
as /dev/null, including the same major/minor numbers, and can
be used wherever /dev/null is used.

Use /sys/fs/selinux/null instead of trying to create our own
/dev/__null__ device. This moves us one step closer to eliminating
all uses of mknod() by init.

/sys/fs/selinux/null is only available once the /sys/fs/selinux filesystem
is mounted. It's not available to the first stage init, so we
still have to fall back to mknod then.

Change-Id: Ic733767ea6220a130537de33cc478ae79578ce20
2015-04-25 16:48:23 -07:00
Nick Kralevich
1c2457ffda am b31c3a5a: am 178299fd: Merge "init: don\'t double mount /proc and /sys"
* commit 'b31c3a5a453cd9f472698068af9909e80a96ab2c':
  init: don't double mount /proc and /sys
2015-04-25 23:28:45 +00:00
Nick Kralevich
2ae7d4eefd am 6b6df173: am f8b0743e: Merge "init: fix write_file checkreqprot logic error"
* commit '6b6df1733711ace006e0f4f9d44c718f85d2f70d':
  init: fix write_file checkreqprot logic error
2015-04-25 23:28:44 +00:00
Nick Kralevich
178299fd45 Merge "init: don't double mount /proc and /sys" 2015-04-25 23:11:27 +00:00
Nick Kralevich
9dec93bfeb init: don't double mount /proc and /sys
The first stage init mounts /proc and /sys, and then the second
stage init also mounts /proc and /sys on top of the existing mount.
Only mount these two directories once, in the first stage init.

Not yet fixed: the double mounting of /dev. Removing the double
mounting doesn't work right now because both init stages are trying
to create a property space, and if the double mount of /dev goes away,
the property service in the second stage init fails to work.

Change-Id: I13719027a47526d074390c2b1a605ad99fb43a8f
2015-04-25 15:50:03 -07:00
Nick Kralevich
eedbe81f75 init: fix write_file checkreqprot logic error
write_file() returned -errno on error, not -1. Callers who check for
-1 would falsely believe that the write was successful when it wasn't.
Fixup write_file so that it return -1 on error consistent
with other functions.

Change-Id: Ic51aaf8678d8d97b2606bd171f11b3b11f642e39
2015-04-25 15:36:13 -07:00
Nick Kralevich
04faed7aba am ecfb3664: am 8929c77a: Merge "init: remove mkdir /dev /proc /sys"
* commit 'ecfb3664fea6cbe39d94459ceb06a91f57006820':
  init: remove mkdir /dev /proc /sys
2015-04-25 21:30:45 +00:00
Nick Kralevich
a1f6a4b139 init: remove mkdir /dev /proc /sys
These directories are already present in the initial ramdisk, and
these mkdir calls are no-ops.

Change-Id: I528f9e96a3471de904845a2f9e09c1b6ff83a708
2015-04-25 13:48:26 -07:00
Elliott Hughes
2b57981b05 am ae3154e3: am 2899c94b: Merge "Switch init to epoll."
* commit 'ae3154e3968e991fb1e9a6b47bedd1e0819f7925':
  Switch init to epoll.
2015-04-25 05:21:43 +00:00
Elliott Hughes
929f407076 Switch init to epoll.
Not just because it's what the cool kids are doing --- it also lets us
simplify the inner loop and decouple it from whatever systems want to
be woken to perform some activity if there's data to be read on some fd.

Currently this is just used to clean up the existing signal handling,
keychord, and property service code.

Change-Id: I4d7541a2c4386957ad877df69e3be08b96a7dec5
2015-04-24 21:13:44 -07:00
Elliott Hughes
52e5e55cac am 0a4f0be2: am df5d4482: Merge "Clean up property service initialization."
* commit '0a4f0be2aaf697ca4b0938b31fc19bb007e87d0d':
  Clean up property service initialization.
2015-04-25 02:57:36 +00:00
Elliott Hughes
c6c26ed781 Clean up property service initialization.
All the code that was being delayed does is create a socket. We can
do that straight away, avoid the overhead, and simplify our main loop.

The keychord fd, on the other hand, seems a little tricky. It looks
like /dev/keychord isn't immediately available, at least not on N9;
we have to wait for ueventd to set us up the bomb.

Change-Id: I020e75b8e4b233497707f0a3cbbb6038b714161f
2015-04-24 19:15:20 -07:00
Elliott Hughes
799d8a165b am d503cc21: am b749be0b: Merge "Clean up init signal handling a little."
* commit 'd503cc21ec663b39e8d84feb373d3a287bb02d63':
  Clean up init signal handling a little.
2015-04-25 01:31:14 +00:00
Elliott Hughes
9042cae40b Clean up init signal handling a little.
We can set it up earlier, and error reporting like this helped me find
the SELinux problem with the last change to this code.

Change-Id: If0f38bc5ff0465c4030e2d39d34f31f49b2d8487
2015-04-24 17:43:21 -07:00
Elliott Hughes
7c6d5dd863 am bdf133de: am 662baefb: Merge "Setup signal handler before any exec command"
* commit 'bdf133de65a1fbb2d5e91fcd854d9824bcff4ea1':
  Setup signal handler before any exec command
2015-04-25 00:42:58 +00:00
Elliott Hughes
662baefbb7 Merge "Setup signal handler before any exec command" 2015-04-25 00:24:55 +00:00
Elliott Hughes
813c769cf6 am e6433c12: am a5669861: Merge "Revert "Revert "Remove now-unusable \'setcon\' command."""
* commit 'e6433c12456324812a9ea791da3bf462ee2476d7':
  Revert "Revert "Remove now-unusable 'setcon' command.""
2015-04-24 20:45:29 +00:00
Elliott Hughes
a8088f3809 am ec389902: am 132440b0: Merge "Revert "Revert "Make init re-exec itself for its SELinux domain transition."""
* commit 'ec389902980c88956ab8e3e630e3503cbb22d39b':
  Revert "Revert "Make init re-exec itself for its SELinux domain transition.""
2015-04-24 19:54:09 +00:00
Elliott Hughes
c7ca9dd6c8 Revert "Revert "Remove now-unusable 'setcon' command.""
This reverts commit b862bd00a4.

This change was fine but an earlier change it depended on was broken.
That change has been fixed and resubmitted.

Bug: http://b/19702273
Change-Id: I17e565721026e48e2a73526f729f2481d4d6edb5
2015-04-24 12:41:47 -07:00
Elliott Hughes
f65730e620 Revert "Revert "Make init re-exec itself for its SELinux domain transition.""
This reverts commit 4217374611.

It turns out that the kernel passes any unrecognized arguments on to init,
and (at least) N6 and N9 have such arguments. My lazy check of argc was
thus insufficient to recognize what stage of init we were in, so we'd
skip to stage 2 and not set up SELinux. And apparently you can get a
very long way with SELinux off... We'll fix that in a later change.

Bug: 19702273
Change-Id: I43b3fb722fed35dd217cb529cbcac9a29aff4e4b
2015-04-24 12:26:05 -07:00
Tom Cherry
17560f8884 am 92b82635: am 10936d1f: Merge "init: consider all platform devices for find_platform_device"
* commit '92b826357692988407018c5754584ef2da9e390e':
  init: consider all platform devices for find_platform_device
2015-04-24 17:53:19 +00:00
Nick Kralevich
b706a8acff am 2db3cd3e: am 46fee19c: Merge "Revert "Make init re-exec itself for its SELinux domain transition.""
* commit '2db3cd3e5e5957da4cf8429b7bbc9b6d36c934a5':
  Revert "Make init re-exec itself for its SELinux domain transition."
2015-04-24 17:17:00 +00:00
Nick Kralevich
22fed877d1 am ac699569: am f0b47920: Merge "Revert "Remove now-unusable \'setcon\' command.""
* commit 'ac6995690a329fd07d434c7fce417d75b794df48':
  Revert "Remove now-unusable 'setcon' command."
2015-04-24 17:16:59 +00:00
Nick Kralevich
4217374611 Revert "Make init re-exec itself for its SELinux domain transition."
shamu isn't booting.

This reverts commit adf0d1bbfa.

Change-Id: I89d568838cebbe14cc4a8ae3843f0f1ac54987af
2015-04-24 16:57:21 +00:00
Nick Kralevich
b862bd00a4 Revert "Remove now-unusable 'setcon' command."
Temporarily revert because device isn't booting.

This reverts commit 7b15ac99f3.

Change-Id: Ice986bac62e20c70f7bedf1744a617b97392ae8c
2015-04-24 16:55:16 +00:00
Elliott Hughes
9e690e0287 am 301691c2: am 659b7d63: Merge "Remove now-unusable \'setcon\' command."
* commit '301691c258cb7e1901eec835a55f227a5af8e5eb':
  Remove now-unusable 'setcon' command.
2015-04-24 04:16:59 +00:00
Elliott Hughes
7b15ac99f3 Remove now-unusable 'setcon' command.
Bug: http://b/19702273
Change-Id: Icd340c80ba074476dcc63f1c1dd5c61a5c768893
2015-04-23 20:54:46 -07:00
Elliott Hughes
77434ab362 am ef68fd3f: am d4656784: Merge "Make init re-exec itself for its SELinux domain transition."
* commit 'ef68fd3f807438fd9aae3b8f104f3a85ef9eb699':
  Make init re-exec itself for its SELinux domain transition.
2015-04-24 03:28:45 +00:00
Elliott Hughes
adf0d1bbfa Make init re-exec itself for its SELinux domain transition.
Change-Id: I38adabe5789d671e3f7d21936071a758ec8cea8a
2015-04-23 15:20:51 -07:00
Tom Cherry
1225a61f0a init: consider all platform devices for find_platform_device
Certain platforms list their platform devices with a path other than
the current /devices or /devices/platform.  Additionally, sometimes
these paths are a platform device themselves.  An example are devices
with a path /devices/soc.0/... where /devices/soc.0 is also a platform
devices.

Instead of continuing to special case these path prefixes, we can
consider the entire path, given that no mmc or usb devices create
platform devices as subdevices, which they should not by their very
nature.

This keeps the symlinks for block devices named identically for
current platform devices and places them in /dev/block/<full path to
device> for devices in locations other than /devices or
/devices/platform, eg /dev/block/platform/soc.0/7824900.sdhci

This keeps the symlinks for character deviced named identically for
all cases.

Change-Id: Ifc8eedf1086db1826dbc8f7e96cdfcfa5da876b3
2015-04-23 15:04:06 -07:00
Paul Lawrence
4bf1887c78 Securely encrypt the master key
Remove unencrypted link since it is easier to manage directly
Move creation of key to vold
Start vold early so this is possible in a timely fashion

This is one of four changes to enable this functionality:
  https://android-review.googlesource.com/#/c/144586/
  https://android-review.googlesource.com/#/c/144663/
  https://android-review.googlesource.com/#/c/144672/
  https://android-review.googlesource.com/#/c/144673/

Bug: 18151196
Change-Id: Idb17d1f1a724c6ec509d181ae4427113e9d3b5e6
2015-04-23 10:23:03 -07:00
Paul Lawrence
efe190e023 Only run vold command when file encryption enabled
Avod slowing other boot times

Change-Id: I4862312ea90d8a1e67d9a755a75f708f5e82cbc5
2015-04-23 10:23:03 -07:00
Johan Redestig
4f673306fc Setup signal handler before any exec command
Fixes init deadlock when an exec command was called
in an on-init section.

The exec command handling relies on that the signal handler
mechanism is working to know when to continue executing
commands.

Change-Id: Ib0ce75ffad7cf3bf926c93d0506b2fe3e5a92630
2015-04-18 14:18:25 +02:00
Elliott Hughes
96b8b3f5b1 am 4048e091: am 710fd65e: Merge "Don\'t try to read /system/default.prop."
* commit '4048e0911244304e0d31cbc66531c26e99ee7752':
  Don't try to read /system/default.prop.
2015-04-16 20:13:37 +00:00
Elliott Hughes
95f709a9f5 Don't try to read /system/default.prop.
It doesn't exist. We use /system/build.prop.

Change-Id: Ie635f9b3cc65de807f128339199b853db5a8eb2f
2015-04-15 17:05:23 -07:00
Ed Tam
d0b6de41f8 Merge "resolved conflicts for merge of 79f33846 to lmp-mr1-dev-plus-aosp" into lmp-mr1-dev-plus-aosp 2015-04-13 23:37:52 +00:00
Ed Tam
438443e742 resolved conflicts for merge of 79f33846 to lmp-mr1-dev-plus-aosp
Change-Id: I24c60a2747931917a3ea09b953905ce0f4145280
2015-04-13 16:29:05 -07:00
Tom Cherry
ae392cf609 Fix memory leak in parse_action
Change-Id: I3ed1da5674ae0b4ac50c1925e4f63af7f1748483
2015-04-13 13:37:20 -07:00
Chris Fries
79f3384652 fs_mgr: introduce fs_mgr_format to format wiped partitions
Move fastboot's format logic into fs_mgr, to consolidate the knowledge
about how to do this (and when to wipe metadata).

Try to format these formattable paritions if they are wiped.

If formatting fails, we will fall out to let recovery mode handle it.

Bug: 20082763
Change-Id: I397cc197550e78d932e8a154fd234695c46dbe7b
2015-04-10 15:01:16 -07:00
Mohamad Ayyash
030ef35966 Revert "Revert "fs_mgr_verity: Add support for squashfs""
This reverts commit 7b97c7a3fa.

Change-Id: Id47e70479fe9247b7936f2e54d4dbfbb4f63f635
2015-04-08 18:08:00 -07:00
Mohamad Ayyash
e322ae1996 Merge "Revert "fs_mgr_verity: Add support for squashfs"" 2015-04-08 19:34:10 +00:00
Mohamad Ayyash
7b97c7a3fa Revert "fs_mgr_verity: Add support for squashfs"
This reverts commit 807f47004f.

Change-Id: I2d7972c0828c842b44747dd08fbe44668f2a55db
2015-04-08 19:31:00 +00:00
Mohamad Ayyash
70f81ceeeb Merge "fs_mgr_verity: Add support for squashfs" 2015-04-08 19:02:11 +00:00
Sami Tolvanen
284c5cb2a1 Merge "Set verity mode as the verified property value" 2015-04-07 08:45:24 +00:00
Mohamad Ayyash
807f47004f fs_mgr_verity: Add support for squashfs
- Cleanup the code to get filesystem size in a block device
- Add support to reading size of squashfs in a block device

Change-Id: I3848a705ed4dc2fc9afad20331f0fdecfee545c5
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
2015-04-06 16:20:26 -07:00
Elliott Hughes
e2837a9107 Remove execonce.
Use 'exec' instead.

Change-Id: I1320d1971f7cd8b23753c27aa87089006e112a11
2015-04-03 09:06:52 -07:00
Elliott Hughes
a57fb596f3 Merge "Remove no-op "capabilities"." 2015-04-01 18:37:06 +00:00
Paul Lawrence
27cda9a535 Merge "Revert "Revert "Adding e4crypt support""" 2015-04-01 17:40:38 +00:00
Elliott Hughes
b022b8428c Remove no-op "capabilities".
This never worked, and implementing it would just be an attempt to cling to
the pre-SELinux past.

Change-Id: Iecba2affa50ee49ccf62677a607bfae95cb0aaf7
2015-04-01 10:20:52 -07:00
Paul Lawrence
b8c9d273a0 Revert "Revert "Adding e4crypt support""
Fix build break caused by original change

This reverts commit 84b0bab58f.

Change-Id: I99fbd7c3d1ed92db1f546033c8493bb71a327924
2015-03-31 13:02:13 -07:00
Sami Tolvanen
454742392f Set verity mode as the verified property value
Set the verity mode as the value for partition.%s.verified to make it
easier for userspace to determine in which mode dm-verity was started.

Change-Id: Icc635515f8a8ede941277aed196867351d8387cb
2015-03-31 09:12:00 +01:00
Elliott Hughes
9efd95b029 Build init with clang.
Change-Id: I14d95b3fe0505dd7d7632e2eedc537f97553c715
2015-03-30 14:37:11 -07:00
Elliott Hughes
59abac27cb Clarify a few things about bootcharts.
Make it clearer in dmesg when we're deliberately not doing
bootcharting, and explain in the documentation that the output
for init is quite misleading (and, as far as I can tell, not
within our power to fix).

Change-Id: I0b22a56f83521d64c6d176dc423c81f7ea86b23c
2015-03-28 12:12:51 -07:00
Elliott Hughes
56a0656ed9 Further cleanup of the logic in device_init.
Change-Id: I96e4b11894926b50792b9b7d7cfa0fe8392abef6
2015-03-28 11:26:15 -07:00
Elliott Hughes
747383649c Fix clang build by removing unused locals.
Also don't manually set FD_CLOEXEC on a socket that's always opened
with SOCK_CLOEXEC. (None of the other callers to the function do this.)

Also move locals to where they're first used to help prevent more of this
kind of breakage.

Change-Id: I1ba7cd9400f53508dffb51a2bbf9d491ae647f26
2015-03-28 10:51:23 -07:00
Elliott Hughes
da40c00137 Log more timing information from init.
Also make important events in init's life NOTICE rather than INFO,
and ensure that NOTICE events actually make it to the kernel log.

Also fix the logging so that if you have a printf format string
error, the compiler now catches it.

Also give messages from init, ueventd, and watchdogd distinct tags.
(Previously they'd all call themselves "init", and dmesg doesn't
include pids, so you couldn't untangle them.)

Also include the tag in SELinux messages.

Bug: 19544788
Change-Id: Ica6daea065bfdb80155c52c0b06f346a7df208fe
2015-03-28 00:25:22 -07:00
Mark Salyzyn
7a3d66c9eb init: missing break statement
Change-Id: Iac4a19c404590c3faba6021c7e537b01805c2d45
2015-03-24 07:29:22 -07:00
Elliott Hughes
930974cedf Add missing parenthesis in init log message.
Change-Id: Iddcd8a002bfc692b1e70d59fa8c6530306c500fa
2015-03-23 08:07:19 -07:00
Sami Tolvanen
8d6ea4bed4 Fix the number of arguments for verity commands
Neither of the built-in verity state commands accept arguments, so
set the number of required arguments to zero.

Change-Id: Id57fe671b6b82eaf1e43b8ed7ff9d1e502ada5bd
2015-03-22 12:41:46 +00:00
Elliott Hughes
cd67f00e18 Always use strerror to report errno.
Change-Id: Icd18e4bd7dc093c18967f45b99cd451359457b03
2015-03-20 17:05:56 -07:00
Elliott Hughes
bf684148e2 Merge "Ensure all init commands are documented." 2015-03-21 00:01:27 +00:00
Elliott Hughes
91a3be547c Ensure all init commands are documented.
Change-Id: I21ef4d88b33337093396e14d792e1ff1fe0bfa17
2015-03-20 16:59:59 -07:00
Daniel Rosenberg
72510c56ec Merge "init: refactor firmware loading locations into table" 2015-03-20 23:55:30 +00:00
Elliott Hughes
81399e1e0e Use unique_ptr to call closedir.
Change-Id: I8f572a06ce59283e5bd444ae0491dea71b0ea304
2015-03-20 16:03:41 -07:00
Daniel Rosenberg
d1d9602f89 init: refactor firmware loading locations into table
Change-Id: I3ce8f9d237bf783335ae85540306aa539a8da568
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2015-03-20 15:42:01 -07:00
Elliott Hughes
db3f267c99 Clean up property setting code.
In particular, ensure that all property_set failures are reported.

Change-Id: Iab94a28bcba2346868c0f39bcfe26e55a2c55562
2015-03-20 10:03:32 -07:00
Elliott Hughes
1b8dbe7441 Merge "Lose bootmode and console globals." 2015-03-20 16:29:37 +00:00
Sami Tolvanen
ddd0639e7e Merge "Add init command to set verified properties" 2015-03-20 15:59:33 +00:00
Elliott Hughes
d679bc9e56 Lose bootmode and console globals.
Also remove some code marked "TODO: these are obsolete. We should delete
them".

Change-Id: I6255cee4cb6680bfcbc5b46366990309cba95037
2015-03-20 08:58:42 -07:00
Rom Lemarchand
6a52443d31 Parse boot properties from device tree
- Make sure compatible DT node is "android,firmware"
- Set ro.boot.* properties from firmware/android/ DT node

(cherry-pick of cbcbea27c70846a96f4bba2f7cb245f937de4d3f.)

Change-Id: If3d0716831516cb3d3fde1f75d57e2691d42d054
2015-03-19 16:32:02 -07:00
Elliott Hughes
bbc01d8254 Merge "Remove /proc/cpuinfo parsing" 2015-03-19 23:21:29 +00:00
Sami Tolvanen
acbf9bef43 Add init command to set verified properties
Add a command that updates dm-verity state and sets partition.%.verified
properties used by adb remount.

This is needed in init since fs_mgr cannot set properties:
    I6a28cccb1ccce960841af20a4b20c32d424b5524

Change-Id: I0fdf5bc29c56690dcadff9d0eb216d3c68483538
2015-03-19 10:11:17 +00:00
Elliott Hughes
ee2e362f8b Merge "Remove useless memset from init." 2015-03-19 05:07:33 +00:00
Elliott Hughes
0dccc888bd Remove useless memset from init.
Change-Id: Ia880810bb2c9a976dceeb0ffdba0cb98e69e3c6d
2015-03-18 20:17:31 -07:00
Elliott Hughes
7010301933 Remove chroot from init.
This is not obviously useful. Let's wait until we have an actual need.

Change-Id: I2c75c96314b281e89df25b6ed202b3dd5dfdaf15
2015-03-18 12:41:54 -07:00
Elliott Hughes
cc86fb2b29 Switch init over to _PATH_DEFPATH.
Bug: 19564110
Change-Id: I343b4a360b10319dca13ab01f2d411ff940e9052
2015-03-17 20:01:13 -07:00
Dan Albert
c007bc3856 Revert "Revert "Create libbase.""
This reverts commit a7870d8816.
2015-03-16 10:08:46 -07:00
Nicolas Geoffray
a7870d8816 Revert "Create libbase."
Breaks internal master.

This reverts commit 98ff77204c.

Change-Id: I18dc6021cb43efff8aa88486c2d980dc2b8eedba
2015-03-16 11:07:29 +00:00
Elliott Hughes
641d3e8ea0 Remove chdir from init.
Change-Id: Ib2880c6cb18db613deac04ee3b06b9719f5248b9
2015-03-15 10:52:20 -07:00
Johan Redestig
0b42ba24ac Document mkdir behavioural change
Since 27164dc mkdir will update mode, owner and group even
if the directory exists already

Change-Id: Ic37975d118a87afded5bfade775cb3d0d3b19892
2015-03-15 17:47:36 +01:00
Elliott Hughes
285c2ae04a Merge "Document the mount option string in the readme.txt" 2015-03-15 16:39:56 +00:00
Niklas Tibbling
bc3f69f190 Document the mount option string in the readme.txt
also make a distinction between flag and option.

Change-Id: Ia872bc8dc98b3459f9c1e992d096c115699357af
2015-03-15 16:20:44 +00:00
Dan Albert
98ff77204c Create libbase.
Move StringPrintf and the string based file I/O from libutils to
libbase.

Change-Id: I0297a6063874b9d92100e0dd5123fddfbda932fe
2015-03-14 16:36:18 -07:00
Rom Lemarchand
74b34f3cb7 Remove /proc/cpuinfo parsing
- Clean up the paths for ro.revision and ro.hardware parsing
- Use ro.hardwre in ueventd instead of parsing the kernel command line

(cherry-pick of 38b340a52f8e864650db8bae1eb88d5c00485db0.)

Bug: 19366018
Change-Id: I018a293f3d46e736a8b65132b5b00b0f7c20edae
2015-03-14 11:05:48 -07:00
Elliott Hughes
5878aa92cd Remove obsolete setkey.
It's undocumented and unused.

Change-Id: I685dc900adbc14f2e8b4eeebb1e4d111782f141d
2015-03-13 15:37:54 -07:00
Stephen Smalley
d4b2d8923f Remove getsebool/setsebool from init and toolbox.
These were leftovers from the SELinux boolean support that
was originally merged.  Since Android prohibits SELinux policy
booleans, we can just drop it.

Change-Id: I02f646a7d8db65e153702205b082b87a73f60d73
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2015-03-13 14:01:58 -04:00
Nick Kralevich
cee683e290 builtins: remove setenforce command
Adding "setenforce 0" to init.rc isn't a supported way to turn off
SELinux, and doesn't work with AOSP SELinux policy. Remove the code
from init.

Change-Id: If8c8149560789c9a7ba518a0a100e6033bb68898
2015-03-11 17:48:45 -07:00
Elliott Hughes
58c3bacc38 Fix a printf format string (caught by clang but not GCC).
Change-Id: I665756615eef74b05ef92f5865d910f29ead0695
2015-03-11 12:31:53 -07:00
Elliott Hughes
a4d98484a2 Merge "Implement exec." 2015-03-11 18:20:29 +00:00
Elliott Hughes
7c0c15f0ed Fix outdated comments in grab-bootchart.sh.
I've been deliberately vague about the name of the readme because I want to
come back and switch to markdown, but that probably won't happen today.

Change-Id: I60651703709bbfd499227f882eb949396e8f4f6c
2015-03-06 13:25:32 -08:00
Sami Tolvanen
8ee42f9c50 Merge "Add init support for dm-verity logging mode" 2015-03-04 20:42:09 +00:00
Sami Tolvanen
8ff0190835 Add init support for dm-verity logging mode
Add a built-in command for loading verity state. If dm-verity
will be started in logging mode, trigger verity-logging.

Needs changes from
  Ibb82953594d234f81ad21c40f524190b88e4ac8f

Change-Id: I5af4918f2f14fdd4d07f51c55837e08111fd3748
2015-03-04 03:07:47 +00:00
Elliott Hughes
8d82ea05cb Implement exec.
Change-Id: I20329bc9b378479d745b498d6a00eca0872cd5ab
2015-02-25 17:55:34 -08:00
Mark Salyzyn
d4e5c32af7 init: grab-bootchart.sh: run bootchart and display results
- KISS as all options are now passed to adb for better or worse
- runs bootchart and immediately displays the results

Bug: 19485335
Bug: 18390773
Change-Id: Id32930031371d0368e605810f0c998232a1d4f16
2015-02-24 13:56:43 -08:00
Yabin Cui
e2d63af002 Move sprintf to snprintf.
Bug: 19340053
Change-Id: Id0d866e6195ed4752b4be6081eeb2aab8b1dbe9a
2015-02-17 19:27:51 -08:00
Elliott Hughes
0f58cb0035 Remove unused variable BOOTCHART_DEFAULT_TIME_SEC.
Change-Id: Id43c73dd32d2f9f1eee9592b55aa3fd3c02094b2
2015-02-13 16:17:42 -08:00
Elliott Hughes
841b263fae Further refactoring of the bootchart code.
Change-Id: Ifed6ae8d481b605139fd27799574de4c2d0f5908
2015-02-13 15:15:11 -08:00
Yongqin Liu
a197ff12dd bootchart: fix bootchart can not be triggered problem
bootchart uses a file on the data partition to decide if it should collect
data for bootchart, but the data partition will be mounted by the mount_all
command in the "on fs" section, and it will be only added into the action
queue when command "trigger fs" is executed, but that's after the
bootchart_init action (late_init).

This change makes bootchart_init a builtin command of init,
and make it executed as the first command of "on post-fs" section
which will be triggered after the "on fs" section.

This change also refactors the bootchart code to all be in bootchart.cpp.

Change-Id: Ia74aa34ca5b785f51fcffdd383075a549b2a99d9
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2015-02-12 12:13:24 -08:00
Johan Redestig
7e952f41f1 Bump do_write buffer size
In the case of do_write (write to generic file) there
is really no relation to the PROP_VALUE_MAX limitation
of system properties. The current value, 92, is not so
much for writing to files so bump it a bit.

Ideally there should not be any low hard limit in this
case. Either expand_props should allocate the output
buffer or take the output fd and to streaming write.
Such a change is rather invasive though and at this
point in time it seems reasonable that one dont want
more than 256 character strings in the init files.

Change-Id: I846a282ae4e747e6171eef38b302b46287951451
2015-02-07 10:57:10 +01:00
Elliott Hughes
f682b4786a Clean up reading and writing in init.
This isn't particularly useful in and of itself, but it does introduce the
first (trivial) unit test, improves the documentation (including details
about how to debug init crashes), and made me aware of how unpleasant the
existing parser is.

I also fixed a bug in passing --- unless you thought the "peboot" and "pm"
commands were features...

Bug: 19217569
Change-Id: I6ab76129a543ce3ed3dab52ef2c638009874c3de
2015-02-06 14:20:30 -08:00
Elliott Hughes
c0e919c920 Stop using #if for conditional compilation.
Use regular 'if' to prevent bitrot.

Also remove remaining typedefs.

Change-Id: I2e6ca928e2db29b88b643cf990ff05cfb0be94a6
2015-02-04 17:16:11 -08:00
Elliott Hughes
24627906bf Use TEMP_FAILURE_RETRY, always build bootchart.cpp.
Also switch the revision parsing over to sscanf as promised. I haven't
done the hardware parsing because I don't yet know whether we actually need
to keep the space-stripping code.

Change-Id: Ic33378345cd515cb08d00c543acf44eb72673396
2015-02-04 10:25:09 -08:00
Elliott Hughes
2145779c87 Fix clang "ueventd.cpp:111:1: error: no return statement in function returning non-void".
Change-Id: I69c9e5534975bffa0fbf98ca4af50400f6b94aa0
2015-02-04 10:19:50 -08:00
Elliott Hughes
f3cf438714 Build init as C++.
This is just the minimal change to keep it building.

Change-Id: I245c5b8413a1db114576c81462eb5737f5ffcef2
2015-02-04 08:59:10 -08:00
Dmitriy Ivanov
3107a2f5f2 Fix x86_64 build
Change-Id: Iaa3a641907de55b398a3bdd0bbc63cbb9d367982
2015-02-03 16:43:15 -08:00
Elliott Hughes
d4a6fc5bc2 Merge "Init: Fix Clang unsupported attributes" 2015-02-03 22:51:47 +00:00
Andreas Gampe
0ab46c9e2b Init: Fix literal
This is a literal 0 implicitly converted to a NULL.

Change-Id: I0573e85eb0578f938877c4bec79054081c27e661
2015-02-03 11:31:11 -08:00
Andreas Gampe
fe2fb359d6 Init: Fix Clang unsupported attributes
Make attributes conditional on not compiling with Clang.

Change-Id: Ic4e9b382308651c7b1901bfa192b6591672dc5ab
2015-02-03 11:25:26 -08:00
Elliott Hughes
d3e37d14e7 Trivial cleanup of recent changes.
A typo in the documentation for one, and a couple of signed/unsigned warnings
in the implementation of the other.

Change-Id: I8fb4b7448ac901c543dea7420aabcedf13ec1bd8
2015-02-02 16:43:32 -08:00
San Mehat
429721c5c4 init: Implement 'exec' command.
(cherry-pick of d05ab3952ec0e38f33a0e80ce6b9eb45b0064ba4.)

Change-Id: Id6d9bb32e51a0ad090ed8240cc505dc45b57b35d
2015-02-02 16:22:56 -08:00
Badhri Jagan Sridharan
0b41512a2e init: Add support "&&" operator in property triggers
"&&" operator can now be used to test the validity
of two of more properties.

For example:

on property:test.a=1 && property:test.b=1
    setprop test.c 1

The above stub sets the test.c to 1 only when
both test.a=1 and test.b=1

(cherry-pick of 162f7d797c67019a7a3f08c3b0f0ffc91d548ddc.)

Change-Id: I72c19f7aa92231372a416193618ee6c7fd368141
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
2015-02-02 16:21:05 -08:00
Nick Kralevich
45a884f85f Add O_CLOEXEC to lots of open() calls.
and other related fixups.

Change-Id: Ia88fb37a07ff6777d00c49800081f5a519c0c78d
2015-02-02 14:37:22 -08:00
Nick Kralevich
bc60954fae builtins.c: Don't require file open() for chmod/chown
42a9349dc4 modified init's
builtin chmod, chown, and mkdir calls to avoid following
symlinks. This addressed a number of attacks we were seeing
at the time where poorly written init scripts were following
attacker supplied symlinks resulting in rooting vulnerabilities.

To avoid race conditions, the previous implementation only ran
fchown / fchmod on file descriptors opened with open(O_NOFOLLOW).
Unfortunately, unlike the normal "chown" or "chmod" calls, this
requires read or write access to the underlying file. This
isn't ideal, as opening some files may have side effects, or
init may not have permission to open certain files (such as when
SELinux is enabled).

Instead of using open(O_NOFOLLOW) + fchown(), use lchown() instead.
As before, the target of the symlink won't be modified by chown.
This also supports setting the ownership of symlinks.

Instead of using open(O_NOFOLLOW) + fchmod(), use
fchmodat(AT_SYMLINK_NOFOLLOW) instead. As before, the target of the
symlink won't be modified by chmod.

This change will continue to ensure that chown/chmod/mkdir doesn't
follow symlinks, without requiring init to open every file in
read-only or read-write mode.

This change depends on bionic commit I1eba0cdb2c509d9193ceecf28f13118188a3cfa7

Addresses the following mako/occam SELinux denial:

  audit(1422770408.951:6): avc:  denied  { write } for  pid=1 comm="init" name="smd7" dev="tmpfs" ino=7207 scontext=u:r:init:s0 tcontext=u:object_r:radio_device:s0 tclass=chr_file

Change-Id: I14fde956784d65c44e7aa91dd7eea9a004df3081
2015-02-02 13:45:21 -08:00
Elliott Hughes
3d74d7a739 Add missing includes.
Change-Id: Iaa130c0a7eb2cbc0c8486546e5b622661b6d9e23
2015-01-29 21:31:23 -08:00
Chih-Hung Hsieh
d3d4741584 Enable clang for init, after fix of global .mk files.
LOCAL_FORCE_STATIC_EXECUTABLE was not working properly for clang
because -Bstatic was ignored by clang. We can now enable clang
for init after the -static flag is added to link static executable
files in build/core/definitions.mk.

BUG: 18008984
Change-Id: I3f361b83c1e0b313914603dff33fd090cd3b116a
2015-01-22 15:28:56 -08:00
Andres Morales
1f1b058e35 property_service: Added vendor build properties to load_all_props
Change-Id: Id50a6dd7fd40752efff8a327ea6b4a45b07fc1b2
2015-01-13 18:18:41 -08:00
Christopher R. Palmer
ba95be58c5 init: Fix memory corruption when sanitizing platform paths
This commit fixes code that incorrectly increments s when it
hits the terminator character of the string being sanitized.
This means it will randomly start trashing memory beyond the
end of the string being sanitized until it happens to hit two
NULs (\0\0) which will break it out of the loop.

(cherry picked from commit 07f3fee164)

Bug: 18885357
Change-Id: If6b01fe2b9bd5985f08f1278deb03b311d0170dc
2015-01-07 12:18:00 -08:00
dcashman
05345bfdb0 Move property_context label handling to libselinux.
Resubmission of commit: dab91bd37af6be355163ee33ca6f1b00e7dd1b51

Change-Id: Iad9517d3f81f7c091307b3e7497675e2cdc32be5
2014-12-10 13:21:17 -08:00
Nick Kralevich
59f64ec31f Revert "Move property_context label handling to libselinux."
Emulator fails to boot.

This reverts commit 98069027bd.

Bug: 18692152
Change-Id: If362e1311bc3f07e033ba81190c05608ada7c361
2014-12-10 02:02:32 +00:00
dcashman
98069027bd Move property_context label handling to libselinux.
Change-Id: I76e2ed95d4e4f8618458e63d30ae82e37d1acf7b
2014-12-03 15:18:40 -08:00
Andreas Gampe
a016c42b4f Init: Remove unused variables
For build-system CFLAGS clean-up, fix unused variables.

Use a #define instead of static variable in a header file.

Change-Id: Id47bf38e51644b61a9f3ac1893a16553695f1aac
2014-11-24 19:52:41 -08:00
Ying Wang
dbb78d65c0 Use LOCAL_POST_INSTALL_CMD to simplify symlink creation.
Change-Id: I67ad7248c26561d394e66901e90ef5814ec69fb3
2014-11-24 15:43:34 -08:00
Daniel Rosenberg
4cf5297cc8 property_service: Added vendor build properties to load_all_props
Signed-off-by: Daniel Rosenberg <drosen@google.com>

(cherry picked from commit b95122205d)

Bug: 18281574
Change-Id: Id1f1c4e9e0d1bfbcae3995fb7966d18bf7d6e06d
2014-11-13 13:08:28 -08:00
Tomasz Kondel
fca58f4b18 Fix segfault in get_character_device_symlinks()
A segmentation fault will occur when strchr function returns NULL.

Change-Id: I76076acfff16056179bf24dff5df9f81d9a45125
2014-11-13 18:23:34 +00:00
Tomasz Kondel
bfdcc40bff Close fd on error path in do_mount()
This fix closes a file descriptor before returning
error from do_mount()

Change-Id: Ib370229f16bf9ac385162d6b163cc5b079a1e73e
2014-11-13 18:20:55 +00:00
Daniel Rosenberg
b95122205d property_service: Added vendor build properties to load_all_props
Change-Id: I267bd848e1f6e2978024c07e603b25f1f41f5fbf
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2014-11-11 12:17:00 -08:00
Elliott Hughes
57583a789f init isn't built for platforms without dirent::d_type.
Change-Id: Icd4b431576f2ba619ff4ae6fb871bb0210d3b2f2
2014-11-10 15:00:00 -08:00
Chih-hung Hsieh
5d727710ba am 2d241ec8: am 3a387176: Merge "Don\'t build init with clang for now"
* commit '2d241ec8a86c56bbf8522eb007674d7b4e3d164d':
  Don't build init with clang for now
2014-10-16 16:32:17 +00:00
Bernhard Rosenkraenzer
84e07fb7a4 Don't build init with clang for now
init doesn't start when built with clang.
Set LOCAL_CLANG:=false until this is analyzed and fixed.

Change-Id: I5a7944aef676ce88defe5c0449e712d9812fb5f3
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
2014-10-04 01:36:49 +02:00
Jeff Sharkey
380e3e67ba am 2b16bf88: Merge "Include reason when wiping data." into lmp-dev
* commit '2b16bf88c768003291f027fdfac94d84abe9dbe6':
  Include reason when wiping data.
2014-09-24 23:35:43 +00:00
Jeff Sharkey
d26135b34d Include reason when wiping data.
This will help us track down who requested a data wipe.

Bug: 17412160
Change-Id: I40f73d2d0f08123d2afc044a3dde485151b400d9
2014-09-24 11:46:36 -07:00
Elliott Hughes
2e826dc2b1 am ae3a8961: am fed0f06b: Merge "init: Fix memory corruption when sanitizing platform paths"
* commit 'ae3a8961f01e436a70cab569483b8ebcc1f56c0c':
  init: Fix memory corruption when sanitizing platform paths
2014-09-23 02:16:48 +00:00
Christopher R. Palmer
07f3fee164 init: Fix memory corruption when sanitizing platform paths
This commit fixes code that incorrectly increments s when it
hits the terminator character of the string being sanitized.
This means it will randomly start trashing memory beyond the
end of the string being sanitized until it happens to hit two
NULs (\0\0) which will break it out of the loop.

Change-Id: I76553d7f183236a78a0bc7b408e92559b98f732f
2014-09-22 20:42:25 -04:00
Paul Lawrence
48fb175d22 am 40af0929: Fix charger mode on first boot of force encrypt devices
* commit '40af09297f9d60a3cfd4a186ff294cef6255a9df':
  Fix charger mode on first boot of force encrypt devices
2014-09-16 22:43:18 +00:00
Paul Lawrence
40af09297f Fix charger mode on first boot of force encrypt devices
waitpid breaks whenever child status signals. Need to loop, continuing
on errno EINTR

Bug: 17515976
Change-Id: Ibb29056a38b3c90dc7904de8c6aedb5a362e511d
2014-09-16 22:14:46 +00:00
Nick Kralevich
042ece12be am 465fc3b9: am 1cbf4329: Merge "Remove obsolete warning from restorecon_recursive documentation."
* commit '465fc3b974384feea3ea991a5e2f801ce1253e2f':
  Remove obsolete warning from restorecon_recursive documentation.
2014-09-02 15:59:17 +00:00
Stephen Smalley
d9c19b0c15 Remove obsolete warning from restorecon_recursive documentation.
We originally included a warning to not invoke restorecon_recursive
with a path leading to a shell-writable or app-writable directory
due to concerns about the potential for mischief with symlinks during
the restorecon_recursive.  However, this warning was never necessary for
calling restorecon_recursive during system initialization before an adb
shell or app can run, and we have further prohibited init from
reading/following symlinks that can be created by shell or apps in
policy, so this warning is superfluous.  It also contradicts current
usage of restorecon_recursive in rootdir/init.rc, since it is called
there on /data.

Change-Id: I28a635e0b5991ced8adcef93e7a04f9d9e5634fd
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-09-02 09:34:53 -04:00
Elliott Hughes
d546cb59ea am bf921c51: am 7a1973ec: Merge "remove examples of unimplemented triggers ( device-added device-removed ) from init/readme.txt"
* commit 'bf921c5112043b5e39b76e76f38f2818bc904b05':
  remove examples of unimplemented triggers ( device-added device-removed ) from init/readme.txt
2014-08-29 22:38:37 +00:00
Trevor Drake
d028394a27 remove examples of unimplemented triggers ( device-added device-removed )
from init/readme.txt

Change-Id: I16e226d8f563a223ae20044fff30498883bc4ae2
2014-08-29 20:07:28 +01:00
Elliott Hughes
a1e9ced56e am 8e207634: am d5f230af: Merge "Remove descriptions of unimplemented triggers."
* commit '8e207634c89e18a319c6514c39acd5aaff6d8f83':
  Remove descriptions of unimplemented triggers.
2014-08-28 17:15:26 +00:00
Trevor Drake
d4a497714a Remove descriptions of unimplemented triggers.
device-added, device-removed and service-exited were described but
never implemented.

Change-Id: I6fbd05a85576d18d6741fc6dd549acc9132b0531
2014-08-28 15:38:52 +01:00
Paul Lawrence
a95e10fe31 am a005e779: Merge "Enable not rebooting during default encryption" into lmp-dev
* commit 'a005e7795e3dfb7cc0bd2bc65208d2490bfc89d8':
  Enable not rebooting during default encryption
2014-08-26 04:53:43 +00:00
Paul Lawrence
c23074f386 Enable not rebooting during default encryption
Need to not set this property) during mount, since it can't
be changed later (ro property)

Also no reason to start class main on encryption cycle - we'll
show surfaceflinger, which is enough UI for this short cycle.

Bug: 17041092
Change-Id: Ica5339c54e45716d0fe20e23c0ab857f388d23ed
2014-08-25 19:24:10 +00:00
Kenny Root
c6c8b563e6 am cf2b944d: am 5a1d5a8c: Merge "ueventd: call _exit for safety"
* commit 'cf2b944df6d744d279a434ec280f9bd8cef03a5b':
  ueventd: call _exit for safety
2014-08-25 18:03:27 +00:00
Kenny Root
17baff480a ueventd: call _exit for safety
Make sure to call _exit instead of exit to avoid triggering exit
handlers that may have existed in the parent process.

Print out a log message when forking to process firmware events fails.

Change-Id: I2436bdf85d9a8ea26b718e62023f1dac89864667
2014-08-25 10:05:08 -07:00
Elliott Hughes
0fd33562d6 am 5d228392: am d24240fb: Merge "Fixed the pacing logic in bootchart data collection."
* commit '5d2283927a9527130cad15d33c1e2b360f4bd46f':
  Fixed the pacing logic in bootchart data collection.
2014-08-06 22:40:43 +00:00
Elliott Hughes
d24240fb4f Merge "Fixed the pacing logic in bootchart data collection." 2014-08-06 17:15:22 +00:00
Bo (Andover) Zhang
3700373c67 Fixed the pacing logic in bootchart data collection.
Ideally bootchart collects system data every BOOTCHART_POLLING_MS ms.
However, the current bootchart pacing logic would collect data every
time the main loop in init.c is executed. This results in:

1. Multiple data samples being taken consecutively or prematurely. In
many cases, these data samples have the same timestamp (in jiffies).
The off-line data processing tool would complain about dividing by
zero "interval" and bail out.

2. Because of the ineffective pacing, bootchart data collection would
terminate prematurely. The total duration of data collection is usually
much shorter than what the user specifies.

The fix is to check whether BOOTCHART_POLLING_MS ms has elapsed
before taking a new data sample. For this purpose, /proc/uptime
is used to get the time values, consistent with the precision of
bootchart timestamps.

Change-Id: I106bf91dbda01059b719df6c73b8bd1cd54a64f0
Signed-off-by: Bo (Andover) Zhang <zhang@broadcom.com>
2014-07-29 21:09:01 -04:00
Elliott Hughes
0b6f8974c9 am 95ec9ae2: am bce3c0c7: Merge "Clarify init\'s write command."
* commit '95ec9ae2c6bad929853c8e0574a354f2eda9604b':
  Clarify init's write command.
2014-07-25 23:04:03 +00:00
Elliott Hughes
afc08ce392 Clarify init's write command.
Bug: https://code.google.com/p/android/issues/detail?id=73996
Change-Id: I4f8d3927d17a4021a2436c2859aa732479c5a118
2014-07-25 14:57:47 -07:00
Elliott Hughes
d41f1a7ae4 Clarify init's write command.
Bug: https://code.google.com/p/android/issues/detail?id=73996

(cherry picked from commit afc08ce392)

Change-Id: Id2fb11d5259957ef23cc839fba14af8452fc69e4
2014-07-25 15:49:44 -07:00
Riley Andrews
4aa98b0c7c am c6ac2793: am ebf9f8f1: Merge "Move unlink("/dev/.booting") until after filesystems are mounted."
* commit 'c6ac27937c632b00836ad72c83c9e7a640030aff':
  Move unlink("/dev/.booting") until after filesystems are mounted.
2014-07-14 20:11:41 +00:00
Riley Andrews
80c7a5e8a8 Move unlink("/dev/.booting") until after filesystems are mounted.
Move the unlink out of init.c and into init.rc, so that the file
will be removed after all the filesystems with firmware are up.

Change-Id: Ifdd5dd1e95d7e064dde5c80b70198882d949a710
2014-07-14 13:17:43 -07:00
Elliott Hughes
ecba4dc037 am 85dfe988: am 796fccb8: Merge "Fix environment variable assignment in init"
* commit '85dfe98830c78f1c3d400ca7be4ac594bfcdd275':
  Fix environment variable assignment in init
2014-07-12 19:36:57 +00:00
Riley Andrews
9464e5a58d Move unlink("/dev/.booting") until after filesystems are mounted.
Move the unlink out of init.c and into init.rc, so that the file
will be removed after all the filesystems with firmware are up.

Change-Id: I7442df2042cc2788d0301f00e3c2fba7d6e0e1c7
2014-07-11 15:47:15 -07:00
James Morrissey
381341f5f7 Fix environment variable assignment in init
The init process allows environment variables to be specified in
the rc script globally, via 'export', and for a specific process,
via the 'setenv' option.

However, the mechanism for assembling the environment simply
appended the new variable without checking whether it was already
defined, so it was not possible to overwrite an existing entry.
This patch fixes that behaviour.

Limitations and concerns:

The limit of a maximum number of 31 variables is unchanged.

Currently, most callers of "add_environment" do not check the return
value, but the function now logs the failure rather than failing
silently.

Change-Id: Ie9a68c37a0f55c5b40e904e695cd35514f67f480
2014-07-10 11:22:46 -07:00
Nick Kralevich
3b4c0bda07 ueventd fixup_sys_perms: fixup SELinux labels unconditionally
Currently, the fixup code in fixup_sys_perms() scans through all
entries in uevent*.rc. If it finds a match, then it performs a fixup.
If there's no match in that file, no fixup is performed.

SELinux file labels are independently stored in /file_contexts,
with no relationship to the files in /ueventd.rc. Even when no
entries exist in ueventd.rc, we still want to fixup the SELinux
file label in /sys when a uevent message occurs.

Change-Id: I0ccb5395ec0be9282095b844a5022e8c0d8903ac
2014-07-07 11:14:59 -07:00
Colin Cross
09117c70f1 Merge "ueventd: allow matching symlink names when setting permissions" 2014-07-02 20:52:43 +00:00
Colin Cross
43d537e0de ueventd: allow matching symlink names when setting permissions
Change-Id: I5f6cc2a25f1236fbe2c7193b65363b7883b9ba2e
2014-07-02 13:56:55 -07:00
Nick Kralevich
4ef159a3c7 am 7367ecbc: am 06023134: am 8022ce1e: Merge "ueventd fixup_sys_perms: fixup SELinux labels unconditionally"
* commit '7367ecbc4839e3a608ab9b7742c659b58065209f':
  ueventd fixup_sys_perms: fixup SELinux labels unconditionally
2014-07-07 20:05:16 +00:00
Colin Cross
0c44584b47 am b18d44e4: am ab7e5752: am 09117c70: Merge "ueventd: allow matching symlink names when setting permissions"
* commit 'b18d44e458501f6b5b99349acc68d3d4e90e9d62':
  ueventd: allow matching symlink names when setting permissions
2014-07-02 23:13:48 +00:00
JP Abgrall
cee206880e [HACK]fs_mgr+init: Format via recovery if encryptable /data is wiped
If the encryptable partition is wiped (4KB worth of 0 or 0xff),
then reboot into recovery to format /data+/cache

This is while waiting for the Mac OS support to format f2fs.
The flashstation running on Mac OS will currently just erase userdata
and not format it with f2fs.

Bug: 15720406
Bug: 15747366
Change-Id: Ib7cca3e1701483a09573457a835750f34da71ee0
2014-07-02 14:28:50 -07:00
JP Abgrall
f22b745294 fs_mrg: clean up multi-type mount_all
Move the code that attempts to mount alternative fstab entries
into its own function.
Clarify return codes.
Suggest wipe via recovery in error messages.

Bug: 15747366
Change-Id: I3634477cd4d1d73f974f3e906c53285f0d9e0eac
Signed-off-by: JP Abgrall <jpa@google.com>
2014-07-02 13:39:44 -07:00
Elliott Hughes
e61679c2fe am fac28281: am b13e4b5e: am 5a53ee05: Merge "Remove an unused #include of <sys/_properties.h>."
* commit 'fac2828161b6b14b7e862d94f2f4ef467621c832':
  Remove an unused #include of <sys/_properties.h>.
2014-06-30 19:41:05 +00:00
Elliott Hughes
11d783f1e7 Remove an unused #include of <sys/_properties.h>.
Bug: 15704351
Change-Id: I7841da7176d0638ae6737fe719cd187892bc38e6
2014-06-30 10:11:55 -07:00
Riley Andrews
24912dc446 resolved conflicts for merge of fa6f2543 to master
Change-Id: I04ce82e5d245e90e2cc62b76d688ec902c1a471d
2014-06-26 20:49:46 -07:00
Riley Andrews
1bbef88e80 Add ability to adjust init log level at runtime.
+ Add a new property, sys.init_log_level, which can be set after init
  bootstrap. This will control the level at which init does prints to klog.

Change-Id: Ia15b2110157b5e6b713785ece9b0fb94889be6c8
2014-06-26 15:05:20 -07:00
Riley Andrews
24a3b783d5 Improve init's debug printing.
+ Make prints of rc commands significantly more verbose. All commands
  will log all arguments, file/line number of the command, return value,
  and parent action which triggered the command.

init: command 'mount tmpfs tmpfs /mnt/obb mode=0755,gid=1000' action=init
      status=0 (/init.rc:89)
init: command 'setprop net.tcp.default_init_rwnd 60' action=boot status=0
      (/init.rc:403)

Change-Id: I5498c7258e4891706be4a12546df4231d14d86c4
2014-06-26 15:05:15 -07:00
Nick Kralevich
f95244a9fc resolved conflicts for merge of dd8e63a4 to master
Change-Id: I5ee88d4a3846cb617ec115cb55c8192c8ecf2f4f
2014-06-26 05:13:39 -07:00
Nick Kralevich
64f5fe2796 Merge "property_service: get rid of hard coded property / control list" 2014-06-25 17:34:34 +00:00
Nick Kralevich
61be43907f am 471a7034: am aadf9f11: am 4ad20e55: Merge "Redirect libselinux logging to dmesg for ueventd."
* commit '471a7034b2fca93f174c88e275d3968032730aa7':
  Redirect libselinux logging to dmesg for ueventd.
2014-06-25 18:46:59 +00:00
Stephen Smalley
439224e275 Redirect libselinux logging to dmesg for ueventd.
We already do this for init, but had failed to do it for ueventd
and could not capture any logging from libselinux calls made by
ueventd.

Truly enabling non-error logging also requires uncommenting a line
in Android.mk:
LOCAL_CFLAGS += -DLOG_UEVENTS=1
which enables other logging and sets the default log level to INFO,
or otherwise changing the klog level in the ueventd code (is not
settable by init.rc loglevel).

Change-Id: I00e6f9d6271f2a21d9078c96368816d74d6d2850
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-06-24 14:11:59 -04:00
Riley Andrews
6bd4588d65 resolved conflicts for merge of 079c637f to master
Change-Id: Iab9a857026de954d7497d6b0eaf3751d2d3904c7
2014-06-23 15:20:51 -07:00