summaryrefslogtreecommitdiffstats
path: root/init
Commit message (Collapse)AuthorAgeFilesLines
* init: increase thermal shutdown timeout to 3sWei Wang2018-10-261-8/+7
| | | | | | | | | | | | 1) increase thermal shutdown timeout to 3s for process to save work 2) respect property "ro.build.shutdown_timeout" in thermal shutdown if it is set less than default time - "3s" Bug: 112432890 Test: Build Change-Id: Idc2b24dd44c1fab8f9b047fd2468de2ee45ff783 Merged-In: Idc2b24dd44c1fab8f9b047fd2468de2ee45ff783 (cherry picked from commit b5de088262b735267288bbdd3f4430f18f281967)
* Merge "init: finer grained permissions for ctl. properties" into pi-devTom Cherry2018-05-222-16/+39
|\
| * init: finer grained permissions for ctl. propertiesTom Cherry2018-05-222-16/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, permissions for ctl. property apply to each action verb, so if a domain has permissions for controlling service 'foo', then it can start, stop, and restart foo. This change implements finer grainer permissions such that permission can be given to strictly start a given service, but not stop or restart it. This new permission scheme is mandatory for the new control functions, sigstop_on, sigstop_off, interface_start, interface_stop, interface_restart. Bug: 78511553 Test: see appropriate successes and failures based on permissions Change-Id: I6ce915ae39954a67eb6fe1795a93cf715c352ae4
* | Merge "init: allow entering of network namespaces" into pi-devTom Cherry2018-05-223-17/+85
|\ \ | |/ |/|
| * init: allow entering of network namespacesTom Cherry2018-05-213-17/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the ability to enter a network namespace when launching a service. Typical usage of this would be something similar to the below: on fs exec ip netns add namespace_name service vendor_something /vendor/... capabilities <lower than root> user not_root enter_namespace net /mnt/.../namespace_name Note changes to the `ip` tool are needed to create the namespace in the correct directory. Bug: 73334854 Test: auto team verified Merged-In: Ifa91c873d36d69db399bb9c04ff2362518a0b07d Change-Id: Ifa91c873d36d69db399bb9c04ff2362518a0b07d (cherry picked from commit aead51b418e70a49191bc0cc5b67c92c969ae699)
* | Adds /dev/block/by-name/<partition> symlinksBowgo Tsai2018-05-194-12/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During uevent processing, some "by-name" symlinks will be created. /dev/block/<type>/<device>/by-name/<partition> <type> can be: platform, pci or vbd. <device> might be: soc.0/f9824900.sdhci, soc.0/f9824900.sdhci, etc. <partition> might be: system, vendor, system_a, system_b, etc. e.g., on a non-A/B device: /dev/block/platform/soc.0/f9824900.sdhci/by-name/system /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor On a A/B device: /dev/block/platform/soc/1da4000.ufshc/by-name/system_a /dev/block/platform/soc/1da4000.ufshc/by-name/system_b /dev/block/platform/soc/1da4000.ufshc/by-name/vendor_a /dev/block/platform/soc/1da4000.ufshc/by-name/vendor_b However, those symlinks are "device-specific". This change adds the "generic" symlinks in ueventd, in addition to the existing symlinks, when the possible "boot devices" are specified in device tree. e.g., &firmware_android { compatible = "android,firmware"; boot_devices ="soc/1da4000.ufshc,soc.0/f9824900.sdhci"; } The following symlinks will then be created on the aforementioned non-A/B and A/B devices, respectively. /dev/block/by-name/system /dev/block/by-name/vendor /dev/block/by-name/system_a /dev/block/by-name/system_b /dev/block/by-name/vendor_a /dev/block/by-name/vendor_b Note that both <type> and <device> are skipped in the newly create symlinks. It assumes there is no more than one devices with the same <partition>, which is the assumption of current first stage mount flow. Finally, when 'boot_devices' in DT is absent, it fallbacks to extract 'boot_devices' from fstab settings. e.g., using 'soc/1da4000.ufshc', 'soc.0/f9824900.sdhci' for a fstab with the following content: /dev/block/platform/soc/1da4000.ufshc/by-name/system /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor Bug: 78613232 Test: adb shell ls /dev/block/by-name Change-Id: Iec920b5a72409b6a2bdbeeb290f0a3acd2046b5d Merged-In: Iec920b5a72409b6a2bdbeeb290f0a3acd2046b5d (cherry picked from commit 8eec38f4e463d8cd980562ec49432c17972cc5cb)
* | Removing block device by-num symlinksBowgo Tsai2018-05-193-7/+0
|/ | | | | | | | | | | | | | | | | | | | The uevent.partition_num easily collides between partitions, for example: Both /dev/block/sda3 and /dev/block/sdd3 will generate the same symlink: /dev/block/platform/soc/1da4000.ufshc/by-num/p3 This change remove those by-num symlinks as there seems no effective user of it. Bug: 78613232 Test: m init_tests && \ adb push $OUT/data/nativetest64/init_tests/init_tests /data/. && \ adb shell /data/init_tests Change-Id: I8dfa8dc1a2f9fc9296aa30f33e905bf158b501de Merged-In: I8dfa8dc1a2f9fc9296aa30f33e905bf158b501de (cherry picked from commit 95591bd00e653826f25bfa705c3f50545f6b06a3)
* init: Use sepolicy version insteadLogan Chien2018-05-046-2/+36
| | | | | | | | | | | | | | | | | | | | This commit uses vendor sepolicy file version (defined in `/vendor/etc/selinux/plat_sepolicy_vers.txt`) to determine whether the source context should be set as `u:r:vendor_init:s0`. Before this commit, the criterion was `ro.vndk.version` >= 28. However, the check in `property_service.cpp` will always be true because `ro.vndk.version` hasn't been loaded from `/vendor/default.prop`. Furthermore, under some circumstances, `ro.vndk.version` may be different from `plat_sepolicy_vers.txt` (e.g. O-MR1 vendor does not define `ro.vndk.version`). Bug: 78605339 # high-level bug to combine O-MR1 and P GSI Bug: 79135481 # the usage of `ro.vndk.version` in init Test: vts-tradefed run vts -m VtsTrebleVintfTest # tetheroffload Change-Id: Ied46e9346b4ca7931aa4dcf1c9dbc11de0e12d93 Merged-In: Ied46e9346b4ca7931aa4dcf1c9dbc11de0e12d93
* First-stage mount: avoid triggering a FATAL errorBowgo Tsai2018-05-021-4/+1
| | | | | | | | | | | | | | | | | | | | | | Related AOSP changes: 1. https://android-review.googlesource.com/#/c/platform/system/core/+/405009/ 2. https://android-review.googlesource.com/#/c/platform/system/core/+/532637/ The second CL raises a FATAL error when it detects fstab-dt has no content during first-stage mount. However, with the first CL, the fstab-dt entry might be "skipped" when bootloader sets the status property to a value other than "ok"/"okay". (e.g., to skip mounting /vendor on upgrading devices which have no vendor partition). Use LOG(INFO) when there is nothing to mount here. The later stages should trigger a FATAL error when some important files in those partitions are not available, e.g., SEPolicy files. Bug: 78441220 Test: boot a device Change-Id: Iae2f47d455679298bdb067d96b771a30c1a82e6f Merged-In: Iae2f47d455679298bdb067d96b771a30c1a82e6f (cherry picked from commit 8fe363f26017e39b80c6cd793f7b2a346da88104)
* Set property for metadata encryption on first bootPaul Crowley2018-04-181-0/+1
| | | | | | Bug: 77335096 Test: device boots twice with and without metadata encryption Change-Id: Iaed78288cb37865ba23833721b73b11414e7e862
* Merge "Re-land "If enablefilecrypto or init_user0 fails, reboot into ↵TreeHugger Robot2018-04-174-21/+50
|\ | | | | | | recovery."" into pi-dev
| * Re-land "If enablefilecrypto or init_user0 fails, reboot into recovery."Paul Crowley2018-04-174-21/+50
| | | | | | | | | | | | | | | | | | An earlier such change was reverted in commit e242a97db547dc73efea1b5287536be66637dc33. Bug: 70487538 Test: ensure that angler can boot Merged-In: Id5f57fce1c9b817a2650e0c848143d8a0d286bf0 Change-Id: Id5f57fce1c9b817a2650e0c848143d8a0d286bf0
* | Merge "Add /mnt/vendor rw mount point for vendor partitions." into pi-devTreeHugger Robot2018-04-171-0/+8
|\ \
| * | Add /mnt/vendor rw mount point for vendor partitions.Tri Vo2018-04-171-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes to init's behavior during early mount: 1. Mounting of tmpfs on /mnt is moved from init stage to early mount. 2. init creates /mnt/vendor used to mount vendor partitions. 3. If a device tree fstab entry for early mount specifies a mount point under /mnt/vendor e.g. /mnt/vendor/foo, init will create /mnt/vendor/foo mount point. Bug: 64905218 Test: change dt fstab entry to mount persist to /mnt/vendor/persist; mount point is created correctly, and partition is mounted in early mount. See go/pag/1069774 Test: device boots with /mnt/vendor and previous contents of /mnt present, and selinux label "mnt_vendor_file" is applied correctly. Test: cts-tradefed run commandAndExit cts --skip-all-system-status-check --primary-abi-only --skip-preconditions -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PermissionsHostTest Change-Id: I3739130739eadf508355c7f2531366fcaed74175
* | | init: do not impose vendor_init restrictions on old vendor imagesTom Cherry2018-04-123-5/+18
| |/ |/| | | | | | | | | | | | | | | | | | | Do not restrict vendor_init restrictions on vendor images that were built before P, as they will not have the correct permissions. Bug: 77732028 Test: test new devices and see vendor_init still works Merged-In: I636a07b54fbfb248e1d1a68a8f3c4d047fd5a9e9 Change-Id: I636a07b54fbfb248e1d1a68a8f3c4d047fd5a9e9 (cherry picked from commit a1dbeb8d338017715ae7747e5a7a3999a54e7213)
* | Allow vendor-init-actionable for vold-related propertiesJaekyun Seok2018-04-121-0/+5
|/ | | | | | | Bug: 75987246 Bug: 73871799 Test: succeeded building and tested with taimen Change-Id: Ifec879f07705a52501757b58b1562a97c668b8b0
* Allow vendor-init-actionable for wlan.driver.status and init.svc.surfaceflingerJaekyun Seok2018-04-051-0/+2
| | | | | | | | | | | | | They are being used as action triggers in some devices including Pixels. So vendor-init-actionable should be allowed for them. Bug: 74266614 Test: building succeeded and tested on a Pixel with PRODUCT_COMPATIBLE_PROPERTY=true Change-Id: I713c5c1a50053f8d64e1cecd1f7ab5dc18201da1 Merged-In: I713c5c1a50053f8d64e1cecd1f7ab5dc18201da1 (cherry picked from commit 167ec7f1d255ef9754d21383a9af46b07a20bac0)
* Add dummy vndk library libmkbootimg to enable abi checks on boot_img_hdr.Jayant Chowdhary2018-04-021-3/+1
| | | | | | | | | | | | Bug: 74763691 Test: m -j libmkbootimg creates libmkbootimg.so.lsdump. Test: make -j64 Merged-In: I8d716c560467aaf090f4f7ee9cfbc53a9405f05d Change-Id: I8d716c560467aaf090f4f7ee9cfbc53a9405f05d (cherry picked from commit 4cc755dce527434dc4b79c1734185faeab084bac)
* Allow vendor-init-actionable for ro.board.platform and ↵Jaekyun Seok2018-03-301-0/+2
| | | | | | | | | | | | | | sys.boot_from_charger_mode ro.board.platform and sys.boot_from_charger_mode are already public-readable, but they should be used as action triggers as well for some products including Android Go devices. Bug: 75987246 Test: succeeded building and tested with taimen Change-Id: I140a8f7ef3fa9823ceced94b00a413800518c240 Merged-In: I140a8f7ef3fa9823ceced94b00a413800518c240 (cherry picked from commit 1f90ccefb6f809fd479ead55247a59378bc5908f)
* Allow vendor-init-actionable for ro.debuggableJaekyun Seok2018-03-291-0/+1
| | | | | | | | | | | Some partners are using ro.debuggable as action trigger to config a product differently according to its value. Bug: 75987246 Test: succeeded building and tested taimen Change-Id: I4cc57e7b52e17fc89e585afa0a8a10925e47fac8 Merged-In: I4cc57e7b52e17fc89e585afa0a8a10925e47fac8 (cherry picked from commit 4f214c5179b2bef7de84b8b5eb2c18fd3f7312a8)
* Merge "Revert "init: Reboot after timeout passes during reboot"" into pi-devTom Cherry2018-03-201-74/+34
|\
| * Revert "init: Reboot after timeout passes during reboot"Tom Cherry2018-03-201-74/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit c9fec9d2be73a26a4f4b297ee6bee9f9c62cb854. Looks like ext4 can't handle a system reboot happening in the middle of an unmount. We'll have to find another way to handle this. Bug: 74817735 Bug: 75310371 Test: reboot device Merged-In: Ib4f7f7fd29988a31a99f146c40f6d987c1fef15e Change-Id: I7c097ba5734e2e4ff320c8b02fb58324d9380513
* | Allow vendor_init_actionable to persist.sys.usb.usbradio.configJaekyun Seok2018-03-201-0/+1
| | | | | | | | | | | | | | | | | | | | persist.sys.usb.usbradio.config can be used as an action trigger in vendor init scripts. Bug: 75202311 Bug: 74266614 Test: succeeded building and tested on pixels Change-Id: I123b5ebce4bbf33f41222c2e11137d52e38ff9f8
* | Export init.svc.console as an actionable propertyJaekyun Seok2018-03-141-0/+1
| | | | | | | | | | | | | | | | | | | | The state of console can be used to set up a device for debugging. Bug: 74266614 Test: succeeded building and tested with Pixels Change-Id: I3691fa2819594a521e05dad150550ab309a78c68 Merged-In: I3691fa2819594a521e05dad150550ab309a78c68 (cherry picked from commit cba467eeda887d2eb65edf7777c525cad23b8ebb)
* | ueventd: Increase uevent buffer size to 2MBDaniel Mentz2018-03-131-2/+2
|/ | | | | | | | | | | | | | | Let's increase the receive buffer size for the NETLINK_KOBJECT_UEVENT socket to 2MB. Unless a large number of uevents queue up, that memory is not allocated anyways. The receive buffer size serves only as an upper limit for the total amount of memory consumed by all skbs queued to a specific socket. We experienced situations where ueventd got blocked for multiple seconds while writing to /dev/kmsg, and the receive buffer overflowed in the meantime. Bug: 72648767 Change-Id: Ice6d7b9c5ed9c83efbad6111086ce95ac6432561
* Merge "Revert "If enablefilecrypto or init_user0 fails, reboot into recovery.""Treehugger Robot2018-03-024-41/+19
|\
| * Revert "If enablefilecrypto or init_user0 fails, reboot into recovery."Paul Crowley2018-03-014-41/+19
| | | | | | | | | | | | | | | | | | | | This reverts commit 959b05553576ffc15da4334a5917ce763611ab82. Reason for revert: b/73968735 Bug: 73968735 Test: b/73968735#comment5 Change-Id: Ifce4c029bab7380c60e20cc2b2885beb4a097456
* | Restrict setting platform properties from vendor .prop filesTom Cherry2018-03-013-7/+34
| | | | | | | | | | | | | | | | | | We should only allow vendor-init-settable properties to be set from .prop files on /vendor and /odm. Bug: 73905119 Test: test on walleye that disallowed properties are rejected Change-Id: I2a5d244fdc71060ddda3e3d87442e831e6b97831
* | Clean up property set error handlingTom Cherry2018-03-015-47/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we only report why a property set call has failed but drop the context of what was trying to set the property. This change adds information about why a property was trying to be set when it fails. It also unifies property_set() within init to go through the same HandlePropertySet() function as normal processes do, removing unneeded special cases. Test: boot bullhead Test: attempt to set invalid properties and see better error messages Change-Id: I5cd3a40086fd3b226e9c8a5e3a84cb3b31399c0d
* | Don't build host_init_verifier on Android eitherTom Cherry2018-02-281-1/+4
| | | | | | | | | | | | | | Also fixes another mac build issue... Test: linux builds still work... Change-Id: I549891c7e38729bd5fbe79f79b7345dabd9b4b28
* | Don't build host_init_verifier for darwinTom Cherry2018-02-281-0/+5
| | | | | | | | | | | | | | And therefore fix the mac build break. Test: none Change-Id: Ice28780abc62fc3e46119497d23bcbc124354159
* | init: add host side parser for initTom Cherry2018-02-2817-56/+369
| | | | | | | | | | | | | | | | | | | | Create a host side parser for init such that init rc files can be verified for syntax correctness before being used on the device. Bug: 36970783 Test: run the parser on init files on host Change-Id: I7e8772e278ebaff727057308596ebacf28b6fdda
* | Merge "init: Reboot after timeout passes during reboot"Tom Cherry2018-02-261-36/+77
|\ \
| * | init: Reboot after timeout passes during rebootTom Cherry2018-02-231-36/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is currently a timeout for reboot, however if the system gets stuck, particularly during file system operations, there is no safety mechanism that guarantees the system will still reboot. This change does all of the optional reboot steps in a separate thread and waits for this thread with a timeout, such that if the reboot steps get hung, the system is guaranteed to still reboot. This is specific to 'reboot'. Shutdown continues to run unbounded to run fsck. Bug: 72781711 Test: Reboot devices hitting and not hitting this timeout Change-Id: Id5e1b3693bab00602177e28b9b662e1499c32961
* | | Merge "Document property expansion."Treehugger Robot2018-02-231-1/+5
|\ \ \ | |/ / |/| |
| * | Document property expansion.Elliott Hughes2018-02-231-1/+5
| | | | | | | | | | | | | | | | | | Bug: N/A Test: N/A Change-Id: I54b9d2d08d98d83060b54981b1c5dc9660b93e8f
* | | init: log control messages along with the process that sent themTom Cherry2018-02-213-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | It's currently not clear that init stops processes due to being sent a control message nor who sent that message. Bug: 73343913 Test: send control messages and see the logs Change-Id: I9e9eff2001e649814107ea961b3b747a1f6da598
* | | Merge "Fix intermittent crash in property_service_test"Treehugger Robot2018-02-201-2/+4
|\ \ \ | |/ / |/| |
| * | Fix intermittent crash in property_service_testTom Cherry2018-02-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a race in the very_long_name_35166374 test of property_service. The test first sends a size value that is beyond the limit that init will handle, then sends a dummy data value. However, init closes the socket upon seeing the faulty size, and if this happens before the test sends the dummy data, the test will crash due to SIGPIPE. Since there is no reason to send the dummy data at all, this change no longer sends it to prevent the crash. It also now checks explicitly that init returns an error through the socket. Bug: 73619375 Test: the unit test in question Change-Id: I2565a69fa54910cee0e15fc798445e18c91156ec
* | | bpfmt.Elliott Hughes2018-02-162-2/+5
| | | | | | | | | | | | | | | | | | Bug: N/A Test: builds Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
* | | Merge "If enablefilecrypto or init_user0 fails, reboot into recovery."Treehugger Robot2018-02-154-19/+41
|\ \ \ | |/ / |/| / | |/
| * If enablefilecrypto or init_user0 fails, reboot into recovery.Paul Crowley2018-02-154-19/+41
| | | | | | | | | | | | Test: Roll back PLATFORM_SECURITY_PATCH, ensure recovery dialog is seen Bug: 70487538 Change-Id: Iceb6af3f9d6aea6bc646dbb4b5d29dffcb284736
* | Move all Action parsing into ActionParserTom Cherry2018-02-145-100/+107
| | | | | | | | | | | | Bug: 36970783 Test: Build Change-Id: Iea2d97fb45c3e88bc83fb72d6fa67049be42cfa9
* | Move ActionManager to its own fileTom Cherry2018-02-1410-126/+185
| | | | | | | | | | | | Bug: 36970783 Test: build Change-Id: I08fa39052236b462249f79de1d02bf02bdbf4c84
* | Move ActionParser to its own fileTom Cherry2018-02-137-55/+117
| | | | | | | | | | | | Bug: 36970783 Test: build Change-Id: Idd5b923e4789760bb9ef67c10982b2642bc6a31a
* | Add support for non-partitioned devices for systemGreg Hartman2018-02-061-13/+24
| | | | | | | | | | | | | | BUG: 69071989 BUG: 71707530 Test: Local build and boot Change-Id: I0cb7d61634be6a694ceb51cb06901c466eae1c35
* | Merge "init: add TODO for mount operations."Treehugger Robot2018-02-051-0/+4
|\ \
| * | init: add TODO for mount operations.Tom Cherry2018-02-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mount operations should be done in vendor init context, but their complexity currently limits this. Add a TODO to make this reason clear to those viewing the code. Bug: 72488820 Test: N/A Change-Id: I8b6dd92aa79f31dc24603559ed6de0815facfcba
* | | Merge "Do not block SIGTERM in init's child processes"Treehugger Robot2018-02-031-0/+17
|\ \ \
| * | | Do not block SIGTERM in init's child processesyusukes2018-02-021-0/+17
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, unless the process unblocks the signal by itself, the signal was never delivered to the process. This caused at least one CTS test failure. Bug: 72453675 Test: 'kill -TERM app_pid' terminates the app process Change-Id: I3977cac75e2673b52c5cf91d34d7a9c258c1a0e4