Commit Graph

1869 Commits

Author SHA1 Message Date
Yu Ning 6a38aa83b6 Allow the use of a custom Android DT directory
On platforms that use ACPI instead of Device Tree (DT), such as
Ranchu x86/x86_64, /proc/device-tree/firmware/android/ does not
exist. As a result, Android O is unable to mount /system, etc.
at the first stage of init:

 init: First stage mount skipped (missing/incompatible fstab in
 device tree)

Those platforms may create another directory that mimics the layout
of the standard DT directory in procfs, and store early mount
configuration there. E.g., Ranchu x86/x86_64 creates one in sysfs
using information encoded in the ACPI tables:

 https://android-review.googlesource.com/442472
 https://android-review.googlesource.com/443432
 https://android-review.googlesource.com/442393
 https://android-review.googlesource.com/442395

Therefore, instead of hardcoding the Android DT path, load it from
the kernel command line using a new Android-specific property key
("androidboot.android_dt_dir"). If no such property exists, fall
back to the standard procfs path (so no change is needed for DT-
aware platforms).

Note that init/ and fs_mgr/ each have their own copy of the Android
DT path, because they do not share any global state. A future CL
should remove the duplication by refactoring.

With this CL as well as the above ones, the said warning is gone,
but early mount fails. That is a separate bug, though, and will be
addressed by another CL.

Test: Boot patched sdk_phone_x86-userdebug system image with patched
      Goldfish 3.18 x86 kernel in patched Android Emulator, verify
      the "init: First stage mount skipped" warning no longer shows
      in dmesg.

Signed-off-by: Yu Ning <yu.ning@intel.com>

(cherry picked from commit c08d2cb0fb7ce470e128c7571553aa12ae9b57a4)

Change-Id: Ia8d5f68e044fde0ecf5c7b14e40f040ff42bc35d
2017-07-31 15:27:09 -07:00
Ben Fennema 7d7e7cdf34 init: fix type of 2nd argument passed to prctl
prctl(PR_SET_SECUREBITS, ...) expects an unsigned long as its 2nd argument.
Passing in a int64_t happens to work with a 64-bit kernel, but does not
work with a 32-bit kernel.

Bug: 63680332
Test: boot 32-bit kernel; verify services with capabilities can successfully
      set those capabilties
Change-Id: I60250d107a77b54b2e9fe3419b4480b921c7e2f8
Signed-off-by: Ben Fennema <fennema@google.com>
(cherry picked from commit a72436067d)
2017-07-27 21:57:40 +00:00
Tom Cherry 684f4883b3 init: only use signed-integer-overflow sanitizer
We've blown up twice in init due to the unsigned integer overflow
sanitizer despite the overflows in question being both defined and
intentional.

Bug: 63680332
Test: boot
Change-Id: I08effe3202ac1367d858982ff5478b3a088bab37
(cherry picked from commit 2ffd65e1d1)
2017-07-27 21:54:47 +00:00
Wei Wang ba6705f9de Do not umount roofs even if it is R/W.
am: b7a8764a12

Change-Id: I56014ac0ae01a5666a58225eed5f89e08859c0d8
2017-07-25 21:34:50 +00:00
Wei Wang b7a8764a12 Do not umount roofs even if it is R/W.
Latest device has rootfs instead of "/system" mount point

(cherry picked from commit a01c27eef8)

Bug: 37737296
Test: adb remount, reboot, and check log
Change-Id: I315ecf71e85255fc55c3a80619920b456bad0956
2017-07-25 11:39:22 -07:00
Wei Wang da4e68944e init: Fire shutdown trigger for thermal shutdown
am: 63a1d0a5f9

Change-Id: I1355e32c56947a79666eb3a58d9299042171a25c
2017-07-25 00:17:29 +00:00
Wei Wang 63a1d0a5f9 init: Fire shutdown trigger for thermal shutdown
Recent change in init has bring normal shutdown sequence in
thermal-shutdown condition. This CL will make sure init fire shutdown
trigger where holds custom shutdown actions for vendor SoC/platform.

(cherry picked from commit 1be2212319)

Bug: 63686426
Test: adb shell setprop sys.powerctl thermal-shutdown
Change-Id: Ieb8579fdf9c30c1a81d60466a7375c9784f3ca98
2017-07-24 14:59:52 -07:00
TreeHugger Robot b6962f2e44 Merge "init: Do full shutdown even for thermal shutdown" into oc-dr1-dev 2017-07-20 06:02:00 +00:00
Keun-young Park cfa0a9524b Merge "init: Do full shutdown even for thermal shutdown" am: d5b36f38ef am: a064892e1a am: 614ccd7a02
am: 44dce1fed7

Change-Id: I1a01555d98864bd13695524e0cb5adff9b49b754
2017-07-20 03:36:25 +00:00
Keun-young Park 44dce1fed7 Merge "init: Do full shutdown even for thermal shutdown" am: d5b36f38ef am: a064892e1a
am: 614ccd7a02

Change-Id: Id714910ec5bdf4b94bfeee238484f4d47a9bdf01
2017-07-20 03:33:42 +00:00
Keun-young Park 614ccd7a02 Merge "init: Do full shutdown even for thermal shutdown" am: d5b36f38ef
am: a064892e1a

Change-Id: Ia6ddd5a680caa8283cf9d2a75c1eb49e1c79e413
2017-07-20 03:30:39 +00:00
Keun-young Park a064892e1a Merge "init: Do full shutdown even for thermal shutdown"
am: d5b36f38ef

Change-Id: If0bcd287d2656279a1d364761b0145ca4464299b
2017-07-20 03:27:38 +00:00
Treehugger Robot d5b36f38ef Merge "init: Do full shutdown even for thermal shutdown" 2017-07-20 03:21:41 +00:00
Keun-young Park c111537f5d init: Do full shutdown even for thermal shutdown
- Skipping SIGTERM / SIGKILL / umount brings race between block
  device driver and fs layer. Do umount before shutting down.
- Reduce timeout to 1 sec for thermal shutdown and skip other time
  taking part like fsck.
- Refactor waiting part to check time in ms so that 1 sec can
  have enough resolution.

bug: 63686426
Test: adb shell setprop sys.powerctl thermal-shutdown, adb shell setprop sys.powerctl reboot and check dmesg
Merged-In: I048bac767b328c8d656a97fe65dde5f2b5bf4ae5
Change-Id: I048bac767b328c8d656a97fe65dde5f2b5bf4ae5
2017-07-19 18:38:20 -07:00
Tom Cherry 1bd7187f32 Merge "ueventd: fixup ueventd_test.cpp" am: 9aaf66b61f am: 34d4d57b87 am: 5d256bc555
am: 5b1202976e

Change-Id: Icf00ff2e4f9a949900ab6b71bba89c3815c4b5d2
2017-07-20 01:26:25 +00:00
Tom Cherry 5b1202976e Merge "ueventd: fixup ueventd_test.cpp" am: 9aaf66b61f am: 34d4d57b87
am: 5d256bc555

Change-Id: I430e26f820653edfe35ededffa853dcf5e1324ad
2017-07-20 01:20:30 +00:00
Tom Cherry 5d256bc555 Merge "ueventd: fixup ueventd_test.cpp" am: 9aaf66b61f
am: 34d4d57b87

Change-Id: I7468e871785ea74e6cd5b070bd6f18153f6304a7
2017-07-20 01:17:31 +00:00
Tom Cherry 34d4d57b87 Merge "ueventd: fixup ueventd_test.cpp"
am: 9aaf66b61f

Change-Id: I7792c9ec68b6011e0186af2d40ca07d0801a4c2f
2017-07-20 01:15:00 +00:00
Tom Cherry 9aaf66b61f Merge "ueventd: fixup ueventd_test.cpp" 2017-07-20 01:05:28 +00:00
Keun-young Park 30173874fc init: Do full shutdown even for thermal shutdown
- Skipping SIGTERM / SIGKILL / umount brings race between block
  device driver and fs layer. Do umount before shutting down.
- Reduce timeout to 1 sec for thermal shutdown and skip other time
  taking part like fsck.
- Refactor waiting part to check time in ms so that 1 sec can
  have enough resolution.

bug: 63686426
Test: adb shell setprop sys.powerctl thermal-shutdown, adb shell setprop sys.powerctl reboot and check dmesg
Change-Id: I048bac767b328c8d656a97fe65dde5f2b5bf4ae5
2017-07-19 17:27:05 -07:00
Keun-young Park 366c51ec1e dump stack before kill all
- If problematic process is from user, kill all kills
  it and dump does not show problematic process.

bug: 37737296
Test: reboot and check log

Merged-In: Iaa4f7d12f5a40fa7528c6672567c36e30b140372
Change-Id: Iaa4f7d12f5a40fa7528c6672567c36e30b140372
2017-07-19 17:11:36 -07:00
Keun-young Park d4f4a3fcf9 Merge "dump stack before kill all" am: c13a2da2f4 am: 4e24aa2bc3 am: 2b33d96db1
am: f0a13c35f2

Change-Id: Id42c59a6488a9405c8f3301585d2b8cb18192197
2017-07-19 22:32:50 +00:00
Keun-young Park f0a13c35f2 Merge "dump stack before kill all" am: c13a2da2f4 am: 4e24aa2bc3
am: 2b33d96db1

Change-Id: Ic9c86ce7ddf8591a9fb2d3b1cdf72057c21d4111
2017-07-19 22:29:51 +00:00
Tom Cherry 2ef572be30 ueventd: fixup ueventd_test.cpp
Use ASSERT_EQ() instead of EXPECT_EQ() to prevent segfaults after
failed API calls.

Do not run setfscreatecon_IsPerThread unless we're in permissive mode
as it will not pass otherwise.

Test: init unit tests
Change-Id: I70525d438e89f1ec036255890169a50b5007b4c4
2017-07-19 15:29:20 -07:00
Keun-young Park 2b33d96db1 Merge "dump stack before kill all" am: c13a2da2f4
am: 4e24aa2bc3

Change-Id: If924fe081a81c2061ed06e741fc5e6984e24b1f9
2017-07-19 22:26:22 +00:00
Keun-young Park 4e24aa2bc3 Merge "dump stack before kill all"
am: c13a2da2f4

Change-Id: Ie09fd8a7e95686c41d2a7af9e9e291f89c673036
2017-07-19 22:23:48 +00:00
Keun-young Park c13a2da2f4 Merge "dump stack before kill all" 2017-07-19 22:17:06 +00:00
Keun-young Park c59b822d1f dump stack before kill all
- If problematic process is from user, kill all kills
  it and dump does not show problematic process.

bug: 37737296
Test: reboot and check log
Change-Id: Iaa4f7d12f5a40fa7528c6672567c36e30b140372
2017-07-18 18:52:25 -07:00
Robert Benea 9865760d3d Merge "Add memcg related configs to init." am: b84666cbc0 am: 7564622f88 am: 5cf308bcde
am: eab1c14aba

Change-Id: I357cef77e7e48fdda55d55dbaeac531e0974a434
2017-07-19 01:22:40 +00:00
Robert Benea eab1c14aba Merge "Add memcg related configs to init." am: b84666cbc0 am: 7564622f88
am: 5cf308bcde

Change-Id: Ic86a3200b5080438ad6cb33f9bc3f6ff2ecca22b
2017-07-19 01:12:40 +00:00
Robert Benea 5cf308bcde Merge "Add memcg related configs to init." am: b84666cbc0
am: 7564622f88

Change-Id: Ia9f5b5d524eb437598e9d453ca05e35d52445cc1
2017-07-19 01:03:32 +00:00
Robert Benea 7564622f88 Merge "Add memcg related configs to init."
am: b84666cbc0

Change-Id: I437c5d05582c6a3cce632f92835ee91f419a7190
2017-07-19 01:01:27 +00:00
Robert Benea b84666cbc0 Merge "Add memcg related configs to init." 2017-07-19 00:54:41 +00:00
Quang Luong 559674dbe3 Merge "uml: init: add USER_MODE_LINUX cflag, USER_MODE_LINUX case in init.cpp" am: a022ea424d am: c1e78e1331 am: be2a262b47
am: 6bcf4fb8b5

Change-Id: I1b6656bc4ec0dbebccb4fe92c6f73f9be6965353
2017-07-18 23:24:51 +00:00
Robert Benea d485226951 Add memcg related configs to init.
Allow configuring memory.swappiness, memory.soft_limit_in_bytes
and memory.limit_in_bytes by init; by doing so there is better
control of memory consumption per native app.

Test: tested on gobo branch.
bug: 63765067
Change-Id: I8906f3ff5ef77f75a0f4cdfbf9d424a579ed52bb
2017-07-18 15:58:40 -07:00
Quang Luong 6bcf4fb8b5 Merge "uml: init: add USER_MODE_LINUX cflag, USER_MODE_LINUX case in init.cpp" am: a022ea424d am: c1e78e1331
am: be2a262b47

Change-Id: I223ebf56a8bbefb38735ebbcfe45c7d2a78cd50c
2017-07-18 22:39:00 +00:00
Quang Luong be2a262b47 Merge "uml: init: add USER_MODE_LINUX cflag, USER_MODE_LINUX case in init.cpp" am: a022ea424d
am: c1e78e1331

Change-Id: I81d4f619f38a6f511562d98fe7a0dd64c7290f81
2017-07-18 21:26:19 +00:00
Quang Luong c1e78e1331 Merge "uml: init: add USER_MODE_LINUX cflag, USER_MODE_LINUX case in init.cpp"
am: a022ea424d

Change-Id: Ie4b2131525373fef14dfa2c7a7ec1e23a50dc56a
2017-07-18 21:20:26 +00:00
Treehugger Robot a022ea424d Merge "uml: init: add USER_MODE_LINUX cflag, USER_MODE_LINUX case in init.cpp" 2017-07-18 21:16:30 +00:00
Quang Luong dd6a85ccd5 uml: init: add USER_MODE_LINUX cflag, USER_MODE_LINUX case in init.cpp
Modified Android.mk to define cflag "USER_MODE_LINUX" if
TARGET_USER_MODE_LINUX := true in BoardCofig.mk.
Modified set_mmap_rnd_bits_action to return 0 if "USER_MODE_LINUX" is
defined. This is needed since uml does not support the mmap_rnd_bits
sysctl, and init would otherwise crash without this check.

Test: manual

Bug: 32523022
Change-Id: I409ef64a1fa253bfb3f9fb59d0267be159819bb8
Signed-off-by: Quang Luong <qal@google.com>
2017-07-18 18:18:31 +00:00
Keun-young Park 45ae1b2754 Do not umount /vendor, /system, and /oem even if they are R/W.
- /vendor, /system, /oem can be remounted to R/W for development
  purpose.

- In such case, umounting these partitions can lead into some processes
  not running properly during shutdown or blocking umount of fs.

- So skip them. As it is dev feature, it is up to each developer to
  understand the risk. But for normal adb sync - reboot should be ok
  as shutdown involves sync operations.

bug: 37737296
Test: adb remount,reboot, and check last kmsg

(cherry picked from commit 6e12b3887e)

Change-Id: Ia92a20aa672e68f695818e451ba2ae53af8f5ab9
2017-07-18 10:32:27 -07:00
Keun-young Park 29017c10c8 Merge "Do not umount /vendor, /system, and /oem even if they are R/W." am: 11649e8925 am: c9f601a178 am: 10b74ed2a6
am: ab54410f0d

Change-Id: Ic0d033d955e2612157dc63922ee85d4722bc9fa6
2017-07-18 03:21:07 +00:00
Keun-young Park ab54410f0d Merge "Do not umount /vendor, /system, and /oem even if they are R/W." am: 11649e8925 am: c9f601a178
am: 10b74ed2a6

Change-Id: Ie0339f41eb166e156ab61133e6a2c19e4bbd28a2
2017-07-18 03:18:07 +00:00
Keun-young Park 10b74ed2a6 Merge "Do not umount /vendor, /system, and /oem even if they are R/W." am: 11649e8925
am: c9f601a178

Change-Id: Ia5f3096e339ed8d088482c5c11ed5e5b906e9205
2017-07-18 03:15:36 +00:00
Keun-young Park c9f601a178 Merge "Do not umount /vendor, /system, and /oem even if they are R/W."
am: 11649e8925

Change-Id: I1b4db022ca316648dfccfa12c3f8e886e6b15b08
2017-07-18 03:12:37 +00:00
Keun-young Park 6e12b3887e Do not umount /vendor, /system, and /oem even if they are R/W.
- /vendor, /system, /oem can be remounted to R/W for development
  purpose.

- In such case, umounting these partitions can lead into some processes
  not running properly during shutdown or blocking umount of fs.

- So skip them. As it is dev feature, it is up to each developer to
  understand the risk. But for normal adb sync - reboot should be ok
  as shutdown involves sync operations.

bug: 37737296
Test: adb remount,reboot, and check last kmsg
Change-Id: Iab6a6374bc558375d359b3b49b14db93d363b1ad
2017-07-17 17:32:26 -07:00
Tom Cherry bbd8b8b534 Merge "ueventd: add tests for setegid()/setfscreatecon() and threads" am: 0ba56096d5 am: 730a5ddf27 am: 92b34b76b5
am: 643307dbd0

Change-Id: Ibd08ed409511c9f32b41981a7a653459dd50f72c
2017-07-17 20:04:37 +00:00
Tom Cherry 643307dbd0 Merge "ueventd: add tests for setegid()/setfscreatecon() and threads" am: 0ba56096d5 am: 730a5ddf27
am: 92b34b76b5

Change-Id: I07b8b06af95c0c0bf8889dce0f256bb901264bcc
2017-07-17 20:01:06 +00:00
Tom Cherry 92b34b76b5 Merge "ueventd: add tests for setegid()/setfscreatecon() and threads" am: 0ba56096d5
am: 730a5ddf27

Change-Id: I8da0974f3a8a42e2bdfb4f97af9ddc44b7483beb
2017-07-17 19:58:37 +00:00
Tom Cherry 730a5ddf27 Merge "ueventd: add tests for setegid()/setfscreatecon() and threads"
am: 0ba56096d5

Change-Id: Ib1619e4c52402710de09e971a1e96fd7caf0f75a
2017-07-17 19:56:06 +00:00