summaryrefslogtreecommitdiffstats
path: root/init
Commit message (Collapse)AuthorAgeFilesLines
...
* | Remove unused variable BOOTCHART_DEFAULT_TIME_SEC.Elliott Hughes2015-02-131-3/+0
| | | | | | | | Change-Id: Id43c73dd32d2f9f1eee9592b55aa3fd3c02094b2
* | Further refactoring of the bootchart code.Elliott Hughes2015-02-135-368/+187
| | | | | | | | Change-Id: Ifed6ae8d481b605139fd27799574de4c2d0f5908
* | bootchart: fix bootchart can not be triggered problemYongqin Liu2015-02-127-111/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bootchart uses a file on the data partition to decide if it should collect data for bootchart, but the data partition will be mounted by the mount_all command in the "on fs" section, and it will be only added into the action queue when command "trigger fs" is executed, but that's after the bootchart_init action (late_init). This change makes bootchart_init a builtin command of init, and make it executed as the first command of "on post-fs" section which will be triggered after the "on fs" section. This change also refactors the bootchart code to all be in bootchart.cpp. Change-Id: Ia74aa34ca5b785f51fcffdd383075a549b2a99d9 Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
* | Bump do_write buffer sizeJohan Redestig2015-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case of do_write (write to generic file) there is really no relation to the PROP_VALUE_MAX limitation of system properties. The current value, 92, is not so much for writing to files so bump it a bit. Ideally there should not be any low hard limit in this case. Either expand_props should allocate the output buffer or take the output fd and to streaming write. Such a change is rather invasive though and at this point in time it seems reasonable that one dont want more than 256 character strings in the init files. Change-Id: I846a282ae4e747e6171eef38b302b46287951451
* | Clean up reading and writing in init.Elliott Hughes2015-02-0611-149/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | This isn't particularly useful in and of itself, but it does introduce the first (trivial) unit test, improves the documentation (including details about how to debug init crashes), and made me aware of how unpleasant the existing parser is. I also fixed a bug in passing --- unless you thought the "peboot" and "pm" commands were features... Bug: 19217569 Change-Id: I6ab76129a543ce3ed3dab52ef2c638009874c3de
* | Stop using #if for conditional compilation.Elliott Hughes2015-02-0411-185/+162
| | | | | | | | | | | | | | | | Use regular 'if' to prevent bitrot. Also remove remaining typedefs. Change-Id: I2e6ca928e2db29b88b643cf990ff05cfb0be94a6
* | Use TEMP_FAILURE_RETRY, always build bootchart.cpp.Elliott Hughes2015-02-046-70/+25
| | | | | | | | | | | | | | | | Also switch the revision parsing over to sscanf as promised. I haven't done the hardware parsing because I don't yet know whether we actually need to keep the space-stripping code. Change-Id: Ic33378345cd515cb08d00c543acf44eb72673396
* | Fix clang "ueventd.cpp:111:1: error: no return statement in function ↵Elliott Hughes2015-02-041-0/+2
| | | | | | | | | | | | returning non-void". Change-Id: I69c9e5534975bffa0fbf98ca4af50400f6b94aa0
* | Build init as C++.Elliott Hughes2015-02-0420-146/+101
| | | | | | | | | | | | This is just the minimal change to keep it building. Change-Id: I245c5b8413a1db114576c81462eb5737f5ffcef2
* | Fix x86_64 buildDmitriy Ivanov2015-02-031-2/+2
| | | | | | | | Change-Id: Iaa3a641907de55b398a3bdd0bbc63cbb9d367982
* | Merge "Init: Fix Clang unsupported attributes"Elliott Hughes2015-02-031-0/+6
|\ \
| * | Init: Fix Clang unsupported attributesAndreas Gampe2015-02-031-0/+6
| | | | | | | | | | | | | | | | | | Make attributes conditional on not compiling with Clang. Change-Id: Ic4e9b382308651c7b1901bfa192b6591672dc5ab
* | | Init: Fix literalAndreas Gampe2015-02-031-1/+1
|/ / | | | | | | | | | | This is a literal 0 implicitly converted to a NULL. Change-Id: I0573e85eb0578f938877c4bec79054081c27e661
* | Trivial cleanup of recent changes.Elliott Hughes2015-02-023-6/+9
| | | | | | | | | | | | | | A typo in the documentation for one, and a couple of signed/unsigned warnings in the implementation of the other. Change-Id: I8fb4b7448ac901c543dea7420aabcedf13ec1bd8
* | init: Implement 'exec' command.San Mehat2015-02-026-4/+74
| | | | | | | | | | | | (cherry-pick of d05ab3952ec0e38f33a0e80ce6b9eb45b0064ba4.) Change-Id: Id6d9bb32e51a0ad090ed8240cc505dc45b57b35d
* | init: Add support "&&" operator in property triggersBadhri Jagan Sridharan2015-02-025-56/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "&&" operator can now be used to test the validity of two of more properties. For example: on property:test.a=1 && property:test.b=1 setprop test.c 1 The above stub sets the test.c to 1 only when both test.a=1 and test.b=1 (cherry-pick of 162f7d797c67019a7a3f08c3b0f0ffc91d548ddc.) Change-Id: I72c19f7aa92231372a416193618ee6c7fd368141 Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
* | Add O_CLOEXEC to lots of open() calls.Nick Kralevich2015-02-028-44/+31
| | | | | | | | | | | | and other related fixups. Change-Id: Ia88fb37a07ff6777d00c49800081f5a519c0c78d
* | builtins.c: Don't require file open() for chmod/chownNick Kralevich2015-02-021-63/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 42a9349dc4e98019d27d7f8d19bc6c431695d7e1 modified init's builtin chmod, chown, and mkdir calls to avoid following symlinks. This addressed a number of attacks we were seeing at the time where poorly written init scripts were following attacker supplied symlinks resulting in rooting vulnerabilities. To avoid race conditions, the previous implementation only ran fchown / fchmod on file descriptors opened with open(O_NOFOLLOW). Unfortunately, unlike the normal "chown" or "chmod" calls, this requires read or write access to the underlying file. This isn't ideal, as opening some files may have side effects, or init may not have permission to open certain files (such as when SELinux is enabled). Instead of using open(O_NOFOLLOW) + fchown(), use lchown() instead. As before, the target of the symlink won't be modified by chown. This also supports setting the ownership of symlinks. Instead of using open(O_NOFOLLOW) + fchmod(), use fchmodat(AT_SYMLINK_NOFOLLOW) instead. As before, the target of the symlink won't be modified by chmod. This change will continue to ensure that chown/chmod/mkdir doesn't follow symlinks, without requiring init to open every file in read-only or read-write mode. This change depends on bionic commit I1eba0cdb2c509d9193ceecf28f13118188a3cfa7 Addresses the following mako/occam SELinux denial: audit(1422770408.951:6): avc: denied { write } for pid=1 comm="init" name="smd7" dev="tmpfs" ino=7207 scontext=u:r:init:s0 tcontext=u:object_r:radio_device:s0 tclass=chr_file Change-Id: I14fde956784d65c44e7aa91dd7eea9a004df3081
* | Add missing includes.Elliott Hughes2015-01-292-0/+2
| | | | | | | | Change-Id: Iaa130c0a7eb2cbc0c8486546e5b622661b6d9e23
* | Enable clang for init, after fix of global .mk files.Chih-Hung Hsieh2015-01-221-4/+0
| | | | | | | | | | | | | | | | | | | | LOCAL_FORCE_STATIC_EXECUTABLE was not working properly for clang because -Bstatic was ignored by clang. We can now enable clang for init after the -static flag is added to link static executable files in build/core/definitions.mk. BUG: 18008984 Change-Id: I3f361b83c1e0b313914603dff33fd090cd3b116a
* | property_service: Added vendor build properties to load_all_propsAndres Morales2015-01-131-0/+1
| | | | | | | | Change-Id: Id50a6dd7fd40752efff8a327ea6b4a45b07fc1b2
* | Move property_context label handling to libselinux.dcashman2014-12-101-20/+0
| | | | | | | | | | | | Resubmission of commit: dab91bd37af6be355163ee33ca6f1b00e7dd1b51 Change-Id: Iad9517d3f81f7c091307b3e7497675e2cdc32be5
* | Revert "Move property_context label handling to libselinux."Nick Kralevich2014-12-101-0/+20
| | | | | | | | | | | | | | | | | | Emulator fails to boot. This reverts commit 98069027bd90d2139d54affa1367dcd3317a1c11. Bug: 18692152 Change-Id: If362e1311bc3f07e033ba81190c05608ada7c361
* | Move property_context label handling to libselinux.dcashman2014-12-031-20/+0
| | | | | | | | Change-Id: I76e2ed95d4e4f8618458e63d30ae82e37d1acf7b
* | Init: Remove unused variablesAndreas Gampe2014-11-246-30/+9
| | | | | | | | | | | | | | | | For build-system CFLAGS clean-up, fix unused variables. Use a #define instead of static variable in a header file. Change-Id: Id47bf38e51644b61a9f3ac1893a16553695f1aac
* | Use LOCAL_POST_INSTALL_CMD to simplify symlink creation.Ying Wang2014-11-241-20/+4
| | | | | | | | Change-Id: I67ad7248c26561d394e66901e90ef5814ec69fb3
* | Fix segfault in get_character_device_symlinks()Tomasz Kondel2014-11-131-1/+1
| | | | | | | | | | | | A segmentation fault will occur when strchr function returns NULL. Change-Id: I76076acfff16056179bf24dff5df9f81d9a45125
* | Close fd on error path in do_mount()Tomasz Kondel2014-11-131-0/+1
| | | | | | | | | | | | | | This fix closes a file descriptor before returning error from do_mount() Change-Id: Ib370229f16bf9ac385162d6b163cc5b079a1e73e
* | property_service: Added vendor build properties to load_all_propsDaniel Rosenberg2014-11-111-0/+1
| | | | | | | | | | Change-Id: I267bd848e1f6e2978024c07e603b25f1f41f5fbf Signed-off-by: Daniel Rosenberg <drosen@google.com>
* | init isn't built for platforms without dirent::d_type.Elliott Hughes2014-11-101-2/+0
| | | | | | | | Change-Id: Icd4b431576f2ba619ff4ae6fb871bb0210d3b2f2
* | am 2d241ec8: am 3a387176: Merge "Don\'t build init with clang for now"Chih-hung Hsieh2014-10-161-0/+4
|\ \ | | | | | | | | | | | | * commit '2d241ec8a86c56bbf8522eb007674d7b4e3d164d': Don't build init with clang for now
| * | Don't build init with clang for nowBernhard Rosenkraenzer2014-10-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | init doesn't start when built with clang. Set LOCAL_CLANG:=false until this is analyzed and fixed. Change-Id: I5a7944aef676ce88defe5c0449e712d9812fb5f3 Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
* | | am 2b16bf88: Merge "Include reason when wiping data." into lmp-devJeff Sharkey2014-09-241-1/+2
|\ \ \ | | |/ | |/| | | | | | | * commit '2b16bf88c768003291f027fdfac94d84abe9dbe6': Include reason when wiping data.
| * | Include reason when wiping data.Jeff Sharkey2014-09-241-1/+2
| | | | | | | | | | | | | | | | | | | | | This will help us track down who requested a data wipe. Bug: 17412160 Change-Id: I40f73d2d0f08123d2afc044a3dde485151b400d9
* | | am ae3a8961: am fed0f06b: Merge "init: Fix memory corruption when sanitizing ↵Elliott Hughes2014-09-231-2/+2
|\ \ \ | | |/ | |/| | | | | | | | | | | | | platform paths" * commit 'ae3a8961f01e436a70cab569483b8ebcc1f56c0c': init: Fix memory corruption when sanitizing platform paths
| * | init: Fix memory corruption when sanitizing platform pathsChristopher R. Palmer2014-09-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes code that incorrectly increments s when it hits the terminator character of the string being sanitized. This means it will randomly start trashing memory beyond the end of the string being sanitized until it happens to hit two NULs (\0\0) which will break it out of the loop. Change-Id: I76553d7f183236a78a0bc7b408e92559b98f732f
* | | am 40af0929: Fix charger mode on first boot of force encrypt devicesPaul Lawrence2014-09-161-1/+6
|\ \ \ | | |/ | |/| | | | | | | * commit '40af09297f9d60a3cfd4a186ff294cef6255a9df': Fix charger mode on first boot of force encrypt devices
| * | Fix charger mode on first boot of force encrypt devicesPaul Lawrence2014-09-161-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | waitpid breaks whenever child status signals. Need to loop, continuing on errno EINTR Bug: 17515976 Change-Id: Ibb29056a38b3c90dc7904de8c6aedb5a362e511d
* | | am 465fc3b9: am 1cbf4329: Merge "Remove obsolete warning from ↵Nick Kralevich2014-09-021-2/+0
|\ \ \ | | |/ | |/| | | | | | | | | | | | | restorecon_recursive documentation." * commit '465fc3b974384feea3ea991a5e2f801ce1253e2f': Remove obsolete warning from restorecon_recursive documentation.
| * | Remove obsolete warning from restorecon_recursive documentation.Stephen Smalley2014-09-021-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | am bf921c51: am 7a1973ec: Merge "remove examples of unimplemented triggers ( ↵Elliott Hughes2014-08-291-6/+0
|\ \ \ | |/ / | | | | | | | | | | | | | | | device-added device-removed ) from init/readme.txt" * commit 'bf921c5112043b5e39b76e76f38f2818bc904b05': remove examples of unimplemented triggers ( device-added device-removed ) from init/readme.txt
| * | remove examples of unimplemented triggers ( device-added device-removed )Trevor Drake2014-08-291-6/+0
| | | | | | | | | | | | | | | | | | from init/readme.txt Change-Id: I16e226d8f563a223ae20044fff30498883bc4ae2
* | | am 8e207634: am d5f230af: Merge "Remove descriptions of unimplemented triggers."Elliott Hughes2014-08-281-9/+0
|\ \ \ | |/ / | | | | | | | | | * commit '8e207634c89e18a319c6514c39acd5aaff6d8f83': Remove descriptions of unimplemented triggers.
| * | Remove descriptions of unimplemented triggers.Trevor Drake2014-08-281-9/+0
| | | | | | | | | | | | | | | | | | | | | device-added, device-removed and service-exited were described but never implemented. Change-Id: I6fbd05a85576d18d6741fc6dd549acc9132b0531
* | | am a005e779: Merge "Enable not rebooting during default encryption" into lmp-devPaul Lawrence2014-08-261-1/+0
|\ \ \ | | |/ | |/| | | | | | | * commit 'a005e7795e3dfb7cc0bd2bc65208d2490bfc89d8': Enable not rebooting during default encryption
| * | Enable not rebooting during default encryptionPaul Lawrence2014-08-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Clarify init's write command.Elliott Hughes2014-07-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Bug: https://code.google.com/p/android/issues/detail?id=73996 (cherry picked from commit afc08ce39235d0e3f1e63f30ee587f2a5952be44) Change-Id: Id2fb11d5259957ef23cc839fba14af8452fc69e4
| * | Move unlink("/dev/.booting") until after filesystems are mounted.Riley Andrews2014-07-141-15/+8
| | | | | | | | | | | | | | | | | | | | | 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
* | | am cf2b944d: am 5a1d5a8c: Merge "ueventd: call _exit for safety"Kenny Root2014-08-251-1/+3
|\ \ \ | | |/ | |/| | | | | | | * commit 'cf2b944df6d744d279a434ec280f9bd8cef03a5b': ueventd: call _exit for safety
| * | ueventd: call _exit for safetyKenny Root2014-08-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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