Commit graph

43691 commits

Author SHA1 Message Date
David Anderson
e0e693c32f fastboot: do not die if ANDROID_PRODUCT_OUT undefined
When checking for existence of "super_empty.img" to determine if
flash image product set is meant for logical partitions, we die if
ANDROID_PRODUCT_OUT environment is unset or empty.  This check
is done before we look at the flash image name to determine if it
is a candidate to look at the logical metadata.

Instead, allow this check to conservatively fail for now.

Test: export ANDROID_PRODUCT_OUT=
      fastboot flash bootloader
Bug: 120041144
Change-Id: I43f124015f9d26c79a0feb9123522432fe937343
Merged-In: I43f124015f9d26c79a0feb9123522432fe937343
2018-11-28 18:54:28 +00:00
Idries Hamadi
484f88bcef Add OWNERS file to fastdeploy so idries@ can approve changes
Test: None
Change-Id: If04c5cadd04b0b866b3e5b73e9e2d5d70db20881
2018-11-28 16:55:00 +00:00
changho.shin
715b1aab50 Support product partition for non-treblized devices
Non-treblized devices use ld.config.legacy.txt, which does not
support product partition, leading to access denial from/to product partition.
Declare directly /product since search paths are resolved in linker config.

Test: m -j with non-treblized device upgraded to P.
Change-Id: Ic142b807f5dbffdfa5c774b3df8d0903b9626b6a
2018-11-28 17:17:05 +09:00
Jinguang Dong
8ac2f27cc2 tombstoned: fixed tombstones failed issue
There is a problem about tombstone, which it will fail to
generate tombstone file in some scenarios due to socket
communication exception.

Reproduce step:
step 1: reboot device
step 2: ps -ef |grep zygote , get the pid of zygote64
(Attention: zygote64 should never been killed or reboot,
otherwise we can get the tombstone file)
step 3: kill -5 pid of zygote64
step 4: cd data/tombstones/, and could not find the tombstone
file of zygote64.

[Cause Analysis]
1. There are following logs by logcat:
11-19 15:38:43.789   569   569 F libc : Fatal signal 5 (SIGTRAP),
code 0 (SI_USER) in tid 569 (main), pid 569 (main)
11-19 15:38:43.829  6115  6115 I crash_dump64: obtaining output
fd from tombstoned, type: kDebuggerdTombstone
11-19 15:38:43.830   569  5836 I Zygote  : Process 6114 exited
cleanly (0)
11-19 15:38:43.830   777   777 I /system/bin/tombstoned: received
crash request for pid 569
11-19 15:38:43.831  6115  6115 I crash_dump64: performing dump of
process 569 (target tid = 569)
...
11-19 15:38:43.937   777   777 W /system/bin/tombstoned: crash
socket received short read of length 0 (expected 12)
2. The last log was print by function of crash_request_cb in
file of tombstoned.cpp, following related code:
  rc = TEMP_FAILURE_RETRY(read(sockfd, &request, sizeof(request)));
  if (rc == -1) {
    PLOG(WARNING) << "failed to read from crash socket";
    goto fail;
  } else if (rc != sizeof(request)) {
    LOG(WARNING) << "crash socket received short read of length " << rc << " (expected "
                 << sizeof(request) << ")";
    goto fail;
  }

Tombstoned read message by socket, and now the message length is
zero. Some socket communication exception occurs at that time.
We try to let crash_dump resend the socket message when the
communication is abnormal. Just as this CL.

Test: 1 reboot device
      2 ps -ef |grep zygote , get the pid of zygote64
       (Attention: zygote64 should never been killed or reboot,
       otherwise we can get the tombstone file)
      3 kill -5 pid of zygote64
      4 cd data/tombstones/, and could find the tombstone file of
       zygote64.

Change-Id: Ic152b081024d6c12f757927079fd221b63445b18
2018-11-28 14:00:27 +08:00
Treehugger Robot
9392718950 Merge "Reduce logging around segfaults" 2018-11-28 04:00:12 +00:00
Treehugger Robot
4380215033 Merge "Fix null pointer dereference in auditParse" 2018-11-28 01:01:43 +00:00
Colin Cross
d780dcbaa5 Reduce logging around segfaults
The excessive logging of pages with segfaults is making it hard to
see what caused the problem, only log the first page that segfaults,
the range that was being walked when the first segfault happened,
and the total number of pages that segfaulted.

Bug: 120032857
Test: memunreachable_test --gtest_filter=HeapWalkerTest.segv
Change-Id: I71821a3f5be65f2fbcb36afc4b7b1ffa4a48e660
2018-11-27 17:00:56 -08:00
Jaegeuk Kim
9c4ae20f0e Merge "make_f2fs: use -g android by default" 2018-11-28 00:57:25 +00:00
Elliott Hughes
f2228e0cc5 Merge "TEST_MAPPING: add the rest of our actively maintained tests." 2018-11-28 00:56:36 +00:00
Treehugger Robot
9f96cc20a2 Merge "Permissions for /dev/uinput" 2018-11-27 23:52:29 +00:00
Treehugger Robot
69f174a488 Merge "Allow product partition to have vendor_overlay" 2018-11-27 23:34:25 +00:00
Justin Yun
dc5a32797e Allow product partition to have vendor_overlay
Most vendor_overlay files are product specific that are not allowed
to be installed on system partition.
To install those files on product partition, product/vendor_overlay
is added to the vendor_overlay source directory list.
If the same files are provided from both partitions, files on product
partition will be used.

Bug: 119850553
Test: Build and boot to check if the vendor_overlay works
Change-Id: I1ae97cb5c9dd66d1da5c9eaa3133426d2ba77471
2018-11-27 23:34:00 +00:00
Dan Austin
b43eb943ae Fix null pointer dereference in auditParse
There is an issue in LogAudit::auditParse where
android::uidToName(uid) crashes with a null pointer dereference.
Include a null check on the value before passing it on.

Bug: 120043607
Test: End-to-end test with syzkaller as per instructions in bug.
Change-Id: Ic0ac5c3003fcd289ec156ce63fbd668413763429
2018-11-27 14:01:29 -08:00
Mark Salyzyn
a30b6964d6 fastboot: propagate error for format command
If fastboot format command fails, return error.

Test: adb-remount-test.sh
Bug: 109821005
Change-Id: Ic4e1a1dea8861028f19ac7f9c834d26e8adba56c
2018-11-27 13:51:42 -08:00
Mark Salyzyn
cb2f6b6776 fs_mgr: overlayfs: resize scratch should it be too small
If scratch gets made too small (eg: fastboot flash scratch small-file)
it can not recover without a workaround.  The workaround is not
intuitive, (adb enable-verity then adb disable-verity to erase and
re-establish the proper sized scratch.  This needs to be automatic.
If we detect it is too small to support a filesystem, resize it to an
more appropriate size if it exists.

Alter unit test to check for fastboot characteristics and assumptions
associated with the scratch partition, and a test case to flash the
partition.

Test: adb-remount-test.sh
Bug: 109821005
Change-Id: Icfceaa461c2bf13ca5a7dd4e34675dde8a4d251f
2018-11-27 13:46:55 -08:00
Treehugger Robot
fa105049d8 Merge "adb: stop using adbkey.pub." 2018-11-27 21:35:44 +00:00
Ivan Lozano
017e12af06 Merge "Tombstone support for XOM-related SIGSEGVs." 2018-11-27 20:33:30 +00:00
Ivan Lozano
d98acb0d4a Merge "Disable XOM in init." 2018-11-27 20:30:46 +00:00
Siarhei Vishniakou
e615b2aa76 Permissions for /dev/uinput
Currently /dev/uinput is owned by system/bluetooth.
But that's inconsistent with some of the sepolicies for uhid_device.
This also means that the new native tests for inputflinger aren't able
to execute properly, because they require the ability to register a new
input device via uinput.

Bug: none
Test: atest inputflinger_test
The newly added EventHub_test is still under review

Change-Id: I53524738db1a5d3ba962b9bec35ef322ed3028f2
2018-11-27 11:21:21 -08:00
Ivan Lozano
055347e564 Disable XOM in init.
init doesn't cooperate with execute-only memory just yet, so disable it
until we can determine the root cause.

Bug: 77958880
Test: Device boots.
Change-Id: Ieb78315ba1e48c9cd0d047a42951bd3fbd36641b
2018-11-27 09:12:16 -08:00
Ivan Lozano
df3cec925f Tombstone support for XOM-related SIGSEGVs.
Make XOM related crashes a little less mysterious by adding an abort
cause explaining the crash.

Bug: 77958880
Test: Abort cause in tombstone for a XOM-related crash.

Change-Id: I7af1bc251d9823bc755ad98d8b3b87c12bbaecba
2018-11-27 09:00:54 -08:00
Treehugger Robot
ee9d6382d1 Merge "Switch from dist-for-goals to dist in Android.bp" 2018-11-27 00:59:19 +00:00
Jaegeuk Kim
46542f9ecc make_f2fs: use -g android by default
Bug: 119875846
Change-Id: I0c6d642d474df5cc678ced9ec4c04027ee51c6d1
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2018-11-22 03:42:07 -08:00
Roland Levillain
2f56b1fff8 Add Android Runtime APEX lib directories to the system linker configuration.
Test: Device boot test with Android Runtime APEX.
Test: Device boot test without Android Runtime APEX.
Bug: 113373927
Change-Id: Iff32fcd79a667b07df839f4e6ef2cdb3cf70e9d3
2018-11-21 19:41:59 +00:00
David Anderson
66a6d8877c Merge "fastbootd: Support two super partitions for retrofit devices." 2018-11-21 17:40:43 +00:00
David Anderson
8771a95e4c Merge "fastboot: Warn when flashing dynamic partitions in the bootloader." 2018-11-21 17:40:01 +00:00
David Anderson
6900fce913 Merge "liblp: Modify NewForUpdate to accomodate two super partitions." 2018-11-21 17:36:48 +00:00
David Anderson
c15618a2c6 liblp: Modify NewForUpdate to accomodate two super partitions.
This method was designed for a single-super model, and now needs to
change to accomodate two super partitions (system_a and system_b, for
retrofitting).

NewForUpdate is supposed to transition metadata from one block device
to the next for updates. For normal devices this is a no-op, since
metadata only exists on one partition (super). For retrofit devices,
metadata exists on system_a and system_b. This has two implications.

First, any references to the source slot must be rewritten. For example
"vendor_b" must become "vendor_a". However this is not true of partition
names. Partitions/extents are cleared in the updated metadata since they
no longer have any meaning (the block device list has been
rewritten). We also clear groups since they are re-added during OTA.

The reason we have to do this rewriting is that slot suffixes are
automatically applied in ReadMetadata. We do not have access to the
original unsuffixed metadata that was written by the initial OTA.
This was a conscious design decision, since it localizes retrofitting
idiosyncracies to just a few places (ReadMetadata, NewForUpdate, and
fastbootd), minimizing the number of external callers that have to
understand auto-slot-suffixing.

It would be arguably cleaner if retrofit metadata was always serialized
*without* slot suffixes, thereby making NewForUpdate a no-op. However
this would necessitate changes to the API elsewhere. The functions that
read partition names would have to take a slot suffix, and this would
further complicate MetadataBuilder and fastbootd. Another solution would
be to augment LpMetadata to retain unsuffixed information, but this is
probably not worthwhile given that retrofitting is intended to be
surgical, and will have a shorter lifespan than the non-retrofit case.

Bug: 116802789
Test: liblp_test gtest
Change-Id: I33596d92b38c47bc70bc0aa37ed04f6f0b9d4b6f
2018-11-21 17:36:28 +00:00
David Anderson
d25f1c3775 fastbootd: Support two super partitions for retrofit devices.
Retrofit devices will have two super partitions, spanning the A and B
slots separately. By design an OTA will never cause "A" or "B"
partitions to be assigned to the wrong super. However, the same is not
true of fastbootd, where it is possible to flash the inactive slot. We
do not want, for example, logical "system_a" flashing to super_b.

When interacting with partitions, fastbootd now extracts the slot suffix
from a GetSuperSlotSuffix() helper. On retrofit devices, if the partition
name has a slot, that slot will override FastbootDevice::GetCurrentSlot.
This forces partitions in the inactive slot to be assigned to the correct
super.

There are two consequences of this. First, partitions with no slot
suffix will default to the current slot. That means it is possible to
wind up with two "scratch" partitions, if "adb remount" is used on both
the "A" and "B" slots. However, only the active slot's "scratch" will be
visible to the user (either through adb or fastboot).

Second, if one slot does not have dynamic partitions, flashing will
default to fixed partitions. For example, if the A slot is logical and B
is not, flashing "system_a" will be logical and "system_b" will be
fixed. This works no matter which slot is active. We do not try to
upgrade the inactive slot to dynamic partitions.

Bug: 116802789
Test: fastboot set_active a
      fastboot flashall # dynamic partitions
      fastboot getvar is-logical:system_a # true
      fastboot getvar is-logical:system_b # false
      fastboot set_active b
      fastboot flashall --skip-secondary
      fastboot getvar is-logical:system_a # true
      fastboot getvar is-logical:system_b # true
      Booting both slots works.

Change-Id: Ib3c91944aaee1a96b2f5ad69c90e215bd6c5a2e8
2018-11-20 13:47:01 -08:00
Treehugger Robot
9c637f3823 Merge "storaged: emplace recent_perf in load_perf_history_proto" 2018-11-20 20:36:19 +00:00
David Anderson
8956964ee2 fastboot: Warn when flashing dynamic partitions in the bootloader.
On retrofit devices, it is easy to accidentally overwrite
system/vendor/product by flashing system in the bootloader. The reason
is that GPT system_a is really the super partition, and the bootloader
doesn't know it.

Addressing this in bootloaders would require two separate commands: one
that rejects flashing system/vendor/product, and another for
expert/factory use that would allow direct flashing.

This patch introduces protection into the host fastboot tool instead.
It's not mutually exclusive with bootloader changes; having protection
in the host tool affords us better and consistent UI. However it does
rely on users having newer builds.

With this change, the following will not work in the bootloader:

    fastboot flash system       # or vendor, product, etc

The message is the same whether or not the device is a retrofit. To
continue anyway, you can do:

    fastboot flash --force system

If we decide on bootloader protection as well, the --force flag can be
re-used.

Bug: 119689480
Test: fastboot flash system # disallowed in bootloader, allowed in fastbootd
      fastboot flash --force system # allowed in bootloader
Change-Id: I0861e3f28a15be925886d5c30c7ebd4b20c477cf
2018-11-20 12:10:16 -08:00
David Anderson
27be9f1ffd Merge "liblp: Enable building on Windows." 2018-11-20 19:30:32 +00:00
Mark Salyzyn
0ade88c83d storaged: emplace recent_perf in load_perf_history_proto
If recent_perf contains existing content, overwrite in method
load_perf_history_proto.  If proto of recent_perf contains a lot of
history, the content would have grown with system_server crashes.

Test: setprop ro.storaged.flush_proto.interval 60
      while true;do sleep 5;stop;sleep 1;start;ps -A|grep storaged;done
      and look at value for rss should remain about 4MB over long term.
Bug: 119798824
Change-Id: I50aae7d61eb791a8fcddbbd829254baf8f708186
2018-11-20 09:00:05 -08:00
Treehugger Robot
630d803dee Merge "llkd: do not crash kernel if llkd stops running" 2018-11-20 16:10:51 +00:00
Dan Willemsen
3f439a7a88 Switch from dist-for-goals to dist in Android.bp
Removes a few more Android.mk files.

Test: check for adb, mkbootfs, and fastboot in the build artifacts
Change-Id: Ie4e50a363a734d0b9207f0d0098c54719f038e76
2018-11-19 23:06:12 -08:00
David Anderson
a3c47e63a6 liblp: Enable building on Windows.
Bug: 119689480
Test: builds when fastboot.exe uses liblp
Change-Id: I8ba2ad51d806c4650a0f35d41e4906b703d4661d
2018-11-19 16:20:51 -08:00
Mark Salyzyn
b3418a2255 llkd: do not crash kernel if llkd stops running
Today, assume llkd is not hardened enough to 100% guarantee that
lack of progress in inspection loops is a direct result of a
livelock condition affecting llkd itself.  Log a fatal alarm to
make init restart llkd instead for the time being.

ToDo: develop trust in llkd regarding sigalarm causes.

Test: compile
Bug: 119781757
Change-Id: I668dc1773898da6c95aad7221724b16f1684b067
2018-11-19 15:26:20 -08:00
David Anderson
eb1213f170 Merge "liblp: Auto-suffix group names." 2018-11-19 22:37:33 +00:00
Treehugger Robot
cfd0b6c19d Merge "Writes cpu variant information to dev/" 2018-11-19 21:37:32 +00:00
David Anderson
7256eaa1b4 liblp: Auto-suffix group names.
This is needed for update_engine to properly clean old partitions on
retrofit devices.

Bug: 119687874
Test: liblp_test gtest
Change-Id: Ida9483ad3c127e357f45789540ebbedc9d3d3883
2018-11-19 11:20:09 -08:00
Haibo Huang
d60a19b184 Writes cpu variant information to dev/
This change adds a command to init.rc to write cpu variant information to a file under dev/

Test: sync to device and make sure corresponding files are created.
Change-Id: Ibf90967f13f72af925c82ff79bd973ef4cdc4068
2018-11-19 18:57:50 +00:00
Treehugger Robot
8995970ce3 Merge "fs_mgr: remove by_name_symlinks_map_ from AvpOps" 2018-11-19 05:56:36 +00:00
Treehugger Robot
87a0865648 Merge "Convert libpixelflinger to Android.bp" 2018-11-17 06:06:34 +00:00
Dan Willemsen
596e2217e2 Convert libpixelflinger to Android.bp
See build/soong/README.md for more information.

Test: cd system/core/libpixelflinger; mma
Change-Id: I2354e5bc6b0b8a10d598e3677bc63962f70bf7bc
2018-11-16 19:15:38 -08:00
Treehugger Robot
e04aa9e03a Merge "Don't fail when no glob match" 2018-11-17 00:54:39 +00:00
Treehugger Robot
10654730a4 Merge "logical -> dynamic partitions." 2018-11-16 23:47:45 +00:00
Yifan Hong
6af857f21d Merge "liblp: MetadataBuilder::HasBlockDevice" 2018-11-16 23:14:38 +00:00
Yifan Hong
0e0f818c8a logical -> dynamic partitions.
Reflect a name change.
Test: boots
Bug: 119286600

Change-Id: I076071be18be521eeee4ebae10491b9f3e8ef857
2018-11-16 12:53:18 -08:00
Josh Gao
3a2bd498f8 Merge "Fix double closes in ziparchive tests." 2018-11-16 19:58:27 +00:00
Josh Gao
5db84229e1 Fix double closes in ziparchive tests.
Bug: http://b/119632446
Test: setprop debug.fdsan fatal && /data/native64/ziparchive-tests/ziparchive-tests
Change-Id: I3a9e6f3823ba49c56602041779cb085a6971ca6d
2018-11-16 19:54:41 +00:00