Commit Graph

29140 Commits

Author SHA1 Message Date
Mark Salyzyn 2b616cea9e libcutils: fs_config() add check /odm/etc/fs_config_*
Add reading of vendor file-system config files
/odm/etc/fs_config_dirs and /odm/etc/fs_config_files.

Order of interpretation (for dirs and files respectively):
- /system/etc/fs_config_dirs or /system/etc/fs_config_files
- /vendor/etc/fs_config_dirs or /vendor/etc/fs_config_files
- /oem/etc/fs_config_dirs or /oem/etc/fs_config_files
- /odm/etc/fs_config_dirs or /odm/etc/fs_config_files
- internal android_dirs[] or android_files[] structures.

No restrictions are placed on the odm file-system config files,
although the developer is advised to restrict the scope to the /odm
file-system since the intent is to provide support only for
customized portions of odm.img.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: Ic3afb5bb4ea20b15bd5df728be9f16045bf5b039
2017-03-22 15:28:40 -07:00
Christopher Ferris f5e568e653 Do not access device maps.
It's possible that a device map has memory controlled by a single entry
device driver. Thus, you can deadlock if a process is touching that
device memory and we try to unwind it and also touch that device memory.
Simply skip any attempts to step through, or get function names from
device memory maps.

Bug: 36130325

Test: Ran new unit tests, ran bionic unit tests, ran art ThreadStress.
Change-Id: Ibc62d7ec8106c619ee08968f05e04aea55d7cbfa
2017-03-22 14:55:05 -07:00
Elliott Hughes ee1ac710cd Switch "adb sideload" over to lseek/read.
This made no difference to the time taken to sideload an AOSP marlin
update (1m24s), but does reduce the memory requirements to 64KiB.

Bug: https://code.google.com/p/android/issues/detail?id=258500
Bug: http://b/36046324
Test: "time adb sideload update.zip"
Change-Id: Ib0a4daeb5fe798a9bb9c9e0e5fbcff0ed46f20df
2017-03-22 14:34:16 -07:00
Elliott Hughes 535520480a Merge "Keep the ReadFileToString/ReadFdToString overhead down."
am: 2af784bf20

Change-Id: I4c59280af2b5d3aad0911df7696e675a86cad701
2017-03-22 21:03:31 +00:00
Treehugger Robot 2af784bf20 Merge "Keep the ReadFileToString/ReadFdToString overhead down." 2017-03-22 21:00:00 +00:00
Keun-young Park f803be004a Merge "remove emergency shutdown and improve init's reboot logic"
am: 437dc91fa3

Change-Id: I6d7cac831981f418562579750b3a96ec039ba677
2017-03-22 20:19:23 +00:00
Treehugger Robot 437dc91fa3 Merge "remove emergency shutdown and improve init's reboot logic" 2017-03-22 20:13:43 +00:00
Adam Lesinski 3dec1aa66d healthd: Implement scheduleUpdate
scheduleUpdate forces a healthd battery update,
which will notify all listeners.
Test: Manual (strace -p $healthd_pid)
Bug: 32645990

Change-Id: I8b19f79b633ca8988f0e3dd5be14757f6421ddcb
2017-03-22 12:15:11 -07:00
Vijay Venkatraman c0c4aeb556 Merge "Moved include/android_filesystem_*.h and canned_fs_config.h to libcutils"
am: a4bc98941a

Change-Id: Ib90d711895c8a75f5abec2284ff66723c4f5b35e
2017-03-22 18:31:55 +00:00
Keun-young Park 8d01f63f50 remove emergency shutdown and improve init's reboot logic
- Emergency shutdown just marks the fs as clean while leaving fs
  in the middle of any state. Do not use it anymore.

- Changed android_reboot to set sys.powerctl property so that
  all shutdown can be done by init.

- Normal reboot sequence changed to
    1. Terminate processes (give time to clean up). And wait for
      completion based on ro.build.shutdown_timeout.
        Default value (when not set) is changed to 3 secs. If it is 0, do not
        terminate processes.
    2. Kill all remaining services except critical services for shutdown.
    3. Shutdown vold using "vdc volume shutdown"
    4. umount all emulated partitions. If it fails, just detach.
       Wait in step 5 can handle it.
    5. Try umounting R/W block devices for up to max timeout.
      If it fails, try DETACH.
      If umount fails to complete before reboot, it can be detected when
      system reboots.
    6. Reboot

- Log shutdown time and umount stat to log so that it can be collected after reboot

- To umount emulated partitions, all pending writes inside kernel should
  be completed.
- To umount /data partition, all emulated partitions on top of /data should
  be umounted and all pending writes should be completed.
- umount retry will only wait up to timeout. If there are too many pending
  writes, reboot will discard them and e2fsck after reboot will fix any file system
  issues.

bug: 36004738
bug: 32246772

Test: many reboots combining reboot from UI and adb reboot. Check last_kmsg and
      fs_stat after reboot.

Change-Id: I6e74d6c68a21e76e08cc0438573d1586fd9aaee2
2017-03-22 11:23:31 -07:00
Vijay Venkatraman a4bc98941a Merge "Moved include/android_filesystem_*.h and canned_fs_config.h to libcutils" 2017-03-22 18:21:44 +00:00
Steven Moreland 9e36331174 Start hwservicemanager earlier.
Also start hals where hwservicemanager was started before.

Bug: 36278706
Test: internal marlin+angler boots
Change-Id: Ia55d2ef747fcbd086a09e1bb856824b14343118b
2017-03-22 11:19:31 -07:00
Christopher Ferris 6f4175fefc Merge "Allow calling GetFunctionName before unwinding."
am: 435fc45103

Change-Id: Id3ffdd9623b7109d9133fe2f5bfbb733d782eb71
2017-03-22 17:37:26 +00:00
Christopher Ferris 435fc45103 Merge "Allow calling GetFunctionName before unwinding." 2017-03-22 17:30:34 +00:00
Narayan Kamath abd4613f05 Logwrapper: Remove unused support for input / output processing.
Should make it easier to switch callers over to posix_spawn once
that's available.

NOTE: The (now) unused arguments will be removed in a followup (multi-project)c
hange once we empirically confirm that there aren't any prebuilt blobs
using this function. I did readelf all currently checked in prebuilts to look
for a reference to this method, but one can never be too paranoid.

Test: make checkbuild
Change-Id: I454d80c52f269c31846133cc54375decd702fe71
2017-03-22 11:00:43 +00:00
Lorenzo Colitti 5e801e7bd5 Make the xtables lock readable only by AID_RADIO and root.
Anyone who can read this file can call flock(..., LOCK_EX) on it,
thereby blocking any future iptables commands from running.
Restrict it to user AID_RADIO, which includes device-specific
network management daemons, and group root.

Bug: 36108349
Test: see https://android-review.googlesource.com/#/c/348939/
Change-Id: I4dae4b5a835fabdc1a61a330e0446b39651f8156
2017-03-22 17:03:19 +09:00
Vijay Venkatraman d4e2386057 Moved include/android_filesystem_*.h and canned_fs_config.h to libcutils
Bug: 33241851
Test: No changes needed for modules not using VNDK.
For VNDK, enable BOARD_VNDK_VERSION in BoardConfig.mk
and add libcutils to modules that need these headers.

Change-Id: I6102778aab35ed26a5ddde11230502dcd4edc852
2017-03-21 17:34:58 -07:00
Mark Salyzyn 1bc4b39bef Merge "liblog: tests: liblog.__security property failure"
am: 2a54ae97eb

Change-Id: I32ae5a9cfa1be0a50ac4b1847a550464146c6644
2017-03-22 00:15:42 +00:00
Mark Salyzyn 2a54ae97eb Merge "liblog: tests: liblog.__security property failure" 2017-03-22 00:10:04 +00:00
Alex Vakulenko 16b3d261bd Merge "Add 'ro.cpuset.default' system property for default cpusets."
am: 2fdcf37af1

Change-Id: I5b977b1f34a8009963d7aab708b1a97d4f569451
2017-03-21 23:54:03 +00:00
Treehugger Robot 2fdcf37af1 Merge "Add 'ro.cpuset.default' system property for default cpusets." 2017-03-21 23:46:56 +00:00
Tom Cherry f0cb60083e Merge "init: reboot to bootloader on crash for development builds"
am: ac8a3bd283

Change-Id: Ieb55ec65e908410eb5dadc1cd0f25a9bbf37fd4a
2017-03-21 23:01:28 +00:00
Treehugger Robot ac8a3bd283 Merge "init: reboot to bootloader on crash for development builds" 2017-03-21 22:50:38 +00:00
Mark Salyzyn ef5d981977 liblog: tests: liblog.__security property failure
CTS tests are failing to set ro.device_owner property.

Test: gTest liblog_unit_tests --gtest_filter=liblog.__security
Bug: 36480230
Change-Id: Icafea9f7488ce9c4ea47d42dc08505bc0cf99a3e
2017-03-21 15:22:29 -07:00
Wei Wang 857e716f3e Merge changes from topic 'remove_bg_cgroup'
am: e941c5fa41

Change-Id: Icb9b9591ffe353dfcbf782437b4f06481a8fdf3a
2017-03-21 22:20:14 +00:00
Wei Wang 20943abad0 init.rc: remove bg_non_interactive cgroup
am: a27a91a5fd

Change-Id: I795b160f56f3ff492e312ea145948a24890e9029
2017-03-21 22:19:59 +00:00
Treehugger Robot e941c5fa41 Merge changes from topic 'remove_bg_cgroup'
* changes:
  libcutils: only change cgroup when fd is initialized
  init.rc: remove bg_non_interactive cgroup
2017-03-21 22:09:51 +00:00
Christopher Ferris 82f3bbdc25 Allow calling GetFunctionName before unwinding.
Some extra initialization needs to occur before calling the local/remote
GetFunctioneName.

Also, cleanup the test code a bit:

- Make all local functions static.
- Create a common function to create and finish remote processes.
- Remove unused function.
- Fix the formatting a bit by making it match clang format.

Test: Ran the unit tests.
Change-Id: I998bed1378d582df59fdf9263df6f208db5d795a
2017-03-21 14:21:49 -07:00
Elliott Hughes 9bb7971ae7 Keep the ReadFileToString/ReadFdToString overhead down.
Bug: https://code.google.com/p/android/issues/detail?id=258500
Bug: http://b/36046324
Test: ran tests
Change-Id: I40e76a6dd164ea9a5e8e18159f543e1bb221dcba
2017-03-21 13:43:08 -07:00
Tom Cherry 663fdfc1b2 init: reboot to bootloader on crash for development builds
Currently, if init crashes, the kernel panics.  During development, we
would like to catch this crash before the kernel panics and reboot
into bootloader. This will prevent boot looping bad configurations,
particularly desired in test labs where manual intervention would
otherwise be required to reset the devices.

Keep the existing behavior for user builds, as init crashes should be
rare for production builds and rebooting the device is the correct
behavior for end users.

Bug: 34147472
Test: Boot bullhead userdebug, force init to crash, check that the
      device is in bootloader
Test: Boot bullhead user, force init to crash, check that the kernel
      panics and the device reboots as it did previously
Change-Id: Iab3d45ed0d1f82ffaad2a0835d9ca537c0516421
2017-03-21 13:42:17 -07:00
Tom Cherry ff6eb509aa Merge "init: Fix leaking fd and error print"
am: e87a826a1d

Change-Id: Ie807fa6321b0d0313221711999fb01897c192419
2017-03-21 20:23:47 +00:00
Treehugger Robot e87a826a1d Merge "init: Fix leaking fd and error print" 2017-03-21 20:11:09 +00:00
Alex Vakulenko 0828676dff Add 'ro.cpuset.default' system property for default cpusets.
Normally 'writepid' is used to add a process to a particular cpuset. However
certain systems with big/small cores might need to specify a default cpuset for
system processes which do not explicitly specify one. Add an option to use
'ro.cpuset.default' system property to specify default cpuset for system processes
which do not explicitly write to /dev/cpuset/... with 'writepid' option.

The cpuset name specified in ro.cpuset.default is just the cpuset name, e.g.
'/system-background', '/foreground', or simply '/' for the "root" cpuset.

Bug: 28550814
Test: `m -j32` succeeds for aosp_sailfish-eng. Phone boots successfully.
      Also tested manually with debug trace messages on emulator with different
      combinations of values for 'ro.cpuset.default'.
Change-Id: I501727fa5ee3f4bb7a938fa104b81a404b616633
2017-03-21 12:00:31 -07:00
Christopher Ferris 46d0609097 Merge "Use the 2 space clang format for libunwindstack."
am: 4b9a555a0f

Change-Id: Ifb0a52a2f99ddd69b4fe7196b749a985b7851be5
2017-03-21 18:25:03 +00:00
Mark Salyzyn 6b5913a8b6 Merge "libcutils: fs_config() add check /oem/etc/fs_config_*"
am: c530045850

Change-Id: Idbe297f1402adb73bfa6e7bf82c39a0214752178
2017-03-21 18:24:49 +00:00
Christopher Ferris 4b9a555a0f Merge "Use the 2 space clang format for libunwindstack." 2017-03-21 18:21:19 +00:00
Treehugger Robot c530045850 Merge "libcutils: fs_config() add check /oem/etc/fs_config_*" 2017-03-21 18:13:31 +00:00
Christopher Ferris adda674466 Use the 2 space clang format for libunwindstack.
Test: NA
Change-Id: Ibf321931d1e7ac5bbe4e8479c9d706576f55e8ac
2017-03-21 10:41:45 -07:00
Mark Salyzyn 122310429f Merge changes I4077bd6a,I92c4090e,Iff579600
am: e9539eb02f

Change-Id: I28748a1f0a3e797ddd4bc76adc19f2ea308a70c8
2017-03-21 16:53:33 +00:00
Mark Salyzyn e9539eb02f Merge changes I4077bd6a,I92c4090e,Iff579600
* changes:
  libcutils: fs_config() add check /vendor/etc/fs_config_*
  libcutils: fs_config: sort files
  libcutils: fs_config: sort dirs
2017-03-21 16:49:53 +00:00
Mark Salyzyn ba9d88ebab Merge "fs_mgr: remove private/android_filesystem_config.h"
am: f5ee213a5c

Change-Id: I78230fad7c5f910433a00f96e87d26c4c8b9be0d
2017-03-21 15:20:25 +00:00
Mark Salyzyn 62c701e174 libcutils: fs_config() add check /oem/etc/fs_config_*
Add reading of vendor file-system config files
/oem/etc/fs_config_dirs and /oem/etc/fs_config_files.

Order of interpretation (for dirs and files respectively):
- /system/etc/fs_config_dirs or /system/etc/fs_config_files
- /vendor/etc/fs_config_dirs or /vendor/etc/fs_config_files
- /oem/etc/fs_config_dirs or /oem/etc/fs_config_files
- internal android_dirs[] or android_files[] structures.

No restrictions are placed on the oem file-system config files,
although the developer is advised to restrict the scope to the /oem
file-system since the intent is to provide support only for
customized portions of oem.img.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: I56f3fed5efa44d622a9a110937dbc949083d44ae
2017-03-21 08:15:58 -07:00
Mark Salyzyn 9ceadcb0c4 libcutils: fs_config() add check /vendor/etc/fs_config_*
Add reading of vendor file-system config files
/vendor/etc/fs_config_dirs and /vendor/etc/fs_config_files.

Order of interpretation (for dirs and files respectively):
- /system/etc/fs_config_dirs or /system/etc/fs_config_files
- /vendor/etc/fs_config_dirs or /vendor/etc/fs_config_files
- internal android_dirs[] or android_files[] structures.

No restrictions are placed on the vendor file-system config files,
although the developer is advised to restrict the scope to the /vendor
file-system since the intent is to provide support only for
customized portions of vendor.img.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: I4077bd6afcda2ee16189b2eb3c322af15205bbb9
2017-03-21 08:14:42 -07:00
Mark Salyzyn a45eae93f6 libcutils: fs_config: sort files
Sort android_files[] first by requirements, grouping, specificity and
finally by alphanumeric order.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: I92c4090eac0067e0327ac7c8dde229747893d585
2017-03-21 08:14:42 -07:00
Mark Salyzyn c4f9f4c216 libcutils: fs_config: sort dirs
Sort android_dirs[] first by requirements, grouping, specificity and
finally by alphanumeric order.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: Iff579600b05d7b2a0b9fc7d9e9d897e0bb69aebd
2017-03-21 08:14:42 -07:00
Mark Salyzyn f5ee213a5c Merge "fs_mgr: remove private/android_filesystem_config.h" 2017-03-21 15:14:31 +00:00
Mark Salyzyn 679942bf0d Merge "libcutils: fs_config.c code compliance"
am: b501400a76

Change-Id: Ia6188feca0185192b41259cb4be41d3f4385b17d
2017-03-21 14:51:53 +00:00
Mark Salyzyn b501400a76 Merge "libcutils: fs_config.c code compliance" 2017-03-21 14:48:32 +00:00
Wei Wang 97957fc420 libcutils: only change cgroup when fd is initialized
This is to avoid failues on setting non-exist cgroup

Bug: 34193533
Test: on marlin
Change-Id: I619dcba332fda9ec421df811745cf10311beddd3
2017-03-20 22:13:22 -07:00
Wei Wang a27a91a5fd init.rc: remove bg_non_interactive cgroup
We have seen cases when threads in this cgroup not scheduled for more than
a few seconds in heavy workload situation and causing device freeze.
In Linux, multiple threads placed in ROOT cgroup cause the CPU resource to
be split per thread, rather than per group.
Currently we have many threads in ROOT cgroup, which makes threads in
bg_non_interactive cgroup to have "tiny" CPU resource other than 5%
quota defined.

Bug: 34193533
Test: on marlin
Change-Id: I7721f6196560fbedf6265e8b6db130cec9edefd7
2017-03-20 22:13:07 -07:00