Commit graph

36388 commits

Author SHA1 Message Date
Elliott Hughes
ad4e3e2f54 Add lmkd/OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ic4970a95d799c16ffe06bc94a85adabc18d6cc0b
2017-12-08 16:12:58 -08:00
Elliott Hughes
aaa0bbce8e Merge "use std::hash instead of hashing byte by byte" 2017-11-30 23:18:19 +00:00
Dan Willemsen
f106bb6bb8 Merge "Fix / suppress new unused warnings for mingw+clang" 2017-11-30 22:31:54 +00:00
Treehugger Robot
017203b140 Merge "Fix typos in ADB documentation" 2017-11-30 21:41:26 +00:00
Jim Kaye
ab74e068ee Fix typos in ADB documentation
Bug: None

Test: None

Change-Id: Ib036eefc602bf0ebac869146b04eea225cae39ef
2017-11-30 10:57:51 -08:00
James Hawkins
5470a12513 Merge "bootstat: Three more boot reasons." 2017-11-30 17:47:00 +00:00
Treehugger Robot
c02b92a923 Merge "Run restorecon after init creates a symlink or writes to a file." 2017-11-30 17:30:17 +00:00
Dan Willemsen
528f144e77 Fix / suppress new unused warnings for mingw+clang
Bug: 69933068
Test: mmma system/core
Change-Id: I089166a979d3d8c5ada38a7745d507b555048499
2017-11-29 21:37:28 -08:00
Christopher Ferris
96b5268405 Merge "Fix incorrect usage of relative pcs." 2017-11-30 03:11:41 +00:00
Christopher Ferris
c3d79f7c07 Fix incorrect usage of relative pcs.
When stepping, it's necessary to use both the unaltered relative pc
and the adjusted relative pc. If the adjusted pc is not used, the
wrong unwind information can be used.

Added new offline unit tests that take real data and verifies that it
unwinds properly.

Fix a bug in the map code that would not properly parse map data for
a 64 bit process when done in a 32 bit process.

Fix bug in eh_frame processing that didn't adjust the pc correctly.
Fix unit tests related to the pc adjustment.

Bug: 69475565

Test: Passes libbacktrace/libunwindstack unit tests.
Test: Run debuggerd -b on processes on a hikey.
Change-Id: Ic501a1c4549c5f61d2742a7105c42a960f2c892b
2017-11-29 16:10:08 -08:00
Joel Galenson
4b591f1851 Run restorecon after init creates a symlink or writes to a file.
Init currently sets the SELinux context on a mkdir but not on
other operations.  This patch modifies it to do so when creating
symlinks, writing to a file, or copying a file.

Test: Built, flashed, and booted.  Added fake init entries and
verified that they received the proper SELinux context.

Change-Id: I836b570fef81d74f3b6c8e7ce0274e94ca7b12d3
2017-11-29 15:29:49 -08:00
James Hawkins
5f85f8354b bootstat: Three more boot reasons.
Bug: none
Test: none
Change-Id: I37b6ed6ce73f403aa5f9db2c0234e9dc4c0f7c01
2017-11-29 14:30:06 -08:00
James Hawkins
b623389421 Merge "bootstat: Add a few more bootreasons." 2017-11-29 19:29:54 +00:00
Treehugger Robot
34778d24ae Merge "ld.config.txt.in typo: absolution -> absolute" 2017-11-29 17:49:33 +00:00
Elliott Hughes
166c6a4390 Merge "Remove a duplicate TEMP_FAILURE_RETRY." 2017-11-29 16:06:12 +00:00
Sebastian Pop
1f93d71022 use std::hash instead of hashing byte by byte
This patch uses libcxx's string_view hashing.  The performance is better than the
current implementation, and almost the same as for the hashing implementation amended
by the patch in https://android-review.googlesource.com/404742

The following experiments were conducted on a HiKey aarch64 A53.

No changes:
$ adb push out/target/product/hikey/data/benchmarktest64/ziparchive-benchmarks /data
$ adb shell /data/ziparchive-benchmarks --benchmark_repetitions=5
-----------------------------------------------------------------
Benchmark                          Time           CPU Iterations
-----------------------------------------------------------------
FindEntry_no_match          82279629 ns   81759676 ns          9
FindEntry_no_match          81648056 ns   81627431 ns          9
FindEntry_no_match          81384074 ns   81369057 ns          9
FindEntry_no_match          89618889 ns   82437755 ns          9
FindEntry_no_match          81811389 ns   81785261 ns          9
FindEntry_no_match_mean     83348407 ns   81795836 ns          9
FindEntry_no_match_stddev    3520421 ns     394962 ns          0
Iterate_all_files          137622000 ns  137589032 ns          5
Iterate_all_files          139666333 ns  138409469 ns          5
Iterate_all_files          150070000 ns  140883697 ns          5
Iterate_all_files          138600667 ns  138540646 ns          5
Iterate_all_files          137599833 ns  137567438 ns          5
Iterate_all_files_mean     140711767 ns  138598056 ns          5
Iterate_all_files_stddev     5299929 ns    1354928 ns          0

$ cd system/core/libziparchive
$ git fetch https://android.googlesource.com/platform/system/core refs/changes/42/404742/7 && git cherry-pick FETCH_HEAD
$ mma
$ cd -
$ adb push out/target/product/hikey/data/benchmarktest64/ziparchive-benchmarks /data
$ adb shell /data/ziparchive-benchmarks --benchmark_repetitions=5
-----------------------------------------------------------------
Benchmark                          Time           CPU Iterations
-----------------------------------------------------------------
FindEntry_no_match          53302756 ns   53291178 ns         13
FindEntry_no_match          54314487 ns   54272272 ns         13
FindEntry_no_match          53866923 ns   53851178 ns         13
FindEntry_no_match          53324423 ns   53317296 ns         13
FindEntry_no_match          53289231 ns   53289159 ns         13
FindEntry_no_match_mean     53619564 ns   53604216 ns         13
FindEntry_no_match_stddev     458449 ns     443527 ns          0
Iterate_all_files          128211111 ns  112254783 ns          6
Iterate_all_files          110695000 ns  110677726 ns          6
Iterate_all_files          109351250 ns  109350998 ns          6
Iterate_all_files          109367500 ns  109367796 ns          6
Iterate_all_files          110872222 ns  110591407 ns          6
Iterate_all_files_mean     113699417 ns  110448542 ns          6
Iterate_all_files_stddev     8143723 ns    1194577 ns          0

$ cd system/core/libziparchive
$ git checkout HEAD~
$ git am 0001-use-std-hash.patch
$ mma
$ cd -
$ adb push out/target/product/hikey/data/benchmarktest64/ziparchive-benchmarks /data
$ adb shell /data/ziparchive-benchmarks --benchmark_repetitions=5
-----------------------------------------------------------------
Benchmark                          Time           CPU Iterations
-----------------------------------------------------------------
FindEntry_no_match          55339872 ns   55195112 ns         13
FindEntry_no_match          56232628 ns   56069924 ns         13
FindEntry_no_match          55694103 ns   55255946 ns         13
FindEntry_no_match          55275064 ns   55120136 ns         13
FindEntry_no_match          54971987 ns   54944411 ns         13
FindEntry_no_match_mean     55502731 ns   55317106 ns         13
FindEntry_no_match_stddev     482032 ns     436766 ns          0
Iterate_all_files          114618611 ns  114487804 ns          6
Iterate_all_files          112552917 ns  112229801 ns          6
Iterate_all_files          111288750 ns  111255044 ns          6
Iterate_all_files          111291528 ns  111259045 ns          6
Iterate_all_files          114347222 ns  113677119 ns          6
Iterate_all_files_mean     112819806 ns  112581763 ns          6
Iterate_all_files_stddev     1606214 ns    1454858 ns          0

Change-Id: I1e3413d331bcb460ca38bc2c87e23f89b456cd2f
2017-11-29 09:44:28 -06:00
Christopher Ferris
f819c1d94b Merge "Allow multiple threads sharing a map to unwind." 2017-11-29 02:58:06 +00:00
Elliott Hughes
3df2fa6d8e Remove a duplicate TEMP_FAILURE_RETRY.
Bug: N/A
Test: builds
Change-Id: I19c2f50422e8a7e0c451a464586553f3e5eaadab
2017-11-28 18:05:27 -08:00
James Hawkins
74b1758cad bootstat: Add a few more bootreasons.
Bug: none
Test: none
Change-Id: I9b482e642a9eec26670118a265046194f3cc2a7a
2017-11-28 15:20:44 -08:00
Christopher Ferris
be788d891d Allow multiple threads sharing a map to unwind.
Add a mutex in MapInfo, and a mutex in Elf. Lock the creation of an Elf
file using the MapInfo mutex, and lock when calling Step, GetFunctionName,
or GetSoname since they can modify information in the object. It might
be beneficial to use a fine grained lock in the future.

Change the Maps object to contain a vector of MapInfo pointers rather
than the total objects. This avoids copying this data around.

Add a test to libbacktrace to verify that sharing a map while doing
unwinds in different threads works.

Add concurrency tests in libunwindstack to verify the locking works.

Add always inline to the RegsGetLocal arm and aarch64 functions. I had
a case where clang did not inline the code, so make sure this is specified.

Bug: 68813077

Test: New unit tests to cover the case. Passes all unit tests.
Test: Ran a monkey test while dumping bugreports and verified that
Test: no crashes in libunwind.
Test: Remove the locking and verified that all of the concurrenty tests fail.
Change-Id: I769e728c676f6bdae9e64ce4cdc03b6749beae03
2017-11-28 15:20:38 -08:00
Christopher Ferris
2f1aa4e90f Merge "Add way to specify an offset in an elf file." 2017-11-28 23:09:48 +00:00
Steven Moreland
ab338c10e6 ld.config.txt.in typo: absolution -> absolute
Test: none
Change-Id: I247722c0881fa733226eec6578f17b1a481d1e91
2017-11-28 12:42:19 -08:00
Treehugger Robot
f03f2a5cd7 Merge "add null pointer check for msg buffer" 2017-11-28 19:54:27 +00:00
Christopher Ferris
a141709b21 Add way to specify an offset in an elf file.
This is to support the ability to dump an elf embedded in an apk.

Test: Ran unwind_info on a file, then ran it on an apk with an offset.
Change-Id: I8f23f4bdaadfd3665900bdd45d50cb270e2e0eed
2017-11-28 10:59:33 -08:00
Treehugger Robot
8055ea44de Merge "Don't complain that the DNSSL RA option is "unknown"." 2017-11-28 09:08:14 +00:00
Yan, Shaopu
53eb0cb5a3 add null pointer check for msg buffer
Test: Build
Change-Id: I94e08ccc8372449f11f6e673b6449c50d7eef4f9
2017-11-28 15:17:27 +08:00
Lorenzo Colitti
cbfd65d947 Don't complain that the DNSSL RA option is "unknown".
This option isn't unknown, we just don't support it.

Bug: 69778511
Test: walleye builds, boots, connects to IPv6 network
Change-Id: If3a37d855f404da708fec4a7ba242ed41a493895
2017-11-28 06:42:04 +00:00
Logan Chien
23cc38d440 Merge "libutils: Cleanup unused class declaration" 2017-11-28 02:16:50 +00:00
Treehugger Robot
4bbcddf64d Merge "add llndk|vndksp.libraries.txt to vndk_package" 2017-11-28 01:48:43 +00:00
Jiyong Park
e04e4e7dfe add llndk|vndksp.libraries.txt to vndk_package
List of llndk and vndk-sp libraries are written in the txt file so that
they can be available at run-time. The information is used by
libnativeloader to configure the classloader-namespace specially for
vendor apks.

Bug: 64882323
Test: build 2017 pixel devices. check that the two files exist on
/system/etc.

Merged-In: Ifbe339a5862f6ef57a8213a14a022765ccf77283
Change-Id: Ifbe339a5862f6ef57a8213a14a022765ccf77283
(cherry picked from commit 26335f89b1)
2017-11-28 01:29:30 +00:00
Treehugger Robot
af03f483d7 Merge "Standarize on VFS_CAP_REVISION_2" 2017-11-28 01:00:08 +00:00
Tom Cherry
f71a3d66b3 Merge "Revert "init: use ro.init.subcontexts_enabled to enable subcontexts"" 2017-11-27 22:54:45 +00:00
Nick Kralevich
65b8d749f7 Standarize on VFS_CAP_REVISION_2
In https://github.com/torvalds/linux/commit/8db6c34f1dbc8 , namespaced
file capabilities were introduced. That change updated VFS_CAP_REVISION
from VFS_CAP_REVISION_2 to VFS_CAP_REVISION_3.

Android code is written assuming v2 capabilities, and the code will
break if we naively try to treat a v2 structure as a v3 structure.
So don't even try.

Android kernels prior to v4.14 will not support this extended capability
structure, so attempting to set such capabilities will ultimately fail.

With 8db6c34f1dbc8, it appears that attempting to read a v3 capabilities
xattr will always downgrade the capability to a v2 capability, so it
really doesn't make sense to look for a v3 capability.

Android capabilities are only created at /system and /vendor filesystem
creation time by host tools. Android processes, within or outside a
namespace, are not permitted CAP_SETFCAP
(https://android-review.googlesource.com/c/platform/system/sepolicy/+/547801/1/public/domain.te
line 1101). So we should never have to deal with a v3 capability other
than those that might appear on the /system / /vendor partition at a
future date by a future author.

Bug: 69617725
Test: build/test/boot/CTS passes
Change-Id: I0378b3f1195dc62dbeb771944ab378c881441118
2017-11-27 14:17:42 -08:00
Treehugger Robot
a227804015 Merge "init: Drop inheritable capabilities when switching uids" 2017-11-27 21:29:59 +00:00
Treehugger Robot
3dfba33d67 Merge "Create location to store surface and window trace files on init" 2017-11-27 21:17:07 +00:00
Treehugger Robot
db49c08513 Merge "fastboot: make_f2fs call by linux/darwin" 2017-11-27 19:12:44 +00:00
Vishnu Nair
d09ab7a217 Create location to store surface and window trace files on init
Bug: 64831661
Test: adb shell su root rm /data/misc/wmtrace && adb reboot && adb shell su ls /data/misc/wmtrace
Change-Id: I60979c26a9226534df534abd3d59df309f6ea6ad
2017-11-27 09:54:31 -08:00
Tom Cherry
193e43494f Revert "init: use ro.init.subcontexts_enabled to enable subcontexts"
This reverts commit 79193a42e7.

Bug: 62875318
Test: boot walleye, sailfish without SELinux audits
Change-Id: I019b66a3130acba2c07e984e4bc352228f09d7f5
2017-11-27 09:03:28 -08:00
Tom Cherry
fa65396ca2 Merge "Move mkdir /data/nfc/... to rootdir init.rc" 2017-11-22 19:56:10 +00:00
Logan Chien
20f7dc7041 libutils: Cleanup unused class declaration
This commit removes unused class declaration for SharedBuffer and
TextOutput.  SharedBuffer has become internal implementation details
since 282efae9c.  TextOutput usages have been removed since 9eb2a3b1.

Test: AOSP and master build w/o problems
Change-Id: I1871c4919a46f1ea8f41fb7eb79b4dc800b6f6f4
2017-11-22 18:31:10 +08:00
Chen Xu
76adcdf688 Merge "a new folder to store OTA carrier id update" 2017-11-22 04:31:29 +00:00
fionaxu
06b8e2e130 a new folder to store OTA carrier id update
Bug:64131637
Test: Build
Change-Id: I0ce4322f297bab427d70aed3c329345c899786bb
(cherry picked from commit 45713ff621)
2017-11-21 17:31:00 -08:00
Tom Cherry
c319310f9b Move mkdir /data/nfc/... to rootdir init.rc
These are directories used by the system so they should be created by
the system.

Test: treehugger
Change-Id: I2a721ef7871c8842fa912497f5ec6988fcec9e58
2017-11-21 10:40:25 -08:00
Treehugger Robot
70fda27eb2 Merge "bootstat: kernel_panic test w/o bootloader or pstore support" 2017-11-21 17:14:31 +00:00
Mark Salyzyn
547063eab6 bootstat: kernel_panic test w/o bootloader or pstore support
If the platform has no bootloader or pstore support, kernel_panic
test should fail if the results are not correct. Drop skipping of
failed test if pstore support is lacking.

If device demonstrably has pstore content support, the result must
be exacting kernel_panic,sysrq. Otherwise accept the less precise
result.

Test: On hikey960 (which currently lacks reliable pstore, or a
      compliant bootloader reporting bootreason), expect failure of:
      system/core/bootstat/boot_reason_test.sh kernel_panic
Bug: 63736262
Change-Id: I071a2a9c00dc522ec037c8a8997fea524d17e6e4
2017-11-20 12:18:09 -08:00
Christopher Ferris
b7969272a3 Merge "Force call the fallback handler." 2017-11-17 18:33:20 +00:00
Luis Hector Chavez
94fb5b0bef init: Drop inheritable capabilities when switching uids
This change explicitly drops all inheritable capabilities (and, by
extension, ambient capabilities) when there are no explicit capabilities
being set by a service and the user is changed. This prevents Android
running in a container from accidentally granting extra capabilities to
services.

Bug: 69320306
Test: aosp_sailfish still boots
Test: sailfish:/ $ grep Cap /proc/`pidof android.hardware.audio@2.0-service`/status
      CapInh: 0000000000000000
      CapPrm: 0000000000000000
      CapEff: 0000000000000000
      CapBnd: 0000003fffffffff
      CapAmb: 0000000000000000
Test: sailfish:/ $ grep Cap /proc/`pidof logd`/status
      CapInh: 0000000000000000
      CapPrm: 0000000440000000
      CapEff: 0000000440000000
      CapBnd: 0000003fffffffff
      CapAmb: 0000000000000000
Test: Android in Chrome OS still boots
Test: localhost ~ # grep Cap /proc/`pidof android.hardware.audio@2.0-service`/status
      CapInh: 0000000000000000
      CapPrm: 0000000000000000
      CapEff: 0000000000000000
      CapBnd: 000000006daefdff
      CapAmb: 0000000000000000
Test: localhost ~ # grep Cap /proc/`pidof logd`/status
      CapInh: 0000000000000000
      CapPrm: 0000000040000000
      CapEff: 0000000040000000
      CapBnd: 000000006daefdff
      CapAmb: 0000000000000000

Change-Id: I9218f2e27ff4fb4d91d50f9a98c0fdb4e272952c
2017-11-17 09:11:37 -08:00
Christopher Ferris
664d2a9093 Force call the fallback handler.
Always check to see if the fallback handler has been called and is
not trying to dump a specific thread.

Bug: 69110957

Test: Verified on a system where the prctl value changes, that before the
Test: change it dumps multiple tombstones, and after the change it
Test: works as expected.
Test: Ran debuggerd unit tests.
Test: Dumped process using debuggerd -b <PID> and debuggerd <PID>.
Change-Id: Id98bbe96cced9335f7c3e17088bb4ab2ad2e7a64
2017-11-16 20:07:13 -08:00
Jaegeuk Kim
8d9b6ee621 fastboot: make_f2fs call by linux/darwin
Bug: 69298953
Change-Id: I6a7483e8617b649666247c4ca985384d086f15f8
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2017-11-15 14:22:37 -08:00
Treehugger Robot
37eb97d911 Merge changes from topic "b69050941"
* changes:
  Allow a service to override another.
  Move service name duplication lookup to EndSection
  EndSection returns Result<Success>
  Fix out of date SectionParser comment.
2017-11-15 21:30:56 +00:00