Commit graph

601 commits

Author SHA1 Message Date
Nick Kralevich
ae76f6dbcf init: call restorecon on /sys
Not all files on /sys are not getting labeled properly. Fix them.

Change-Id: I9dcff76354e7f50d41f1b6e702836cfbbc149278
2013-09-03 15:55:58 -07:00
Nick Kralevich
935bd3e315 init: allow disabling selinux via a kernel command line
Create a new "androidboot.selinux" option, to control how userspace
handles SELinux. This kernel command line can have three options:

* disabled
* permissive
* enforcing

"disabled" completely disables userspace support for SELinux. No
policy is ever loaded, nor is the SELinux filesystem /sys/fs/selinux
ever mounted.

"permissive" loads the SELinux policy, but puts SELinux into
permissive mode. SELinux policy violations are logged, but not rejected.

"enforcing", the default, loads the SELinux policy, and places
SELinux into enforcing mode. Policy violations are rejected.

This change addresses post review comments for change
b710ed21de .

Change-Id: I912583db8e6a0e9c63380de32ad8ffc47a8a440f
2013-09-03 15:55:00 -07:00
Nick Kralevich
56fa0ac6b6 init: move SELinux into enforcing mode.
When init starts up, immediately put SELinux into enforcing mode.

This is currently a no-op. We currently have everything in the
unconfined domain, so this should not break anything.
(if it does, I'll roll it back immediately)

If the kernel doesn't have SELinux support compiled in, then
don't try loading a policy and continue without SELinux protections.

Change-Id: Id0279cf82c545ea0f7090137b7566a5bc3ddd641
2013-09-03 15:54:15 -07:00
Dima Zavin
c3c03f12ad am 28e52c81: am b35f68a6: Merge "init: load factory properties"
* commit '28e52c816d06d78fa823be2d310d9f4c25012c8f':
  init: load factory properties
2013-08-28 14:14:59 -07:00
Dima Zavin
b35f68a697 Merge "init: load factory properties" 2013-08-28 21:08:43 +00:00
Nicolas SUET
841859f79f [GNSS] Add AID_GPS to property user white list
Add "gps." and "persist.gps." to property_perms white list.

Change-Id: I7177170676d774c87e08d1548f5264ac27cba3ff
Orig-Change-Id: I7a94caa26be4aefd2fe4f155908e2f8f09858bee
Signed-off-by: Nicolas SUET <nicolas.suet@intel.com>
Signed-off-by: jerome Pantaloni <jeromex.pantaloni@intel.com>
Signed-off-by: Jian Luo <jian.luo@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 118091
2013-08-26 16:20:18 -04:00
Colin Cross
b69f863455 am 0cbaed42: am a8ba1f2f: Merge "Add support for socket security context specification."
* commit '0cbaed4211b514dd2aaa4d28f8936ba58e83c6a5':
  Add support for socket security context specification.
2013-08-23 18:40:12 -07:00
Colin Cross
a8ba1f2f0b Merge "Add support for socket security context specification." 2013-08-24 00:12:03 +00:00
Colin Cross
30caffc025 resolved conflicts for merge of a1af5cf6 to klp-dev-plus-aosp
Change-Id: I08e9898940f7cdd466469b76760807cc5d5c67e4
2013-08-23 14:39:39 -07:00
Stephen Smalley
8348d279c7 Add support for socket security context specification.
Add an optional argument to the socket option for specifying
a SELinux security context for the socket.  Normally the socket
security context is automatically computed from the service security
context or set using the seclabel option, but this facility allows
dealing with two scenarios that cannot be addressed using the existing
mechanisms:
1) Use of logwrapper to wrap a service.
In this case, init cannot determine the service security context
as it does not directly execute it and we do not want logwrapper
to run in the same domain as the service.

2) Situations where a service has multiple sockets and we want to
label them distinctly.

Change-Id: I7ae9088c326a2140e56a8044bfb21a91505aea11
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-08-23 08:35:43 -04:00
Andrew Boie
3899f522f1 init: load factory properties
These properties are typically set at device provisioning time
or in the factory. They contain unit-specific data that isn't
touched by software updates or factory data reset. Only
read-only properties can be read by this mechanism.

Change-Id: Ifff9184f039072c3c0ce99f825c3075afb524514
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2013-08-20 11:47:55 -07:00
Alex Klyubin
0d872d8bb4 Seed Linux RNG from Hardware RNG at boot during init.
The Linux RNG may have little entropy during boot. As more and more
devices have a Hardware RNG, we mix in 512 bytes from Hardware RNG
(if present) into Linux RNG early during boot (after
wait_for_coldboot_done and before property_service_init actions in
init).

To avoid having to trust the output of Hardware RNG, we do not mix it
into the Linux RNG's primary pool or increase the Linux RNG's entropy
estimates.

Bug: 10362513
Change-Id: I80617f21710400747f5e7533e518d90ea74e2f11
2013-08-19 16:58:28 -07:00
Geremy Condra
d893e39d4f Merge "Add basic verity support to fs_mgr." 2013-08-07 18:20:33 +00:00
Geremy Condra
3ad3d1c4b5 Add basic verity support to fs_mgr.
This change adds a "verify" fs_mgr flag specifying that
the device in question should be verified.

Devices marked with this flag are expected to have a
footer immediately after their data containing all
the information needed to set up a verity instance.

Change-Id: I10101f2c3240228ee0932e3767fe35e673d2e720
2013-08-06 22:15:58 -07:00
Stephen Smalley
e2eb69db6d Handle policy reloads within ueventd rather than restarting it.
Restarting ueventd upon policy reloads has reportedly created
stability problems for some users and could cause events to be lost.
Stop restarting ueventd and instead handle policy reloads within ueventd.

Also stops restarting installd upon policy reloads.

Change-Id: Ic7f310d69a7c420e48fbc974000cf4a5b9ab4a3b
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-07-26 15:39:41 -04:00
Colin Cross
776751ad79 am 8c4b1539: am f9873987: am 5954ecb8: Merge "Allow more characters in partition name links"
* commit '8c4b153911e399f00fdf0ed4e39782d0d49396d6':
  Allow more characters in partition name links
2013-07-22 15:45:42 -07:00
Colin Cross
f987398723 am 5954ecb8: Merge "Allow more characters in partition name links"
* commit '5954ecb87b8c77425d8cc766c0cc798957a07a7d':
  Allow more characters in partition name links
2013-07-22 15:40:55 -07:00
Johan Redestig
93ca79b445 Allow more characters in partition name links
We have several partitions with underscores in their names
which would not be properly linked in:
/dev/block/platform/msm_sdcc.1/by-name/

With this change more characters (_-.) are allowed in
partition name links. Also, any other character is
replaced with '_' so the resulting link names have the
same length as the partition name.

Change-Id: I746566c03db98b10326c755692362d2c10e528ae
2013-07-18 10:06:01 +02:00
Nick Kralevich
f29c533c49 init: call restorecon on /sys
Not all files on /sys are not getting labeled properly. Fix them.

Change-Id: I9dcff76354e7f50d41f1b6e702836cfbbc149278
2013-07-15 13:10:02 -07:00
Ken Sumrall
a76baaabe5 Add swapon_all to init's builtin commands
For enabling swap devices found in the fstab file

Change-Id: Iec4fd4d208df3d7a161a90d95f8606e8b516334a
2013-07-09 18:42:09 -07:00
Nick Kralevich
4838aa1b7b init: allow disabling selinux via a kernel command line
Create a new "androidboot.selinux" option, to control how userspace
handles SELinux. This kernel command line can have three options:

* disabled
* permissive
* enforcing

"disabled" completely disables userspace support for SELinux. No
policy is ever loaded, nor is the SELinux filesystem /sys/fs/selinux
ever mounted.

"permissive" loads the SELinux policy, but puts SELinux into
permissive mode. SELinux policy violations are logged, but not rejected.

"enforcing", the default, loads the SELinux policy, and places
SELinux into enforcing mode. Policy violations are rejected.

This change addresses post review comments for change
b710ed21de .

Change-Id: I912583db8e6a0e9c63380de32ad8ffc47a8a440f
2013-06-28 12:05:07 -07:00
Nick Kralevich
cbc76fcadb Merge "init: move SELinux into enforcing mode." 2013-06-25 21:08:56 +00:00
Nick Kralevich
b710ed21de init: move SELinux into enforcing mode.
When init starts up, immediately put SELinux into enforcing mode.

This is currently a no-op. We currently have everything in the
unconfined domain, so this should not break anything.
(if it does, I'll roll it back immediately)

If the kernel doesn't have SELinux support compiled in, then
don't try loading a policy and continue without SELinux protections.

Change-Id: Id0279cf82c545ea0f7090137b7566a5bc3ddd641
2013-06-25 11:23:29 -07:00
Colin Cross
25383a5da2 am 372d668a: am 39021a48: am 83ada447: Merge changes Ib54f39fd,I7e36edd8
* commit '372d668a279934ff3b2ec2f07a76fe2f351789d5':
  init: Retain traditional restart behavior for critical and oneshot services.
  init: Safely restart services to avoid race conditions.
2013-06-25 05:59:40 -07:00
Colin Cross
b1e3bb2798 am b1a9f8cf: resolved conflicts for merge of b6c60285 to stage-aosp-master
* commit 'b1a9f8cf4b15a861ab998a4c5f0c69068f22c62a':
  init: move initial property area allocation into bionic
  property_service: make /dev/__properties__ readable
2013-06-24 17:22:56 -07:00
Colin Cross
b1a9f8cf4b resolved conflicts for merge of b6c60285 to stage-aosp-master
Change-Id: I5afba55b668065499fa28369cf217d4f5eafab4a
2013-06-24 17:19:43 -07:00
Colin Cross
b6c6028594 Merge changes Ieb94caab,I762da21e
* changes:
  init: move initial property area allocation into bionic
  property_service: make /dev/__properties__ readable
2013-06-25 00:07:54 +00:00
Colin Cross
372d668a27 am 39021a48: am 83ada447: Merge changes Ib54f39fd,I7e36edd8
* commit '39021a48a0e0687c654423acd5a4c99a1d79440d':
  init: Retain traditional restart behavior for critical and oneshot services.
  init: Safely restart services to avoid race conditions.
2013-06-24 15:27:43 -07:00
Colin Cross
39021a48a0 am 83ada447: Merge changes Ib54f39fd,I7e36edd8
* commit '83ada447aed69dfcd0a88e952eced8db1e4d6584':
  init: Retain traditional restart behavior for critical and oneshot services.
  init: Safely restart services to avoid race conditions.
2013-06-24 15:24:57 -07:00
Colin Cross
83ada447ae Merge changes Ib54f39fd,I7e36edd8
* changes:
  init: Retain traditional restart behavior for critical and oneshot services.
  init: Safely restart services to avoid race conditions.
2013-06-24 22:23:32 +00:00
Greg Hackmann
2baad52520 init: move initial property area allocation into bionic
bionic's __system_property_add() now expands the property area as needed
by mapping in more pages.  Rather than duplicate the mapping code, move
it inside bionic and have bionic's __system_property_area_init() set up
the first page.

Signed-off-by: Greg Hackmann <ghackmann@google.com>

(cherry picked from commit f14eef0c3c)

Change-Id: Ieb94caab1527c71f2155efe3795490b0ea215a29
2013-06-19 12:26:31 -07:00
Nick Kralevich
26f2d2f519 property_service: make /dev/__properties__ readable
Currently, system properties are passed via the environment
variable ANDROID_PROPERTY_WORKSPACE and a file descriptor passed
from parent to child. This is insecure for setuid executables,
as the environment variable can be changed by the caller.

Make the /dev/__properties__ file accessible, so an app can
get properties directly from the file, rather than relying on
environment variables.

Preserve the environment variable for compatibility with pre-existing
apps.

Bug: 8045561

(cherry picked from commit 7ece0a862c)

Change-Id: I762da21ef4075f288745efed0ec7d16c2b71303c
2013-06-19 12:26:28 -07:00
Greg Hackmann
f14eef0c3c init: move initial property area allocation into bionic
bionic's __system_property_add() now expands the property area as needed
by mapping in more pages.  Rather than duplicate the mapping code, move
it inside bionic and have bionic's __system_property_area_init() set up
the first page.

Change-Id: If9917d5f775c1a82eb89be55b84635395145ca49
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-18 16:37:54 -07:00
Colin Cross
44d1f3c703 am 99c1a416: resolved conflicts for merge of 95a41f6b to stage-aosp-master
* commit '99c1a4168ba792437f298d31cd4631ff01661476':
  init: fix copying boot properties
  toolbox: hide property implementation from watchprops
  init: verify size of property buffers passed to property_get
  init: move the system property writer implementation
  init: switch property_get to use __system_property_get
2013-06-17 18:24:39 -07:00
Colin Cross
99c1a4168b resolved conflicts for merge of 95a41f6b to stage-aosp-master
Change-Id: Icfae29edf989fb43a7f0b8bda188a9807f76a3b9
2013-06-17 18:19:28 -07:00
Colin Cross
5e484e9c43 init: fix copying boot properties
The previous patch "init: verify size of property buffers passed
to property_get" incorrectly modified one of the callers,
resulting in ro.serialno, ro.bootmode, ro.baseband, and
ro.bootloader always being set to their default values.

Bug: 9469860

(cherry picked from commit 67e3663fc9)

Change-Id: Ia7b337e1fab6e334729f47ee1269e6c736615177
2013-06-17 16:58:14 -07:00
Colin Cross
a5a860ef20 init: verify size of property buffers passed to property_get
Verify that the buffer passed as the value parameter to property_get
is always big enough.

(cherry picked from commit 88ac54a4e8)

Change-Id: Iacc2b42bfe4069e0bfcbb1c48474f30126a93139
2013-06-17 16:58:02 -07:00
Colin Cross
993b6ceeb0 init: move the system property writer implementation
Move the system property writer implementation into bionic to keep
it next to the reader implementation and allow for better testing.

(cherry picked from commit 9f5af63501)

Change-Id: Idf6100d1d0170751acd5163a22597912bff480f0
2013-06-17 16:57:49 -07:00
Colin Cross
1a6f4c3bf2 init: switch property_get to use __system_property_get
(cherry picked from commit 2deedfe0b1)

Change-Id: If3fba2cc1dd5c167b0924ddfe42dbe2e6387208a
2013-06-17 16:57:32 -07:00
Colin Cross
67e3663fc9 init: fix copying boot properties
The previous patch "init: verify size of property buffers passed
to property_get" incorrectly modified one of the callers,
resulting in ro.serialno, ro.bootmode, ro.baseband, and
ro.bootloader always being set to their default values.

Bug: 9469860
Change-Id: Id45bd8dd657e8d61f4cfaf7e6b2559d2bfd05181
2013-06-17 16:20:08 -07:00
Colin Cross
88ac54a4e8 init: verify size of property buffers passed to property_get
Verify that the buffer passed as the value parameter to property_get
is always big enough.

Change-Id: Ie5b6fcd94bb908215cfd55d0c9b07f717ddb70b1
2013-06-17 12:44:35 -07:00
Colin Cross
9f5af63501 init: move the system property writer implementation
Move the system property writer implementation into bionic to keep
it next to the reader implementation and allow for better testing.

Change-Id: I9026e604109e30546b2849b60cab2e7e5ff00ba5
2013-06-17 12:44:35 -07:00
Colin Cross
2deedfe0b1 init: switch property_get to use __system_property_get
Change-Id: I4fc0502a1a5b331087618a4d2e3d90948743d7bd
2013-06-17 12:44:35 -07:00
Ajay Dudani
fd914ee94c am 05a52055: am 76c58893: Free file handle for /firmware/image after use
* commit '05a52055661701c20f71124161798fdea8ea2982':
  Free file handle for /firmware/image after use
2013-06-14 09:11:34 -07:00
Ajay Dudani
05a5205566 am 76c58893: Free file handle for /firmware/image after use
* commit '76c5889325c2ada5dda07fd9af20a4a485978538':
  Free file handle for /firmware/image after use
2013-06-14 08:36:02 -07:00
Ajay Dudani
76c5889325 Free file handle for /firmware/image after use
Change-Id: Id59e25486b45dffc87a89a961970a6e8128a5237
2013-06-13 13:18:12 -07:00
Colin Cross
e9ab162f30 init: prevent action being added to the action_queue twice
Property triggers may cause an action to be queued twice, resulting
in a loop in the action queue.  Keep actions that are not on the queue
in the list_empty state (act->qlist->next == act->qlist), and only
add them to the list if they are in that state.

Bug: 8335133
Change-Id: I3a3ec18176cf19cbaa3a45220a03c7560eacfe79
2013-06-10 14:16:00 -07:00
Matthew Xie
17775724b8 am 5cb9a02b: am 7e723498: Merge "Add permission for bluetooth app in non-primary users" into jb-mr2-dev
* commit '5cb9a02b0322c18b48eb9ce261502c3b830c113c':
  Add permission for bluetooth app in non-primary users
2013-05-22 10:41:26 -07:00
Matthew Xie
5cb9a02b03 am 7e723498: Merge "Add permission for bluetooth app in non-primary users" into jb-mr2-dev
* commit '7e72349865db83d62f98eec8bca4b170712fe0e0':
  Add permission for bluetooth app in non-primary users
2013-05-22 10:38:44 -07:00
Matthew Xie
7e72349865 Merge "Add permission for bluetooth app in non-primary users" into jb-mr2-dev 2013-05-22 17:36:53 +00:00
Matthew Xie
40a91a2884 Add permission for bluetooth app in non-primary users
bug 8954114
Change-Id: Id6a42f5a5beefa22c3cc8eecfb39a2222017a3b4
2013-05-22 10:00:23 -07:00
gcondra@google.com
a022ce7c80 am 8f6adcfc: am 49be2407: Revert "Add logic to fixup file contexts after a policy update."
* commit '8f6adcfcc55414cc07c18fe47d7c4314da148544':
  Revert "Add logic to fixup file contexts after a policy update."
2013-05-20 16:35:35 -07:00
gcondra@google.com
1e47a74668 am 253e91b4: am 477e35d6: Revert "Add persistent property for SELinux enforcment status."
* commit '253e91b4ffb631b188fdac0c1624786103471f05':
  Revert "Add persistent property for SELinux enforcment status."
2013-05-20 16:35:35 -07:00
gcondra@google.com
acef650dbc am 43329bc1: am 8a387870: Revert "Reload policy after setting up the data partition."
* commit '43329bc1c99c0f5f3670a8aaab39e54df34819a1':
  Revert "Reload policy after setting up the data partition."
2013-05-20 16:35:34 -07:00
gcondra@google.com
104c33992f am f5410f2b: am 3d32cd93: Revert "Remove /system from the dirs to relabel."
* commit 'f5410f2bde6fd5295cad36e3ba3efba0beb92780':
  Revert "Remove /system from the dirs to relabel."
2013-05-20 16:35:34 -07:00
gcondra@google.com
9a8cb3abf8 am b9866649: am 52351300: Revert "Add a version check for SELinux policy on device."
* commit 'b9866649e24d7b6eedcaf2e03ffc605a3417537d':
  Revert "Add a version check for SELinux policy on device."
2013-05-20 16:35:33 -07:00
gcondra@google.com
8f6adcfcc5 am 49be2407: Revert "Add logic to fixup file contexts after a policy update."
* commit '49be240735a06f44e1d91aa51dd299779ad36d96':
  Revert "Add logic to fixup file contexts after a policy update."
2013-05-20 15:52:28 -07:00
gcondra@google.com
253e91b4ff am 477e35d6: Revert "Add persistent property for SELinux enforcment status."
* commit '477e35d6d56c7fe9b2305becdf3ed4f590ddfbd6':
  Revert "Add persistent property for SELinux enforcment status."
2013-05-20 15:52:28 -07:00
gcondra@google.com
43329bc1c9 am 8a387870: Revert "Reload policy after setting up the data partition."
* commit '8a3878700eb9cd8ecf495cd01f15face5c3879c8':
  Revert "Reload policy after setting up the data partition."
2013-05-20 15:52:27 -07:00
gcondra@google.com
f5410f2bde am 3d32cd93: Revert "Remove /system from the dirs to relabel."
* commit '3d32cd938746215e5fa9b1a3c3b78903e043ae73':
  Revert "Remove /system from the dirs to relabel."
2013-05-20 15:52:27 -07:00
gcondra@google.com
b9866649e2 am 52351300: Revert "Add a version check for SELinux policy on device."
* commit '52351300d156826bf22c493828571f45a1cea16a':
  Revert "Add a version check for SELinux policy on device."
2013-05-20 15:52:26 -07:00
repo sync
49be240735 Revert "Add logic to fixup file contexts after a policy update."
This reverts commit ebcf93e3bf.
2013-05-17 12:48:34 -07:00
repo sync
477e35d6d5 Revert "Add persistent property for SELinux enforcment status."
This reverts commit b89bdfde42.
2013-05-17 12:48:18 -07:00
repo sync
8a3878700e Revert "Reload policy after setting up the data partition."
This reverts commit fee250d27a.
2013-05-17 12:47:04 -07:00
repo sync
3d32cd9387 Revert "Remove /system from the dirs to relabel."
This reverts commit 3d4d07b2fa.
2013-05-17 12:46:31 -07:00
repo sync
52351300d1 Revert "Add a version check for SELinux policy on device."
This reverts commit 921be8b656.
2013-05-17 12:46:00 -07:00
gcondra@google.com
e45710f19f am 5a98566d: am 921be8b6: Add a version check for SELinux policy on device.
* commit '5a98566d589408c78e35f4476f478a2fa1c13e78':
  Add a version check for SELinux policy on device.
2013-05-14 23:45:59 -07:00
gcondra@google.com
5a98566d58 am 921be8b6: Add a version check for SELinux policy on device.
* commit '921be8b6568df0057c4eacbac2e1022b71e09620':
  Add a version check for SELinux policy on device.
2013-05-14 23:43:56 -07:00
repo sync
921be8b656 Add a version check for SELinux policy on device.
This helps to ensure that when a new system image is installed,
old userdata policy isn't applied over the top of it.

Bug: 8841348
Change-Id: I135af32250aa62979763e775842ce0af3c8b6f9f
2013-05-14 21:05:03 -07:00
gcondra@google.com
2fd3cc4c0f am ac5cf925: am 683aa89b: Merge "Remove /system from the dirs to relabel." into jb-mr2-dev
* commit 'ac5cf925f86706d2bf89948e7cd3379376185d3b':
  Remove /system from the dirs to relabel.
2013-05-08 15:04:02 -07:00
gcondra@google.com
ac5cf925f8 am 683aa89b: Merge "Remove /system from the dirs to relabel." into jb-mr2-dev
* commit '683aa89bfdf2439d1c5d9a4dc240d6a673678a98':
  Remove /system from the dirs to relabel.
2013-05-07 19:19:50 -07:00
repo sync
3d4d07b2fa Remove /system from the dirs to relabel.
Bug: 8841348
Change-Id: Ia1545288e8a8184feffaaa6158faad62f95cbcce
2013-05-07 19:05:08 -07:00
Colin Cross
72b1ffd375 am 803eda6a: am f69cc564: Merge "Update ueventd set the SELinux context on sysfs"
* commit '803eda6a2dfcb50f61dd4a6a616e560a87453cb0':
  Update ueventd set the SELinux context on sysfs
2013-04-30 21:13:47 -07:00
Colin Cross
51ef5882e7 am 55d69a96: am 032be7a4: Merge "Log an error if property pool is exhausted"
* commit '55d69a9681061b97d6bdcc0b1b92a7de63d0a07b':
  Log an error if property pool is exhausted
2013-04-30 21:13:46 -07:00
Colin Cross
803eda6a2d am f69cc564: Merge "Update ueventd set the SELinux context on sysfs"
* commit 'f69cc564f4129ad7f223bb7d83ebec9fe3438b62':
  Update ueventd set the SELinux context on sysfs
2013-04-30 21:12:28 -07:00
Colin Cross
55d69a9681 am 032be7a4: Merge "Log an error if property pool is exhausted"
* commit '032be7a4c5be8c015063084d162d1f394279aa3d':
  Log an error if property pool is exhausted
2013-04-30 21:12:28 -07:00
Colin Cross
f69cc564f4 Merge "Update ueventd set the SELinux context on sysfs" 2013-05-01 03:48:41 +00:00
gcondra@google.com
efbe7fc6cc am 63577d92: am fee250d2: Reload policy after setting up the data partition.
* commit '63577d9280e7919bfb7221030d211b833e66bb1e':
  Reload policy after setting up the data partition.
2013-04-30 17:18:05 -07:00
gcondra@google.com
63577d9280 am fee250d2: Reload policy after setting up the data partition.
* commit 'fee250d27a9c03af1ba439047b976d89563b1887':
  Reload policy after setting up the data partition.
2013-04-30 17:04:53 -07:00
repo sync
fee250d27a Reload policy after setting up the data partition.
This forces a policy reload + fixcon to deal with dynamically
delivered policy changing labels on device nodes.

It's implemented as a new keyword in init.

Bug: 8702843
Change-Id: I803cf1ecf6ff8318ce25dcc5cda4f292adc9738c
2013-04-30 11:40:22 -07:00
Johan Redestig
fd7ffb1089 Log an error if property pool is exhausted
Failing to set properties due to an exhausted pool leads
to difficult to debug problems. This change adds an
error log to make the situation a bit easier to handle.

Change-Id: Icc1d97a80882fb23e74428a0195f1d28dba68fa8
2013-04-29 13:07:40 +02:00
gcondra@google.com
ada3291c8d am 14ad7861: am 538b5d4e: Merge "Add persistent property for SELinux enforcment status." into jb-mr2-dev
* commit '14ad786183455ad9c8298e24946d4da0f24458d7':
  Add persistent property for SELinux enforcment status.
2013-04-26 13:39:40 -07:00
gcondra@google.com
14ad786183 am 538b5d4e: Merge "Add persistent property for SELinux enforcment status." into jb-mr2-dev
* commit '538b5d4e8e4c480b2120aa957fe3e11a2836a1b3':
  Add persistent property for SELinux enforcment status.
2013-04-26 13:37:52 -07:00
repo sync
b89bdfde42 Add persistent property for SELinux enforcment status.
Also adds triggers for going between enforcing and
permissive status.

Bug: 8702843
Change-Id: I841d80999b96acf6b6fd0a5408fb074952d6ae72
2013-04-25 14:19:16 -07:00
Nick Kralevich
ca8e66a8b0 Make init handle reboots
Move the responsibility for rebooting the system from the
reboot command to init. Init is in a better position to take
actions to bring the system down cleanly, including making sure
filesystems are mounted read-only.

The only UIDs which can perform an init triggered reboot are
root, system, and shell.

Modify the reboot command so that it calls into init to perform
the reboot. The reboot command no longer requires CAP_SYS_BOOT.

Remove the -n reboot option and code which supports it.  Anyone needing
to do an unclean shutdown can just do a 'echo c > /proc/sysrq-trigger'.

Modify adb so that it calls into init to perform a shutdown.

Bug: 8646621
Change-Id: I84c0513acb549720cb0e8c9fcbda0050f5c396f5
2013-04-23 13:21:40 -07:00
Geremy Condra
7e25fa1859 am ebcf93e3: Add logic to fixup file contexts after a policy update.
* commit 'ebcf93e3bf92bf46c54c8e0f2ec8936bb2db6aea':
  Add logic to fixup file contexts after a policy update.
2013-04-15 16:13:53 -07:00
Geremy Condra
ebcf93e3bf Add logic to fixup file contexts after a policy update.
Bug: 8116902

(cherry picked from commit 47677a506f)

Change-Id: I2a50f68a53aee2c94d03d3e5ced1ea36337fde33
2013-04-15 14:59:42 -07:00
Geremy Condra
dbdd280ea6 Merge "Add logic to fixup file contexts after a policy update." 2013-04-15 21:34:07 +00:00
Geremy Condra
47677a506f Add logic to fixup file contexts after a policy update.
Bug: 8116902
Change-Id: Ifa1785c75a24a9b3cfcb700f22ded7d16a917f79
2013-04-15 13:16:38 -07:00
Ken Sumrall
d45dcbd5f8 am 1a6d9ec2: Merge "fs_mgr: Capture the output of e2fsck and add to the kernel log" into jb-mr2-dev
* commit '1a6d9ec2af7b3151c64a167162c87d258d30735b':
  fs_mgr: Capture the output of e2fsck and add to the kernel log
2013-04-15 10:35:32 -07:00
Ken Sumrall
bf021b4cd7 fs_mgr: Capture the output of e2fsck and add to the kernel log
Currently, the output of e2fsck is not saved, and we have no insight
into how many errors e2fsck is finding and fixing.  Using the new
abbreviated logging feature in liblogwrap, up to the first 100 lines,
and last 4K bytes of the output of e2fsck is captured by fs_mgr, and
added to the kernel log.

Usually, the filesystem will be clean, and this will only add a few
lines to the kernel log on boot, but when things go wrong, it should
save enough to indicate what the problem is, without potentially
filling the kernel log with only e2fsck output if the filesystem is
really corrupted.

Change-Id: I9c264798e6fe721c8f818b5ce15d0975027ddbdd
2013-04-14 17:11:00 -07:00
Colin Cross
a5ca229a45 am 1615c09a: Merge "init: Fix potential null pointer issue"
* commit '1615c09ac1065104f56ddc444f5467aff76c0daa':
  init: Fix potential null pointer issue
2013-04-05 19:56:27 -07:00
Jeff Sharkey
b4d52a437e Only handle keycodes when adb is enabled.
This prevents accidental bugreports on userdebug/eng devices.

Bug: 8541006
Change-Id: Iefd15826090fd91434403f197cfd166e64400224
2013-04-04 10:46:33 -07:00
Stephen Smalley
5f7b017f41 Update ueventd set the SELinux context on sysfs
This change enables labeling of dynamically created sysfs nodes
with specific SELinux security contexts.

Change-Id: If8b8d66120453123c1371ce063b6f20e8b96b6ef
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-04-03 17:44:19 -07:00
Geremy Condra
8e15eabdc0 Apply the correct SELinux label for the properties workspace.
Change-Id: Ibb9c8044caa9d39ee6ec9fe06d54bb9dc4b56ff3
2013-04-03 11:59:56 -07:00
Hong-Mei Li
11467189bc init: Fix potential null pointer issue
With the old strdup() mechanism, it may return NULL if insufficient memory was
available. So we check the return value or do not use strdup to avoid null
pointer issue.

Change-Id: Id684948d6cb6c2f06327f29a2ba692f9542fce80
Signed-off-by: Hong-Mei Li <a21834@motorola.com>
2013-04-01 11:17:51 +08:00
Geremy Condra
de97f798a1 am bed08333: am c0e1bc1c: Merge "Drop /data/system as a policy file location"
* commit 'bed08333d921e97bc60b81c0f183816386709d79':
  Drop /data/system as a policy file location
2013-03-27 16:42:21 -07:00
William Roberts
04561b6347 Drop /data/system as a policy file location
/data/system is no longer used as a policy
file location. Use /data/security instead.

Change-Id: Ie77be9e25c67c8a2157c7b6c468f3215a49ead52
2013-03-26 23:33:18 +00:00
William Roberts
bfd71b489b Create a new location for /data policy files
Adding a new location for policy files under
/data, the new location is /data/security. The
new location is used before attempting to use
any other location.
This requires a new directory to be created by
the init script and an update to the location of
the property_contexts file for property service.

Change-Id: I955a722ac3e51fa6c1b97201b8bdef3f601cf09d
2013-03-21 14:26:12 -07:00
William Roberts
46e1bd89b4 Create a new location for /data policy files
Adding a new location for policy files under
/data, the new location is /data/security. The
new location is used before attempting to use
any other location.
This requires a new directory to be created by
the init script and an update to the location of
the property_contexts file for property service.

Change-Id: I955a722ac3e51fa6c1b97201b8bdef3f601cf09d
2013-03-20 19:34:55 -07:00
Dima Zavin
f395c9237d ueventd: allow platform devices to have just a /devices/ prefix
When using device tree, platform devices may not have a
/devices/platform/ path prefix, but can be rooted in
/devices/.

Modify the platform device tracking code to store the device
path as well as the name. This way, when we create symlinks, we
can correctly skip the base platform device prefix and get to the
proper device node path.

Change-Id: I939ef8fbcb45c5c803cd9a054e40136a912efc72
Signed-off-by: Dima Zavin <dima@android.com>
2013-03-14 18:14:32 -07:00
Nick Kralevich
eb6dd010b5 am 9573a175: am dbf4937b: Merge "Revert "init: Set ADDR_COMPAT_LAYOUT before spawning processes.""
* commit '9573a1755c4ef0f6f86277fcf2ff95645bb1dfb4':
  Revert "init: Set ADDR_COMPAT_LAYOUT before spawning processes."
2013-03-14 16:16:40 -07:00
Nick Kralevich
76ba83cce2 Revert "init: Set ADDR_COMPAT_LAYOUT before spawning processes."
This logic has been moved to platform/frameworks/base commit
8a0a929422682ba3eb6a205dc6c0638e68b909de and is no longer needed
here.

This reverts commit 01b1dee0ab.
2013-03-14 15:23:30 -07:00
Dima Zavin
53a0288463 ueventd: allow platform devices to have just a /devices/ prefix - DO NOT MERGE
When using device tree, platform devices may not have a
/devices/platform/ path prefix, but can be rooted in
/devices/.

Modify the platform device tracking code to store the device
path as well as the name. This way, when we create symlinks, we
can correctly skip the base platform device prefix and get to the
proper device node path.

Change-Id: I939ef8fbcb45c5c803cd9a054e40136a912efc72
Signed-off-by: Dima Zavin <dima@android.com>
2013-03-11 11:13:17 -07:00
Colin Cross
a5064626de init: prevent action being added to the action_queue twice
Property triggers may cause an action to be queued twice, resulting
in a loop in the action queue.  Keep actions that are not on the queue
in the list_empty state (act->qlist->next == act->qlist), and only
add them to the list if they are in that state.

Bug: 8335133
Change-Id: I3a3ec18176cf19cbaa3a45220a03c7560eacfe79
2013-03-07 13:44:59 -08:00
Ken Sumrall
ab6b852235 fs_mgr: support a unified fstab format.
Update fs_mgr to support more flags needed to unify the 3
fstabs currently in android into one.

Change-Id: Ie46cea61a5b19882c55098bdd70f39e78fb603be
2013-02-19 10:18:42 -08:00
Dave Burke
9e76a29752 Merge "Revert "Revert "init: Set ADDR_COMPAT_LAYOUT before spawning processes.""" 2013-02-12 01:05:42 +00:00
Dave Burke
eb22e6a52b Revert "Revert "init: Set ADDR_COMPAT_LAYOUT before spawning processes.""
This reverts commit 87980b5c9f

Getting more reports of app crashes (e.g. 7990090), so given timeline for MR2, want to revert.

Change-Id: Ic2d101d2d1156b3864d5c9b88aa8c94cd5aa345f
2013-02-11 19:48:43 +00:00
Colin Cross
544d196e22 am 7480c007: am b2639f40: Merge "Label sockets consistently with the seclabel value if specified."
# By Stephen Smalley
# Via Android Git Automerger (1) and others
* commit '7480c0079d8c7fcfd5b3d9decfdabfebde162781':
  Label sockets consistently with the seclabel value if specified.
2013-02-01 15:28:52 -08:00
Colin Cross
b2639f4015 Merge "Label sockets consistently with the seclabel value if specified." 2013-02-01 19:04:56 +00:00
Nick Kralevich
7ece0a862c property_service: make /dev/__properties__ readable
Currently, system properties are passed via the environment
variable ANDROID_PROPERTY_WORKSPACE and a file descriptor passed
from parent to child. This is insecure for setuid executables,
as the environment variable can be changed by the caller.

Make the /dev/__properties__ file accessible, so an app can
get properties directly from the file, rather than relying on
environment variables.

Preserve the environment variable for compatibility with pre-existing
apps.

Bug: 8045561
Change-Id: If81e2b705eca43ddd8b491871aceff59c0e00387
2013-01-23 09:30:17 -08:00
Nick Kralevich
2840647b15 Revert "init: make system properties more secure."
This reverts commit 51e06618db.

Bug: 8045561
2013-01-22 12:46:09 -08:00
Nick Kralevich
51e06618db init: make system properties more secure.
Currently, system properties are passed via the environment
variable ANDROID_PROPERTY_WORKSPACE and a file descriptor passed
from parent to child. This is insecure for setuid executables,
as the environment variable can be changed by the caller.

Modify system property handling so that we get the properties
from a root owned properties file, rather than using an
environment variable.

Related to bug: 8029617

Change-Id: I18610128e11c4037ed6f4dec6eba20f69fa647eb
2013-01-18 14:31:19 -08:00
jp abgrall
c2b19de2ec am 3f8d6cde: am d084ec96: Merge "ueventd: Increase uevent buffer size"
* commit '3f8d6cded84bd526f7e648905565a1d262ca9906':
  ueventd: Increase uevent buffer size
2013-01-04 17:50:57 -08:00
Andrew Boie
d562ca78aa ueventd: Increase uevent buffer size
As it turns out, no, 64K is not enough. A device provisioning
tool was generating many uevents as it manipulated the GPT,
causing events near the end of the process (including events
as a result of the final BLKRRPART ioctl()) to get lost.

It's not clear what the best value for this should be, but
increasing to 256K fixed the problem in this case.

Change-Id: I4883b34e96c89e8a6fa581bc9cd121bb021b5694
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2013-01-04 11:37:34 -08:00
Dima Zavin
487c4ea012 am 7ec62dbd: am 82ea44f8: Merge "Change setsebool syntax to be consistent with other init built-ins."
* commit '7ec62dbd9d2bd7369fa074bf002f642b03e6dd39':
  Change setsebool syntax to be consistent with other init built-ins.
2012-12-19 09:51:38 -08:00
Stephen Smalley
0e23fee505 Change setsebool syntax to be consistent with other init built-ins.
Change setsebool syntax from name=value to name value.
This is to make it consistent with setprop and similar commands.
Update both the init built-in command and the toolbox command
for consistency.

Change-Id: I2c8e016ba26731c4a2ad4a49ae3b89362bf8f8a8
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2012-12-13 15:41:53 -05:00
Jon Medhurst
229dc35f69 init: Fix get_hardware_name() to cope with long /proc/cpuinfo output
get_hardware_name() uses a fixed size buffer to slurp the contents of
/proc/cpuinfo into and with newer multicore systems this is not big
enough, leading to the inability to pick up the hardware name.

Fix this by using a dynamically allocated, exponentially growing buffer.

Change-Id: I51c6c276b6e110f462839e205a4428adc6656e75
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2012-12-10 20:39:17 +00:00
Kenny Root
7af628233e am 27888a5d: am 9b82ce20: Merge "Document the SELinux extensions to the Android init language."
* commit '27888a5ded21182e1f15b19010fd2527fb7e1ef0':
  Document the SELinux extensions to the Android init language.
2012-11-27 17:34:27 -08:00
Kenny Root
9b82ce20eb Merge "Document the SELinux extensions to the Android init language." 2012-11-27 11:20:38 -08:00
Stephen Smalley
30f3033042 Label sockets consistently with the seclabel value if specified.
This is necessary to ensure that the adbd socket is created in the
adbd domain rather than the init domain.

Change-Id: Id4997d7f074aeefea62b41c87b46a6609e03f527
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2012-11-16 14:35:55 -05:00
Stephen Smalley
3fb6110830 Document the SELinux extensions to the Android init language.
Change-Id: I9b066e0789c93e5147c28a60baeed91c44dd9359
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2012-11-02 15:22:34 -04:00
Nick Kralevich
7c85af005d am 6575a162: am 8f98c4b5: Merge "Fix dirfd crash issue in property service"
* commit '6575a1625ac585b46f90c6f036db9231db50c969':
  Fix dirfd crash issue in property service
2012-10-23 10:49:48 -07:00
Nick Kralevich
6575a1625a am 8f98c4b5: Merge "Fix dirfd crash issue in property service"
* commit '8f98c4b5f011db8637ce1b9361e82d59b13434f4':
  Fix dirfd crash issue in property service
2012-10-23 10:46:55 -07:00
Yi-wei Zhao
e41bc31555 Fix dirfd crash issue in property service
In "init: harden property service" patch, dirfd() is invoked
without checking whether opendir() return successfully. It may
fail if load_persistent_properties() is invoked before userdata
partition is mounted; then dirfd(NULL) will make init crash.
This may happen if "is_charger" is true.

Change-Id: I216fb743a3c9fa050f92fcb31b62e766346d84bb
Signed-off-by: Yi-wei Zhao <gbjc64@motorola.com>
2012-10-23 21:31:06 +08:00
Kenny Root
429bbfcafb am 2a36ae56: am 7b88a90d: Merge "Remove HAVE_SELINUX guards"
* commit '2a36ae5608e9d655b2bb14ce538f6fbdb910cada':
  Remove HAVE_SELINUX guards
2012-10-17 09:59:41 -07:00
Kenny Root
2a36ae5608 am 7b88a90d: Merge "Remove HAVE_SELINUX guards"
* commit '7b88a90da2a27e347fc16c14fa577f4ae1ef07fd':
  Remove HAVE_SELINUX guards
2012-10-17 09:57:10 -07:00
Kenny Root
b5982bf7c6 Remove HAVE_SELINUX guards
Change-Id: I8272c573b3c5dc663203bafab68fad5e94d89364
2012-10-16 23:18:18 -07:00
Nick Kralevich
87980b5c9f Revert "init: Set ADDR_COMPAT_LAYOUT before spawning processes."
This reverts commit 01b1dee0ab.

Bug: 7188322
Change-Id: Ia159eab36e9e7373f470d20a3796b63868ea5689
2012-10-05 12:45:05 -07:00
Nick Kralevich
569182a2ab am 7f3de6a4: am d282dfc4: Merge "init: Set ADDR_COMPAT_LAYOUT before spawning processes." into jb-mr1-dev
* commit '7f3de6a450f025245bb27fdc13f5bbc1dc22624d':
  init: Set ADDR_COMPAT_LAYOUT before spawning processes.
2012-10-05 12:14:11 -07:00
Nick Kralevich
01b1dee0ab init: Set ADDR_COMPAT_LAYOUT before spawning processes.
Some Android programs have problems with memory which grows
from the top down.  Temporarily set ADDR_COMPAT_LAYOUT to
avoid breaking those programs.

Bug: 7188322
Change-Id: I61760500e670b4563838c63b82d4a0b6e354a86e
2012-10-05 12:02:46 -07:00
Nick Kralevich
474cb0e33a am 33045b3d: am f9c05970: Merge "init: harden property service."
* commit '33045b3d7bd965f67e2e0b175976cf9934fb924f':
  init: harden property service.
2012-10-04 11:47:06 -07:00
Nick Kralevich
7ecfe6a94b init: harden property service.
Don't create temporary files in a well-known location. Rather,
use mkstemp().

Don't read persistent property files from insecure files.

Change-Id: I81e2aca674a2a7ca54869f088737fb228d3af6d2
2012-10-04 10:47:05 -07:00
Nick Kralevich
32b9023d08 init: Don't read local properties if ro.debuggable=0
Bug: 7195965
Change-Id: I29fdad61aa61f2c46d49db227cf7b84d9cc6f25d
2012-09-19 13:03:18 -07:00
Jean-Baptiste Queru
c3a4a054a9 am 3af04b71: am 7c386a61: Merge "Extend and document the "wait" command"
* commit '3af04b71e51e89af02a1fe526e4fc32dce0100d3':
  Extend and document the "wait" command
2012-08-20 10:29:38 -07:00
Jean-Baptiste Queru
7c386a610d Merge "Extend and document the "wait" command" 2012-08-20 09:18:38 -07:00
Jean-Baptiste Queru
d7f78e88b5 am e3bdaeb6: am 2765e4fb: Merge "Use sigemptyset to initialise signal mask as it is more portable. Referencing sa_restorer fails on MIPS"
* commit 'e3bdaeb603ab7ac941b35b41856c6b8ebf47c6bb':
  Use sigemptyset to initialise signal mask as it is more portable. Referencing sa_restorer fails on MIPS
2012-08-15 09:37:56 -07:00
Iliyan Malchev
a8f1e11bcc Merge "bluetooth: bring up with bluedroid stack" into jb-mr1-dev 2012-08-15 09:20:33 -07:00
Jeonghoon lim
e953e9657c bluetooth: bring up with bluedroid stack
- change permission of "bluetooth." property to AID_BLUETOOTH

Change-Id: Ifcd97f136cfc3372412fe500e4f800d1bbbd065c
2012-08-15 01:34:31 -07:00
Benoit Goby
5c8574b512 init: Fix mkdir command when using ISUID or ISGID bit
On first boot, the directory is created with root:root ownership and
then chowned. chown clears the ISUID and ISGID bits, so we need to chmod
the directory again after chown.

Change-Id: I02dfe7a19a637678256b4e7cc09e6b5431e6f11e
2012-08-14 15:51:44 -07:00
Chris Dearman
6736eb1829 Use sigemptyset to initialise signal mask as it is more portable.
Referencing sa_restorer fails on MIPS

Change-Id: I81c9ed5ef027a9d5258942ffcecb96e3f787e93c
Signed-off-by: Chris Dearman <chris@mips.com>
2012-08-14 15:30:39 -07:00
Jeff Sharkey
90b80de5a7 Merge "Support shared-subtree and bind mount flags." into jb-mr1-dev 2012-08-14 14:17:45 -07:00
Jeff Sharkey
e50ac5f777 Support shared-subtree and bind mount flags.
Bug: 6925012
Change-Id: Id8d887d17c6b1b2f90cfd1a1de991ccaba730b7d
2012-08-14 12:38:14 -07:00
Jean-Baptiste Queru
96539e8153 am ee0d281a: am c95c15b1: Merge "Char device /dev/dri/card0 was not created during startup."
* commit 'ee0d281a3e5fe611bdda23db18fa0e5684ee43ed':
  Char device /dev/dri/card0 was not created during startup.
2012-08-14 08:41:16 -07:00
Jean-Baptiste Queru
c95c15b192 Merge "Char device /dev/dri/card0 was not created during startup." 2012-08-14 08:06:44 -07:00
Kenny Root
2fec4de5c7 am 11c783f1: am 9494f297: Merge "Implement SELinux/MAC checks for property service."
* commit '11c783f1ead9f276e8854cb1adaebeed8517e8a1':
  Implement SELinux/MAC checks for property service.
2012-08-13 10:22:57 -07:00
Kenny Root
605103fb55 resolved conflicts for merge of 4dcd52ab to jb-mr1-dev
Change-Id: Ibd0c03a7883a2e31adab18543c016776b7b36866
2012-08-13 10:21:35 -07:00
rpcraig
63207cd20f Implement SELinux/MAC checks for property service.
This is a set of changes to the init property service
implementation to apply a SELinux check over who can
change what properties. Also included control hooks
for the 'ctl' keys.

Change-Id: I5a18809bf5536f6459a36b6bf0d622b9f5061aa0
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2012-08-09 10:05:49 -04:00
Stephen Smalley
ae6f3d7c05 Add support for reloading policy from /data/system.
To support runtime policy management, add support for reloading
policy from /data/system.  This can be triggered by setting the
selinux.loadpolicy property to 1, whether from init.rc after
mounting /data or from the system_server (e.g. upon invocation of
a new device admin API for provisioning policy). ueventd and
installd are restarted upon policy reloads to pick up the new
policy configurations relevant to their operation.

Change-Id: I97479aecef8cec23b32f60e09cc778cc5520b691
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2012-08-09 09:59:10 -04:00
Stephen Hines
4900f43670 am f442cf27: am b3a5343e: Merge "Fixed a discarded const qualifier warning"
* commit 'f442cf27c5d1229eb32973cb499578ccd63ba727':
  Fixed a discarded const qualifier warning
2012-08-08 17:44:04 -07:00
Stephen Hines
b3a5343e3e Merge "Fixed a discarded const qualifier warning" 2012-08-08 15:27:25 -07:00
Jean-Baptiste Queru
ff5c802e6c am faad67fa: am ef3f7fa3: Merge "Set the SELinux security label on new directories."
* commit 'faad67fac68642ca039fe5c29099acebf546f5ee':
  Set the SELinux security label on new directories.
2012-08-08 14:06:27 -07:00
Jean-Baptiste Queru
ef3f7fa32b Merge "Set the SELinux security label on new directories." 2012-08-08 13:42:20 -07:00
Ravi Nagarajan
a8afd723a4 Allow AID_BLUETOOTH to update persist.service.bdroid
When devices are provisioned, bd address path is set in ro.bt.bdaddr_path.
On devices where this property is not present, a random bd address is
generated and saved to the property: persist.service.bdroid.bdaddr
This change allows bluetooth process to update this property
bug 6885309

Change-Id: I2e8a2471a0e890da82e6bbec6a2ef67ec8e1f8f4
2012-08-06 23:56:45 -07:00
Veeren Mandalia
4f97fd91e3 init: fix return value for android uid/gid check
Now get_android_id function returns -EINVAL if the uid/gid is not in the list
of android ids. This will allow ueventd to catch invalid ids and report the
error.

Change-Id: I943b04dd64d518891623e1ee2d561b8061af4863
Signed-off-by: Veeren Mandalia <v.mandalia@sta.samsung.com>
2012-08-03 13:16:05 -07:00
Edwin Vane
de7f1ad86f Fixed a discarded const qualifier warning
Change-Id: I9007924d0bf49705363aa130e6e588a9e0ccdc31
Author: Edwin Vane <edwin.vane@intel.com>
Reviewed-by: Tareq A Siraj <tareq.a.siraj@intel.com>
2012-08-02 09:20:51 -04:00
Ed Heyl
3cac204d35 Merge remote-tracking branch 'goog/jb-dev-mako' into jb-mr1-dev 2012-07-28 11:48:12 -07:00
Stephen Smalley
e096e36e50 Set the SELinux security label on new directories.
Automatically set the SELinux security label on directories created
by init.rc.  This avoids the need to separately call restorecon on
each such directory from the init.rc file.  Also restorecon /dev
and /dev/socket after initial policy load so that they are labeled
correctly before any other dev nodes or sockets are created.

Change-Id: If6af6c4887cdead949737cebdd673957e9273ead
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2012-07-26 09:01:22 -04:00
Colin Cross
308bc52d33 ueventd: fixup /sys permissions on change uevents
Change uevents may be triggered after new files are created on a device
in /sys, run the sys permissions fixup when they occur.

Change-Id: Iec2725c9f8a032e5124190444edaf189a766b0b2
2012-07-24 12:36:40 -07:00
Patrick McCormick
96d0a4dda8 Extend and document the "wait" command
The wait command was currently implemented but
undocumented and only used internally. This change
adds a second option toi (optionally) override the default
timeout of 5 seconds.

The wait command can be used to wait for a file to appear
during the boot process, for example a disk or other device,
and is a better alternative than an unconditional sleep.

Change-Id: Ia11d8419c0ea84deec0e1bf5adfca5bc76ff38b7
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2012-07-24 10:31:49 -07:00
Lukasz Anaczkowski
e6f8d45da8 Char device /dev/dri/card0 was not created during startup.
This device is required by libdrm for GPUs like IvyBridge.

Change-Id: I0ac47056a9cec2100f3e6eaa5591571fe6bbc145
Signed-off-by: Lukasz Anaczkowski <lukasz.anaczkowski@intel.com>
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2012-07-23 16:08:17 -07:00
jeonghoon.lim
8c0350f4ee bluetooth: add property permission for bluetooth
add property permission for bluetooth.

Change-Id: I099f325f533d06c63ad43843dd6477ea81fc9781
2012-07-16 17:35:22 -07:00
Arve Hjønnevåg
d97d9074ba Add watchdogd
"/sbin/watchdogd <interval> <margin>" will open /dev/watchdog, try
to set the timeout to <interval>+<margin> then write to it every
<interval> seconds to reset the watchdog.

Change-Id: I15571980cdb868ec19f20e80bf8274b32107d36d
2012-06-14 15:43:23 -07:00
Iliyan Malchev
029d44e6ae HACK: use /firmware/image as a 3rd choice
Change-Id: I74af2e2dc872f88b904ead13e300ae32547e70c8
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-06-11 14:18:45 -07:00
Benoit Goby
93574c619c init: Fix chown and chmod for write-only files
Change-Id: I570b631ced11ab104aafe7ebfe71bae4e380d8af
2012-05-04 16:29:41 -07:00
Geremy Condra
42a9349dc4 init: make chmod/mkdir/chown not follow symlinks
This change brings init's do_chmod, mkdir, and do_chown into line
with open's O_NOFOLLOW semantics, causing them to fail when the
last element of their target path is a symlink.

Change-Id: If00e1a25cfe17ef6f738af4bf0541abd0c1b084b
2012-05-02 11:13:49 -07:00
Ken Sumrall
048cc27c8a am 0e9dd90a: Change init to use libfs_mgr to mount filesystems.
* commit '0e9dd90ac336278659477cad0b9e9f1004e2b338':
  Change init to use libfs_mgr to mount filesystems.
2012-05-01 14:01:13 -07:00
Ken Sumrall
0e9dd90ac3 Change init to use libfs_mgr to mount filesystems.
The new fs_mgr library moves much of the knowledge of what filesystems
to mount into a new fstab.<device> file, and just calls one function to
mount all the filesystems.

Change-Id: If3db37530a0676000cba3e679db27aca734227e5
2012-05-01 13:14:27 -07:00
Ken Sumrall
08ec39ecc6 Change init to use libfs_mgr to mount filesystems.
The new fs_mgr library moves much of the knowledge of what filesystems
to mount into a new fstab.<device> file, and just calls one function to
mount all the filesystems.

Change-Id: If3db37530a0676000cba3e679db27aca734227e5
2012-04-30 19:31:06 -07:00
Romain Guy
d0ffe3840b am ce182cb8: Merge "Let users with SYSTEM permission set debug. properties" into jb-dev
* commit 'ce182cb8c00d0f5dedadbd4964dbc8cb705b8550':
  Let users with SYSTEM permission set debug. properties
2012-04-27 15:27:48 -07:00
Romain Guy
45fa13f370 Let users with SYSTEM permission set debug. properties
Change-Id: Ieda3f7dd5dca5f6a8fc50b07822e6a875db030ad
2012-04-27 15:19:30 -07:00
Colin Cross
cf41769375 am 64753635: am a02ff986: Merge "init: Add noexec mount option"
* commit '647536359f8ea63330805cb77abbf2f101952daa':
  init: Add noexec mount option
2012-04-27 00:21:22 -07:00
Lars Svensson
b6ee25e3ad init: Add noexec mount option
Change-Id: Ic13d66797a86d38432e79af0c3387ce986d0a19f
2012-04-23 13:27:48 -07:00
Andrew Flynn
34f6d9e910 Don't set ro.carrier in init.c
It will instead be set using PRODUCT_PROPERTY_OVERRIDES
in makefiles

Change-Id: Idc8b480af4c15e15c2d97cdd82a20f259e027c52
2012-04-13 09:00:48 -07:00
Nick Kralevich
6ebf12fe1b init: Change umask of forked processes to 077
Modify init to set the umask to 077 when forking processes.
This helps protect against inadvertant information disclosure
in init's child processes.

ueventd: Keep umask at 000. uevent needs to be able to
create device nodes with exactly the permissions it
indicates.

Testing:
1) Do an "ls -lR /data /dev" on the device before and after
the umask change and diff the output. Verified by hand
that the permission change wouldn't cause any problems.

2) Verify that package installation works, and the permissions
are as expected, when installing a program from market and
"adb install".

Bug: 3272072
Change-Id: Ie4f7f06c0ee9da8d9b6fce25d71d8991a9bce406
2012-04-02 14:11:07 -07:00
Benoit Goby
5890301308 init: Fix chown and chmod for write-only files
Change-Id: I570b631ced11ab104aafe7ebfe71bae4e380d8af
2012-03-28 18:24:08 -07:00
Wei Zhong
f97b887848 Add handling for DEVNAME for usb devices
When creating device node, user-space handler should honor device
node provided by kernel if present.

Bug: 6105248

Change-Id: I9ab3810563f29f065c239e15149882db28f08893
Signed-off-by: Wei Zhong <wzhong@google.com>
2012-03-23 14:16:37 -07:00
Mike Kasick
b54f39fdd9 init: Retain traditional restart behavior for critical and oneshot services.
Adds an SVC_RESTART state that's used for an explicit "restart" of a
running service.  This retains the traditional restart behavior for
critical and oneshot services (previously altered by 7e36edd8), whereby
these services are "simply restarted" instead of counting as a crash (for a
critical serivce) or going into the disabled state (for a oneshot service).
2012-03-22 22:25:17 -04:00
Mike Kasick
7e36edd80f init: Safely restart services to avoid race conditions.
Previously, service restarts (either an explicit "restart", or a "stop,
start" pair) exhibited a race condition whereby the new (restarting)
service process was often spawned before the old (stopping) process had
terminated.  This may have resulted in the new service process failing to
acquire a limited resource (file lock, socket bind, etc.) that the old
process had not yet released.

Now, a stopping service remains in the SVC_RUNNING state until its exiting
process has been reaped by waitpid.  This prevents a "stop, start" sequence
from spawning a second service process before resources held by the first
are released.  This enables safe service restarts by stopping the service,
waiting for the old service process to terminate, and (only then) starting
the new service process.  In the event of "restarting" an already stopped
service, the previous behavior is maintained whereby the service is simply
started.

This scenario could be special-cased by the restart command, however, we
have observed instances where services are, unintentionally, stopped and
started "too quickly," and so simultaneous processes for the same service
should never be allowed.

Note that this commit alters the behaviors for explicit restarts of
critical and oneshot services.  Previously these serivces would simply be
restarted, whereas now, an explicit restart of a critical service counts as
a crash (which may result in a recovery reboot) and oneshot services go
into the disabled state.
2012-03-22 22:11:41 -04:00
Geremy Condra
9ed1fe7732 init: make chmod/mkdir/chown not follow symlinks
This change brings init's do_chmod, mkdir, and do_chown into line
with open's O_NOFOLLOW semantics, causing them to fail when the
last element of their target path is a symlink.

Change-Id: If00e1a25cfe17ef6f738af4bf0541abd0c1b084b
2012-03-21 15:13:08 -07:00
Colin Cross
50fb5a6933 init: manually set controlling tty for console services
Normally, calling open on a tty will set that tty as the process
group controlling tty if none already exists.  However, if the tty
is /dev/console, the kernel will never automatically set it as the
controlling tty.  Call the TIOCSCTTY manually on the fd, which will
always attempt to set it as the controlling tty.

Fixes ctrl-c on the console shell when androidboot.console is not
passed on the kernel command line and the default /dev/console is
used.

Change-Id: I449cc41b47e93ac38ad6987413bb54131e1ec0cd
2012-03-18 15:39:59 -07:00
Colin Cross
9c38e14299 am 1a2f32c4: am d39f9d93: am 9cec99ba: Merge "Fix typo in queue_property_triggers ident"
* commit '1a2f32c4828380ca8590cf664725650ef35f1e37':
  Fix typo in queue_property_triggers ident
2012-03-01 23:57:11 -08:00
Chris Dearman
469b7b2da8 Fix typo in queue_property_triggers ident
Signed-off-by: Chris Dearman <chris@mips.com>
Change-Id: I5f18ccb0912b9bb89c9f5104f9505c610c109af8
2012-03-01 15:29:20 -08:00
Jean-Baptiste Queru
6439693eff am 3b04bde9: am ee79b455: am 93553073: Merge "Extend init and ueventd for SE Android."
* commit '3b04bde991d57765a830e06c6f5bb094722583bd':
  Extend init and ueventd for SE Android.
2012-02-24 11:17:43 -08:00
Stephen Smalley
e46f9d510d Extend init and ueventd for SE Android.
Add SE Android support for init and ueventd.

init:
- Load policy at boot.
- Set the security context for service daemons and their sockets.
- New built-in commands: setcon, setenforce, restorecon, setsebool.
- New option for services: seclabel.

ueventd:
- Set the security context for device directories and nodes.

Change-Id: I98ed752cde503c94d99dfa5b5a47e3c33db16aac
2012-02-01 07:49:08 -05:00
Nick Kralevich
abc12070d0 Merge "Don't read /data/local.prop on user builds" 2012-01-18 15:41:47 -08:00
Nick Kralevich
0dbda7e1c5 Don't read /data/local.prop on user builds
Creating a root owned /data/local.prop is one of the most common
ways to root an Android device. /data/local.prop is only intended
to assist developers on debuggable devices, and is never
intended to be used on production devices.

Change-Id: Ifcfa21c2ee9914b0b54445218b4cf0fea0a98e9c
2012-01-18 13:38:34 -08:00
Nick Kralevich
38f368c1b3 Don't parse properties from unsafe files.
Don't set properties from files that are unsafe (world-writable
or group-writable)

Change-Id: I8da539c6446b10596be1d7c2014e4b9aea13e3fd
2012-01-18 13:22:38 -08:00
Dima Zavin
84bf9af758 init: use init's property expansion code for setprop/write
Change-Id: I3c284860cc8d5106ac2b086e62baeb6263873935
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:36:09 -08:00
Dima Zavin
78a1b1fe1a init: delay importing files until after parsing the current file
If we process the import directive inline, then the ordering of the
commands for the "on xxx" sections would be a little unexpected. The
init.rc files do not really have an implied  order as to which section
appears and gets processed first. The init code itself provides that
ordering explicitly. For the user, the expectation is that if both the
current file and the imported file define a section (e.g. "on init"),
then the commands in the current file will be executed first, and then
the ones from the imported file(s).

The current implementation did not do that. It processed the import
directive inline, and thus the imported (i.e. dependent) files would
appear first in the command lists for the sections. This created
unintended side effects and the solution would have been to try and
put the import lines somewhere in the middle of the init file. This
would be difficult to notice and hard to extract the dependencies.

To solve this, we add the imports to a list for each file being parsed
and process the list after finishing parsing the file. This provides
predictable order for imports and provides a logical flow from the
user perspective: the currently parsed file gets to run its commands
before the files being imported.

Change-Id: I06dc35ff286314060e16b18923683cd2787269de
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:36:06 -08:00
Dima Zavin
5511c84a50 init: export all androidboot cmd line values as ro.boot.xx props
Also, clean up how we initialize the ro.xx properties and process
the kernel command line.

Change-Id: Iedda6c90e31340a189171a44b2767480403354f7
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:36:02 -08:00
Dima Zavin
3e7b7739e3 init: import the hardware specific init file in init.rc
This removes the hardcoding of the file import in init and instead
allows the init.rc file to fully control what is loaded.

Change-Id: I933e5bbab57f1e8705a370d660f92c6508da94d2
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:35:58 -08:00
Dima Zavin
a6235eacf4 init: allow init file imports to use properties in names
Adds new property syntax in init files during init file filename
expansion during the import command:
${prop.name}

So, one can do:  import /init.${ro.hardware}.usb.rc

Should convert other usages of property names to use the new function.

Change-Id: I9205d7d7a2da620bc8e6b89ac0eb554fad53ded3
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:35:53 -08:00
Dima Zavin
d7634c9cda init: initialize property area early at boot
The property service is still started later, but the property area
and the initial boot properties are initialized before the init.rc
file is processed. This allows init.rc files to have access to boot
properties during parsing.

Change-Id: Iae9ed1093c821831a864b39ae6bc697e62b94757
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:35:49 -08:00
Dima Zavin
ebe2cb312d init: use init's property expansion code for setprop/write
Change-Id: I3c284860cc8d5106ac2b086e62baeb6263873935
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-05 15:02:28 -08:00
Dima Zavin
304f12270d init: delay importing files until after parsing the current file
If we process the import directive inline, then the ordering of the
commands for the "on xxx" sections would be a little unexpected. The
init.rc files do not really have an implied  order as to which section
appears and gets processed first. The init code itself provides that
ordering explicitly. For the user, the expectation is that if both the
current file and the imported file define a section (e.g. "on init"),
then the commands in the current file will be executed first, and then
the ones from the imported file(s).

The current implementation did not do that. It processed the import
directive inline, and thus the imported (i.e. dependent) files would
appear first in the command lists for the sections. This created
unintended side effects and the solution would have been to try and
put the import lines somewhere in the middle of the init file. This
would be difficult to notice and hard to extract the dependencies.

To solve this, we add the imports to a list for each file being parsed
and process the list after finishing parsing the file. This provides
predictable order for imports and provides a logical flow from the
user perspective: the currently parsed file gets to run its commands
before the files being imported.

Change-Id: I06dc35ff286314060e16b18923683cd2787269de
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-05 15:02:00 -08:00
Dima Zavin
8886112d87 init: export all androidboot cmd line values as ro.boot.xx props
Also, clean up how we initialize the ro.xx properties and process
the kernel command line.

Change-Id: Iedda6c90e31340a189171a44b2767480403354f7
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-05 15:02:00 -08:00
Dima Zavin
7634bf87cf init: import the hardware specific init file in init.rc
This removes the hardcoding of the file import in init and instead
allows the init.rc file to fully control what is loaded.

Change-Id: I933e5bbab57f1e8705a370d660f92c6508da94d2
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-05 15:02:00 -08:00
Dima Zavin
976b878a0a init: allow init file imports to use properties in names
Adds new property syntax in init files during init file filename
expansion during the import command:
${prop.name}

So, one can do:  import /init.${ro.hardware}.usb.rc

Should convert other usages of property names to use the new function.

Change-Id: I9205d7d7a2da620bc8e6b89ac0eb554fad53ded3
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-05 15:01:57 -08:00
Dima Zavin
65a8360795 init: initialize property area early at boot
The property service is still started later, but the property area
and the initial boot properties are initialized before the init.rc
file is processed. This allows init.rc files to have access to boot
properties during parsing.

Change-Id: Iae9ed1093c821831a864b39ae6bc697e62b94757
Signed-off-by: Dima Zavin <dima@android.com>
2011-12-20 13:46:17 -08:00
Jeff Brown
33901e6024 Delete dead code.
Change-Id: Icfb9bcee2c524026ecbeb7e30e943d8ca299a33a
2011-11-18 15:21:56 -08:00
Ken Sumrall
a286480f56 Fix the class_reset command
The class_reset command used to reset services that had been set to
"disabled" in the init.rc file to a non-disabled state.  Now, if the
service was originally set to "disabled", have the reset command set
it back to disabled.  Otherwise, set it to the "reset" state as it
currently does.

Change-Id: I0c10582e46a8e443d4748d9d893ae762b19b653a
2011-10-26 16:58:27 -07:00
Vladimir Chtchetkine
2b99543cef Pick up on androidboot.hardware kernel cmd option
x86 emulator passes hardware name through the androidboot.hardware kernel cmd option, and
ueventd must pick up on it to locate proper ueventd.rc file for that hardware.

Change-Id: Id61c5b67fe6275a15c7aa62556e0b89eda7968f8
2011-09-28 11:44:30 -07:00
Dima Zavin
ebf46586f5 init: do not load default.prop from ramdisk in charger mode
Change-Id: Ic471b891829d7f857674b925c9948954972d9ecb
Signed-off-by: Dima Zavin <dima@android.com>
2011-09-06 10:12:41 -07:00
Dima Zavin
ca47cef749 init: add charge mode handling
Introduces a 'charger' section that is processed when androidboot.mode
supplied on the kernel commandline is "charger".

In this mode, sections such as fs, post-fs, etc are skipped. Only the
'early-init' and 'init' sections of the init rc files are processed before
processing the 'charger' section.

Change-Id: If9eb6334de18f04cbcf2aab784578e2993615242
Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02 12:11:18 -07:00
Dima Zavin
da04c52ab1 init/cutils: move list utility code to cutils from init
Change-Id: I357ceee813700297d8343159f22a07659e768d41
Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02 12:11:18 -07:00
Dima Zavin
8f91282ebe init/cutils: move kernel logging interface to libcutils from init
Change-Id: Ia0f91b1fcd6cae69d76bf3dd841340958db938a8
Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02 12:11:17 -07:00
Dima Zavin
2d55e02d0f libcutils/init: move uevent socket opening code to libcutils
Change-Id: I90adf78c0eb6185505f2bf7b62e96e25ab918345
Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02 12:11:17 -07:00
Dima Zavin
3bea0790e2 init: check for list empty when getting commands for action
Change-Id: Id42d6a6b6297919b2e6520e074e31b5e01ae17bc
Signed-off-by: Dima Zavin <dima@android.com>
2011-08-26 14:03:32 -07:00
Benoit Goby
5da93589f1 Allow radio to set sys.usb.config
This allows the ril to put the phone into diagnostic mode

Change-Id: Iafc8164991550e7ab0ffda8b8da1d58e34a4225b
2011-08-22 12:12:37 -07:00
Benoit Goby
22bfc4cca0 Allow radio to set net.cdma* properties
Change-Id: I656abde9d06175eb158e84de4d08ede42620b46a
2011-07-28 18:10:23 -07:00
Benoit Goby
7100f640de Allow radio to set net.lte* properties
Change-Id: I4b7a280ba4c773673b28db8cfbbffcb360ee717f
2011-07-25 18:02:06 -07:00
Conley Owens
c21dcef9fe am 45e8fc6b: am 8621b5ea: am 212282c3: am 80dbd2a7: Merge "Fix build error in init when building with bootchart"
* commit '45e8fc6bfd9221274f48861287ff7af06ee7a199':
  Fix build error in init when building with bootchart
2011-07-25 17:25:13 -07:00
Conley Owens
45e8fc6bfd am 8621b5ea: am 212282c3: am 80dbd2a7: Merge "Fix build error in init when building with bootchart"
* commit '8621b5ea475822499128e6f138a9dfc224bbb569':
  Fix build error in init when building with bootchart
2011-07-25 12:21:21 -07:00
Conley Owens
80dbd2a7f2 Merge "Fix build error in init when building with bootchart" 2011-07-21 17:41:32 -07:00
Chia-chi Yeh
9bb4d411e0 init: update permissions for VPN.
VPN no longer uses system properties to keep network parameters.
Besides, profiles are now stored and encrypted by keystore.

Change-Id: I7575f04f350b7d8d5ba7008eb874a72180d057e8
2011-07-08 20:03:03 -07:00
Chia-chi Yeh
27164dce5f init: make "mkdir" work even when the directory already exists.
This allows us to change permissions and ownerships of directories
in init scripts without adding additional commands.

Change-Id: I1815d6015953035251b98f28c0f3efd3c7f25f80
2011-07-08 16:06:56 -07:00
Mike Lockwood
d18678f882 init: Handle EINTR in handle_property_set_fd()
Change-Id: I5a6f1791eaf11e98b1d81697112d78c99822fba5
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-01 15:04:38 -04:00
Mike Lockwood
1f0bd32f90 init: Add support for assigning system properties to system properties in init.rc
For example:
    setprop sys.usb.config $persist.sys.usb.config

Change-Id: I7b4e1ed1335906b32621bd96a341b0f94bbee7f5
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-09 15:42:54 -07:00
Mike Lockwood
f5cb5b2435 init: Fix the init.rc import command
Change-Id: I8a91c3f7d1ca31e137d9043bb7f56e4a44fb63df
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-09 15:42:47 -07:00
Mike Lockwood
7ba61b15ed init: Allow wildcards in property triggers by using * for property value
For example, the following trigger will fire when the sys.foo property
is set to any value:

on property:sys.foo=*
    write /data/foo hello

It is also possible to refer to the property within the trigger actions:

on property:sys.foo=*
    write /data/foo $sys.foo

Change-Id: If78d20a532f77e17aa5703d53be581ad6736cbcf
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-09 15:42:42 -07:00
Mike Lockwood
2c4d5dc415 init: Add support for writing system property value to a file in init.rc
The write command will write a property value if the value starts with a "$'

For example:
    write /sys/class/android_usb/iSerial $ro.serialno

Use double leading '$' if you need to write a string that starts with '$':

    write /data/foo $$hello

to write "$hello" to /data/foo

Change-Id: I55431ac7715a5347bb95c3a15aee97c575444dde
2011-06-09 15:42:31 -07:00
Ken Sumrall
211ce13432 Merge "Teach the mount command in init to not consider a wiped partition to be encrypted." 2011-05-27 16:13:43 -07:00
Ken Sumrall
7bc6e9ebe4 Teach the mount command in init to not consider a wiped partition to be encrypted.
Change-Id: I3e989f0b81ec35084baddc04e014406f4d90ce04
2011-05-26 20:01:39 -07:00
Nick Kralevich
57de8b8f27 rename uevent_checked_recv to uevent_kernel_multicast_recv
Change-Id: I1839627490080efcbb7269699709064856312f8b
2011-05-11 14:58:24 -07:00
Nick Kralevich
4682abaaa6 am b0d0e260: resolved conflicts for merge of 2baeb898 to honeycomb-plus-aosp
* commit 'b0d0e260bd6118959fa0e2d3c84037b3e0178551':
  Fold uevent message origin checking from init into libcutils.
2011-04-27 13:49:59 -07:00
Nick Kralevich
b0d0e260bd resolved conflicts for merge of 2baeb898 to honeycomb-plus-aosp
Change-Id: Ib3169b3a36aa13ef413da624355b1737e9b76fd9
2011-04-27 13:09:24 -07:00
Vernon Tang
3f582e92f0 Fold uevent message origin checking from init into libcutils.
Change-Id: I7cbc0cb840d1b4962e6c360fdad9a9c0ce20e87b
2011-04-28 05:16:21 +10:00
Nick Kralevich
bb738d6727 am de35f274: am 03752be0: am 0c297f5e: Merge "Revert "Fold uevent message origin checking from init into libcutils.""
* commit 'de35f2741c4e32e331a92be99f7c04b92b94beb2':
  Revert "Fold uevent message origin checking from init into libcutils."
2011-04-27 10:37:48 -07:00
Nick Kralevich
de35f2741c am 03752be0: am 0c297f5e: Merge "Revert "Fold uevent message origin checking from init into libcutils.""
* commit '03752be0a437d12e19ac73ebe23385fe6f756e2c':
  Revert "Fold uevent message origin checking from init into libcutils."
2011-04-27 10:35:06 -07:00
Nick Kralevich
de9e65dd65 Revert "Fold uevent message origin checking from init into libcutils."
This reverts commit 8405ec0e75.

The original change does not compile.
2011-04-27 10:21:24 -07:00
Nick Kralevich
3268eda4dc am e3ab4245: am a7cf7ed9: am 282c2ab4: Merge "Fold uevent message origin checking from init into libcutils."
* commit 'e3ab42457077ec2a66bac553e59a7fee08d4fa9e':
  Fold uevent message origin checking from init into libcutils.
2011-04-27 10:00:34 -07:00
Nick Kralevich
e3ab424570 am a7cf7ed9: am 282c2ab4: Merge "Fold uevent message origin checking from init into libcutils."
* commit 'a7cf7ed93486240ca48a407e67c7c3683a3b93aa':
  Fold uevent message origin checking from init into libcutils.
2011-04-27 09:59:14 -07:00
Vernon Tang
8405ec0e75 Fold uevent message origin checking from init into libcutils.
Change-Id: I1a38e611a7ad990f74306ce453740a1eeed2416d
2011-04-27 14:17:15 +10:00
Carl-Emil Lagerstedt
9ab8190e41 Fix build error in init when building with bootchart
There was a build error in init.c if you enabled bootchart, this
should probably be shipped upstream if not fixed already.

Change-Id: Iea3451c3e15d5cac00c5420d99bfce9a950aaaac
2011-04-11 14:17:54 +02:00
Brad Fitzpatrick
d6efa45489 am 80337ffc: am 47e4ee59: am 71ead183: Close the client socket early for ctl.* properties.
* commit '80337ffcf45205750b8b90cbbe28c4c8e7e2baff':
  Close the client socket early for ctl.* properties.
2011-04-01 12:27:04 -07:00
Brad Fitzpatrick
71ead18353 Close the client socket early for ctl.* properties.
Bug: 4199411
Change-Id: I3bf335e16e0df8405c538989a8f4f6db7795fa36
2011-04-01 12:00:35 -07:00
Colin Cross
ab0c4e0356 Merge "ueventd: track platform device uevents to parse block device names" 2011-03-31 17:01:26 -07:00
Colin Cross
320cbfa719 Merge "ueventd: refactor uevent handling" 2011-03-31 17:01:13 -07:00
Colin Cross
fadb85e3bd ueventd: track platform device uevents to parse block device names
The mmc block devices on panda boards use a platform device called
omap/omap_hsmmc.0.  The number of path entries in the uevent after
the platform device is unknown, and the number of path entries in
the platform device is unknown, so the only way to determine how
many entries make up the platform device is to compare against
a list of platform devices.

Add a list of platform devices that have been registered, and
iterate through it to determine the platform device portion of
a block device uevent.

Change-Id: I1480bc6429172ca6997d548787be3863ce062472
2011-03-31 16:44:04 -07:00
Colin Cross
eb5ba83065 ueventd: refactor uevent handling
Change-Id: I2002be3580ff87b0a55dc030a9099bf6d795011f
2011-03-31 16:37:20 -07:00
Brad Fitzpatrick
9f1e0e3ae3 Close the property socket *after* updating properties.
Also remove some dead code.

Bionic update is in change I3e80cecf

Bug: 4185486
Change-Id: I28e06197ff7a452c70b89b9fc5e2bcf0d9d54bbe
2011-03-30 15:27:03 -07:00
Brad Fitzpatrick
8ec49049da Close the property socket *after* updating properties.
Also remove some dead code.

Bionic update is in change I3e80cecf

Bug: 4185486
Change-Id: I8dd685eaea1a927c1659df5a1228cc259227ad1c
2011-03-30 14:18:25 -07:00
Brian Swetland
8d48c8e457 defer firmware load until after filesystems are mounted
In some situations a driver could try to request firmware before
/system is mounted.  Previously we'd fail the request.  Now we
will retry the read-from-filesystem every 100ms until we find the
firmware or we've finished the "fs" and "post-fs" stages of init.

Change-Id: Ie32402f7d41c818bf20f3297286ed5f99705b72c
2011-03-25 13:01:35 -07:00
Ken Sumrall
c5c51033c8 Load the persistent properties after decrypting the /data partition
Fix for bug 3415286.  The persistent properties are normally read early
in the boot process after /data is mounted.  However, for an encrypted
system, at that point /data is a tmpfs ramdisk.  This change adds a new
command to init (load_persist_props) to read the persistent properties,
and adds an action to init.rc to load the persistent properties.  This
action is triggered by setting a property in vold, but that's in a
different CL.

Change-Id: I74b3057974ee6029c29d956b76fef5566700d471
2011-03-10 18:12:19 -08:00
Ken Sumrall
e3aeeb4de3 Try to unmount writable filesystems when rebooting
Ext4 filesystems like to be unmounted before rebooting.  The Android system
doesn't have a traditional Linux init setup, and shutting down the system
was not much more than calling sync(2) and reboot(2).  This adds a new
function to libcutils called android_reboot().  By default, it calls sync()
and then remounts all writable filesystems as read-only and marks them clean.
There is a flag parameter in which the caller can ask for sync() not to be
called, or to not remount the filesystems as read-only.  Then it will call
reboot(2) as directed by the other parameters.  This change also updates
adb, init and toolbox to call the new android_reboot() function.
Fixes bugs 3350709 and 3495575.

Change-Id: I16d71ffce3134310d7a260f61ec6f4dd204124a7
2011-03-10 18:11:46 -08:00
Amol Bhatkar
cf01597121 property_service: Give radio permission to set net.qmi*
Change-Id: I771ef22859799b863ab79de9d3248ef610af4dd8
2011-03-02 16:00:58 -08:00
Ken Sumrall
dd4d786cbf Fix for bug 3379244, non-eMMC devices don't start all services.
Fix for non-eMMC based devices to properly start the "on nonencrypted"
action.

Change-Id: I5d2966db352b02f1a1724fb105e1cefc46037e42
2011-02-17 18:09:47 -08:00
Ken Sumrall
203bad597f Add the commands rm and rmdir to init.
rm only removes a single non-directory directory entry (no -r support)
rmdir removes a single empty directory

Change-Id: I49702b02ba98a177027b126268c2c2846f968195
2011-01-18 17:39:24 -08:00
Ken Sumrall
4e84d3bcf9 Set a read-only property to indicate if the device is running encrypted.
The UI needs to know if the device is running with an encrypted
filesystem or now.  So set a read-only property at boot to let it know.

Change-Id: I753de2d606c975bcbe9946d10fd47558cf357dac
2011-01-14 12:44:09 -08:00