Commit graph

38396 commits

Author SHA1 Message Date
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
Christopher Ferris
b22451f178 Merge "Always set the sp reg to the cfa for DWARF." 2018-03-19 17:48:59 +00:00
David Srbecky
e8d1b75c0c Merge "Don't include map name if the consumer doesn't want names." 2018-03-19 11:23:10 +00:00
David Srbecky
e62f4c4d4c Don't include map name if the consumer doesn't want names.
Simpleperf doesn't need the name, so avoid the string copies.

This seems to speed up simpleperf by around 20%.

Test: backtrace_test libunwindstack_test
Change-Id: Iba064c7078f7e5ecfc9d8539ba09c14495a52158
2018-03-19 11:20:00 +00:00
Yabin Cui
11e96fe48a Always set the sp reg to the cfa for DWARF.
There are a few places where it is assumed that this register is
set to the cfa value when interpreting DWARF information.

Add a testcase for unwinding art_quick_osr_stub on ARM.

Bug: 73954823

Test: Ran libunwindstack/libbacktrace unit tests.
Test: Random debuggerd -b of process on a hikey.
Test: Ran the 137 art test on host.
Change-Id: Ida6ccdc38c3cfeea6b57fe861a0cc127b150b790
2018-03-16 23:38:07 -07:00
Treehugger Robot
4fa763290e Merge "adb: Remove usages of ENDPOINT_ALLOC" 2018-03-17 00:50:54 +00:00
Treehugger Robot
bda0a3e637 Merge changes If35518c0,I04bede0b
* changes:
  bootstat: add support for suppressing needle match on output
  bootstat: usb and rtc refinement
2018-03-16 22:48:51 +00:00
Mark Salyzyn
281932803d bootstat: add support for suppressing needle match on output
For aliasReasons allow one to optionally suppress needle for output
member using a <bang> (!) character prefix.

Test: boot_reason_test.sh
Bug: 63736262
Bug: 74595769
Change-Id: If35518c08cf909c6c78a16275e9d8dfd0ff839a9
2018-03-16 15:47:27 -07:00
Mark Salyzyn
8aa36c67f8 bootstat: usb and rtc refinement
For all known cases, if usb is present in the bootloader reason,
then it is actually reporting a cold,charger canonical boot reason.
This signifies that the device was powered down, and was woken
up by the charger being connected.

For all known cases, if rtc is present in the bootloader reason,
then it is actually reporting a cold,rtc canonical boot reason.
This signifies that the device was powered down, and was woken
up by the rtc clock.

Test: boot_reason_test.sh
Bug: 74595769
Bug: 63736262
Change-Id: I04bede0b7ccaa1b859943f7def93521a8f7b25c6
2018-03-16 15:47:27 -07:00
Treehugger Robot
f4be06450a Merge "bootstat: add support for regex in aliasReasons and powerkeys" 2018-03-16 22:44:57 +00:00
Josh Gao
31b5be69f4 adb: implement std::make_unique, start using it.
Add an implementation of std::make_unique for Windows, where we're
currently stuck with C++11, and switch some uses of new over to it.

Test: treehugger
Change-Id: I99b85f07754adda7c525243480c3e0bce9a25ce7
2018-03-16 15:35:52 -07:00
Josh Gao
5791e21697 base: export GetThreadId.
and stop using the incorrect (on Mac) version in adb..

Test: mma
Change-Id: If28f6c8d73b03db863be13ed88df81422c3aef87
2018-03-16 15:35:52 -07:00
Jerry Zhang
99499f1740 adb: Remove usages of ENDPOINT_ALLOC
All devices that previously used ENDPOINT_ALLOC
are on the new async io routines. None of the devices
using aio_compat have ENDPOINT_ALLOC so remove the
code to stop logging failures.

Fixes: 74213465
Test: adb works
Change-Id: I0c903eb76b006b6bcce48cec24f5353fa47cc128
(cherry picked from commit 9a1be3ad0e)
2018-03-16 15:33:26 -07:00
Josh Gao
32caa9870f Merge "adb: add test for flushing socket data after a write failure." 2018-03-16 22:18:43 +00:00
Treehugger Robot
40858e95b6 Merge "bootstat: alias underline to space in bit error rate handling" 2018-03-16 19:46:37 +00:00
Treehugger Robot
1408ceec4f Merge "bootstat: comment out duplicate entries in kBootReasonMap" 2018-03-16 19:35:24 +00:00
Treehugger Robot
5e2b2681ef Merge "bootstat: 3.18 kernel does not report "SysRq : Trigger a crash"" 2018-03-16 18:49:49 +00:00
Mark Salyzyn
25900dd772 bootstat: add support for regex in aliasReasons and powerkeys
Add support for regex in aliasReasons for the alias member.  Use this
new feature to check powerkey|power_key|PowerKey for a single entry.

Test: boot_reason_test.sh
Bug: 63736262
Change-Id: Ia6add99b9e33f3197643dbaab88dde20aa726f90
2018-03-16 11:41:17 -07:00
Treehugger Robot
c8e757b6dd Merge "Remove test_suites: ["vts"] from memunreachable_binder_test" 2018-03-16 18:40:52 +00:00
Benedict Wong
78ca1fecef Merge "Set SPI Allocation Timeout to One Hour" 2018-03-16 17:45:20 +00:00
Mark Salyzyn
1e7d1c77fa bootstat: alias underline to space in bit error rate handling
When we are matching existing known boot reasons, we should try with
compliant underlines first, then again with underlines replaced with
spaces.  Replace references to Ber with BitError for maintenance
clarity.  Replace helper functions with C++11 lambdas.

Test: boot_reason_test.sh
Bug: 63736262
Change-Id: I91b865013513526a55a85523080c7127f198968c
2018-03-16 10:37:03 -07:00
Mark Salyzyn
2b820536e6 bootstat: comment out duplicate entries in kBootReasonMap
Two entries can be reused. The third "unknown" entry is not really
a duplicate since the kUnknownBootReason is not checked.  Duplicate
entries reused in the future, should have
analysis/uma/configs/clearcut/TRON/histograms.xml updated first.

Test: boot_reason_test.sh
Change-Id: If2071a18160dc2c93e851fecc6b8c11fc76c9845
2018-03-16 10:36:53 -07:00
Mark Salyzyn
853bb80e58 bootstat: 3.18 kernel does not report "SysRq : Trigger a crash"
Use an alternate means to determine that the sysrq crash was
requested.  Also, to be CTS compliant, the kernel_panic subreason
must be in lower case.

Test: boot_reason_test.sh
Bug: 74595769
Bug: 63736262
Change-Id: Ica06960ce62d220a909006e365951376d672b7e6
2018-03-16 09:39:17 -07:00
Treehugger Robot
450b1afcb5 Merge "bootstat: test: regression from "Fix perfomance degredation from BootSequence atom"" 2018-03-16 16:18:24 +00:00
Treehugger Robot
97debc7055 Merge "Support /odm partition" 2018-03-16 03:51:28 +00:00
Christopher Ferris
a411fc65d1 Merge "Handle ARM thumb function symbols." 2018-03-16 02:14:10 +00:00
Treehugger Robot
d5fc6bdd36 Merge "adb: checks device state when using adb disable-verity for AVB" 2018-03-16 01:33:51 +00:00
Mark Salyzyn
7f5a562177 bootstat: test: regression from "Fix perfomance degredation from BootSequence atom"
Added --set_system_boot_reason to expected filter

Test: boot_reason_test.sh
Bug: 74595769
Bug: 63736262
Bug: 72864061
Change-Id: Ie912d097fb6468dd826fd9422758fb9fb3e1ee29
2018-03-15 16:42:31 -07:00