Commit Graph

49772 Commits

Author SHA1 Message Date
Yifan Hong aca2bc0992 Merge "init: add umount_all builtin." into qt-dev 2019-04-16 17:01:19 +00:00
Christopher Ferris 82866421b8 Fix pc/function name for signal handler frame.
This refactors the step function slightly to split it up into
distinct pieces since the code needs to handle a signal handler
versus normal step slightly differently.

Add a new error for an invalid elf.

Modify libbacktrace code to handle new error code.

Bug: 130302288

Test: libbacktrace/libunwindstack unit tests.
Change-Id: I3fb9b00c02d2cf2cc5911541bba0346c6f39b8e6
Merged-In: I3fb9b00c02d2cf2cc5911541bba0346c6f39b8e6
(cherry picked from commit d11ed86d65)
2019-04-15 14:14:56 -07:00
TreeHugger Robot 1dd53f763b Merge "Allow fuzzy_fastboot number to run for a specific device serial number" into qt-dev 2019-04-15 20:57:18 +00:00
Yifan Hong 81f1385589 init: add umount_all builtin.
umount_all is the cleanup step for mount_all.

In particular, the mount_all builtin creates a verity device,
'postinstall-verity', for the following line:

system /postinstall ... ... slotselect_other,logical,avb_keys=...

cppreopt umounts /postinstall but doesn't destroy the postinstall-verity
device, causing OTA to fail (because it cannot destroy the
system_[other] device). umount_all also destroy the verity device.

Note that mount_all does not map system_[other]; it is mapped by
first stage init. Hence, umount_all doesn't destroy it either. The OTA
client is reponsible for unmapping the device itself.

Bug: 129988285
Test: flash, boot, then check `dmctl list devices`, then OTA

Change-Id: Id3ab65b3860b6ea6cfec310ab13652009c81f415
2019-04-15 10:22:57 -07:00
Hridya Valsaraju c18cccc227 Allow fuzzy_fastboot number to run for a specific device serial number
Test: ./fuzzy_fastboot --serial=826X003L --gtest_filter=*Logical*
Bug: 117181762
Change-Id: I9dec510aa604b7994f25ce26edb87d7f6ec3e875
Merged-In: I9dec510aa604b7994f25ce26edb87d7f6ec3e875
(cherry picked from commit b9051a3e65)
2019-04-12 17:13:24 +00:00
David Srbecky e5c4d62ba3 Revert "Check for data races when reading JIT/DEX entries."
This reverts commit 85b5fecec9.

Reason for revert: Breaks ART tests, reverting to investigate.
Exempt-From-Owner-Approval: Revert.

(cherry picked from commit b9cc4fbb26)

Bug: 130406806
Change-Id: I634e37060b97484d627fc544e3b406fd90aaa784
2019-04-12 12:55:50 +00:00
TreeHugger Robot 84ababefb7 Merge "first-stage mount: support using other avb_keys" into qt-dev 2019-04-11 05:45:53 +00:00
Bowgo Tsai 7a4fb7a435 first-stage mount: support using other avb_keys
This change allows specifying additional avb keys to verify a fstab
entry. It can be used together with the original 'avb' flag. When both
'avb' and 'avb_keys' are present, it will try to use avb_keys to verify
this partition and extract the AVB descriptor from the end of it first.
When avb_key fails, it falls back to searching the AVB descriptor in the
built-in /vbmeta (and its chained partitions) with the matched partition
name.

An example of a fstab file:

system  /system  ext4  ro,barrier=1  wait,slotselect,avb=vbmeta,logical,first_stage_mount,avb_keys=/avb/gsi.avbpubkey
vendor  /vendor  ext4  ro,barrier=1  wait,slotselect,avb,logical,first_stage_mount

The overhead of adding an additional 'avb_keys' should not be significant,
as the typical size of a AVB Hashtree descriptor for /system is usually
less than 1000 bytes. e.g., on crosshatch, it's about 600 bytes, which
takes less than 1 millisecond for the following call to return failure.

   auto avb_standalone_handle = AvbHandle::LoadAndVerifyVbmeta(*fstab_entry);

We also checked the time spent on init's first stage on crosshatch, with the
following CL to set ro.boottime.init.first_stage. The testing result
shows no significant difference between them as well.

https://android-review.googlesource.com/c/platform/system/core/+/934536

With an additional avb_keys entry for /system
    [ro.boottime.init.first_stage]: [728]
    [ro.boottime.init.first_stage]: [720]
    [ro.boottime.init.first_stage]: [722]

Without an additional avb_keys entry for /system
    [ro.boottime.init.first_stage]: [730]
    [ro.boottime.init.first_stage]: [728]
    [ro.boottime.init.first_stage]: [725]

Bug: 124491153
Test: boot a device with above fstab settings

Change-Id: I0c81f816efb0dd40c93da2df304f2e215df9d105
Merged-In: I0c81f816efb0dd40c93da2df304f2e215df9d105
(cherry picked from commit a0f8b05d91)
2019-04-11 01:44:13 +00:00
TreeHugger Robot 192cf72105 Merge changes I6cd11c94,I35a35d20 into qt-dev
* changes:
  Binding err to inout for raw protocol for in-process execute.
  adb: defuse CHECK on IOVector::append of an empty block.
2019-04-10 23:07:44 +00:00
David Anderson 25e56c1a56 Merge "Add fiemap_writer_test to VTS." into qt-dev 2019-04-10 19:30:31 +00:00
TreeHugger Robot 06766e197d Merge "libmeminfo/procrank: Ignore failures when process disappears." into qt-dev 2019-04-10 18:28:55 +00:00
Alex Buynytskyy 7e1d397d1a Binding err to inout for raw protocol for in-process execute.
As raw protocol does not allow for splitting err - it has to be redirected to inout.
Before this change it was not done for in-process and all err data was lost.

Bug: 130086616
Test: manual + atest adbd_test
Change-Id: I6cd11c940673d73e2993a6eb23c46d31bd8bf504
(cherry picked from commit 704c97d6c2)
2019-04-10 11:13:39 -07:00
Josh Gao a7f6cd0470 adb: defuse CHECK on IOVector::append of an empty block.
Bug: http://b/129706741
Test: treehugger
Change-Id: I35a35d20d179a155adb4fe83078739fcaf517136
(cherry picked from commit 3443b77415)
2019-04-10 11:13:35 -07:00
Sandeep Patil c4c05e3b25 libmeminfo/procrank: Ignore failures when process disappears.
procrank currently fails if a process gets killed while it is reading
the stats. This behavior is a regression from the previous version of
procrank and is often undesired.

Change procrank to silently ignore the process if it detects that it had
been killed while reading the stats. If the process is still around,
then print a warning about it and continue to read stats for other
processes in the system.

Fixes: 130177765
Test: Tested by deliberately killing specific process in ProcessRecord()
      constructor

Change-Id: I701808c3226bb9b3a350ccf8e67fb29b59b0d4e0
Merged-In: I701808c3226bb9b3a350ccf8e67fb29b59b0d4e0
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-04-10 08:01:06 -07:00
Nick Kralevich ac3ca99b77 introduce auditctl and use it to configure SELinux throttling
In an effort to ensure that our development community does not
introduce new code without corresponding SELinux changes, Android
closely monitors the number of SELinux denials which occur during
boot. This monitoring occurs both in treehugger, as well as various
dashboards. If SELinux denials are dropped during early boot, this
could result in non-determinism for the various SELinux treehugger
tests.

Introduce /system/bin/auditctl. This tool, model after
https://linux.die.net/man/8/auditctl , allows for configuring the
throttling rate for the kernel auditing system.

Remove any throttling from early boot. This will hopefully reduce
treehugger flakiness by making denial generation more predictible
during early boot.

Reapply the throttling at boot complete, to avoid denial of service
attacks against the auditing subsystem.

Delete pre-existing unittests for logd / SELinux integration. It's
intended that all throttling decisions be made in the kernel, and
shouldn't be a concern of logd.

Bug: 118815957
Test: Perform an operation which generates lots of SELinux denials,
      and count how many occur before and after the time period.

(cherry picked from commit be5e446791)

Change-Id: I283cd56151d199cd66f0d217b49115460c4a01e5
2019-04-09 20:54:47 -07:00
TreeHugger Robot 83e52ce905 Merge "charger: Allow to rw /sys/power/[state,wakeup_count]" into qt-dev 2019-04-10 01:33:58 +00:00
David Anderson 50f524515c Add fiemap_writer_test to VTS.
Note: fiemap_writer_test's default argument now defaults to
/data/local/unencrypted or /data (whichever exists), since there is no
way to pass arguments via AndroidTest.xml.

Bug: 129000341
Test: vts-tradefed run commandAndExit vts-kernel --primary-abi-only --module VtsFiemapWriterTest
Change-Id: I8cc2e39e170b26b53cf0a829b308171890ae82fd
2019-04-09 17:04:04 -07:00
Christopher Ferris 98877cbabe Remove include of backtrace/Backtrace.h.
Somehow the code was still including this include from libbacktrace.
I think the libbacktrace include directory was coming from some
transitive includes. I verified that nothing in debuggerd is using
the libbacktace.so shared library.

Bug: 120606663

Test: Builds, unit tests pass.
Change-Id: I85c2837c5a539ccefc5a7140949988058d21697a
Merged-In: I85c2837c5a539ccefc5a7140949988058d21697a
(cherry picked from commit 3336c7bce0)
2019-04-09 13:22:51 -07:00
Yifan Hong c9a9d279ef charger: Allow to rw /sys/power/[state,wakeup_count]
charger needs to suspend the device when the power goes away
when it doesn't have root. These two files are marked with
group system, user system, mode 0600 in 'on boot', but
it is not executed in charger. Hence, move these actions
to 'on init'.

Test: no failure in libsuspend in charger

Bug: 129138950

Change-Id: I787b935b4ff6177601329aeedccdac361b119ca3
2019-04-09 13:13:33 -07:00
TreeHugger Robot b017a1cd9b Merge "Test is-logical command for vendor and boot partitions." into qt-dev 2019-04-09 05:11:19 +00:00
Hridya Valsaraju 1e30c33a1a Test is-logical command for vendor and boot partitions.
Vendor must be a logical partition and boot must not be a logical
partition.

Test: fuzzy_fastboot --gtest_filter=*Logical*
Bug: 117220134
Change-Id: Ifc6f2f715ca92cd1fe779e8fce2d6a10a1f140b9
Merged-In: Ifc6f2f715ca92cd1fe779e8fce2d6a10a1f140b9
(cherry picked from commit 61a5bc6cf4)
2019-04-08 15:31:25 -07:00
Bowgo Tsai 13d92df720 Update GSI keys for dynamic system image
Bug: 112293933
Test: tree hugger
Change-Id: Ia5fd08410fd680b8fd3676cfc4daae1caf1ff425
Merged-In: Ia5fd08410fd680b8fd3676cfc4daae1caf1ff425
(cherry picked from commit b9b9a68f49)
2019-04-08 23:59:26 +08:00
TreeHugger Robot 723c4df590 Merge "cutils: add ashmem_init" into qt-dev 2019-04-05 17:06:51 +00:00
TreeHugger Robot c202a4f883 Merge "Allow to build non-sparse super image." into qt-dev 2019-04-05 10:17:16 +00:00
TreeHugger Robot bd0f767dfe Merge "CgroupSetupCgroups: don't leak fd." into qt-dev 2019-04-05 04:45:42 +00:00
TreeHugger Robot 0294313ad9 Merge "Open image files in binary mode" into qt-dev 2019-04-05 02:42:47 +00:00
Tim Murray 943f1c1d4a cutils: add ashmem_init
Add a new ashmem_init function that only dlopens libashmemd_client.
This allows the library to be preloaded in the zygote.

Test: boots, works
Bug: 129543489

Change-Id: Ie106791edf381654f085203c266c9f9c0df35cfc
2019-04-05 00:28:05 +00:00
Yifan Hong b4b2bfc115 Allow to build non-sparse super image.
- Rename SparseBuilder to ImageBuilder, WriteSplitSparseFiles
  to WriteSplitImageFiles, WriteToSparseFile to WriteToImageFile, etc.
- Add sparsify argument to ImageBuilder, WriteToImageFile, and
  WriteSplitImageFiles

This allows lpmake to write non-sparse super image directly. Virtual
devices needs non-sparse images to work on.

Test: lpmake without --sparse
Test: liblp_test
Bug: 120041578

Change-Id: I76ee09efd02df7caaa8abd37a55ae0bebf9cfa29
Merged-In: I76ee09efd02df7caaa8abd37a55ae0bebf9cfa29
2019-04-04 16:34:05 -07:00
Christopher Ferris 4a6483923c Merge "Fix off by one reading build id." into qt-dev 2019-04-04 21:47:42 +00:00
Yifan Hong 0558e58214 CgroupSetupCgroups: don't leak fd.
- If file is unlinked, the mmapped region is still there.
- If file is truncated, a SIGBUS will be seen, and holding
  the fd doesn't help.

Test: boots (sanity)
Bug: 123664216
Change-Id: I6683804bc795fab6798891a4471e5fe58fbffe13
Merged-In: I6683804bc795fab6798891a4471e5fe58fbffe13
2019-04-04 13:14:10 -07:00
Yifan Hong d588728951 libcgrouprc: version script: linux only
mac builds doesn't support version script.
This fixes the build.

Test: pass

Fixes: 129905103

Change-Id: Ia3d06e4eff05b41982b3dfbb946efa41358b2c76
2019-04-04 18:48:16 +00:00
Hridya Valsaraju 4113cf749e Open image files in binary mode
This is required for read() to function correctly
in Windows since it behaves differently in text mode and
binary mode and may cause unpredictable behavior depending
on the contents of the image file.

Bug: 129281908
Test: fastboot.exe flashall
Change-Id: I64370af44a050bafea60ff1b0b2be18cc531480a
Merged-In: I64370af44a050bafea60ff1b0b2be18cc531480a
(cherry picked from commit 1a6f6feff4)
2019-04-04 09:48:29 -07:00
Christopher Ferris a46de76024 Fix off by one reading build id.
Update unit tests and add new build id displaying in offline unwinds.

Bug: 129873279

Test: All unit tests pass.
Test: Verify that debuggerd displays build id properly.
Change-Id: I97f4a204842447a20c812f535a458155b937d5e1
Merged-In: I97f4a204842447a20c812f535a458155b937d5e1
(cherry picked from commit 1760b45709)
2019-04-04 09:26:28 -07:00
Jaegeuk Kim 20b0bd9ca4 Merge "libfiemap_writer: test pinned file bit" am: 73bb342956 am: e0df95d8a8
am: fa5dced8ea

Change-Id: I1008eb301eb4b6f813e3a14e739492695c7dd896
2019-04-03 15:21:06 -07:00
Jaegeuk Kim fa5dced8ea Merge "libfiemap_writer: test pinned file bit" am: 73bb342956
am: e0df95d8a8

Change-Id: I02a0da79d123a8ef7ea13af7ffcef3e3b487dc57
2019-04-03 15:13:03 -07:00
Jaegeuk Kim e0df95d8a8 Merge "libfiemap_writer: test pinned file bit"
am: 73bb342956

Change-Id: I2a4b5794e2be4c28f2362ed95e8cd75994d02cbd
2019-04-03 15:04:24 -07:00
Treehugger Robot 73bb342956 Merge "libfiemap_writer: test pinned file bit" 2019-04-03 21:31:18 +00:00
Yifan Hong 662eeac40c [automerger skipped] Merge changes from topic "libprocessgroup_rc" am: 25d42eeaa6 am: 8f3d266984
am: 10f7835736 -s ours
am skip reason: change_id I47c46ca9ba5c1fbf3f9f7a1b185dc48b058b1e32 with SHA1 eecba5c11d is in history

Change-Id: I55e5a8c5e71ff037bb391909a167d3b3db69d37a
2019-04-03 14:01:08 -07:00
Yifan Hong 2b040de4d7 [automerger skipped] Add libcgrouprc to ld.config.*.txt. am: 063b6beef0 am: 4e52c76d92
am: 794f523b80 -s ours
am skip reason: change_id I23c3ece44816e4e213f9630b915e19978a259823 with SHA1 169a3e6095 is in history

Change-Id: I27ec2c2dce10b2bbf6929f6b4b4c2ef8fe823e0c
2019-04-03 14:00:12 -07:00
Yifan Hong 0f50989a61 [automerger skipped] libprocessgroup: use libcgrouprc to read cgroup.rc am: 53e0deb7b2 am: c2cb4aa768
am: 30559a8a00 -s ours
am skip reason: change_id I635d9885db62e82f37421f6d20f59c84a6f4cbb2 with SHA1 fad638c82d is in history

Change-Id: I531a2cc66c5374ad0a8ffdd0bb4e6b2294bfbf51
2019-04-03 13:59:24 -07:00
Yifan Hong 8fa5f95050 [automerger skipped] libprocessgroup_setup: use libcgrouprc_format am: d8ce1fb1d1 am: edca509a38
am: 818d7e3678 -s ours
am skip reason: change_id If5e2301a1b65c3f6a51a1661cfeeed4e299f634e with SHA1 1a0996a308 is in history

Change-Id: If71b56793a251a5c318787d680df32be6c9e294e
2019-04-03 13:58:25 -07:00
Yifan Hong ba414d95c5 [automerger skipped] libprocessgroup: Move CgroupSetupCgroups() to libprocessgroup_setup am: 6f9ce2e548 am: c1c18f9a04
am: e7f9de2cc7 -s ours
am skip reason: change_id I941dc0c415e2b22ae663d43e30dc7a464687325e with SHA1 bd623a4ce0 is in history

Change-Id: Ifec90c82d6e1c58be8c6e1328cb858e6d3a8edcb
2019-04-03 13:57:38 -07:00
Yifan Hong 8298fc6177 [automerger skipped] libprocessgroup: Add libcgrouprc am: 098323ba5b am: 15c6496640
am: 6dc78dc56f -s ours
am skip reason: change_id I9c13c0528461758154e23cbab3a94ade7fb351ee with SHA1 d895647095 is in history

Change-Id: I9233b271e03ec67ff7bfa3ef728d227cc6aef01d
2019-04-03 13:56:51 -07:00
Yifan Hong 7a8be29c1c [automerger skipped] libprocessgroup: Add libcgrouprc_format am: c4b3ab4edc am: 7e7c203528
am: e470498138 -s ours
am skip reason: change_id Iaf6199f759a6264590b13ca7ba6d7f576c3ed56a with SHA1 f4212744ed is in history

Change-Id: Ibcd0a74102a606e7dccc7f65f58cb56968d01fbb
2019-04-03 13:56:06 -07:00
Yifan Hong 10f7835736 Merge changes from topic "libprocessgroup_rc" am: 25d42eeaa6
am: 8f3d266984

Change-Id: Iec5b74b1e6a72f5afd1386f902aae7e942d104cd
2019-04-03 12:54:53 -07:00
Yifan Hong 794f523b80 Add libcgrouprc to ld.config.*.txt. am: 063b6beef0
am: 4e52c76d92

Change-Id: I4c05c28b213a3781cd94b34de64d95c7aaa22320
2019-04-03 12:54:05 -07:00
Yifan Hong 30559a8a00 libprocessgroup: use libcgrouprc to read cgroup.rc am: 53e0deb7b2
am: c2cb4aa768

Change-Id: Icb28519d3ed68751de8bad36611ab090b276a4bb
2019-04-03 12:53:13 -07:00
Yifan Hong 818d7e3678 libprocessgroup_setup: use libcgrouprc_format am: d8ce1fb1d1
am: edca509a38

Change-Id: I584367960506fcc724bb8a20b78cc5091084e131
2019-04-03 12:52:36 -07:00
Yifan Hong e7f9de2cc7 libprocessgroup: Move CgroupSetupCgroups() to libprocessgroup_setup am: 6f9ce2e548
am: c1c18f9a04

Change-Id: I4d716a985ea666324d3daaaa0d00a5a90cd3c3ea
2019-04-03 12:51:59 -07:00
Yifan Hong 6dc78dc56f libprocessgroup: Add libcgrouprc am: 098323ba5b
am: 15c6496640

Change-Id: I2e6969425516c307275f94d21d8161999eebecd4
2019-04-03 12:51:23 -07:00