Commit graph

968 commits

Author SHA1 Message Date
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