Commit graph

504 commits

Author SHA1 Message Date
Nick Kralevich
488b5eafe3 am 2e7347d6: Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API."
* commit '2e7347d617b02b13d227bb4cecf6bd69b7b20fa9':
  Convert all selinux_android_restorecon and _setfilecon calls to new API.
2014-02-12 23:19:02 +00:00
Paul Lawrence
13d5bb4bad Mount default encrypted devices at boot
If userdata is default encrypted, we should mount it at boot
to avoid bringing the framework up and then down unnecessarily.

Needs matching vold changes from
 https://googleplex-android-review.googlesource.com/#/c/412649/

Bug: 8769627
Change-Id: I4b8276befd832cd788e15c36edfbf8f0e18d7e6b
2014-02-07 07:23:11 -08:00
Stephen Smalley
27a93650c0 Convert all selinux_android_restorecon and _setfilecon calls to new API.
libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-02-07 09:38:32 -05:00
JP Abgrall
073e62e4ee am cdecfcbb: Merge "init: prevent waiting forever when a setprop is incomplete." into klp-volantis-dev
* commit 'cdecfcbb33fc3cc85ac7210ec53f6f1f90a6ffee':
  init: prevent waiting forever when a setprop is incomplete.
2014-01-31 23:07:20 +00:00
JP Abgrall
4515d81e7e init: prevent waiting forever when a setprop is incomplete.
Any app can
  socket_local_client_connect(s, "property_service", ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM)
and just keep it open without sending anything.
From then on, the property_service.c::handle_property_set_fd() will
just recv() forever.
This prevents any other properties (i.e. property_set("sys.powerctl", "reboot"))
from being processed.

Now, we just poll() for 2 sec before recv(...,MSG_DONTWAIT).

Bug: 12061560
Change-Id: Iffea4ebb444c7100b59c43ed87aecc5c99f9d3e8
2014-01-31 14:53:21 -08:00
Nick Kralevich
8ca9400c0a am f2869381: am 11322efd: am acd96b11: am 12db3eb6: Merge "Move restorecon and restorecon_recursive code to libselinux."
* commit 'f286938177390ec058ea39b308c9b9498b011c7c':
  Move restorecon and restorecon_recursive code to libselinux.
2014-01-28 21:19:32 +00:00
Nick Kralevich
acd96b1118 am 12db3eb6: Merge "Move restorecon and restorecon_recursive code to libselinux."
* commit '12db3eb6db3b80011043e404530012612a1d0fbf':
  Move restorecon and restorecon_recursive code to libselinux.
2014-01-28 21:02:57 +00:00
Stephen Smalley
dbd37f2e1d Move restorecon and restorecon_recursive code to libselinux.
This requires telling libselinux to use the sehandle already
obtained by init rather than re-acquiring it internally.  init
retains ownership of the sehandle because it performs the
initial load, uses the sehandle for other purposes (e.g. labeling
of directories created via mkdir and labeling of socket files),
and handles the policy reload property trigger.

Change-Id: I4a380caab7f8481c33eb64fcdb16b6cabe918ebd
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-01-28 10:42:24 -05:00
Nick Kralevich
ca53f0a084 don't load property_contexts from /data
Bug: 12613118

(cherry picked from commit dc3a42bb11)

Change-Id: If630478b0e3fdda8c1c14b3f41b717085acf9914
2014-01-22 12:17:36 -08:00
Nick Kralevich
349f894e52 Merge "don't load property_contexts from /data" 2014-01-19 18:29:01 +00:00
Nick Kralevich
dc3a42bb11 don't load property_contexts from /data
Bug: 12613118
Change-Id: I5a84b13d2151075d5136e3682431fbcc9307df13
2014-01-18 15:28:11 -08:00
Elliott Hughes
ab88481dc7 Merge "resolved conflicts for merge of ec9e5891 to master" 2014-01-16 22:43:20 +00:00
Elliott Hughes
b70375abc2 resolved conflicts for merge of ec9e5891 to master
Change-Id: I704e3159d529e436e060cb66c1739ef8e7b612d4
2014-01-16 14:42:35 -08:00
Elliott Hughes
ccecf14254 system/core 64-bit cleanup.
This cleans up most of the size-related problems in system/core.
There are still a few changes needed for a clean 64-bit build,
but they look like they might require changes to things like the
fastboot protocol.

Change-Id: I1560425a289fa158e13e2e3173cc3e71976f92c0
2014-01-16 12:54:18 -08:00
Doug Zongker
7baebf1345 add the pre-recovery service
Add a service called "pre-recovery" which is normally stopped but can
be started by the system server when we want to go into recovery.  It
will do any preparation needed (currently needed to handle update
packages that reside on an encrypted /data partition) and then set
sys.powerctl when it's ready to actually reboot.

Bug: 12188746
Change-Id: I894a4cb200395a0f6d7fe643ed4c2ac0a45d2052
2014-01-16 08:54:59 -08:00
Nick Kralevich
da1f43f075 am 5b5b1f9b: am d896c195: am 45f3ed05: am 105f6b66: Merge "restorecon_recursive("/sys") speed boot time"
* commit '5b5b1f9b48f966942be3cda8d4ecfb7d910f12a0':
  restorecon_recursive("/sys") speed boot time
2014-01-14 00:37:28 +00:00
Nick Kralevich
a613819a96 restorecon_recursive("/sys") speed boot time
Currently, the restorecon_recursive("/sys") call in
init.c takes approx 2 seconds on hammerhead. This change
reduces the delay to 1.2 seconds.

1) Avoid double stat call when using nftw (time savings
of 0.3 seconds)
2) Avoid the repeated calls to is_selinux_enabled() (time
savings of 0.5 seconds)

Avoid calling lsetfilecon if the file is already properly
labeled. This doesn't speed up the restorecon on /sys,
but it should help when handling files on /data.

Bug: 11640230
Change-Id: Ie212ce4f4acade208c5676d60c1f03f50e2388a4
2014-01-10 19:49:14 -08:00
Colin Cross
dab375bcba am 764daa33: am 21ff8257: am bb96da43: am 268cc540: Merge "ueventd: fix a busy loop while reading uevents"
* commit '764daa33c06b5fd699bf0c8162b18dd39b00795a':
  ueventd: fix a busy loop while reading uevents
2013-12-30 18:08:59 +00:00
Colin Cross
268cc54089 Merge "ueventd: fix a busy loop while reading uevents" 2013-12-28 20:09:53 +00:00
Nick Kralevich
81fcdd250e am b470d404: am b988e95c: am 6fec3a23: Merge "Log a warning on services that lack SELinux domains."
* commit 'b470d404e58bbe89c5c2822120b220e45ff72b42':
  Log a warning on services that lack SELinux domains.
2013-12-10 17:56:01 +00:00
Stephen Smalley
af06c6745b Log a warning on services that lack SELinux domains.
Sample output on flo:
<3>[    7.270568] init: Warning!  Service irsc_util needs a SELinux domain defined; please fix!
<3>[    8.290832] init: Warning!  Service bootanim needs a SELinux domain defined; please fix!

Change-Id: If5514b188517917d58ee81c446af563b0443be45
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-12-09 15:40:24 -05:00
Greg Hackmann
bf5e7ed84e am 5ebd8e43: am b2406973: Merge changes I727d9135,I3bd1b59d,I0d05aa28
* commit '5ebd8e43ba992d12fcdac4aedf7da51b50d6b949':
  rootdir: add ueventd.rc rule for adf subsystem
  init: add subsystem rules to ueventd.rc
  init: handle ueventd path truncation better
2013-11-27 17:09:20 +00:00
Greg Hackmann
dde75d940a am 675c9966: am 0914e01e: Merge "init: limit visibility of init_parser.c helpers"
* commit '675c996651e0513e9c7b657d356c55f9b05c7c9f':
  init: limit visibility of init_parser.c helpers
2013-11-27 17:09:20 +00:00
Elliott Hughes
7b1791e153 am 8bda6ce5: am 121400a4: Merge "Make init distinguish between orderly exit and being killed by signals."
* commit '8bda6ce55700e46760f8d59820406b72964fa171':
  Make init distinguish between orderly exit and being killed by signals.
2013-11-27 17:09:20 +00:00
Greg Hackmann
3312aa8379 init: add subsystem rules to ueventd.rc
By default ueventd creates device nodes under /dev based on the ueventd
DEVPATH.  Several subsystems have special rules which are hardcoded in
devices.c.  Moving forward these special rules should go in ueventd.rc.

Special rules have the syntax:

	subsystem <s>
		devname (uevent_devname|uevent_devpath)
		[dirname <dir>]

Devices matching SUBSYSTEM=<s> will be populated under <dir>.  dirname
is optional and defaults to /dev.  If dirname is provided, <dir> must
start with "/".

If devname is uevent_devname, ueventd will create the device node as
<dir>/DEVNAME.  DEVNAME may include intermediate subdirectories, which
ueventd will automatically create.

If devname is uevent_devpath, ueventd will use the legacy behavior of
computing DEVPATH_BASE=basepath(DEVPATH), and creating the device node
as <dir>/DEVPATH_BASE.

The new parsing code is based on init_parser.c, with small tweaks to
handle commands which don't fall under a section header.

Change-Id: I3bd1b59d7e62dfc9d289cf6ae889e237fb5bd7c5
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-11-26 13:18:23 -08:00
Greg Hackmann
f6e009ee26 init: handle ueventd path truncation better
Log an error before discarding problematic events, and add a missing
truncation check to the usb subsystem's unique codepath

Change-Id: I0d05aa287ffc63b46d1752d2a7409d35dc8caca7
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-11-26 13:17:35 -08:00
Greg Hackmann
0914e01ed9 Merge "init: limit visibility of init_parser.c helpers" 2013-11-26 20:58:43 +00:00
Elliott Hughes
6c5ad5c2ce Make init distinguish between orderly exit and being killed by signals.
Bug: 11826724
Change-Id: I7c11f602447dbd6862decc51cdfe883003cf7d67
2013-11-25 16:33:53 -08:00
Greg Hackmann
d68db71e75 init: limit visibility of init_parser.c helpers
To prevent clashing with forthcoming changes to uevent_parser.c

Change-Id: I2ee183261c7f43e0e4104a16a280c7ee73d7df96
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-11-25 11:24:16 -08:00
The Android Open Source Project
66ed50af68 Merge commit '536dea9d61a032e64bbe584a97463c6638ead009' into HEAD
Change-Id: I5c469a4b738629d99d721cad7ded02d6c35f56d5
2013-11-22 13:44:43 -08:00
Amir Goldstein
1d4e86c445 ueventd: fix a busy loop while reading uevents
Under certain conditions, poll() may raise the POLLERR
flag along with POLLIN, in which case the check for
(ufd.revents == POLLIN) results in an endless busy loop.

The following fix was applied to
hardware/libhardware_legacy/uevent/uevent.c
to fix a similar bug:

  commit 3aabb260ceef10377c31c9e45fb239247f5cfeba
  Author: Mathias Agopian <mathias@google.com>
  Date:   Mon Oct 1 14:53:18 2012 -0700

    fix a typo in uevent_next_eventi

    Bug: 7114973
    Change-Id: I15a4c714b59aeb1d02db00517d70b5f0e5ab22c2

Applying the same fix for two more poll loops in init
and ueventd.

Change-Id: I50693f6d3c904992ac4b8a9a14a83c7106e6b9e0
2013-11-17 14:50:00 +02:00
JP Abgrall
8ac7c9f659 am 308f0f9b: am 95e69261: am ac568b8f: Merge "init: remove obsolete rle logo"
* commit '308f0f9bf2a82d9c1e02982f0e177f6b04545210':
  init: remove obsolete rle logo
2013-10-17 09:50:44 -07:00
JP Abgrall
308f0f9bf2 am 95e69261: am ac568b8f: Merge "init: remove obsolete rle logo"
* commit '95e69261b22cd57c795e96e5ac122f120113f819':
  init: remove obsolete rle logo
2013-10-17 09:46:10 -07:00
Marcin Chojnacki
50dc936964 init: remove obsolete rle logo
Obsolete RLE 565 logo is used nowhere,
because 565 framebuffer isn't used for years.

It's not necessary to keep this thing alive anymore.

Change-Id: Ie61e168790f791230530cd3eb1c68b1f7344c9a7
2013-10-16 17:39:16 +02:00
Nick Kralevich
3a5a7c0e26 am aa4051dc: am 2f924ebe: am a94d2b39: Merge "Add a restorecon_recursive built-in command to init."
* commit 'aa4051dc4f90f987ba05269ce396d676571156e0':
  Add a restorecon_recursive built-in command to init.
2013-10-10 12:42:49 -07:00
Nick Kralevich
aa4051dc4f am 2f924ebe: am a94d2b39: Merge "Add a restorecon_recursive built-in command to init."
* commit '2f924ebe0b0891dba1996c246839427b23705018':
  Add a restorecon_recursive built-in command to init.
2013-10-10 12:38:44 -07:00
Stephen Smalley
726e8f7a8f Add a restorecon_recursive built-in command to init.
Functionally equivalent to the restorecon -R toolbox command.
A use case is given by:
I48eaa2b9901ac8c978192c14493ba1058a089423

Also, fix error handling and documentation for restorecon command.

Change-Id: Ia7fbcc82645baf52c6bff0490d3492f458881cbb
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-10-10 14:09:19 -04:00
Benoit Goby
adb88e20e4 am 4820022b: am 0b7d588d: am f2c4c4ad: Merge "init: Fix queue_all_property_triggers with nonexistent properties"
* commit '4820022b5edb0d19e268d836c25aa628b4378aba':
  init: Fix queue_all_property_triggers with nonexistent properties
2013-09-24 16:18:09 -07:00
Benoit Goby
4820022b5e am 0b7d588d: am f2c4c4ad: Merge "init: Fix queue_all_property_triggers with nonexistent properties"
* commit '0b7d588d531691904530ba57d772b31fb24ed343':
  init: Fix queue_all_property_triggers with nonexistent properties
2013-09-24 16:15:43 -07:00
Benoit Goby
d679e1b572 init: Fix queue_all_property_triggers with nonexistent properties
Don't queue actions for "on property=*" if the property does not exist.
This fixes these errors on boot:

    init: property 'sys.powerctl' doesn't exist while
    expanding '${sys.powerctl}'
    init: powerctl: cannot expand '${sys.powerctl}

Change-Id: I3bd354d73a860f856be5df2c654f940445f9efd9
2013-09-24 15:20:34 -07:00
Colin Cross
7a060eddce am 54aad026: am 8dc82eea: am 36b39a97: Merge "init: Fix get_hardware_name() to cope with long /proc/cpuinfo output"
* commit '54aad026616148164ff6ceda7508a4e5a04ec569':
  init: Fix get_hardware_name() to cope with long /proc/cpuinfo output
2013-09-18 16:09:13 -07:00
Colin Cross
54aad02661 am 8dc82eea: am 36b39a97: Merge "init: Fix get_hardware_name() to cope with long /proc/cpuinfo output"
* commit '8dc82eea7ebda374830ee7fa1802222a94eefd88':
  init: Fix get_hardware_name() to cope with long /proc/cpuinfo output
2013-09-18 16:04:22 -07:00
Colin Cross
36b39a97f3 Merge "init: Fix get_hardware_name() to cope with long /proc/cpuinfo output" 2013-09-18 21:38:33 +00:00
Nick Kralevich
3dcfb7f107 am 18c34183: am 5535b051: write_file: introduce O_NOFOLLOW, use sane mask
* commit '18c34183d76be2efbf2f498ec0185c1ceffa49f0':
  write_file: introduce O_NOFOLLOW, use sane mask
2013-09-17 15:07:10 -07:00
Nick Kralevich
18c34183d7 am 5535b051: write_file: introduce O_NOFOLLOW, use sane mask
* commit '5535b05120fa3fd3d68a09e01284aba35cc6e058':
  write_file: introduce O_NOFOLLOW, use sane mask
2013-09-17 15:04:45 -07:00
Nick Kralevich
5535b05120 write_file: introduce O_NOFOLLOW, use sane mask
Don't follow symlinks when writing to a file.
Don't create world-writable files.

Bug: 10802869
Change-Id: Ifb55600d574307a535df878acb3347e02028cd30
2013-09-17 14:46:00 -07:00
Nick Kralevich
c2c5a2410a property_service: address comments from previous review.
Address post-submit comments from
6946361421

Bug: 10733330
Change-Id: I7c652f7ef0379536df48b9478a2362f1bfd252fe
2013-09-16 11:32:37 -07:00
Nick Kralevich
b453a9aa1d am 3a0d4b34: Merge "property_service: better validate property names" into klp-dev
* commit '3a0d4b34816d65e21951f44e4d98a954c5c855ae':
  property_service: better validate property names
2013-09-16 10:31:12 -07:00
Nick Kralevich
6946361421 property_service: better validate property names
Don't allow unexpected characters in property names.
Don't allow double dots in property names.

Bug: 10733330
Change-Id: I8d69740d697efb791f2f201f90989576e13bac81
2013-09-16 09:05:29 -07:00
Dima Zavin
e4e7fef1bc am 5951a369: am b4819e4a: Merge "init: support longer command lines"
* commit '5951a3691eb0378ec65ea2e6a2e2fe77d24c5e55':
  init: support longer command lines
2013-09-13 09:42:10 -07:00
Andrew Boie
2e63e71f31 init: support longer command lines
The Linux kernel supports command lines up to 2048 bytes on x86,
see COMMAND_LINE_SIZE in asm/setup.h.

If any androidboot.xxxx arguments were past the 1024 byte limit
here, they were lost.

Change-Id: I6247c511a7de04109490fffa0125801d274a5501
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2013-09-09 13:11:34 -07:00
Colin Cross
d64df29699 am 9dd40e97: am d171b656: Merge "[GNSS] Add AID_GPS to property user white list"
* commit '9dd40e9756de23a25aaa9909c8d4055105621a76':
  [GNSS] Add AID_GPS to property user white list
2013-09-03 17:13:35 -07:00
Colin Cross
d171b65670 Merge "[GNSS] Add AID_GPS to property user white list" 2013-09-04 00:09:30 +00:00
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