Commit graph

38841 commits

Author SHA1 Message Date
Mark Salyzyn
adc433d3ea bootstat: clear persist.sys.boot.reason once read
To ensure a surprise reboot does not take the last boot reason on
face value especially if coming from more than one boot sessions ago.
We shift and clear the value from persist.sys.boot.reason to
sys.boot.reason.last and establish a correct last reboot reason in
the canonical sys.boot.reason property.

This effectively deprecates persist.sys.boot.reason as an API.  They
should have been using sys.boot.reason instead for a correctly
determined reasoning.

Test: boot_reason_test.sh
Bug: 86671991
Merged-In: If85750704445088fd62978679ab3a30744c46abb
Change-Id: If85750704445088fd62978679ab3a30744c46abb
2018-06-14 15:36:56 +00:00
Treehugger Robot
91061985f5 Merge changes from topic "sharedlib_in_recovery"
* changes:
  Build init with shared libraries
  Shared libs are supported in recovery mode
2018-06-13 23:14:29 +00:00
Treehugger Robot
b066bbebd1 Merge changes from topic "libdm"
* changes:
  fs_mgr: libdm: Add support to list existing device mapper devices
  fs_mgr: libdm: add support to create and delete device mapper devices.
  fs_mgr: device mapper: Add libdm and 'dmctl' tool to use it.
2018-06-13 22:45:30 +00:00
Treehugger Robot
06651fbe02 Merge "libsparse: add OWNERS." 2018-06-13 21:48:29 +00:00
Treehugger Robot
43c4bbd965 Merge "sync: remove legacy sync info API" 2018-06-13 21:34:54 +00:00
Sandeep Patil
f603cfdd70 fs_mgr: libdm: Add support to list existing device mapper devices
Test: dmctl create system; dmctl list devices; dmctl delete system;
      dmctl list devices
Bug: 110035986

Change-Id: I4ae5d40041458421068976fa2a99c662c542a9a1
Signed-off-by: Sandeep Patil <sspatil@google.com>
2018-06-13 13:50:21 -07:00
Treehugger Robot
8e41582c8d Merge changes I8e44ba77,Ib8b933fe
* changes:
  libsparse: Add .clang-format and reformat to google3 style
  libsparse: Change source files to cpp
2018-06-13 20:47:14 +00:00
Treehugger Robot
4aa8421203 Merge "init: Add warning in init first stage mount" 2018-06-13 20:39:32 +00:00
Sandeep Patil
45d94ab683 fs_mgr: libdm: add support to create and delete device mapper devices.
Test: dmctl create system; dmctl delete system
Test: verify that ueventd creates /dev/block/dm-X and verify the dm
device name from /sys/block/dm-X/dm/name
Bug: 110035986

Change-Id: I2a08e2ea7007c0c13fe64d444f0d6618784edae7
Signed-off-by: Sandeep Patil <sspatil@google.com>
2018-06-13 13:35:48 -07:00
Sandeep Patil
59f04ee74c fs_mgr: device mapper: Add libdm and 'dmctl' tool to use it.
libdm is small static library that is intended to be the one source to
control device mapper. It is intended to have APIs to create, control
and destroy device mapper targets. Eventually, all fs_mgr implementation
that talks to device mapper will be moved to using libdm APIs.

Added 'dmctl', a command line tool that lists the registered device
mapper targets and their corresponding version. The tool will continue
to get new features to exemplify new APIs implemented in libdm.

The library is intentionally static and folds into libfs_mgr. All
clients must link to libfs_mgr as a result.

Test: dmctl list
Bug: 110035986

Change-Id: I71e7146073a74e7523524bf3b20d0be6d06f9fad
Signed-off-by: Sandeep Patil <sspatil@google.com>
2018-06-13 13:35:44 -07:00
Jerry Zhang
7b444f08c1 libsparse: Add .clang-format and reformat to google3 style
Bug: 78793464
Test: compiles
Change-Id: I8e44ba77195a12fc2bac7d4276bbc4aa95149b31
2018-06-13 20:32:24 +00:00
Elliott Hughes
b7761b2673 Merge "logd: make behavior more consistent across builds." 2018-06-13 19:45:56 +00:00
Elliott Hughes
91e66ab14a libsparse: add OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ie26da2ff47de4cef20050b996a04d53c2b5c358f
2018-06-13 12:43:08 -07:00
Treehugger Robot
0a257c7715 Merge "libsparse: Add method to create sparse file from buffer" 2018-06-13 19:42:41 +00:00
Jesse Hall
82d377b585 sync: remove legacy sync info API
The legacy fence/pt info API has been deprecated for a while. This
change removes it from headers, so remaining users will have to switch
to the modern API when they're re-compiled. The functions are still
provided by libsync.so and tests remain, so existing binaries should
continue to work. Eventually these will be removed too, though, once
it's reasonable to expect those binaries to have been recompiled.

This reverts commit eed25df46a, which
reverted the previous attempt in commit
798ba95bda now that more users of the
legacy API have been converted.

Bug: 35326015
Test: make checkbuild
Test: adb shell dumpsys SurfaceFlinger --latency
2018-06-13 11:52:10 -07:00
Jerry Zhang
5a75507795 libsparse: Change source files to cpp
Bug: 78793464
Test: compiles
Change-Id: Ib8b933fe3ccb8dfa49a77f7955891678bf0df086
2018-06-13 11:17:22 -07:00
Wei Wang
fdafb3d0ec init: Add warning in init first stage mount
init need find required devices and it some times takes a long time due
to rogue drivers. Add a warning if the timing is longer than 50ms.

Bug: 80494921
Test: Reboot
Change-Id: I8f937d7ca7127dc89ed76bb6e5f1781459d5c94a
2018-06-13 11:02:13 -07:00
Elliott Hughes
cef62b4014 logd: make behavior more consistent across builds.
Bug: 110127913
Test: boots
Change-Id: I0c1efacfb5ac0407e896ddde0bcc63927edc0525
2018-06-13 10:34:43 -07:00
Treehugger Robot
7222199281 Merge "logd: Stop calling prctl(PR_SET_KEEPCAPS, 1)" 2018-06-13 16:41:15 +00:00
Luis Hector Chavez
499f3a2aed logd: Stop calling prctl(PR_SET_KEEPCAPS, 1)
This change removes the call to prctl(PR_SET_KEEPCAPS, 1), because now
that logd is being run with ambient capabilities, init will set the
KEEP_CAPS / KEEP_CAPS_LOCKED securebits.

Bug: 110127913
Test: liblog-unit-tests, logd-unit-tests, logcat-unit-tests
      (on an aosp_sailfish-userdebug)

Change-Id: I72b6a49c5cd1552085f9ad44cb19a7333a13eeea
2018-06-13 07:36:23 -07:00
Christopher Ferris
9c1d75983a Merge "Fix handling of load bias values." 2018-06-13 00:43:13 +00:00
Treehugger Robot
cd7244100b Merge "libcutils: add OWNERS." 2018-06-12 22:46:28 +00:00
Tom Cherry
86e65e9cac Merge "ueventd: fix extraneous 'Invalid section' error" 2018-06-12 22:05:48 +00:00
Treehugger Robot
cefd4e56ad Merge "bootstat: Remove the CAP_SYSLOG capability" 2018-06-12 20:59:45 +00:00
Elliott Hughes
796eb71e9c libcutils: add OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ia147e1dc9511810cd86a463861db3d3d7fedab9b
2018-06-12 13:58:30 -07:00
Treehugger Robot
28cd2a02b1 Merge "logd: Move the capabilities from file based to ambient" 2018-06-12 20:56:56 +00:00
Tom Cherry
413bf61e48 Merge "init: Actually check the return value for calls during first stage init" 2018-06-12 20:40:30 +00:00
Tom Cherry
788fc8229c init: Actually check the return value for calls during first stage init
Init never checked the return values of the calls made during first
stage init (since of course they're not going to fail, right?).  But
of course commands can fail and they might not necessarily be obvious
when they do, so let's make it obvious.

Since the kernel log isn't up until later, this creates a list of the
failures that can then be sent to the kernel log once it's ready
(pending of course failures in setting it up...)

Test: boot bullhead, don't see errors
Change-Id: I8c12c61fa12e4368346e8b0e1c0bb0844b5d0377
2018-06-12 11:18:17 -07:00
Tom Cherry
d5d626c9f7 ueventd: fix extraneous 'Invalid section' error
When adding a new error case for host_init_parser, I didn't handle the
individual line callbacks used for ueventd correctly.  This change
fixes that.

Test: bullhead boots without extraneous ueventd warnings
Change-Id: I56cad854b0defd936a7fbcab73fe2f2963c0e2e4
2018-06-12 10:59:12 -07:00
Treehugger Robot
e5aa7ee753 Merge "bootstat: ppdone_timeout kernel panic" 2018-06-12 15:47:02 +00:00
Christopher Ferris
4cc36d2b43 Fix handling of load bias values.
It turns out that for the dwarf information, if a FDE indicates it's pc
relative, then pc has to be incremented by the load bias. If not, then
it should not be incremented.

Previously, the code always subtracted load bias values from pcs, and assumed
that all fdes were incremented by load bias values. The new code actually
reads the fdes and adjusted the pcs in the fde and in the eh frame hdr so
that load bias values are already handled properly.

In addition, add dumping of arm exidx values in unwind_reg_info. This allowed
verifying that the debug frame in those elf files was being handled properly.

Added a new unit test that only has a debug frame that has a non-zero load
bias and has fde entries that do not have pc relative encoding.

Fix a couple of other small bugs.

Bug: 109824792

Test: All libbacktrace/libunwindstack unit tests pass.
Test: Ran ART 137-cfi test and 004-ThreadStress.
Test: Verify that displaying the fde start and end pc actually match the
Test: real data for fde that have pc relative set, and that don't.
Test: Verified that the unwind information for arm exidx matches the
Test: debug frame data.

Change-Id: I707555286b5cb05df9f25489e8c5ede753cfe0fb
2018-06-11 18:53:55 -07:00
Treehugger Robot
d0687a8aec Merge "fs_mgr: reorder getting boot config" 2018-06-11 23:36:17 +00:00
Luis Hector Chavez
0becca32bc bootstat: Remove the CAP_SYSLOG capability
This change removes the CAP_SYSLOG file based capability from bootstat,
since the intention is that it should not be accessing the logs in the
long term. In order to avoid bitrot, the fallback code that depends on
CAP_SYSLOG has also been removed.

Bug: 62845925
Test: system/core/bootstat/boot_reason_test.sh
Change-Id: I899be44ef3ac1c4d81072f801d55c928ae09bb15
2018-06-11 12:41:24 -07:00
Luis Hector Chavez
d32c36c961 logd: Move the capabilities from file based to ambient
This change moves logd's capabilities from being file based to being set
by init through ambient capabilities.

Bug: 62845925
Test: sailfish:/ # grep Cap /proc/`pidof logd`/status
      CapInh: 0000000000000000
      CapPrm: 0000000440000000
      CapEff: 0000000440000000
      CapBnd: 0000000440000040
      CapAmb: 0000000000000000
      $ capsh --decode=0x440000040
      0x440000040=cap_setgid,cap_audit_control,cap_syslog
Test: liblog-unit-tests, logd-unit-tests, logcat-unit-tests
Change-Id: I28c7c4ad37ad5eafd399aef78c303ce31298a9ef
2018-06-11 10:04:11 -07:00
Bowgo Tsai
7481e6cceb fs_mgr: reorder getting boot config
The params in kernel cmdline is expected to be consumed by kernel.
For bootloader <--> userland communication, we're moving it to
device-tree or system property.

Bug: 78615592
Test: boot a device
Change-Id: I26bc2ea4cda91241242eb9fd0210b5b10659a297
2018-06-12 00:16:14 +08:00
Treehugger Robot
ec9b6b73ff Merge "fs_mg: allow getting VBMeta Digest from device-tree" 2018-06-11 16:10:21 +00:00
Treehugger Robot
53fe135595 Merge "Add files to CleanSpec.mk" 2018-06-11 15:35:47 +00:00
Treehugger Robot
7da6b579c1 Merge "fs_mgr: fs_mgr_get_boot_config_from_kernel_cmdline deal with quote" 2018-06-11 14:29:24 +00:00
Bowgo Tsai
3474297379 fs_mg: allow getting VBMeta Digest from device-tree
fs_mgr gets androidboot.vbmeta.{size, hash_alg, digest} from kernel
cmdline to assure the integrity of all vbmeta structs. This CL Allows
fs_mgr to get those parameters from device tree because they're only
consumed by userland instead of kernel.

  https://android.googlesource.com/platform/external/avb/+/master#The-VBMeta-Digest

Bootloader could construct a device tree overlay at run time then merge
it into main device tree. e.g.,

    firmware {
        android {
            vbmeta.size = "5245";
            vbmeta.hash_alg = "sha256";
            vbmeta.digest = "0c51233ca3ecaa...63c6d912e79b709";
        };
    };

Bug: 80168311
Test: boot a device using AVB

Change-Id: I6cf151713af04e6cf554d593e9f0b43e9e214d8c
2018-06-11 22:08:45 +08:00
Jiyong Park
787322c55f Build init with shared libraries
recovery partition now supports shared librarys. Therefore, init can now
be built as a dynamic executable both for normal and recovery modes.

To save save in the recovery mode, not all libs are dynamically linked.
Libs that are only used by init in the recovery mode are still
statically linked.

Note: init is still a static executable for legacy devices where
system-as-root is not on, because the dynamic linker and shared libs
which are in /system are not available when init starts.

Bug: 63673171
Test: `adb reboot recovery; adb devices` shows the device ID
Test: device boots to the UI in normal mode.
Test: do that for both walleye (system-as-root) and bullhead (legacy
ramdisk).
Change-Id: I30c84ae6a8e507e507ad0bb71acad281316d9e90
2018-06-10 08:32:33 +09:00
Jiyong Park
011ee12b1d Shared libs are supported in recovery mode
adbd has been built as a static executable since the same binary was
copied to the recovery partition where shared library is not supported.
However, since we now support shared library in the recovery partition,
adbd is built as a dynamic executable.

In addition, the dependency from adbd to libdebuggerd_handler is removed
as debuggerd is handled by the dynamic linker.

A few more modules in /system/core are marked as recovery_available:
true as they are transitive dependencies of the dynamic linker.

This change also includes ld.config.recovery.txt which is the linker
config file for the recovery mode. It is installed to /etc/ld.config.txt
and contains linker namespace config for the dynamic binaries under
/sbin.

Bug: 63673171
Test: `adb reboot recovery; adb devices` shows the device ID
Test: Select 'mount /system' in the recovery mode, then `adb shell`.
$ lsof -p `pidof adbd` shows that libm.so, libc.so, etc. are loaded from
the /lib directory.

Change-Id: I363d5a787863f1677ee40afb5d5841321ddaae77
2018-06-10 08:32:24 +09:00
Logan Chien
7881135fa9 Add files to CleanSpec.mk
This commit removes stale files from incremental builds:

* /system/etc/ld.config.txt,
* /system/etc/llndk.libraries.txt
* /system/etc/public.libraries.txt

These files are replaced by versioned ones.

Bug: 78605339
Test: Those files are removed in incremental builds
Merged-In: I7925fa45b47397829bde835ab3c479611faffa33
Change-Id: I7925fa45b47397829bde835ab3c479611faffa33
(cherry picked from commit 9afd9b488f)
2018-06-10 08:29:24 +09:00
Mark Salyzyn
596fac3c6d fs_mgr: fs_mgr_get_boot_config_from_kernel_cmdline deal with quote
Spans quoted with " are dealt with atomically, and are stripped from
the key/value results when parsing the kernel cmdline.

Test: compile, device boot, fs_mgr_unit_test
Bug: 109821005
Change-Id: I45f3d7395f34295edefdeaafa4c15c6ee25cc4da
2018-06-08 16:04:17 -07:00
Tao Bao
3ee8926f5d Merge "Update shell and utilities doc on the use of dd and grep." 2018-06-08 19:30:04 +00:00
Mark Salyzyn
78e54fd0ab bootstat: ppdone_timeout kernel panic
Add kernel_panic,_sde_encoder_phys_cmd_handle_ppdone_timeout to help track
occurrences.

Test: compile
Bug: 67728931
Change-Id: I3306ae2936dc4355902e838d9ac8d8b11837348d
2018-06-08 10:37:06 -07:00
Tao Bao
6220400636 Update shell and utilities doc on the use of dd and grep.
We have moved away from BSD dd and grep, which is also shown in the
section for Android Q.

Test: N/A
Change-Id: I13484879e697a1cf2c8b82d7e28a167cb34c00fa
2018-06-08 12:52:56 -04:00
Tom Cherry
158dd05b8a Merge "fs_mgr: remove some unused functions" 2018-06-08 02:27:03 +00:00
Tom Cherry
e6eabf42f2 fs_mgr: remove some unused functions
Test: build
Change-Id: I8a44f2f777fff369df06c73f06d53e448826f7b5
2018-06-07 16:49:01 -07:00
Treehugger Robot
e1bc807b7d Merge "fs_mgr: avb should use built-in kernel command line parser" 2018-06-07 23:28:26 +00:00
Mark Salyzyn
346c52e972 fs_mgr: avb should use built-in kernel command line parser
Switch from open-coded parsing of /proc/cmdline to built-in
fs_mgr_get_boot_config_from_kernel_cmdline function.

Test: compile and smoke boot test
Bug: 109821005
Change-Id: I935d2e76c76ad417cbcee398e2afbf9b061d1719
2018-06-07 14:45:08 -07:00