Commit graph

441 commits

Author SHA1 Message Date
Mark Salyzyn
ebf49f3e87 init: 64-bit build issue
(cherry pick from Icc5344abc184adf4247175d85b2da08af4636e49)

Change-Id: I88b0c9b20720ac62ebae8359ded4ab77b4ebcdde
2014-05-01 12:19:45 -07:00
Ruchi Kandoi
75b287b771 ueventd: Ueventd changes the permission of sysfs files for max/min
cpufreq

The owner and permissions for the sysfs file
/sys/devices/system/cpu*/cpufreq/scaling_max/min_freq is changed.
This would allow the PowerHAL to change the max/min cpufreq even after
the associated CPU's are hotplugged out and back in.

Change-Id: Ibe0b4aaf3db555ed48e89a7fcd0c5fd3a18cf233
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2014-05-01 17:30:41 +00:00
Colin Cross
e99e5474e1 Merge "Sync persist property immediately,in case of suddenly remove the battery." 2014-04-18 18:49:17 +00:00
Mark Salyzyn
322445ce6d init: unused paramter warning messages
Change-Id: I1667371106be4b230ac3850e9819e4549eea2973
2014-04-01 15:35:14 -07:00
OPPO
de73a0cfdf Sync persist property immediately,in case of suddenly remove the battery.
Change-Id: I83c5812c69db532f4675f5dbfa508e55999c8dfe
2014-03-31 09:55:16 +00:00
Alex Ray
eb6ffc765b ueventd: fix klog debug typo
Change-Id: Ib0acece15145cc0e868452ede8f3acbab419b965
2014-03-19 15:17:59 -07:00
Jeff Sharkey
06f8c09542 Add "import" support to system property files.
During boot, allow a property file to import properties from another
file.  Supports importing the entire file, a specific key, or any
keys matching a specific prefix.  Here's some example syntax:

import /oem/oem.prop
import /oem/oem.prop foo.*
import /oem/oem.prop foo.bar

Bug: 13340779
Change-Id: I867f9a10ca09684326675d9f051f5cf2ae171617
2014-03-19 13:31:36 -07:00
Nick Kralevich
de151571a4 don't load property_contexts from /data
Bug: 12613118
Change-Id: I5a84b13d2151075d5136e3682431fbcc9307df13
(cherry picked from commit dc3a42bb11)
2014-03-11 21:27:27 -07:00
Alex Ray
18ccc1b8ee ueventd: easier debug logging
Move ueventd debug flag into the Android.mk.
Boost klog level if event logging enabled.

Change-Id: Iae48edbc43c487092c2424023576af29c76ff401
2014-03-07 13:58:02 -08:00
Mark Salyzyn
154f4608aa liblog: enable logging to logd.
* Modify liblog to send all messages to the new syslog user
  space daemon.

Original-Change-Id: I0ce439738cd921efb2db4c1d6a289a96bdbc8bc2
Original-Change-Id: If4eb0d09409f7e9be3eb4bb7017073dc7e931ab4
Signed-off-by: Nick Kralevich <nnk@google.com>

* Add a TARGET_USES_LOGD make flag for BoardConfig.mk to manage
  whether logd is enabled for use or not.
* rename syslog to logd to avert confusion with bionic syslog
* Add fake log support back in
* prefilter for logging messages from logd
* Fill in timestamps at logging source
* update abstract log reader
* switch from using suffix for id to v3 format
* log a message when creating devices that a deprecated interface
  is being utilized.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>

(cherry pick from commit 099e2c1f6f706a8600c1cef74cce9066fc315480)

Change-Id: I47929a5432977a1d7235267a435cec0a7d6bd440
2014-02-28 13:49:11 -08:00
Elliott Hughes
763bfce0b1 Remove an unused #include of <asm/page.h>.
Change-Id: I000aead8c82ec11151f69e6ce439dd09b0f0b4f4
2014-02-24 15:42:22 -08:00
Stephen Smalley
eb3f421e02 Enable building init with -Wall -Werror.
Eliminates various warnings from SELinux-related code.

Bug: 12587913
Change-Id: I28921f0ebd934324436609540d95ccef58552b64
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-02-19 09:15:09 -05: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
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
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
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
268cc54089 Merge "ueventd: fix a busy loop while reading uevents" 2013-12-28 20:09:53 +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
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
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
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
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
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
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
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