Commit graph

559 commits

Author SHA1 Message Date
Nick Kralevich
042ece12be am 465fc3b9: am 1cbf4329: Merge "Remove obsolete warning from restorecon_recursive documentation."
* commit '465fc3b974384feea3ea991a5e2f801ce1253e2f':
  Remove obsolete warning from restorecon_recursive documentation.
2014-09-02 15:59:17 +00:00
Stephen Smalley
d9c19b0c15 Remove obsolete warning from restorecon_recursive documentation.
We originally included a warning to not invoke restorecon_recursive
with a path leading to a shell-writable or app-writable directory
due to concerns about the potential for mischief with symlinks during
the restorecon_recursive.  However, this warning was never necessary for
calling restorecon_recursive during system initialization before an adb
shell or app can run, and we have further prohibited init from
reading/following symlinks that can be created by shell or apps in
policy, so this warning is superfluous.  It also contradicts current
usage of restorecon_recursive in rootdir/init.rc, since it is called
there on /data.

Change-Id: I28a635e0b5991ced8adcef93e7a04f9d9e5634fd
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-09-02 09:34:53 -04:00
Elliott Hughes
d546cb59ea am bf921c51: am 7a1973ec: Merge "remove examples of unimplemented triggers ( device-added device-removed ) from init/readme.txt"
* commit 'bf921c5112043b5e39b76e76f38f2818bc904b05':
  remove examples of unimplemented triggers ( device-added device-removed ) from init/readme.txt
2014-08-29 22:38:37 +00:00
Trevor Drake
d028394a27 remove examples of unimplemented triggers ( device-added device-removed )
from init/readme.txt

Change-Id: I16e226d8f563a223ae20044fff30498883bc4ae2
2014-08-29 20:07:28 +01:00
Elliott Hughes
a1e9ced56e am 8e207634: am d5f230af: Merge "Remove descriptions of unimplemented triggers."
* commit '8e207634c89e18a319c6514c39acd5aaff6d8f83':
  Remove descriptions of unimplemented triggers.
2014-08-28 17:15:26 +00:00
Trevor Drake
d4a497714a Remove descriptions of unimplemented triggers.
device-added, device-removed and service-exited were described but
never implemented.

Change-Id: I6fbd05a85576d18d6741fc6dd549acc9132b0531
2014-08-28 15:38:52 +01:00
Paul Lawrence
a95e10fe31 am a005e779: Merge "Enable not rebooting during default encryption" into lmp-dev
* commit 'a005e7795e3dfb7cc0bd2bc65208d2490bfc89d8':
  Enable not rebooting during default encryption
2014-08-26 04:53:43 +00:00
Paul Lawrence
c23074f386 Enable not rebooting during default encryption
Need to not set this property) during mount, since it can't
be changed later (ro property)

Also no reason to start class main on encryption cycle - we'll
show surfaceflinger, which is enough UI for this short cycle.

Bug: 17041092
Change-Id: Ica5339c54e45716d0fe20e23c0ab857f388d23ed
2014-08-25 19:24:10 +00:00
Kenny Root
c6c8b563e6 am cf2b944d: am 5a1d5a8c: Merge "ueventd: call _exit for safety"
* commit 'cf2b944df6d744d279a434ec280f9bd8cef03a5b':
  ueventd: call _exit for safety
2014-08-25 18:03:27 +00:00
Kenny Root
17baff480a ueventd: call _exit for safety
Make sure to call _exit instead of exit to avoid triggering exit
handlers that may have existed in the parent process.

Print out a log message when forking to process firmware events fails.

Change-Id: I2436bdf85d9a8ea26b718e62023f1dac89864667
2014-08-25 10:05:08 -07:00
Elliott Hughes
0fd33562d6 am 5d228392: am d24240fb: Merge "Fixed the pacing logic in bootchart data collection."
* commit '5d2283927a9527130cad15d33c1e2b360f4bd46f':
  Fixed the pacing logic in bootchart data collection.
2014-08-06 22:40:43 +00:00
Elliott Hughes
d24240fb4f Merge "Fixed the pacing logic in bootchart data collection." 2014-08-06 17:15:22 +00:00
Bo (Andover) Zhang
3700373c67 Fixed the pacing logic in bootchart data collection.
Ideally bootchart collects system data every BOOTCHART_POLLING_MS ms.
However, the current bootchart pacing logic would collect data every
time the main loop in init.c is executed. This results in:

1. Multiple data samples being taken consecutively or prematurely. In
many cases, these data samples have the same timestamp (in jiffies).
The off-line data processing tool would complain about dividing by
zero "interval" and bail out.

2. Because of the ineffective pacing, bootchart data collection would
terminate prematurely. The total duration of data collection is usually
much shorter than what the user specifies.

The fix is to check whether BOOTCHART_POLLING_MS ms has elapsed
before taking a new data sample. For this purpose, /proc/uptime
is used to get the time values, consistent with the precision of
bootchart timestamps.

Change-Id: I106bf91dbda01059b719df6c73b8bd1cd54a64f0
Signed-off-by: Bo (Andover) Zhang <zhang@broadcom.com>
2014-07-29 21:09:01 -04:00
Elliott Hughes
0b6f8974c9 am 95ec9ae2: am bce3c0c7: Merge "Clarify init\'s write command."
* commit '95ec9ae2c6bad929853c8e0574a354f2eda9604b':
  Clarify init's write command.
2014-07-25 23:04:03 +00:00
Elliott Hughes
afc08ce392 Clarify init's write command.
Bug: https://code.google.com/p/android/issues/detail?id=73996
Change-Id: I4f8d3927d17a4021a2436c2859aa732479c5a118
2014-07-25 14:57:47 -07:00
Elliott Hughes
d41f1a7ae4 Clarify init's write command.
Bug: https://code.google.com/p/android/issues/detail?id=73996

(cherry picked from commit afc08ce392)

Change-Id: Id2fb11d5259957ef23cc839fba14af8452fc69e4
2014-07-25 15:49:44 -07:00
Riley Andrews
4aa98b0c7c am c6ac2793: am ebf9f8f1: Merge "Move unlink("/dev/.booting") until after filesystems are mounted."
* commit 'c6ac27937c632b00836ad72c83c9e7a640030aff':
  Move unlink("/dev/.booting") until after filesystems are mounted.
2014-07-14 20:11:41 +00:00
Riley Andrews
80c7a5e8a8 Move unlink("/dev/.booting") until after filesystems are mounted.
Move the unlink out of init.c and into init.rc, so that the file
will be removed after all the filesystems with firmware are up.

Change-Id: Ifdd5dd1e95d7e064dde5c80b70198882d949a710
2014-07-14 13:17:43 -07:00
Elliott Hughes
ecba4dc037 am 85dfe988: am 796fccb8: Merge "Fix environment variable assignment in init"
* commit '85dfe98830c78f1c3d400ca7be4ac594bfcdd275':
  Fix environment variable assignment in init
2014-07-12 19:36:57 +00:00
Riley Andrews
9464e5a58d Move unlink("/dev/.booting") until after filesystems are mounted.
Move the unlink out of init.c and into init.rc, so that the file
will be removed after all the filesystems with firmware are up.

Change-Id: I7442df2042cc2788d0301f00e3c2fba7d6e0e1c7
2014-07-11 15:47:15 -07:00
James Morrissey
381341f5f7 Fix environment variable assignment in init
The init process allows environment variables to be specified in
the rc script globally, via 'export', and for a specific process,
via the 'setenv' option.

However, the mechanism for assembling the environment simply
appended the new variable without checking whether it was already
defined, so it was not possible to overwrite an existing entry.
This patch fixes that behaviour.

Limitations and concerns:

The limit of a maximum number of 31 variables is unchanged.

Currently, most callers of "add_environment" do not check the return
value, but the function now logs the failure rather than failing
silently.

Change-Id: Ie9a68c37a0f55c5b40e904e695cd35514f67f480
2014-07-10 11:22:46 -07:00
Nick Kralevich
3b4c0bda07 ueventd fixup_sys_perms: fixup SELinux labels unconditionally
Currently, the fixup code in fixup_sys_perms() scans through all
entries in uevent*.rc. If it finds a match, then it performs a fixup.
If there's no match in that file, no fixup is performed.

SELinux file labels are independently stored in /file_contexts,
with no relationship to the files in /ueventd.rc. Even when no
entries exist in ueventd.rc, we still want to fixup the SELinux
file label in /sys when a uevent message occurs.

Change-Id: I0ccb5395ec0be9282095b844a5022e8c0d8903ac
2014-07-07 11:14:59 -07:00
Colin Cross
09117c70f1 Merge "ueventd: allow matching symlink names when setting permissions" 2014-07-02 20:52:43 +00:00
Colin Cross
43d537e0de ueventd: allow matching symlink names when setting permissions
Change-Id: I5f6cc2a25f1236fbe2c7193b65363b7883b9ba2e
2014-07-02 13:56:55 -07:00
Nick Kralevich
4ef159a3c7 am 7367ecbc: am 06023134: am 8022ce1e: Merge "ueventd fixup_sys_perms: fixup SELinux labels unconditionally"
* commit '7367ecbc4839e3a608ab9b7742c659b58065209f':
  ueventd fixup_sys_perms: fixup SELinux labels unconditionally
2014-07-07 20:05:16 +00:00
Colin Cross
0c44584b47 am b18d44e4: am ab7e5752: am 09117c70: Merge "ueventd: allow matching symlink names when setting permissions"
* commit 'b18d44e458501f6b5b99349acc68d3d4e90e9d62':
  ueventd: allow matching symlink names when setting permissions
2014-07-02 23:13:48 +00:00
JP Abgrall
cee206880e [HACK]fs_mgr+init: Format via recovery if encryptable /data is wiped
If the encryptable partition is wiped (4KB worth of 0 or 0xff),
then reboot into recovery to format /data+/cache

This is while waiting for the Mac OS support to format f2fs.
The flashstation running on Mac OS will currently just erase userdata
and not format it with f2fs.

Bug: 15720406
Bug: 15747366
Change-Id: Ib7cca3e1701483a09573457a835750f34da71ee0
2014-07-02 14:28:50 -07:00
JP Abgrall
f22b745294 fs_mrg: clean up multi-type mount_all
Move the code that attempts to mount alternative fstab entries
into its own function.
Clarify return codes.
Suggest wipe via recovery in error messages.

Bug: 15747366
Change-Id: I3634477cd4d1d73f974f3e906c53285f0d9e0eac
Signed-off-by: JP Abgrall <jpa@google.com>
2014-07-02 13:39:44 -07:00
Elliott Hughes
e61679c2fe am fac28281: am b13e4b5e: am 5a53ee05: Merge "Remove an unused #include of <sys/_properties.h>."
* commit 'fac2828161b6b14b7e862d94f2f4ef467621c832':
  Remove an unused #include of <sys/_properties.h>.
2014-06-30 19:41:05 +00:00
Elliott Hughes
11d783f1e7 Remove an unused #include of <sys/_properties.h>.
Bug: 15704351
Change-Id: I7841da7176d0638ae6737fe719cd187892bc38e6
2014-06-30 10:11:55 -07:00
Riley Andrews
24912dc446 resolved conflicts for merge of fa6f2543 to master
Change-Id: I04ce82e5d245e90e2cc62b76d688ec902c1a471d
2014-06-26 20:49:46 -07:00
Riley Andrews
1bbef88e80 Add ability to adjust init log level at runtime.
+ Add a new property, sys.init_log_level, which can be set after init
  bootstrap. This will control the level at which init does prints to klog.

Change-Id: Ia15b2110157b5e6b713785ece9b0fb94889be6c8
2014-06-26 15:05:20 -07:00
Riley Andrews
24a3b783d5 Improve init's debug printing.
+ Make prints of rc commands significantly more verbose. All commands
  will log all arguments, file/line number of the command, return value,
  and parent action which triggered the command.

init: command 'mount tmpfs tmpfs /mnt/obb mode=0755,gid=1000' action=init
      status=0 (/init.rc:89)
init: command 'setprop net.tcp.default_init_rwnd 60' action=boot status=0
      (/init.rc:403)

Change-Id: I5498c7258e4891706be4a12546df4231d14d86c4
2014-06-26 15:05:15 -07:00
Nick Kralevich
f95244a9fc resolved conflicts for merge of dd8e63a4 to master
Change-Id: I5ee88d4a3846cb617ec115cb55c8192c8ecf2f4f
2014-06-26 05:13:39 -07:00
Nick Kralevich
64f5fe2796 Merge "property_service: get rid of hard coded property / control list" 2014-06-25 17:34:34 +00:00
Nick Kralevich
61be43907f am 471a7034: am aadf9f11: am 4ad20e55: Merge "Redirect libselinux logging to dmesg for ueventd."
* commit '471a7034b2fca93f174c88e275d3968032730aa7':
  Redirect libselinux logging to dmesg for ueventd.
2014-06-25 18:46:59 +00:00
Stephen Smalley
439224e275 Redirect libselinux logging to dmesg for ueventd.
We already do this for init, but had failed to do it for ueventd
and could not capture any logging from libselinux calls made by
ueventd.

Truly enabling non-error logging also requires uncommenting a line
in Android.mk:
LOCAL_CFLAGS += -DLOG_UEVENTS=1
which enables other logging and sets the default log level to INFO,
or otherwise changing the klog level in the ueventd code (is not
settable by init.rc loglevel).

Change-Id: I00e6f9d6271f2a21d9078c96368816d74d6d2850
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-06-24 14:11:59 -04:00
Riley Andrews
6bd4588d65 resolved conflicts for merge of 079c637f to master
Change-Id: Iab9a857026de954d7497d6b0eaf3751d2d3904c7
2014-06-23 15:20:51 -07:00
Ruchi Kandoi
c603720aed ueventd: UEVENT_MSG_LEN changed to 2048 from 1048 in compliance with the
BUFFER_LEN in the kobject_uevent in kernel.

Change-Id: Ib98626f20a7c26e7718bbe4d5ec4513a1ae5d9b7
2014-06-23 11:22:09 -07:00
Riley Andrews
e4b7b294f3 Add ability to boot from charger mode.
Add the ability to boot up directly from charger mode, instead of forcing
charger mode to initiate a full restart to launch 'full' android. This
should shave a few seconds off of boot time on supported devices (just
manta for now).

Change-Id: Ieec4494d929e92806e039f834d78b9002afd15c4
2014-06-20 16:43:00 -07:00
Daniel Leung
c0c1ffea58 init/ueventd: adds wildcard matching for ueventd rules
The sysfs nodes can change from devices to devices for
a particular class of peripheral. Some of them even change
after suspend/resume, e.g. rfkill for USB bluetooth adapters.

This patch adds to the way how ueventd rules with wildcard are
handled. In addition to matching the prefix with a trailing
wildcard, now rules can have wildcard anywhere in the rule.
The wildcard matching is implemented using fnmatch(), where
its matching is simliar to shell pathname expansion. It suits
this particular usage model well. To avoid abuse, the number of
slashes has to match between path name and the rule.

For example, instead of creating a rule to match:

  /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.0/bluetooth/hci0/rfkill*

, this would suffice:

  /sys/devices/pci0000:00/0000:00:1d.0/*/*/*/*/bluetooth/hci0/rfkill*

The prefix matching behavior is retained, such that those
rules do not have to pay for processing penalty with fnmatch().

Change-Id: I3ae6a39c838f6d12801cb71958e481b016f731f5
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2014-06-20 09:28:37 -07:00
Colin Cross
c7ee12d7ed am 105ecf71: am 72d9c0b1: am 56b1d74e: Merge "init/ueventd: adds wildcard matching for ueventd rules"
* commit '105ecf71c2a7f683d34995dc290a4bf50413cf15':
  init/ueventd: adds wildcard matching for ueventd rules
2014-06-21 00:28:53 +00:00
Nick Kralevich
528c13eb07 property_service: get rid of hard coded property / control list
Don't force people to make modifications to property_service.c
when handling properties. Exclusively use the SELinux rules,
which are more flexible and easily adjusted.

Change-Id: Ic0bbd01b5df2eef0040286ac59c0a01e9bd14315
2014-06-17 22:23:54 -07:00
Nick Kralevich
3a53b49075 am 545c6599: am a029d14d: am 2af91ffb: Merge "Extend ueventd to use the label-by-symlink support in libselinux."
* commit '545c6599fa2702a3a220f486367e9df42b20e0b6':
  Extend ueventd to use the label-by-symlink support in libselinux.
2014-06-17 18:53:56 +00:00
Stephen Smalley
b4c5200f51 Extend ueventd to use the label-by-symlink support in libselinux.
When ueventd creates a device node, it may also create one or more
symlinks to the device node.  These symlinks may be the only stable
name for the device, e.g. if the partition is dynamically assigned.
A corresponding change with the same Change-Id to external/libselinux
introduces selabel_lookup_best_match() to support looking up the "best match"
for a device node based on its real path (key) and any links to it
(aliases).  This change updates ueventd to use this new interface
to find the best match for the device node when creating it.

Change-Id: Id6c2597eee2b6723a5089dcf7c450f8d0a4128f4
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-06-16 09:44:30 -04:00
Nick Kralevich
d69f6b6f7a am 38fd5650: am 82015d4f: Merge "Only allow disabling SELinux on userdebug / eng builds"
* commit '38fd5650ea03b1f47ead2a12a655298ef2f70a91':
  Only allow disabling SELinux on userdebug / eng builds
2014-06-03 16:43:10 +00:00
Nick Kralevich
f3c85b2488 Only allow disabling SELinux on userdebug / eng builds
Only parse and honor the kernel command line on userdebug
or eng builds. On user builds, assume that selinux is always enabled
and enforcing.

Change-Id: I71c66e4365bdf2f226800634126a38b716d96599
2014-06-02 20:56:04 -07:00
Nick Kralevich
ab1816a6c0 am 4f04439f: am 6fb92bd8: am 252b0e2b: Merge "SELinux changes to check policy versions during a reload."
* commit '4f04439f0eab481d1b7938e78d8ee316dda4d641':
  SELinux changes to check policy versions during a reload.
2014-05-31 11:38:44 +00:00
Nick Kralevich
252b0e2b46 Merge "SELinux changes to check policy versions during a reload." 2014-05-31 05:03:05 +00:00
Colin Cross
fd2442ebf9 am c34598aa: am 55c3401b: am 08befc3a: Merge "ueventd: support by-name symlinks for PCI block devices"
* commit 'c34598aa657121ed2feafdae35032e72aa1c9a80':
  ueventd: support by-name symlinks for PCI block devices
2014-05-22 19:26:44 +00:00