Commit graph

38373 commits

Author SHA1 Message Date
Elliott Hughes
5620d224b6 Add "require partition-exists=" support.
The Pixel 2 system images release was a bit of a disaster because anyone
using an old version of fastboot would blindly flash too few partitions,
potentially bricking their device. This change lets us add a line to
the android-info.txt file for a device with a new partition.

Also error out sooner in such cases by checking the requirements
immediately, rather than optimistically unpacking everything first.

Switch Action over to C++ to fix memory issues.

Bug: http://b/77158188 (partition checking)
Bug: http://b/74444116 (error out sooner)
Test: manual testing with a modified android-info.txt
Change-Id: I58b426cad410107e368f35f5725216d07281dd97
2018-03-28 12:43:53 -07:00
Treehugger Robot
cdc553d042 Merge "Adding odm.img for fastboot flashall" 2018-03-28 19:42:30 +00:00
Treehugger Robot
5e7de48f03 Merge "Allow vendor-init-actionable for ro.debuggable" 2018-03-28 19:15:16 +00:00
Bowgo Tsai
017217ec57 Adding odm.img for fastboot flashall
Bug: 64195575
Test: fastboot flashall
Change-Id: Ie6c20a1004867e7c9cfa1894abab9252316a9154
2018-03-29 01:31:51 +08:00
Jaekyun Seok
4f214c5179 Allow vendor-init-actionable for ro.debuggable
Some partners are using ro.debuggable as action trigger to config a
product differently according to its value.

Bug: 75987246
Test: succeeded building and tested taimen
Change-Id: I4cc57e7b52e17fc89e585afa0a8a10925e47fac8
2018-03-28 12:21:03 +09:00
Treehugger Robot
c41ff1b366 Merge "Adding product.img for fastboot flashall" 2018-03-27 01:37:42 +00:00
Tom Cherry
324e27d284 Merge "Verify the SELabels used in property_contexts" 2018-03-26 23:28:30 +00:00
Treehugger Robot
3b279aa5c7 Merge "Allow android::base::ScopeGuard in STL containers" 2018-03-26 23:05:25 +00:00
Luis Hector Chavez
b77035b89a Allow android::base::ScopeGuard in STL containers
This change lets android::base::ScopeGuard be useful in STL containers
(e.g. std::vector<android::base::ScopeGuard<std::function<void()>>>). It
also provides perfect forwarding for android::base::make_scope_guard.

Bug: 34764308
Test: libbase_test

Change-Id: I7d1e5494b0f0695763cff0700efdb9ec18ae85c8
2018-03-26 13:30:09 -07:00
Martijn Coenen
80dce0127c Merge "Add new trace tag for AIDL." 2018-03-26 19:00:57 +00:00
Treehugger Robot
f78ff013d0 Merge "adb: Open FunctionFS files with more restrictive access modes" 2018-03-26 18:48:25 +00:00
Tom Cherry
882faa6448 Verify the SELabels used in property_contexts
Verify that the SELabels used in property_contexts correspond to a
real type in the SEPolicy and that this type has the property_type attribute.

Bug: 74078792
Test: Build property_contexts on bullhead successfully
Test: See failure when using a faulty SELabel in property_contexts
Change-Id: If1618c2c3dae4c0cd3efa5f88056478a6db6bd0b
2018-03-26 09:22:55 -07:00
Martijn Coenen
24426e96a5 Add new trace tag for AIDL.
So we can auto-generate tracing code for AIDL interfaces.

Bug: 74416314
Test: inspect atrace output
Change-Id: I91b14b3b16d8d7a29f531101b14ddf10dbc61a5a
Merged-In: I91b14b3b16d8d7a29f531101b14ddf10dbc61a5a
2018-03-26 09:59:21 +02:00
Bowgo Tsai
0afc6b07f1 Adding product.img for fastboot flashall
Bug: 64195575
Test: fastboot flashall
Change-Id: Ifd119650dd3316508870df0dfc770099e95ae1d1
2018-03-26 15:47:59 +08:00
Christopher Ferris
43cb7ea4ed Merge "Method to avoid skipping frames for local unwinds." 2018-03-24 19:20:16 +00:00
Josh Gao
f8a97c1f14 adb: start building windows test again.
Test: mma
Change-Id: Iea2a3055cc3642905a1bbdd18550a9fc12702da8
2018-03-23 15:37:20 -07:00
Mark Salyzyn
387319307a Merge "storaged: owner adjustment" 2018-03-23 22:01:55 +00:00
Mark Salyzyn
133c9111a3 storaged: owner adjustment
Added salyzyn@ for final owner review on adjustments to storaged.

Test: none
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Change-Id: Iac73403ea416a4820f72689f5860aa88931def06
2018-03-23 14:37:53 -07:00
Josh Gao
2e1e789e2a adb: fix windows test build.
The switch over to soong unintentionally turned off building the
Windows tests (and there's a bug preventing them from being turned on).
Preemptively fix the build breakages that'll happen when we turn them
back on.

Test: mma with Android.bp 's/cc_test_host/cc_binary_host' hacks
Change-Id: I6582cfc61b96052537d50d8ba90533dbb66e3e1d
2018-03-23 13:03:28 -07:00
Christopher Ferris
458f4e725d Method to avoid skipping frames for local unwinds.
In cases where there might be a crash in the unwind library itself,
we need a method to avoid skipping these frames or we won't be able
to see the actual crash.

Added unit test for this behavior.

Bug: 74121887

Test: Ran unit tests on host and target.
Change-Id: I45825020c174016af39dd8ffdc67acb72a24ad4d
2018-03-23 13:01:44 -07:00
Yabin Cui
7102f7c98d Merge "Support a map that represents gdb jit elf data." 2018-03-23 17:27:58 +00:00
Treehugger Robot
3b353ed41c Merge "bootstat: refine "Kernel panic - not syncing"" 2018-03-22 23:17:40 +00:00
Mark Salyzyn
3f48fa9cb2 bootstat: refine "Kernel panic - not syncing"
Provide some easy kernel panic subreasons mined from last kmesg,
generates a canonical boot reason (system boot reason) that
may aid triage.

Notably report kernel_panic,hung if [khungtaskd] triggers on
a livelock condition, forms a signals on the dashboards.

Helper function getSubreason modified to optionally enable checking
for a single quote resulting in a refactoring to ease maintenance of
the termination detection in the face of single bit errors heuristics.

Test: boot_reason_test.sh
Bug: 63736262
Bug: 33808187
Change-Id: I7fdd1e57e7a26095738175074306f0d2d59b1d69
2018-03-22 13:57:31 -07:00
Treehugger Robot
d888e343b7 Merge changes I5fe02059,Iea8bf298,I0630c302,Ifc4b8fe9,I29319bda
* changes:
  adb: bump the local socket backlog to the maximum.
  adb: fix unicode file path test.
  adb: delete vestigial SHELL_EXIT_NOTIFY_FD.
  adb: don't immediately close a socket when write fails.
  adb: make fdevent_run_on_main_thread's fd nonblocking.
2018-03-22 03:48:38 +00:00
Josh Gao
8f7ff94762 adbd: spawn login shell when run without a command.
Match openssh's behavior with regards to login shells.

Bug: http://b/76116378
Test: `adb shell -T set -o` vs `ssh localhost -T set -o`
Test: `adb shell -tt set -o` vs `ssh localhost -tt set -o`
Test: `echo set -o | adb shell -T` vs `echo set -o | ssh localhost -T`
Test: `echo set -o | adb shell -tt` vs `echo set -o | ssh localhost -tt`
Change-Id: I6ed69b43e2ac79c947c242948b5617ece08a713e
2018-03-21 18:23:09 -07:00
Yabin Cui
d5b22c5f04 Support a map that represents gdb jit elf data.
Changes:
- Add a new flag to the libbacktrace and libunwindstack map data.
- Modify the unwinder to handle this map to use the raw pc when stepping.
- Add new unit tests for this case.

Bug: http://b/73127105
Test: Run simpleperf to unwind through jit symfiles.
Test: Run new unit tests.
Test: Run 137-cfi test on host.
Change-Id: I10bc0410680accc6d35fe51e9f1098911f667e01
2018-03-21 17:23:54 -07:00
Josh Gao
bf243a6128 adb: bump the local socket backlog to the maximum.
The listen backlog seems to be more meaningful on Darwin than on Linux,
resulting in connections failing with ECONNRESET. Bump it up to the
maximum supported value to make this less likely. 128 pending
connections ought to be enough for anybody.

Bug: http://b/74616284
Test: python test_device.py
Change-Id: I5fe0205924188cf18ca1fc1204f923ab5523eeb2
2018-03-21 15:13:07 -07:00
Josh Gao
2c621ae741 adb: fix unicode file path test.
This test is failing due to:

     UnicodeWarning: Unicode equal comparison failed to convert both
     arguments to Unicode - interpreting them as being unequal'

Both arguments are already unicode, so stop encoding one side.

Test: python -m unittest test_device.FileOperationsTest.test_unicode_paths
Change-Id: Iea8bf29845ab3008ccf4c7dbd6969196e57ea25d
2018-03-21 15:13:07 -07:00
Josh Gao
dcc055af64 adb: delete vestigial SHELL_EXIT_NOTIFY_FD.
There exists no path through which a value other than -1 can be written
to the SHELL_EXIT_NOTIFY_FD.

Test: adb_test
Test: adbd_test
Test: python test_device.py
Change-Id: I0630c302ba06bc76917f0445aea75d2dbe1dc865
2018-03-21 15:13:07 -07:00
Josh Gao
184f480547 adb: don't immediately close a socket when write fails.
When we fail to write to a local socket peer, we might still have data
queued up to send to the other side. Defer closing the socket until
we've failed to both read and write.

Bug: http://b/74616284
Test: python test_device.py
Change-Id: Ifc4b8fe95369b4872e475c2ae4ee611dd2d8b9d7
2018-03-21 15:13:07 -07:00
Suren Baghdasaryan
5ea2c4baf1 Merge "lmkd: Fix the message printed during a kill to avoid confusion" 2018-03-21 19:19:33 +00:00
Suren Baghdasaryan
d4463fd9d7 Merge "lmkd: Suppress error when accessing soft_limit_in_bytes for system_server" 2018-03-21 19:19:22 +00:00
Suren Baghdasaryan
a77411f425 Merge "lmkd: Change error to warning when accessing oom_score_adj file" 2018-03-21 19:19:10 +00:00
Suren Baghdasaryan
d07a94f973 lmkd: Fix the message printed during a kill to avoid confusion
Current kills message prints min_score_adj marked as "oom_adj" which
is confusing. This change marks it as "min_oom_adj" to be more clear.

Change-Id: If52f0fb25fe3208c928c5d6adce77c04b9f15a0e
2018-03-21 17:12:42 +00:00
Suren Baghdasaryan
4311d1ed36 lmkd: Suppress error when accessing soft_limit_in_bytes for system_server
system_server needs to register with lmkd, however it has no memory
cgroup under /dev/memcg/apps. This change detects if the process being
registered is system_server and suppresses the error message when
/dev/memcg/apps/uid_%d/pid_%d/memory.soft_limit_in_bytes file can't
be accessed.

Bug: 73483785
Test: verified logcat output
Change-Id: I03df7831f41f512ac8d3ebc46330546d08a3cbc6
2018-03-21 10:11:23 -07:00
Suren Baghdasaryan
1ffa246c86 lmkd: Change error to warning when accessing oom_score_adj file
Occasionally processes are killed or crash while lmkd is trying to access
their oom_score_adj file. This is not necessarily an erroneous condition
and therefore should not be reported as an error. Demoting error to a
warning with a detailed message.

Bug: 72039129
Test: verified logcat output
Change-Id: I97444ba5198c02cb7f7ba03c3af12e4aad9d233e
2018-03-20 17:14:38 -07:00
Treehugger Robot
7c681665f0 Merge changes Ibf543273,Id56946b6
* changes:
  bootstat: allow kernel_panic,sysrq to propagate subreason
  bootstat: test error out only on first bad bootloader reason
2018-03-20 22:25:12 +00:00
Josh Gao
1222abc75b adb: make fdevent_run_on_main_thread's fd nonblocking.
If we get a ton of fdevent_run_on_main_thread calls while running one
of the handlers, the socket might become full, which will result in a
deadlock in fdevent_run_on_main_thread when a write to the fd blocks
with the mutex taken. Resolve this by making the fd nonblocking, which
is safe because we always write after appending to the list, and read
before emptying the list, which guarantees that if the byte we write is
consumed, the std::function we appended will be run.

Bug: http://b/74616284
Test: adb_test
Test: python test_device.py
Change-Id: I29319bda2ad7b5a5cdcd91d1d0ddf39f7ab7d115
2018-03-20 13:23:06 -07:00
Mark Salyzyn
39cc3e7073 bootstat: allow kernel_panic,sysrq to propagate subreason
Allow for a daemon to write to last kmsg to propagate a detailed
subreason to kernel_panic,sysrq actions.  A minor refactor moves
common code into a helper function getSubreason for retrieval and
bit error correction operations.

A sysrq crash generally produces a kernel-provided message:
    SysRq : Trigger a crash
which is used to generate a canonical boot reason kernel_panic,sysrq.
A user daemon could write to /dev/kmsg just prior to the sysrq with
    SysRq : Trigger a crash : '<subreason>'
to change the canonical boot reason to kernel_panic,sysrq,<subreason>.

Administration added pending kBootReasonMap entries present in TRON.

Test: manual echo into /dev/kmsg and /proc/sysrq-trigger and check
Test: boot_reason_test.sh
Bug: 33808187
Bug: 63736262
Change-Id: Ibf5432737e5a3449ebe40a8c6cf2d3e912ed6bbc
2018-03-20 13:11:44 -07:00
Mark Salyzyn
855d205817 bootstat: test error out only on first bad bootloader reason
Hopefully the quick property test is first, setting the stage for
ignoring future failures.  This solves a problem with multiple
test failures directly attributed to a CTS compliance issue
with the bootloader's boot reason.  One test fails, the remainder
get a pass on this one issue.

Test: boot_reason_test.sh
Bug: 63736262
Change-Id: Id56946b6f2f3a33d65bd1830543838f153290759
2018-03-20 13:10:16 -07:00
Treehugger Robot
ef454589e4 Merge "/postinstall/* does not search for a lib in /vendor or /odm" 2018-03-20 16:25:48 +00:00
Tom Cherry
92d55b6c07 Merge "Revert "init: Reboot after timeout passes during reboot"" 2018-03-20 13:37:43 +00:00
Josh Gao
7920502065 Merge changes I6a842960,If618c26b
* changes:
  adb: add `adb shell exit 42` stress test.
  adb: improve socket tests.
2018-03-20 07:19:01 +00:00
Josh Gao
46e59af921 Merge "adb: skip IPv6 test if IPv6 isn't available." 2018-03-20 07:18:12 +00:00
Josh Gao
4abb5074be adb: skip IPv6 test if IPv6 isn't available.
Bug: http://b/69813298
Test: none
Change-Id: I0793e793bd52c5f1c639faedf09a513df263db78
2018-03-19 18:19:47 -07:00
Jiyong Park
d7e6cb27b6 /postinstall/* does not search for a lib in /vendor or /odm
There has been no section in the linker config file for the binaries
under /postinstall. As a result, the binaries were run with the legacy
default config where /vendor/lib and /odm/lib are added to the search
paths. This is causing selinux denials as the binaries for OTA are not
allowed to access /vendor/lib or /odm/lib, but the dynamic linker calls
realpath(3) on the paths to canonicalize them.

Fixing the issue by letting /postinstall/* binaries to run with a
dedicated linker namespace config, where /vendor/lib and /odm/lib are
not added to the search paths. Not having the paths is okay because
he OTA binaries should not have dependency to the libs there.

Bug: 75287236
Test: do the OTA, selinux denials on postinstall_file is not shown
Test: above test should pass on  wahoo, marlin and pre-treble devices
Change-Id: I49c11a0929002adfef667890c0a375c2b41054f4
2018-03-20 10:12:00 +09:00
Tom Cherry
0a72e6cb72 Revert "init: Reboot after timeout passes during reboot"
This reverts commit c9fec9d2be.

Looks like ext4 can't handle a system reboot happening in the middle
of an unmount.  We'll have to find another way to handle this.

Bug: 74817735
Bug: 75310371
Test: reboot device
Change-Id: Ib4f7f7fd29988a31a99f146c40f6d987c1fef15e
2018-03-19 16:37:02 -07:00
Josh Gao
c970aefada adb: add adb shell exit 42 stress test.
Add a test to hammer on `adb shell exit $n` for flakiness.

Bug: http://b/74616284
Test: python test_device.py
Change-Id: I6a842960f5b55ff739044698f5c9683992fc42f1
2018-03-19 16:14:53 -07:00
Josh Gao
ecb96ac04d adb: improve socket tests.
Make it so that the socket tests don't leak until your machine blows up
by switching an infinite loop into an assertion failure.

Bug: http://b/74616284
Test: adb_test
Change-Id: If618c26b224b660548454f542cab79bebe46f80e
2018-03-19 16:14:53 -07:00
Treehugger Robot
6156420fb7 Merge changes I99b85f07,If28f6c8d
* changes:
  adb: implement std::make_unique, start using it.
  base: export GetThreadId.
2018-03-19 20:14:33 +00:00