Commit graph

420 commits

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