Commit graph

1257 commits

Author SHA1 Message Date
Elliott Hughes
80744d867f Merge \"Remove MTD cruft from init.\"
am: 90db709a2f

Change-Id: I027708dd324000cbfad1a2a6e970f742db97bae5
2016-06-25 02:25:38 +00:00
Elliott Hughes
3195116e97 Remove MTD cruft from init.
Bug: http://b/29250988
Change-Id: I38ab263192944e4ff291fd91b25db163a8848d75
2016-06-24 18:26:30 -07:00
Elliott Hughes
e9a7f52ce5 Merge \"Remove more obsolete MTD stuff.\"
am: aa9f37185f

Change-Id: I7952147c2115d1e205737277376726507aed8447
2016-06-24 17:31:59 +00:00
Treehugger Robot
aa9f37185f Merge "Remove more obsolete MTD stuff." 2016-06-24 17:19:48 +00:00
Elliott Hughes
01e5a6c971 Remove more obsolete MTD stuff.
Bug: http://b/29250988
Change-Id: Ic2d0514fcdbe26526e87bc681b71efcc90eda678
Test: still builds.
2016-06-24 09:13:51 -07:00
Hung-ying Tyan
23a574a195 resolve merge conflicts of 66277db to stage-aosp-master
Change-Id: I58b1f7fec779c707ac4048ae5401087ec4b7c8b0
2016-06-24 13:21:09 +08:00
Hung-ying Tyan
66277db8d0 Merge "Add -f to insmod" 2016-06-24 04:34:56 +00:00
Hung-ying Tyan
bfa6d75c60 Add -f to insmod
When the flag is on, insmod will bypass vermagic and symbol version
checking in the kernel. This is to make it possible to update kernel
without recompiling kernel modules.

BUG=28803994

Change-Id: Ib4be6999ef52baefd4210ee0d242360e43318907
2016-06-24 11:10:46 +08:00
Chih-Hung Hsieh
65828a0ec9 Merge \"Fix misc-macro-parentheses warnings in system/core.\"
am: 495541c5bb

Change-Id: I021b653779c5119398c31ee354372366ba029328
2016-06-22 22:39:07 +00:00
Chih-Hung Hsieh
cdb2ca5d9f Fix misc-macro-parentheses warnings in system/core.
Add parentheses around macro arguments used beside operators.
Bug: 28705665

Change-Id: I9226f319e283be640eddc31687f75b51a8ef0ac6
2016-06-22 14:33:13 -07:00
Elliott Hughes
32cc6c9908 Merge \"init: report createProcessGroup failure.\"
am: 2d690a920f

Change-Id: I4ec8df459aefa4aebb3cdf9ec5aa40bc4e727f39
2016-06-17 04:16:21 +00:00
Elliott Hughes
ad8e94e017 init: report createProcessGroup failure.
Also directly kill the initial pid for safety, like other libprocessgroup
users.

Change-Id: Ib28936aea19cceaeaa54734759d5ae0c252c7905
2016-06-15 14:49:57 -07:00
William Roberts
787468260d Merge \\"ueventd: only relabel devices if there\\'s a delta\\" am: 95428817d6
am: 807fa4bd5c

Change-Id: I41a8c02332ae12dc1c4fbc9c45ee627a37ce6b77
2016-06-09 19:18:40 +00:00
Treehugger Robot
95428817d6 Merge "ueventd: only relabel devices if there's a delta" 2016-06-09 19:07:27 +00:00
Tom Cherry
39b1d2043e Merge \\"init: expand arguments of services when they start\\" am: 86cd314af3
am: f6ee6e16d9

Change-Id: I995a23e3eaa19bca1c4dc7880d786b806bd53306
2016-06-08 22:55:40 +00:00
Tom Cherry
86cd314af3 Merge "init: expand arguments of services when they start" 2016-06-08 22:42:11 +00:00
Vitalii Tomkiv
69cfeabfc0 Merge \\"Add process priority to service definition.\\" am: 14b00baaae
am: 20cc2787cb

Change-Id: I12993eed4953a7bdd832de0c263ce8d4c2476969
2016-06-08 21:42:31 +00:00
Vitalii Tomkiv
081705c258 Add process priority to service definition.
This change allows to set prioirrity of the process to be set through
*.rc file.

Bug: 28866384
Change-Id: If0108ef05c8a151749c43d2d7de1187653255ce8
2016-06-08 13:22:14 -07:00
Mark Salyzyn
5e2beeb8da Manually fix automerger error on 4ab7548
am: a6f1c46fa0

* commit 'a6f1c46fa04cf6b35b77bf249af11a3ffbe562e3':
  init: Add support for ${x.y:-default} expansion

Change-Id: If03b9453ed461e5878ecefc8863b164a683c10a4
2016-06-07 20:42:24 +00:00
Tom Cherry
bac3536cc9 init: expand arguments of services when they start
Arguments of commands are expanded based on properties if they contain
${property.name}, however this is not currently done for arguments of
services.

This patch makes it that arguments of services are expanded each time
that the service starts at the point immediately before execve().

Change-Id: Iba581a8377e25a6478d4d2ec2e8b29e181d8640c
2016-06-07 11:22:00 -07:00
Mark Salyzyn
4b56162a33 init: Add support for ${x.y:-default} expansion
commit 00ede7d262 (init: do
expand_props before calling the builtins) broke logpersist

Bug: 28120456
Bug: 22654233
Change-Id: Ib4d8231665b26ac083b02243177493fab41c8978
2016-06-07 18:09:17 +00:00
Elliott Hughes
8d532e4737 resolve merge conflicts of cea1d04 to nyc-dev-plus-aosp
Change-Id: I41cdca717664a16f00fd1b28076dd752fa96653d
2016-06-06 21:19:55 -07:00
Collin Mulliner
f7e79b99c1 use process groups for processes started by init
Put every service into a process group, kill the process group
and all child processes created within the group when killing the
service. Removed libutil dependency in libprocessgroup.

Bug: 25355957
Change-Id: Ieed60ec41579f638ab9b1e66a7e6330ed578ab05
Signed-off-by: Collin Mulliner <collinrm@squareup.com>
2016-06-06 16:31:01 -07:00
William Roberts
397de1494f ueventd: only relabel devices if there's a delta
Since commit: 24a3cbfa73
ueventd is attempting to relabel devices on calls to
make_device() when the device already exists. However, it
should only be called if the contexts for relabelfrom and
relabelto are different.

When this condition occurs, one will see denials like this:

[   14.409448] type=1400 audit(978307239.225:26): avc: denied { relabelfrom } for pid=1572 comm="ueventd" name="ttyS0" dev="tmpfs" ino=9613 scontext=u:r:ueventd:s0 tcontext=u:object_r:hci_attach_dev:s0 tclass=chr_file permissive=1
[   14.428107] type=1400 audit(978307239.225:27): avc: denied { relabelto } for pid=1572 comm="ueventd" name="ttyS0" dev="tmpfs" ino=9613 scontext=u:r:ueventd:s0 tcontext=u:object_r:hci_attach_dev:s0 tclass=chr_file permissive=1

Bug: 29106809

Change-Id: I2105b169206f0b26420f3c4b0ba5c49aeb98da92
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-06-03 17:40:18 +00:00
Chih-Hung Hsieh
5fb629a212 resolve merge conflicts of e845c04 to nyc-dev-plus-aosp
Change-Id: I423f722dcc3821b9be52613d68640b49cbac70a6
2016-05-27 16:04:21 -07:00
Chih-Hung Hsieh
c713bce901 Fix misc-macro-parentheses warnings in init and other core modules.
Bug: 28705665
Change-Id: Ice67cebb8c42538f8fb9cf1756678f41a9d68a31
2016-05-18 18:11:49 -07:00
Rob Herring
a0c90085ec Merge "init: support matching sysfs class paths in ueventd.rc" am: faa14b94d5
am: 0da9f42f2c

* commit '0da9f42f2c2ec6985018ad45603b32532d096a60':
  init: support matching sysfs class paths in ueventd.rc

Change-Id: Ifc85ba3205a5207a4285da94b483164490dbde4d
2016-05-13 21:54:48 +00:00
Rob Herring
6de783af07 init: support matching sysfs class paths in ueventd.rc
Currently, ueventd.rc files only support /sys/devices/... paths
and don't support symlinked paths, specifically /sys/class/...
Supporting the class paths is necessary to have non-hardware
dependent paths. Some subsystems like IIO use /sys/bus/iio/, so
support that as well.

Change-Id: I29f3bf67b41664d1d75ac1820c46e13afe336d56
Signed-off-by: Rob Herring <robh@kernel.org>
2016-05-13 13:46:46 -07:00
Rob Herring
7aef62751b Merge "init: rework fixup_sys_perms to use perm_path_matches" am: 0504a94cd9
am: e7028e3d38

* commit 'e7028e3d382ee4099cfc4c1cbfa650fd2f820410':
  init: rework fixup_sys_perms to use perm_path_matches

Change-Id: Iaebea1a143b053ee1c41c47cb5eb2329f992330f
2016-05-13 20:33:28 +00:00
Rob Herring
e5636a3fce init: rework fixup_sys_perms to use perm_path_matches
fixup_sys_perms does the same matching as the function perm_path_matches
other than the leading '/sys'. Adjust the path and use the common
matching function. Replace the fixed length C strings with std::string.

Change-Id: Ic09d91aa4ac1f1096018617537d782b82ee9ef63
Signed-off-by: Rob Herring <robh@kernel.org>
2016-05-11 09:20:19 -05:00
Paul Crowley
71bac3fa4b Merge "Wipe device on policy error" into nyc-dev
am: 8a59fa8524

* commit '8a59fa85243a5f748108279f6d30b01292518b0a':
  Wipe device on policy error

Change-Id: I35205b2ddf8b3e8d049525e3717d27836d6c59a2
2016-05-10 22:17:08 +00:00
Paul Crowley
af8be58ca2 Wipe device on policy error
If we fail to set a crypto policy on a system-DE directory, this is a
serious and unrecoverable condition; the only way forward is to erase
the entire device. In a future commit we will also allow users the
option of booting again.

Bug: 28318405
Change-Id: Iff1e52c5bbee1beed29dc4b609d24bfeb7d138da
2016-05-10 11:04:39 -07:00
Nick Kralevich
f2049163a4 init/builtins.cpp: Switch to finit_module
Switch insmod from using init_module to finit_module. From
"man finit_module":

  The finit_module() system call is like init_module(), but reads the
  module to be loaded from the file descriptor fd. It is useful when the
  authenticity of a kernel module can be determined from its location in
  the file system; in cases where that is possible, the overhead of
  using cryptographically signed modules to determine the authenticity
  of a module can be avoided.

finit_module is preferred over init_module because it allows LSMs, such
as SELinux, to perform a permission check on kernel module loads based on
the file from which the module is loaded. This functionality is not yet
implemented in the Linux kernel, but is on the SEAndroid TODO list.
See https://bitbucket.org/seandroid/wiki/wiki/ToDo

Bug: 27824855

(cherry picked from commit 124a9c97e9)

Change-Id: I5e87de1a7b8c3d8849bf757c71b08e81c378b021
2016-05-04 07:01:46 -07:00
Chih-hung Hsieh
fb44ca5178 Merge "Fix google-explicit-constructor warnings." am: 7bdd6a8b5a
am: 427d8d840f

* commit '427d8d840f6ec5ce5767b2ee521e4ac5b7ebd619':
  Fix google-explicit-constructor warnings.

Change-Id: I26dc45aca83f991aa7993f6d4233e0439dd44a22
2016-04-30 05:16:35 +00:00
Chih-hung Hsieh
7bdd6a8b5a Merge "Fix google-explicit-constructor warnings." 2016-04-30 05:10:05 +00:00
Chih-Hung Hsieh
1c563d96f0 Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I4504e98a8db31e0edcbe63c23f9af43eb13e9d86
2016-04-29 15:44:04 -07:00
Mihai Serban
721c9ce4a5 ueventd: relabel block devices nodes when processing subsequent add events
There is a race in ueventd's coldboot procedure that permits creation
of device block nodes before platform devices are registered. This happens
when the kernel sends events for adding block devices during ueventd's
coldboot /sys walk.
In this case the device node links used to compute the SELinux context
are not known and the node is created under the generic context:
u:object_r:block_device:s0.
A second add event for block device nodes is triggered after the platform
devices are handled by ueventd and the SELinux context is correctly computed
but the mknod call fails because the node already exists. This patch handles
this error case and updates the node's security context.

The race is introduced by the uevent sent from the sdcard device probe
function. The issue appears when this uevent is triggered during ueventd's
coldboot procedure but before the /sys/devices recursive walk reached the
corresponding sdcard platform device path.
The backtrace looks something like:
1. ueventd_main()
2. device_init()
3. coldboot("/sys/devices");
4. do_coldboot()
5. handle_device_fd()
6. handle_device_event()
6.1 handle_block_device_event()
6.2 handle_platform_device_event()

Because handle_device_fd() reads all events from the netlink socket it may
handle the add events for the sdcard partition nodes send occasionally by the
kernel during coldboot /sys walk procedure.
If handle_device_event() continues with handle_block_device_event()
before handle_platform_device_event() registers the sdcard platform device then
handle_block_device_event() will create device nodes without knowing all block
device symlinks (get_block_device_symlinks()):
1. handle_device(path=/dev/block/mmcblk0p3, links = NULL)
2. make_device(path=/dev/block/mmcblk0p3, links = NULL)
3. selabel_lookup_best_match(path=/dev/block/mmcblk0p3, links = NULL)
  returns the default context (u:object_r:block_device:s0) for
  /dev/block/mmcblk0p3 instead of more specific context like:
  u:object_r:boot_block_device:s0
4. setfscreatecon(u:object_r:block_device:s0)
5. mknod(/dev/block/mmcblk0p3)

So the node is create with the wrong context. Afterwards the coldboot /sys walk
continues and make_device() will be called with correct path and links.
But even if the secontext is computed correctly this time it will not be
applied to the device node because mknod() fails.
I see this issue randomly appearing (one time in 10 reboots) on a Minnoboard
Turbot with external sdcard as the boot device.

BUG=28388946

Signed-off-by: Mihai Serban <mihai.serban@intel.com>

(cherry picked from commit 24a3cbfa73)

Change-Id: I2d217f1c8d48553eb4a37457dbf27fff54051cf9
2016-04-28 06:27:39 -07:00
Treehugger Robot
355e4c8350 Merge "ueventd: relabel block devices nodes when processing subsequent add events" am: 94b0f37
am: 51cdf14

* commit '51cdf140db1ab9254ba7c67fe74f9d9c81dcbd21':
  ueventd: relabel block devices nodes when processing subsequent add events

Change-Id: Ic7589319810d12918937f429ab9488344f0e0962
2016-04-28 12:09:55 +00:00
Mihai Serban
24a3cbfa73 ueventd: relabel block devices nodes when processing subsequent add events
There is a race in ueventd's coldboot procedure that permits creation
of device block nodes before platform devices are registered. This happens
when the kernel sends events for adding block devices during ueventd's
coldboot /sys walk.
In this case the device node links used to compute the SELinux context
are not known and the node is created under the generic context:
u:object_r:block_device:s0.
A second add event for block device nodes is triggered after the platform
devices are handled by ueventd and the SELinux context is correctly computed
but the mknod call fails because the node already exists. This patch handles
this error case and updates the node's security context.

The race is introduced by the uevent sent from the sdcard device probe
function. The issue appears when this uevent is triggered during ueventd's
coldboot procedure but before the /sys/devices recursive walk reached the
corresponding sdcard platform device path.
The backtrace looks something like:
1. ueventd_main()
2. device_init()
3. coldboot("/sys/devices");
4. do_coldboot()
5. handle_device_fd()
6. handle_device_event()
6.1 handle_block_device_event()
6.2 handle_platform_device_event()

Because handle_device_fd() reads all events from the netlink socket it may
handle the add events for the sdcard partition nodes send occasionally by the
kernel during coldboot /sys walk procedure.
If handle_device_event() continues with handle_block_device_event()
before handle_platform_device_event() registers the sdcard platform device then
handle_block_device_event() will create device nodes without knowing all block
device symlinks (get_block_device_symlinks()):
1. handle_device(path=/dev/block/mmcblk0p3, links = NULL)
2. make_device(path=/dev/block/mmcblk0p3, links = NULL)
3. selabel_lookup_best_match(path=/dev/block/mmcblk0p3, links = NULL)
  returns the default context (u:object_r:block_device:s0) for
  /dev/block/mmcblk0p3 instead of more specific context like:
  u:object_r:boot_block_device:s0
4. setfscreatecon(u:object_r:block_device:s0)
5. mknod(/dev/block/mmcblk0p3)

So the node is create with the wrong context. Afterwards the coldboot /sys walk
continues and make_device() will be called with correct path and links.
But even if the secontext is computed correctly this time it will not be
applied to the device node because mknod() fails.
I see this issue randomly appearing (one time in 10 reboots) on a Minnoboard
Turbot with external sdcard as the boot device.

BUG=28388946

Change-Id: I96e239af29d82b753e5d349b3ecefaad09edee87
Signed-off-by: Mihai Serban <mihai.serban@intel.com>
2016-04-28 10:45:03 +00:00
Paul Lawrence
1a920d72dc Merge "Don\'t start defaultcrypto twice" into nyc-dev
am: fe5d55a

* commit 'fe5d55a68b9dc3a593d3f6ee5be919b8a9de710c':
  Don't start defaultcrypto twice

Change-Id: I0e9a27208ea046a2cf738992ba97141da9026c08
2016-04-19 14:46:48 +00:00
Paul Lawrence
1f99218612 Don't start defaultcrypto twice
The old way (using triggers) starts defaultcrypto twice because
queue_property_triggers_action retriggers the action.

Bug: 27452459
Change-Id: I48c844836f551673d0dbfed6c33bd8ee1e035f40
2016-04-18 15:37:31 -07:00
Elliott Hughes
bdeac39a42 Remove undocumented functionality from init.
(cherry-pick of a3cc6026301db08285028c760af2665a66b3cc44.)

Bug: http://b/28151340
Change-Id: I5360502c79d9113a13055bf017b39c099033e947
2016-04-13 07:56:51 -07:00
Elliott Hughes
8bcb7caf0e Merge "Remove undocumented functionality from init." into nyc-dev
am: 27fe8c9

* commit '27fe8c904b0e63b047ac90380b6b2433fcec930d':
  Remove undocumented functionality from init.

Change-Id: I3893df1ca5d16e72368f8990baea2395781af24d
2016-04-13 14:51:01 +00:00
Elliott Hughes
9c4a0e0216 Merge changes from topic \'boringssl_conversion\' am: 52eb93c
am: 0781351

* commit '07813516502d12cfeabef94838e916c0cf4f3b46':
  Switch fs_mgr and adb to libcrypto_utils.
  Add libcrypto_utils.

Change-Id: Ib50abd66d546a2b2c7a1249043e1b39c2147c674
2016-04-12 23:22:11 +00:00
Mattias Nissler
097b6bbc76 Switch fs_mgr and adb to libcrypto_utils.
Update code and dependencies to use BoringSSL + libcrypto_utils
instead of mincrypt.

Change-Id: Ic75164bd50c84b81b6310e27a67d4b3c174984f9
2016-04-12 23:04:11 +00:00
Elliott Hughes
a3cc602630 Remove undocumented functionality from init.
Bug: http://b/28151340
Change-Id: I5360502c79d9113a13055bf017b39c099033e947
2016-04-12 15:38:51 -07:00
Yabin Cui
52a302d1e6 Merge "init: write bootloader message directly." into nyc-dev
am: a3a7a88

* commit 'a3a7a886f5277b6223140761e58cea0753854225':
  init: write bootloader message directly.

Change-Id: I764e0288b40264b8e48fc09011c3c0475b71a04e
2016-04-09 00:35:26 +00:00
Yabin Cui
46e037980b init: write bootloader message directly.
Bug: 27176738
Change-Id: I8c95a193f3436c0893d5103760b700f3052888db
2016-04-08 11:05:56 -07:00
Elliott Hughes
c7f5af58d9 Merge "ueventd: convert to use pwd family of functions" am: 2c78f62
am: 1397e7a

* commit '1397e7af4b432d174dbbc7400cca9a00ce34ea5d':
  ueventd: convert to use pwd family of functions

Change-Id: I02c1d78835054bd296ce84586410bbcee1760a9c
2016-04-08 01:55:36 +00:00
Elliott Hughes
2a651e603a Merge "property_service: drop unused header" am: 1134925
am: b627a01

* commit 'b627a014b97a4ffdfe6d4ca4c2e47b61cd87321d':
  property_service: drop unused header

Change-Id: I44b28ece5694d811d55a3de963e95ca14ff68cb0
2016-04-08 01:55:36 +00:00
Elliott Hughes
6ba3710651 Merge "init: drop unused header android_filesystem_config.h" am: 54c27c7
am: 8cb6a9c

* commit '8cb6a9cdb7cb1feaff29914aa88c68399e32f14f':
  init: drop unused header android_filesystem_config.h

Change-Id: I1cc001c883199e8355e97d93a2f6ce0d46bdd767
2016-04-08 01:55:36 +00:00
Elliott Hughes
ff37c38bac Merge "init: switch from android_ids to getpwnam" am: 171504f
am: 43cbd05

* commit '43cbd0585b50996e1601dc6ed56e723aded810c8':
  init: switch from android_ids to getpwnam

Change-Id: I100993cfb07f23bb5b3079846d4e00f31d1a9794
2016-04-08 01:55:35 +00:00
William Roberts
5b5a8ace61 ueventd: convert to use pwd family of functions
Switch ueventd to use the grp.h and pwd.h family of
functions for converting strings to uids. This removes the
need for using android_filesystem_config.h.

Change-Id: I25a6f536bb11683d5cd69a0d7b348d25a272dd3b
Bug: 27999086
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-04-07 13:38:43 -07:00
William Roberts
8e1dce8ba0 property_service: drop unused header
Remove android_filesystem_config.h since it was not being used.

Change-Id: I691513d50a3fdb7563a63aee7551137ba983825c
Bug: 27999086
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-04-07 13:38:43 -07:00
William Roberts
6df15704bd init: drop unused header android_filesystem_config.h
Change-Id: I66e637bc2d7fd5f385f40f150becfe515c53c19a
Bug: 27999086
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-04-07 13:38:43 -07:00
William Roberts
3792e6cf21 init: switch from android_ids to getpwnam
Start to move users of android_filesystem_config.h to use the
standard grp and pwd interface functions.

Advantages:
  * one copy of android_ids in libc, removing it from init objects.
  * immediately starts oem_xxx users and groups in rc.
  * future will support _named_ oem ids via backend improvements.

Change-Id: Ib1ae1e0cbdcaaf60deb3759681a6030b615c069c
Bug: 27999086
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-04-07 13:38:36 -07:00
Mark Salyzyn
402fb79d43 init: turn off backlight when performing shutdown cleanup
(cherry pick from commit a98cc9c202)

Try writing a "0" into:

- /sys/class/leds/lcd-backlight/brightness
- /sys/class/backlight/*/brightness

to turn off the backlight during shutdown cleanup.

Bug: 27506425
Change-Id: Ic8a44dc8909b303f24e14f71cfb43292df60efde
2016-04-05 16:20:59 -07:00
Mark Salyzyn
24f79bed76 Merge "init: turn off backlight when performing shutdown cleanup" am: adf1cde
am: 23702b5

* commit '23702b538b3a02ca35f24c55d406a7cc7b14641f':
  init: turn off backlight when performing shutdown cleanup

Change-Id: I249106a3b6c22e77d06bca5aee1d92184b00ba33
2016-04-05 23:14:28 +00:00
Mark Salyzyn
a98cc9c202 init: turn off backlight when performing shutdown cleanup
Try writing a "0" into:

- /sys/class/leds/lcd-backlight/brightness
- /sys/class/backlight/*/brightness

to turn off the backlight during shutdown cleanup.

Bug: 27506425
Change-Id: Ic8a44dc8909b303f24e14f71cfb43292df60efde
2016-04-05 15:56:27 -07:00
Mark Salyzyn
0fcc2ee4e4 init: watchdog restarted during shutdown fsck
(cherry pick from commit ad575e04a1)

Bug: 27506425
Change-Id: I40967068d18ce1a8cbaf0b750e7a7af6eab3e4e8
2016-04-05 12:44:24 -07:00
Mark Salyzyn
e4c8b31fed Merge "init: watchdog restarted during shutdown fsck" am: 3443caa
am: 34dcdd8

* commit '34dcdd8075a0c12de552219d4f326bccd1c8fe62':
  init: watchdog restarted during shutdown fsck

Change-Id: I28e3a730f2d854c51f1d760a5400faecd3f1fafc
2016-04-05 18:44:59 +00:00
Mark Salyzyn
ad575e04a1 init: watchdog restarted during shutdown fsck
Bug: 27506425
Change-Id: I40967068d18ce1a8cbaf0b750e7a7af6eab3e4e8
2016-04-05 11:31:14 -07:00
Nick Kralevich
d87a1747aa Merge "init/builtins.cpp: Switch to finit_module" am: b3cf2e0
am: 699b115

* commit '699b115be3c79547e9cc6d8bca771d77eb384915':
  init/builtins.cpp: Switch to finit_module

Change-Id: Iab21b9e058fe9435847ba9bca4cb2d1c0f50c88f
2016-03-30 02:17:56 +00:00
Nick Kralevich
124a9c97e9 init/builtins.cpp: Switch to finit_module
Switch insmod from using init_module to finit_module. From
"man finit_module":

  The finit_module() system call is like init_module(), but reads the
  module to be loaded from the file descriptor fd. It is useful when the
  authenticity of a kernel module can be determined from its location in
  the file system; in cases where that is possible, the overhead of
  using cryptographically signed modules to determine the authenticity
  of a module can be avoided.

finit_module is preferred over init_module because it allows LSMs, such
as SELinux, to perform a permission check on kernel module loads based on
the file from which the module is loaded. This functionality is not yet
implemented in the Linux kernel, but is on the SEAndroid TODO list.
See https://bitbucket.org/seandroid/wiki/wiki/ToDo

Bug: 27824855
Change-Id: Id0ea88cd1930393c8c73ce38e63d5b2eeadf946a
2016-03-29 16:53:08 -07:00
Dan Austin
d219b4eff4 Merge "Address const issues in preparation for libcxx rebase."
am: 7f84a07

* commit '7f84a0700ca49cfdf650d46b383d6e5aaae05fdc':
  Address const issues in preparation for libcxx rebase.
2016-03-28 22:43:26 +00:00
Dan Austin
7f84a0700c Merge "Address const issues in preparation for libcxx rebase." 2016-03-28 22:35:51 +00:00
Dan Austin
427fb7216d Merge "Fix const issues in preparation for libcxx rebase."
am: dce9b61

* commit 'dce9b61d253675fc5067b76eb166de66dc8fd367':
  Fix const issues in preparation for libcxx rebase.
2016-03-28 21:48:38 +00:00
Dan Austin
dce9b61d25 Merge "Fix const issues in preparation for libcxx rebase." 2016-03-28 21:41:10 +00:00
Dan Austin
60b976db85 Address const issues in preparation for libcxx rebase.
Change-Id: If9bf6c3ee57c3476a5661401853506551e2150cb
2016-03-28 14:22:12 -07:00
Dan Austin
a27bbd2728 Fix const issues in preparation for libcxx rebase.
Change-Id: Id57474eb63334873ee5383f61eb918941dbb0984
2016-03-28 13:43:15 -07:00
Daniel Cashman
2a1c430ff4 Merge "Revert "Set mmap_rnd_bits to maximum value.""
am: bb296fd

* commit 'bb296fdaecb3c90c21797dab6abb3add4f84d938':
  Revert "Set mmap_rnd_bits to maximum value."
2016-03-25 18:48:14 +00:00
Daniel Cashman
c8f026fc9c Revert "Set mmap_rnd_bits to maximum value."
Prebuilt kernels have not been updated with the requisite patches.

This reverts commit c819e78e7f.

Change-Id: I8e63373a9b8a1e5adcb2471dfe43bde28e3f8e65
2016-03-25 10:45:20 -07:00
Kees Cook
a0218d9c09 Merge "init: improve mmap ASLR failure reporting"
am: b27026f

* commit 'b27026f9253fd66cf85fe4ab519a6781a7cddb0b':
  init: improve mmap ASLR failure reporting
2016-03-24 02:53:10 +00:00
Kees Cook
39caeb5bee init: improve mmap ASLR failure reporting
This should help people track down the reason for entropy setting
failures.

Bug: 27681085
Change-Id: I6bde342ca0215e32c1f851365a1723630c7d4372
2016-03-23 10:00:11 -07:00
dcashman
7b094b759e init: Fix typo.
am: 9261ad1

* commit '9261ad13ed8a6bf5d43450f3eb5a48ecd65587f1':
  init: Fix typo.
2016-03-22 23:24:21 +00:00
dcashman
754dd9660f init: Fix typo.
Bug: 27681085
Change-Id: I4308435a5b58189852c991d1bec65ed11933566a
2016-03-22 16:15:24 -07:00
dcashman
9261ad13ed init: Fix typo.
Bug: 27681085
Change-Id: I4308435a5b58189852c991d1bec65ed11933566a
2016-03-22 16:04:26 -07:00
dcashman
3396b4b665 Temporarily add set_mmap_rnd_bits brillo exception
(cherry-picked from internal commit: 69022e03d8)
Bug: 27794137
Change-Id: Idc6fc1e208bdb19556173d40215feb66e235c6d6
2016-03-22 15:37:19 -07:00
dcashman
0f80d8cd4e Temporarily add set_mmap_rnd_bits brillo exception
am: 69022e0

* commit '69022e03d81e43455cf7c21555314c4d08664311':
  Temporarily add set_mmap_rnd_bits brillo exception
2016-03-22 22:33:54 +00:00
dcashman
69022e03d8 Temporarily add set_mmap_rnd_bits brillo exception
Bug: 27794137
Change-Id: Idc6fc1e208bdb19556173d40215feb66e235c6d6
2016-03-22 15:18:29 -07:00
dcashman
c819e78e7f Set mmap_rnd_bits to maximum value.
Also make sure it is above a minimum threshold, else abort.

(cherry-pick of internal commit: 5d36813dc8)

Bug: 27681085
Change-Id: Ia1d9583254fd64828092533298a99ec64b8233f7
2016-03-22 13:16:26 -07:00
dcashman
8aacc03cc3 Set mmap_rnd_bits to maximum value.
am: 5d36813

* commit '5d36813dc8d3be3f62856cf5147b828a7a8594a7':
  Set mmap_rnd_bits to maximum value.
2016-03-22 19:31:21 +00:00
dcashman
5d36813dc8 Set mmap_rnd_bits to maximum value.
Also make sure it is above a minimum threshold, else abort.

Bug: 27681085
Change-Id: Id03ede491e5e013a2a7a090abb306d00cb74f901
2016-03-22 12:11:51 -07:00
Viorel Suman
4492dd2f9c Merge "Multiple consoles"
am: a01de8f

* commit 'a01de8fee1fa47ef4893d2017ac8c390c3c08a00':
  Multiple consoles
2016-03-21 16:55:58 +00:00
Viorel Suman
70daa67062 Multiple consoles
This CL allows enabling of multiple consoles. A service can be
mapped to a specific console by providing the optional argument,
IE "tty0", to "console" service attribute as follows:

service fbconsole /system/bin/sh
    class core
    console tty0
    disabled
    user shell
    group shell log readproc
    seclabel u:r:shell:s0

Bug: None
Change-Id: I3b24e7f6848bbe5c6475f11334c04ec536e6af88
Tracked-On: https://jira01.devtools.intel.com/browse/BP-289
Signed-off-by: Viorel Suman <viorel.suman@intel.com>
2016-03-21 08:50:01 -07:00
Viorel Suman
441c076630 Merge "Revert "Enable multiple consoles""
am: ba44383

* commit 'ba44383197c8d5e1ca6ad32b67837c9aaf7ee224':
  Revert "Enable multiple consoles"
2016-03-21 15:28:16 +00:00
Viorel Suman
efc7275172 Revert "Enable multiple consoles"
This reverts commit caafe5c620.

Bug: None
Change-Id: Iea2a80003d996ce542393242f87dc658ac6d01c9
Tracked-On: https://jira01.devtools.intel.com/browse/BP-289
Signed-off-by: Viorel Suman <viorel.suman@intel.com>
2016-03-21 11:21:19 +02:00
Viorel Suman
f50b165a4e Merge "Enable multiple consoles"
am: f3f7d64

* commit 'f3f7d64035ca7225437b54bed43e0282b0758682':
  Enable multiple consoles
2016-03-18 01:19:18 +00:00
Viorel Suman
caafe5c620 Enable multiple consoles
This CL allows enabling of multiple consoles. The expected format
of "androidboot.console" kernel parameter is a list of available
consoles, as follows:

  androidboot.console=tty0:ttyS0

A service can be mapped to a specific console by providing the
optional argument, IE "tty0", to "console" service attribute as follows:

service fbconsole /system/bin/sh
    class core
    console tty0
    disabled
    user shell
    group shell log readproc
    seclabel u:r:shell:s0

Bug: None
Change-Id: I3f8556425c8651bd121995869700f18b23365d55
Tracked-On: https://jira01.devtools.intel.com/browse/BP-289
2016-03-17 21:00:15 +02:00
Janis Danisevskis
0af61f0024 Merge "Leftovers of the SELinux policy update mechanism"
am: b9c0788806

* commit 'b9c078880644b51bc9e6c314eed157f230fce43c':
  Leftovers of the SELinux policy update mechanism
2016-03-13 14:53:00 +00:00
Janis Danisevskis
3d1dff2231 Leftovers of the SELinux policy update mechanism
Remove references to SELinux policy files in /data/security
from libselinux/android.c. In the process all code that is
apparently related to handling an alternate policy and/or
reloading the policy has been removed.

Bug: 26544104
Change-Id: I47bf76ac3c26c5d71f92a21ffac2b17ba14262ea
2016-03-11 17:47:30 +00:00
George Burgess IV
02f689e11a Merge "Cleanup uses of sprintf so we can deprecate it." am: 2c5b89a64a
am: 3368bdebba

* commit '3368bdebba02316710bafc5bce120eec388365fb':
  Cleanup uses of sprintf so we can deprecate it.
2016-03-08 07:41:39 +00:00
George Burgess IV
2c5b89a64a Merge "Cleanup uses of sprintf so we can deprecate it." 2016-03-08 04:14:06 +00:00
George Burgess IV
e7aa2b2c83 Cleanup uses of sprintf so we can deprecate it.
Also cleans up two instances of open() with useless mode params, and
changes a few uses of snprintf to use sizeof(buffer) instead of
hardcoded buffer sizes.

Change-Id: If11591003d910c995e72ad8f75afd072c255a3c5
2016-03-07 18:40:40 -08:00
Paul Lawrence
bdd5908766 Merge "Distinguish between unencrypted and unencryptable" into nyc-dev
am: 72d2e06f4e

* commit '72d2e06f4e10d0d11526eb9bb09a3ef23302729c':
  Distinguish between unencrypted and unencryptable
2016-03-07 16:56:51 +00:00
Paul Lawrence
1098aacde4 Distinguish between unencrypted and unencryptable
Set ro.crypto.state flag to unencrypted and unsupported accordingly

Bug: 18002358
Change-Id: I1f88ce9704c5505d7b63256e2ebe5f8441c79ad0
2016-03-04 15:52:33 -08:00
Nick Kralevich
3ae908e906 Merge "Mount selinuxfs when other filesystems are mounted" am: ad5dc479cd
am: 59c8d5e2bf

* commit '59c8d5e2bf31aa5340a563e74af74ad1e11b3e13':
  Mount selinuxfs when other filesystems are mounted
2016-03-03 22:00:23 +00:00
Nick Kralevich
3d9e273359 Mount selinuxfs when other filesystems are mounted
Be consistent when mounting filesystems, and mount selinuxfs
at the same time other filesystems are mounted. In particular,
this ensures that a /sys/fs/selinux/null is available at early
boot, avoiding an unnecessary mknod call.

Change-Id: I01e6b3900f48b4cb3f12d8a928e1e95911524252
2016-03-03 11:26:24 -08:00
Nick Kralevich
9bcfd64b59 init: harden socket creation against symlinks
Instead of using chown, use the symlink safe lchown.

Instead of using chmod, use the symlink safe fchmodat
with AT_SYMLINK_NOFOLLOW.

Fix a bug where the SELinux filesystem creation context may
not be restored, and some memory not freed, if bind() fails.

Check the return values from the chown/chmod calls and unlink
the files if it ever fails.

(cherrypicked from commit ab5629c197)

Bug: 27337831
Change-Id: I28c5f4dee55aa706437eb51ad403c1fbf56138de
2016-02-25 12:38:51 -08:00
Yusuke Sato
c4c8bf4a9c Merge "Use ro.debuggable instead of ro.build.type" am: 37c90df931
am: 4e30b63fc6

* commit '4e30b63fc6049ec728d607b49632f287128074c7':
  Use ro.debuggable instead of ro.build.type
2016-02-25 19:35:52 +00:00
Yusuke Sato
246b0fd0d9 Use ro.debuggable instead of ro.build.type
Change-Id: I4d7c8c353ff47fbeee065b2c4fdd984768d0da00
2016-02-25 10:53:55 -08:00
Nick Kralevich
17e5b23a95 Merge "init: harden socket creation against symlinks" into nyc-dev
am: 53e56b9473

* commit '53e56b9473819fb5058e85e866ac493aaccbae81':
  init: harden socket creation against symlinks
2016-02-25 06:50:49 +00:00
Nick Kralevich
ab5629c197 init: harden socket creation against symlinks
Instead of using chown, use the symlink safe lchown.

Instead of using chmod, use the symlink safe fchmodat
with AT_SYMLINK_NOFOLLOW.

Fix a bug where the SELinux filesystem creation context may
not be restored, and some memory not freed, if bind() fails.

Check the return values from the chown/chmod calls and unlink
the files if it ever fails.

Bug: 27337831
Change-Id: I3343786f5a4eefda7bbb8317f2eca16bd21003c0
2016-02-24 15:50:52 -08:00
James Hawkins
22b6f7a559 resolve merge conflicts of 0f5d443d0c to nyc-dev-plus-aosp
Change-Id: I850bda0808ae17ade5bc0e667211a599d284d6e3
2016-02-19 11:10:30 -08:00
James Hawkins
588a2cad7f system/core: Cleanup direct calls to opendir by containing in a
std::unique_ptr.

Bug: 26643633
Change-Id: Ia3491fdbff086558da694ae949cf08e4c89d0307
2016-02-18 14:52:46 -08:00
Jeff Sharkey
c895f11cf1 Merge "User 0 directories are created by vold now." 2016-02-05 21:01:21 +00:00
Elliott Hughes
be49484810 Merge "init: fix writepid wrong pid written in file(s)" am: 718625010d
am: 880200c9bb

* commit '880200c9bbf8b283b0f6351c1c052bc00d69697d':
  init: fix writepid wrong pid written in file(s)
2016-02-05 19:06:37 +00:00
Anestis Bechtsoudis
b702b46f68 init: fix writepid wrong pid written in file(s)
When child (pid==0) executes fork branch 'pid_str'
will always be 0 writting wrong value to file(s).
Fix by utilizing getpid() to obtain correct pid.

Tracker link provides some insight on why use cases
aren't broken.

Bug: https://code.google.com/p/android/issues/detail?id=200392

Change-Id: I29989365a8bac94502c090918fa30e5cc88eb1ea
Signed-off-by: Anestis Bechtsoudis <anestis@census-labs.com>
2016-02-05 16:49:28 +02:00
Jeff Sharkey
3b9c83a0f6 User 0 directories are created by vold now.
This ensures that all users on device follow a consistent path for
setup and validation of encryption policy.

Also add remaining user-specific directories and fix linking order.

Bug: 25796509
Change-Id: I8c2e42a78569817f7f5ea03f54b743a6661fdb9c
2016-02-04 15:26:23 -07:00
Paul Lawrence
1446f0f318 Merge "Remove code to handle non-default file encryption" 2016-02-02 23:16:02 +00:00
Elliott Hughes
edbc3af294 Merge "init: Fix load_firmware error" am: f330e5462d
am: de0af89c82

* commit 'de0af89c8253ecda179c35cb8c62c592b91e46ae':
  init: Fix load_firmware error
2016-02-02 22:54:32 +00:00
Paul Lawrence
69080180ce Remove code to handle non-default file encryption
Change-Id: I6d986853929c0237c0d958329b8e9aab47907a00
2016-02-02 10:34:40 -08:00
Paul Crowley
5949745534 On FDE devices, initialize user 0
Fix ugly special cases for user 0: initialize them explicitly.

Bug: 26704408
Change-Id: I1b8536b9e5e87ea98b4009a309f2e22c56006651
2016-02-01 16:44:46 +00:00
Biao Lu
dc848566a1 init: Fix load_firmware error
In function 'load_firmware', parameter 'buf' passed to 'write'
is wrong. To fix it, use android::base::WriteFully to replace.

Change-Id: I13f79bdc9be9e5eb669f6bd975535b1dce965ef0
Signed-off-by: Biao Lu <biao.lu@intel.com>
2016-02-01 10:10:28 +08:00
Tom Cherry
6ddde53e8e Merge "init: Update readme.txt to reflect recent changes to init" am: d401eba04c
am: 9262e5fdcd

* commit '9262e5fdcd77e296bd71dbc1c9448a347a851789':
  init: Update readme.txt to reflect recent changes to init
2016-01-25 18:22:24 +00:00
Tom Cherry
1fb20b8377 init: Update readme.txt to reflect recent changes to init
Best practice for services that reside on the system, vendor, and odm
partitions is to have a corresponding init .rc file in the
/{system,vendor,odm}/etc/init directory, which contains its service
entry and any related actions.

Change-Id: I26204f9a0f09ce8069f3791ccd9ee61d164a048f
2016-01-23 05:23:39 +00:00
Paul Crowley
65f54a8e19 Merge "Remove no-longer-needed crypto init builtins" 2016-01-21 11:16:33 +00:00
Hung-ying Tyan
25778dcf5e Merge "Allow paths of .rc files to be specified at mount_all" am: e7f9779886
am: 436a8aa9de

* commit '436a8aa9de9c90a8ee95e02e97bf65e50c80d4f4':
  Allow paths of .rc files to be specified at mount_all
2016-01-21 05:05:09 +00:00
Hung-ying Tyan
e7f9779886 Merge "Allow paths of .rc files to be specified at mount_all" 2016-01-21 04:12:23 +00:00
Hung-ying Tyan
dc738eaf15 Allow paths of .rc files to be specified at mount_all
In current implementation, the mount_all command imports all .rc files
under /{system,vendor,odm}/etc/init/ after mouting filesystems is complete.
There's a need from ODMs to import different .rc files under different boot
modes (e.g., factory mode). Without this support, they will have to fiddle
around the init implementation.

This commit makes mount_all import the .rc files/directories specified
as additional arguments. If no path is given, the original ones are applied
the same way as the current implementation.

BUG: 26549689
Change-Id: Ie67ce13dde4c440ff8bf534826bc392c882a433f
2016-01-21 09:35:43 +08:00
Paul Crowley
558d8f4364 Remove no-longer-needed crypto init builtins
Changes to the way FBE works to support lifecycles mean that these
commands aren't needed any more.

Bug: 22358539
Change-Id: Id73339e0aa8070dd688f35b5d59de75236961395
2016-01-20 11:20:23 +00:00
Nick Kralevich
974bf66088 Merge "logging: avoid unnecessary printfs" am: 542a511f87
am: 5644112b7e

* commit '5644112b7e05372fcda105fa621630c12ec29a6e':
  logging: avoid unnecessary printfs
2016-01-19 18:10:37 +00:00
Nick Kralevich
5db8d6aafa logging: avoid unnecessary printfs
Don't spend CPU cycles formatting a bunch of strings if we're
just going to throw them away later. Maybe make booting faster.

Change-Id: I4d8eb99fb3fa873ca91cf776933d0ad01988abf5
2016-01-16 16:20:24 -08:00
Tom Cherry
363d7cc205 Merge "Remove special case handling of "ro." properties permissions" am: b45f8179be
am: 44e06f5f00

* commit '44e06f5f00c3e0412c85ee5f515ccd0f83abbbc2':
  Remove special case handling of "ro." properties permissions
2016-01-13 18:52:19 +00:00
Tom Cherry
c787cf291a Remove special case handling of "ro." properties permissions
Currently, properties that begin with "ro." are special cased to skip
over the "ro." part of the prefix before matching with entries in
property_contexts.  This is not strictly needed however and it is
causing complications with the separated prop files work from Bug
21852512, so it is now removed.

Bug 26425619

Change-Id: I3cd14fa2176f96b3931e5f6a50c4a7bcd3af3da6
2016-01-11 14:00:40 -08:00
Colin Cross
51aaecea35 Merge "libinit: depend on libselinux" am: 710056efb8
am: f97f11f8c1

* commit 'f97f11f8c14e3efbd3e3840ba8ba1ea8c027e8f7':
  libinit: depend on libselinux
2016-01-08 20:57:18 +00:00
Bertrand Simonnet
530c8c75e2 Merge "init: Allows shutting down cleanly." am: f9f4ee8b72
am: a8c931b7f5

* commit 'a8c931b7f57c8ce74f520d591e99bb367f91dc81':
  init: Allows shutting down cleanly.
2016-01-08 20:54:11 +00:00
Colin Cross
710056efb8 Merge "libinit: depend on libselinux" 2016-01-08 20:49:42 +00:00
Bertrand SIMONNET
b7e03e82b8 init: Allows shutting down cleanly.
When ro.build.shutdown_timeout is set, init will send a SIGTERM signal to
all services on reboot. The normal shutdown process will continue once
all services have exited or after the shutdown timeout
(ro.build.shutdown_timeout).

If ro.build.shutdown_timeout is not set, we assume a 0s timeout.

Bug: 26216447
Test: manual: Ask to reboot. All services exit cleanly.

Change-Id: If921f6e8d87211e500ac9fa86f3e1eabe02d18cf
2016-01-08 11:12:15 -08:00
Colin Cross
c1caf88f25 libinit: depend on libselinux
libinit uses headers from libselinux, add a LOCAL_STATIC_LIBRARIES
dependency.

Change-Id: I6b0a3183058c8593ef40e58abbf2d72bcce59e95
2015-12-21 16:14:08 -08:00
Tom Cherry
bcac4a98d4 Merge "Update init documentation to reflect fs_config changes" am: b11afd7741
am: 80625ed1c3

* commit '80625ed1c3674ab8abf56a7bacd5151215215020':
  Update init documentation to reflect fs_config changes
2015-12-11 14:19:10 -08:00
Tom Cherry
dbddb40c95 Update init documentation to reflect fs_config changes
Change-Id: I00296d90c44af369a51ecb5cbb667567328f0053
2015-12-11 13:20:38 -08:00
Sami Tolvanen
6401e61a6a Merge "Set up dm-verity in EIO mode instead of logging mode" am: 0d1214c68e
am: 42a86f8d1e

* commit '42a86f8d1e918356e86d4eb3fb2444a8c42d25ff':
  Set up dm-verity in EIO mode instead of logging mode
2015-12-10 15:43:02 -08:00
Sami Tolvanen
0d1214c68e Merge "Set up dm-verity in EIO mode instead of logging mode" 2015-12-10 20:12:49 +00:00
Paul Lawrence
c5733cfadb Add createuserkey
Needed so we can make the user0 key on first boot

Change-Id: I4699dbf2efdec44bb09bc4cfa7eeb59e56cb93ab
2015-12-09 15:34:18 -08:00
Sami Tolvanen
9e9efcadc5 init: set ro.boot.flash.locked from ro.boot.verifiedbootstate
If ro.oem_unlock_supported is specified for the device and it supports
verified boot, export lock status in ro.boot.flash.locked.

Bug: 26039090
Change-Id: Ie7844aeb458c97944c72d46ea962b9cfb0a7875d
2015-12-09 10:09:11 +00:00
Tom Cherry
1563d6546c Remove property_area_initialized
This is deadcode as property_init() will only ever be called once and
the only remaining caller of properties_initialized() is
Service::NotifyStateChange() which can only be called after properties
have been initialized.

Change-Id: Ie071af84fcdbead72d259890fc8fb8db624282e7
2015-12-07 17:53:39 -08:00
Tom Cherry
c68998441c Merge "Remove ANDROID_PROPERTY_WORKSPACE" 2015-12-08 01:29:53 +00:00
Elliott Hughes
4f71319df0 Track rename of base/ to android-base/.
Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
2015-12-04 22:00:26 -08:00
Tom Cherry
265f525e21 Remove ANDROID_PROPERTY_WORKSPACE
Bug 23290008

Change-Id: I95babe735444ada10c67594ace700cae5d1ec0b3
2015-12-04 14:11:02 -08:00
Tom Cherry
6036114f93 Abort if __system_property_area_init fails
If __system_property_area_init() fails, there is a fundamental issue
with the system and we should abort from init.

Bug: 21852512
Change-Id: I05d7978ba3bcc347027a6d9443de7cdd229033d2
2015-12-02 11:29:12 -08:00
Sami Tolvanen
90f52df257 Set up dm-verity in EIO mode instead of logging mode
If the device is corrupted, set up dm-verity in EIO mode instead of
logging mode. This prevents corrupted blocks from being returned to
user space. Note that restart mode is used by default and a warning
will be displayed to the user after corruption is first detected.

Bug: 19277516
Change-Id: I38966d73eb814836bc34b4bad1192583e5010b36
2015-12-02 14:38:01 +00:00
Tom Cherry
e36a85cdcc restorecon /property_contexts
/property_contexts exists before selinux policies are loaded, so we must
restorecon before other processes can access it

Bug: 21852512
Change-Id: Ie983caac635eb928ab19eea996a5625f3673de39
2015-12-01 17:47:35 -08:00
Nick Kralevich
83ccb1c76b init: Don't ignore setsockcreatecon errors
The init language supports setting the creation context of a socket
as the 6th argument to the socket keyword. For example, in the
following service, the context associated with the netd socket
is u:r:netd:s0

service netd /system/bin/netd
    class main
    socket netd stream 0660 root system u:r:netd:s0
    socket dnsproxyd stream 0660 root inet
    socket mdns stream 0660 root system
    socket fwmarkd stream 0660 root inet

The 6 argument form of the socket statement is rarely if ever used,
since the init code supplies a sensible default.

Currently, there's no error checking on the value supplied as
the 6th argument. For example, if you have the following socket
statement:

  socket netd stream 0660 root system graphics

a socket will attempt to get created with an invalid "graphics"
context. When setsockcreatecon fails, it retains the default socket
creation context, which for init is u:r:init:s0. This results in a
socket being created which is in an unexpected context.

Check the return value from the setsockcreatecon() call. If an
invalid context is specified, return early and don't subsequently
attempt to create the socket with the default context.

Bug: 25851205
Change-Id: Ic66cd6f7efe3897fb247b587ddeac5d35e1602b7
2015-11-23 17:09:49 -08:00
Nick Kralevich
2d8f1d4c47 Merge "Enable hidepid=2 on /proc" 2015-11-09 20:05:22 +00:00
Nick Kralevich
c39ba5ae32 Enable hidepid=2 on /proc
Add the following mount options to the /proc filesystem:

  hidepid=2,gid=3009

This change blocks /proc access unless you're in group 3009
(aka AID_READPROC).

Please see
  https://github.com/torvalds/linux/blob/master/Documentation/filesystems/proc.txt
for documentation on the hidepid option.

hidepid=2 is preferred over hidepid=1 since it leaks less information
and doesn't generate SELinux ptrace denials when trying to access
/proc without being in the proper group.

Add AID_READPROC to processes which need to access /proc entries for
other UIDs.

Bug: 23310674
Change-Id: I22bb55ff7b80ff722945e224845215196f09dafa
2015-11-09 09:08:46 -08:00
Rom Lemarchand
1dcf325844 init: skip "name" DT entry
DTs have a standard "name" entry which is not to be
turned into an android property, so skip it.

Change-Id: I79f6638b4123358c8d80510c1666cf5d4561160e
2015-11-08 17:51:50 -08:00
Daniel Cashman
27ff12443d Merge "init/adb: correct static lib dependencies for libselinux"
am: 38aee48fc6

* commit '38aee48fc695c25e15435e4ef235c8bc2e0afde9':
  init/adb: correct static lib dependencies for libselinux
2015-10-22 23:12:22 +00:00
Daniel Cashman
38aee48fc6 Merge "init/adb: correct static lib dependencies for libselinux" 2015-10-22 23:03:51 +00:00
William Roberts
bd2d961cc2 init/adb: correct static lib dependencies for libselinux
Now that libselinux uses libpackagelistparser, in order
for libpackagelistparser to be properly statically linked
liblog must come after libselinux for all the liblog
references to be defined in libpackagelistparser which
is included in libselinux. This patch corrects that order.

Change-Id: I7aee10c9395310919779ed2463aab6b2f8b380cc
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-10-22 15:21:26 -07:00
Dan Willemsen
eea68c6f98 Merge "Remove __DATE__/__TIME__ from init and debuggerd"
am: 512b0e60b4

* commit '512b0e60b4fb33ec5535c1784a99a27539787790':
  Remove __DATE__/__TIME__ from init and debuggerd
2015-10-22 22:00:20 +00:00
Dan Willemsen
30622bbb20 Remove __DATE__/__TIME__ from init and debuggerd
Keeping these means that every build has different init and debuggerd
binaries, even if the source was the same. So OTAs that don't touch
these sources would still need to update the binaries.

Both of these messages are only informational, so can be safely removed.
Bootchart already encodes build-specific information from the system
properties.

Bug: 24204119
Change-Id: I7ebd65a20a3e031e7528c9f741616e20b3cd7446
2015-10-22 13:12:18 -07:00
Sami Tolvanen
234aedfaf1 am b8cc70a9: Merge "Error correction: Use libfec in fs_mgr"
* commit 'b8cc70a94bcbf7b920465d92da6889f0db6d6fa5':
  Error correction: Use libfec in fs_mgr
2015-10-16 05:53:55 +00:00
Sami Tolvanen
99e3a927e8 Error correction: Use libfec in fs_mgr
Use libfec to read and parse verity metadata to protect against data
corruption.

Bug: 21893453
Change-Id: I3a3543e0d999316707302b3be8735a7133d22946
2015-10-14 22:12:04 +01:00
Sami Tolvanen
415f1bdcbf am 4bd3148e: Merge "Revert "Error correction: Use libfec in fs_mgr""
* commit '4bd3148e0f509efb75256a01959c9c1af9ffa845':
  Revert "Error correction: Use libfec in fs_mgr"
2015-10-14 19:52:24 +00:00
Sami Tolvanen
0923453462 Revert "Error correction: Use libfec in fs_mgr"
This reverts commit 3de3a0f351.

Change-Id: I1f121cbc4431b8d8ff146eab29832a8dda1eb8ba
2015-10-14 19:46:16 +00:00
Sami Tolvanen
81ef65827c am a2cfddd3: Merge "Error correction: Use libfec in fs_mgr"
* commit 'a2cfddd37e950ed75d72e6a968d7be974aac405f':
  Error correction: Use libfec in fs_mgr
2015-10-14 16:40:33 +00:00
Sami Tolvanen
3de3a0f351 Error correction: Use libfec in fs_mgr
Use libfec to read and parse verity metadata to protect against data
corruption.

Bug: 21893453
Change-Id: Ieee6a1441e2f68148ba635235216e36c69b13db1
2015-10-13 15:53:25 +01:00
Nick Kralevich
545b7c9e39 am 2fb90dc8: Merge changes from topic \'userspace-audit\'
* commit '2fb90dc8b2b590e674c5e433e8bf3d3f08a887c8':
  debuggerd: audit pid, uid and gid on SE Linux denial
  property_service: log pid,uid and gid of setprop client
2015-10-10 20:11:08 +00:00
Nick Kralevich
2fb90dc8b2 Merge changes from topic 'userspace-audit'
* changes:
  debuggerd: audit pid, uid and gid on SE Linux denial
  property_service: log pid,uid and gid of setprop client
2015-10-10 20:07:24 +00:00
Elliott Hughes
17ac480df2 am 55793400: Merge "init shouldn\'t call DumpState by default."
* commit '55793400f20e5160eaab6c85e5df621f48373ec2':
  init shouldn't call DumpState by default.
2015-10-09 21:30:35 +00:00
Elliott Hughes
1946d3bca8 init shouldn't call DumpState by default.
The cost of generating and throwing away a bunch of stuff that no one
normally sees is high enough to be worth avoiding.

Here's AOSP ToT on N9...

 init: (Parsing /system/etc/init/atrace.rc took 0.0112s.)
 init: (Parsing /system/etc/init/bootanim.rc took 0.0094s.)
 init: (Parsing /system/etc/init/crash_reporter.rc took 0.0103s.)
 init: (Parsing /system/etc/init/debuggerd.rc took 0.0090s.)
 init: (Parsing /system/etc/init/debuggerd64.rc took 0.0085s.)
 init: (Parsing /system/etc/init/drmserver.rc took 0.0078s.)
 init: (Parsing /system/etc/init/dumpstate.rc took 0.0073s.)
 init: (Parsing /system/etc/init/gatekeeperd.rc took 0.0063s.)
 init: (Parsing /system/etc/init/installd.rc took 0.0067s.)
 init: (Parsing /system/etc/init/keystore.rc took 0.0060s.)
 init: (Parsing /system/etc/init/lmkd.rc took 0.0060s.)
 init: (Parsing /system/etc/init/logcatd.rc took 0.0059s.)
 init: (Parsing /system/etc/init/logd.rc took 0.0068s.)
 init: (Parsing /system/etc/init/mdnsd.rc took 0.0057s.)
 init: (Parsing /system/etc/init/mediaserver.rc took 0.0064s.)
 init: (Parsing /system/etc/init/metrics_daemon.rc took 0.0063s.)
 init: (Parsing /system/etc/init/mtpd.rc took 0.0055s.)
 init: (Parsing /system/etc/init/netd.rc took 0.0066s.)
 init: (Parsing /system/etc/init/perfprofd.rc took 0.0057s.)
 init: (Parsing /system/etc/init/racoon.rc took 0.0054s.)
 init: (Parsing /system/etc/init/rild.rc took 0.0061s.)
 init: (Parsing /system/etc/init/servicemanager.rc took 0.0063s.)
 init: (Parsing /system/etc/init/surfaceflinger.rc took 0.0061s.)
 init: (Parsing /system/etc/init/uncrypt.rc took 0.0068s.)
 init: (Parsing /system/etc/init/vdc.rc took 0.0065s.)
 init: (Parsing /system/etc/init/vold.rc took 0.0063s.)

0.0112+0.0094+0.0103+0.0090+0.0085+0.0078+0.0073+0.0063+0.0067+0.0060+
0.0060+0.0059+0.0068+0.0057+0.0064+0.0063+0.0055+0.0066+0.0057+0.0054+
0.0061+0.0063+0.0061+0.0068+0.0065+0.0063 = 0.1809

And here it is again with the logging disabled:

 init: (Parsing /system/etc/init/atrace.rc took 0.0021s.)
 init: (Parsing /system/etc/init/bootanim.rc took 0.0006s.)
 init: (Parsing /system/etc/init/crash_reporter.rc took 0.0007s.)
 init: (Parsing /system/etc/init/debuggerd.rc took 0.0004s.)
 init: (Parsing /system/etc/init/debuggerd64.rc took 0.0005s.)
 init: (Parsing /system/etc/init/drmserver.rc took 0.0005s.)
 init: (Parsing /system/etc/init/dumpstate.rc took 0.0005s.)
 init: (Parsing /system/etc/init/gatekeeperd.rc took 0.0005s.)
 init: (Parsing /system/etc/init/installd.rc took 0.0005s.)
 init: (Parsing /system/etc/init/keystore.rc took 0.0013s.)
 init: (Parsing /system/etc/init/lmkd.rc took 0.0006s.)
 init: (Parsing /system/etc/init/logcatd.rc took 0.0013s.)
 init: (Parsing /system/etc/init/logd.rc took 0.0007s.)
 init: (Parsing /system/etc/init/mdnsd.rc took 0.0005s.)
 init: (Parsing /system/etc/init/mediaserver.rc took 0.0009s.)
 init: (Parsing /system/etc/init/metrics_daemon.rc took 0.0008s.)
 init: (Parsing /system/etc/init/mtpd.rc took 0.0011s.)
 init: (Parsing /system/etc/init/netd.rc took 0.0005s.)
 init: (Parsing /system/etc/init/perfprofd.rc took 0.0005s.)
 init: (Parsing /system/etc/init/racoon.rc took 0.0005s.)
 init: (Parsing /system/etc/init/rild.rc took 0.0005s.)
 init: (Parsing /system/etc/init/servicemanager.rc took 0.0005s.)
 init: (Parsing /system/etc/init/surfaceflinger.rc took 0.0005s.)
 init: (Parsing /system/etc/init/uncrypt.rc took 0.0005s.)
 init: (Parsing /system/etc/init/vdc.rc took 0.0005s.)
 init: (Parsing /system/etc/init/vold.rc took 0.0006s.)

0.0021+0.0006+0.0007+0.0004+0.0005+0.0005+0.0005+0.0005+0.0005+0.0013+
0.0006+0.0013+0.0007+0.0005+0.0009+0.0008+0.0011+0.0005+0.0005+0.0005+
0.0005+0.0005+0.0005+0.0005+0.0005+0.0006 = 0.0181

It's less than a second, but one problem is that the cost of the current
dumping is proportional to the number of init.rc files, so the more
cleanly you factor things, the more it would cost.

Change-Id: Id96f59e7d0b082d8cfdba4bdbff43a922ba4eeee
2015-10-09 14:03:14 -07:00
William Roberts
d7aea443d9 property_service: log pid,uid and gid of setprop client
When auditing setprop denials, it is often unclear of who the process is
in a multi-process domain. To help identify the invoker, log the pid, uid,
and gid of the caller.

Before:
avc:  denied  { set } for property=wifi.xxx ...

After:
avc:  denied  { set } for property=wifi.xxx pid=30691 uid=123 gid=345 ...

Change-Id: I5cdcb3d18fbd52e0987b5e1497b9f6620c6c742a
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-10-05 11:39:56 -07:00
Yasuhiro Matsuda
4bc228e317 am f656b683: am ada7fa06: Merge "Fix perfboot.py to work with the recent change."
* commit 'f656b683a6a09dd2ed2934de2e1d5c2044c1fbe2':
  Fix perfboot.py to work with the recent change.
2015-09-16 02:58:28 +00:00
Yasuhiro Matsuda
f656b683a6 am ada7fa06: Merge "Fix perfboot.py to work with the recent change."
* commit 'ada7fa063e4d8e2b8014a138bdf58d7729ce0ee9':
  Fix perfboot.py to work with the recent change.
2015-09-16 02:49:31 +00:00
Yasuhiro Matsuda
6ee194013a Fix perfboot.py to work with the recent change.
device.shell() was changed to return a (stdout, stderr) tuple in
the following CL.

https://android-review.googlesource.com/170420

This CL fixes perfboot.py to work with the return value.

Change-Id: I85d72fc63c1f96257fb19c3051482991a7b4049d
2015-09-15 14:00:10 +09:00
Tom Cherry
a2bdc2d91e am f23ef77f: am 4aa9dbab: Merge "init: Update readme.txt to reflect recent changes to init."
* commit 'f23ef77ffe4700221bc47c70ea1b7f1473d0d902':
  init: Update readme.txt to reflect recent changes to init.
2015-09-02 19:48:22 +00:00
Tom Cherry
f23ef77ffe am 4aa9dbab: Merge "init: Update readme.txt to reflect recent changes to init."
* commit '4aa9dbab6f78a1acae02d39b96fa572fbfc7b6ed':
  init: Update readme.txt to reflect recent changes to init.
2015-09-02 19:37:35 +00:00
Tom Cherry
3be66edc59 init: Update readme.txt to reflect recent changes to init.
Updates are as follows:

A detailed explanation of event triggers and property triggers
including how they can now be used

A new section describing .rc files, their locations, and the
intentions for each of these locations

A new section describing the import keyword and how it is not a
command but rather its own section

Removal of deprecated or incorrect text

Change-Id: If0a37375ac92a857900f3303ada4ba742360daff
2015-09-01 15:32:33 -07:00
Tom Cherry
af20a7cb12 resolved conflicts for merge of cda81d01 to mnc-dr-dev-plus-aosp
Change-Id: I747b279bc49f9f82b8f8859c49b3fc2a4e3b4977
2015-09-01 15:30:56 -07:00
Tom Cherry
cda81d01c6 am 54c70ca1: Merge "init: Use classes for parsing and clean up memory allocations"
* commit '54c70ca15660529466b5b4e091209a20a3e75dff':
  init: Use classes for parsing and clean up memory allocations
2015-09-01 21:42:01 +00:00
Tom Cherry
b7349902a9 init: Use classes for parsing and clean up memory allocations
Create a Parser class that uses multiple SectionParser interfaces to
handle parsing the different sections of an init rc.

Create an ActionParser and ServiceParser that implement SectionParser
and parse the sections corresponding to Action and Service
classes.

Remove the legacy keyword structure and replace it with std::map's
that map keyword -> (minimum args, maximum args, function pointer) for
Commands and Service Options.

Create an ImportParser that implements SectionParser and handles the
import 'section'.

Clean up the unsafe memory handling of the Action class by using
std::unique_ptr.

Change-Id: Ic5ea5510cb956dbc3f78745a35096ca7d6da7085
2015-09-01 12:26:02 -07:00
Tom Cherry
25c22bb9e7 am 08a6775f: am 2d8be6c2: Merge "init: import init rc scripts from file systems after mount_all"
* commit '08a6775f8cdadf48e7b5f4f4d710180fda43b2b6':
  init: import init rc scripts from file systems after mount_all
2015-08-21 21:47:03 +00:00
Tom Cherry
d64bf33890 am 08a6775f: am 2d8be6c2: Merge "init: import init rc scripts from file systems after mount_all"
* commit '08a6775f8cdadf48e7b5f4f4d710180fda43b2b6':
  init: import init rc scripts from file systems after mount_all
2015-08-21 21:44:37 +00:00
Tom Cherry
c7676b5037 am 54b22ca2: am ff5be396: Merge changes from topic \'init-rc-breakup\'
* commit '54b22ca2488e4901265c99a42b5c5e0725a99199':
  init: Queue Triggers instead of Actions
  bundle init.rc contents with its service
2015-08-21 18:24:18 +00:00
Tom Cherry
60eb73ed6a am 54b22ca2: am ff5be396: Merge changes from topic \'init-rc-breakup\'
* commit '54b22ca2488e4901265c99a42b5c5e0725a99199':
  init: Queue Triggers instead of Actions
  bundle init.rc contents with its service
2015-08-21 18:20:22 +00:00
Tom Cherry
b8dd0272e5 init: import init rc scripts from file systems after mount_all
Import /{system,vendor,odm}/etc/init/... after file systems are mounted

Bug: 23186545
Change-Id: Idb0cae9773f904c0330054c8b3e31eb87b2fb7cb
2015-08-21 10:14:43 -07:00
Tom Cherry
cb716f976b init: Queue Triggers instead of Actions
When init queues a trigger, it actually enqueues all of the Actions
that match with that given trigger.  This works currently because
all init scripts are loaded and therefore all Actions are available
before init starts queueing any triggers.

To support loading init scripts after init has started queueing
triggers, this change enqueues Trigger objects instead of their
matching Actions.  Each Trigger object then matches its associated
Actions during its execution.

Additionally, this makes a few cosmetic clean ups related to triggers.

Bug: 23186545
Change-Id: I5d177458e6df1c4b32b1072cf77e87ef952c87e4
2015-08-21 10:14:43 -07:00
Yusuke Sato
2ef82cffad am d1b11a04: am e656be33: Merge "Add |opts| argument to android_fork_execvp_ext"
* commit 'd1b11a04903be74ba6a47307d8c3ef2731e3f4ab':
  Add |opts| argument to android_fork_execvp_ext
2015-08-19 22:31:08 +00:00
Yusuke Sato
9962b04d00 am d1b11a04: am e656be33: Merge "Add |opts| argument to android_fork_execvp_ext"
* commit 'd1b11a04903be74ba6a47307d8c3ef2731e3f4ab':
  Add |opts| argument to android_fork_execvp_ext
2015-08-19 22:20:29 +00:00
Yusuke Sato
d81c3c6c45 Add |opts| argument to android_fork_execvp_ext
to allow the caller to send data to the child's stdin.

Bug: 21725996
Change-Id: I818f5cf61045286c8d64a91b6d50f05740329be1
2015-08-19 11:00:37 -07:00
Yusuke Sato
c52f66b548 am 885400fd: am 4d09db9d: Merge "perfboot.py: Add --end-tag option"
* commit '885400fdbabf9850bd680725c591cc00f2aa71fe':
  perfboot.py: Add --end-tag option
2015-08-18 05:55:34 +00:00
Yusuke Sato
8e9a1ae593 am 885400fd: am 4d09db9d: Merge "perfboot.py: Add --end-tag option"
* commit '885400fdbabf9850bd680725c591cc00f2aa71fe':
  perfboot.py: Add --end-tag option
2015-08-18 05:55:28 +00:00
Yusuke Sato
3966ebb74d perfboot.py: Add --end-tag option
The current behavior, which is to use tags[-1] for end_tag, is good
enough in most cases, but sometime it makes more sense to use a
different one as end_tag.

For example, when optimizing APK scanning code in package manager,
using 'boot_progress_pms_scan_end' as end_tag would give us quicker
benchmark iterations as well as more relevant numbers possibly with
a smaller standard deviation.

Change-Id: Ic6371c936b36d1d87e9742502fd8958682a3b7d5
2015-08-17 22:07:34 -07:00
Nick Kralevich
d717f86a3e am 64c30a79: am 084c00b8: Merge "init: add LOCAL_SANITIZE := integer"
* commit '64c30a79def4dc29749a86c00a970243a2a45f1e':
  init: add LOCAL_SANITIZE := integer
2015-08-17 01:15:17 +00:00
Nick Kralevich
d7f0a73f8d am 64c30a79: am 084c00b8: Merge "init: add LOCAL_SANITIZE := integer"
* commit '64c30a79def4dc29749a86c00a970243a2a45f1e':
  init: add LOCAL_SANITIZE := integer
2015-08-17 01:15:05 +00:00
Nick Kralevich
084c00b804 Merge "init: add LOCAL_SANITIZE := integer" 2015-08-16 15:37:35 +00:00
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