Commit graph

34343 commits

Author SHA1 Message Date
Tom Cherry
c317009410 init: split security functions out of init.cpp
This change splits out the selinux initialization and supporting
functionality into selinux.cpp and splits the security related
initialization of the rng, etc to security.cpp.  It also provides
additional documentation for SEPolicy loading as this has been
requested by some teams.

It additionally cleans up sehandle and sehandle_prop.  The former is
static within selinux.cpp and new wrapper functions are created around
selabel_lookup*() to better serve the users.  The latter is moved to
property_service.cpp as it is isolated to that file for its usage.

Test: boot bullhead
Merged-In: Idc95d493cebc681fbe686b5160502f36af149f60
Change-Id: Idc95d493cebc681fbe686b5160502f36af149f60
(cherry picked from commit 9afb86b25d8675927cb37c86119a7ecf19f74819)
2017-08-14 11:07:27 -07:00
Christopher Ferris
1f6a481462 Merge "Compare new unwinder to old unwinder in debuggerd."
am: bb2f03f344

Change-Id: I3e51fadda629f7d4bda8e4ddc4c0b60ebbdb49b8
2017-08-12 16:11:47 +00:00
Christopher Ferris
e10835f28a Merge "Add demangling of function name."
am: 6452b9036d

Change-Id: I7a2b883afb4fca2e8ce754b3bcea867ed0779c5b
2017-08-12 16:11:18 +00:00
Christopher Ferris
bb2f03f344 Merge "Compare new unwinder to old unwinder in debuggerd." 2017-08-12 16:06:48 +00:00
Christopher Ferris
6452b9036d Merge "Add demangling of function name." 2017-08-12 16:06:18 +00:00
Jocelyn Bohr
9295f6f36d Merge "Enable non-secure side to receive messages > 4K"
am: 28fa8b0924

Change-Id: Ibfe35d6b861640974b268213353745a32f11a56b
2017-08-12 03:08:03 +00:00
Treehugger Robot
28fa8b0924 Merge "Enable non-secure side to receive messages > 4K" 2017-08-12 03:02:01 +00:00
Josh Gao
4c968c1ef6 Merge "debuggerd_handler: print pid and process name."
am: 94b0e4f5df

Change-Id: I16ab84a436d972de08172c5235abff650609e818
2017-08-12 01:34:58 +00:00
Treehugger Robot
94b0e4f5df Merge "debuggerd_handler: print pid and process name." 2017-08-12 01:27:53 +00:00
Tom Cherry
a1051005a9 Merge "init: fix format issue"
am: f95338f634

Change-Id: I771056e5543e8d1028a61fd9190e90a29b9bcfec
2017-08-12 00:15:53 +00:00
Treehugger Robot
f95338f634 Merge "init: fix format issue" 2017-08-12 00:07:58 +00:00
Christopher Ferris
9a8c855780 Compare new unwinder to old unwinder in debuggerd.
In debuggerd, when dumping a tombstone, run the new unwinder and verify
the old and new unwinder are the same. If not, dump enough information
in the tombstones to figure out how to duplicate the failure.

Bug: 23762183

Test: Builds, ran and forced a mismatch and verified output.
Change-Id: Ia178bde64d67e623d4f35086ebda68aebbff0c3c
2017-08-11 16:37:59 -07:00
Josh Gao
81e6c0b613 debuggerd_handler: print pid and process name.
Bug: http://b/64483618
Test: manual
Change-Id: Ie772324895a8ffcd41d919a4a6113862a6468d12
2017-08-11 15:38:51 -07:00
Christopher Ferris
04fdec0bbf Add demangling of function name.
Bug: 23762183

Test: Builds, unit tests pass.
Change-Id: Id49248a27d822db0f3837bfc0c20d004c55315fc
2017-08-11 15:17:46 -07:00
Wei Wang
826bc7b507 Merge "init: Add readahead built-in command"
am: 12bd22badf

Change-Id: I4cd4ea9a013a1bcbe065e7dbce18f61a897393d9
2017-08-11 21:51:36 +00:00
Treehugger Robot
12bd22badf Merge "init: Add readahead built-in command" 2017-08-11 21:37:47 +00:00
Tom Cherry
1f87cd1bd0 init: fix format issue
Trying to limit merge conflicts later...

Test: build
Change-Id: I802f2cf86b8432f65ad4dcd45bfd543ee5091775
2017-08-11 13:22:37 -07:00
Wei Wang
542aae443f init: Add readahead built-in command
Inspired by ag/2659809/, this CL add readahead built-in command in init
to let files be prefetched into pagecache for faster reading.
Readahead happens in background but due to filesystem limitation it
might take small amount of time in it reading the filesystem metadata
needed to locate the requested blocks. So the command is executed in a
forked process to not block init execution.

Bug: 62413151
Test: boottime, dumpcache
Change-Id: I56c86e2ebc20efda4aa509e6efb736bd1d92baa5
2017-08-11 11:24:08 -07:00
Christopher Ferris
df04d3bc93 Merge "Fix another set of bugs."
am: af6a262020

Change-Id: Ie17cded589e0a930c6ae19b981f320a969a353aa
2017-08-11 14:33:52 +00:00
Christopher Ferris
af6a262020 Merge "Fix another set of bugs." 2017-08-11 14:28:46 +00:00
Christopher Ferris
9e484bdb4a Fix another set of bugs.
- The pc read from the eh frame binary table of pc/fde offset is off by 4.
  I verified that on arm/arm64/x86/x86_64 the pc in this table matches
  the fde pc_start value. I did this by adding an error if this occurred
  and ran unwind_info over everything in system/lib, system/lib64, system/bin.
- Fixed unit tests for the above change.
- Fix a small bug in the processing encoded values. The high
  bit of the encoding should be masked off, but I wasn't doing that. That
  meant during processing of the fde, I was incorrectly returning
  an error because the encoded value was unknown.
- Added a new test for this encoding change.

Bug: 23762183

Test: Build and all unit tests pass. Also, see above comments.
Change-Id: If074a410a1726392274cd72c64470ca0be48e0db
2017-08-10 17:37:32 -07:00
Jocelyn Bohr
b3ed3772b9 Enable non-secure side to receive messages > 4K
AttestKeyResponse may be larger than 4K (always less than 8K) when
attesting an RSA key. This change allows the non-secure side to read a
response that may be larger than 4K by adding an additional bit
indicating the end of a response. If a message command has the
KEYMASTER_STOP_BIT set, then the non-secure side knows that the response
has been fully read.

Test: android.keystore.cts.KeyAttestationTest#testRsaAttestation passes
      with production attestation key and chain, when AttestKeyResponse is
      larger than 4K.

      Tested with other CTS tests when keymaster messages are smaller
      than 4K, still passes.

      Manual test to verify that a tipc error due to large message size is
      handled correctly.
Bug: 63335726

Change-Id: I8776ba7ca70da893648e15cfa770784ab31a2cb0
2017-08-10 16:53:27 -07:00
Andrew Scull
ef1dd0d279 Merge "Add HSM AID."
am: 4723d7c66d

Change-Id: If7075378ac5a13bbe79a02843d13d34c5f128d2a
2017-08-10 21:35:47 +00:00
Treehugger Robot
4723d7c66d Merge "Add HSM AID." 2017-08-10 21:28:30 +00:00
Andrew Scull
f73c5e1f84 Add HSM AID.
This is used by resources related to a hardware security module (HSM).

Bug: 64569509
Change-Id: I30d47e1b275e3c4ae0a00f7ceb286a1096d84273
2017-08-10 20:25:11 +01:00
Mark Salyzyn
67ad31b21f Merge "bootstat: switch from root.root to system.log"
am: de6b44aa0e

Change-Id: Ia69fd5a537f7e4b9ee2a6867ccc182b44c09b6df
2017-08-10 15:04:12 +00:00
Treehugger Robot
de6b44aa0e Merge "bootstat: switch from root.root to system.log" 2017-08-10 14:56:37 +00:00
Dan Willemsen
3efedfae39 Merge "Don't try to strip a shell script"
am: ff7e13c260

Change-Id: I187a638711076f9c04b84980b74cebccc259aa51
2017-08-10 05:46:55 +00:00
Treehugger Robot
ff7e13c260 Merge "Don't try to strip a shell script" 2017-08-10 05:42:46 +00:00
Tom Cherry
fb9deac35c Merge changes If1cffa85,I9011a959
am: 30bd51c61f

Change-Id: Ib59f5e16d656185bba05ad5dcec1425f2ce72b1b
2017-08-10 04:36:11 +00:00
Tom Cherry
30bd51c61f Merge changes If1cffa85,I9011a959
* changes:
  init: move property_service.cpp to libinit
  init: statically link libselinux to init_tests
2017-08-10 04:31:54 +00:00
Dan Willemsen
e1cf0f5f73 Don't try to strip a shell script
Test: lunch aosp_mips-eng; mmma system/core/logcat
Change-Id: I4e641701522fb5b042d52e460d40b42ed12f22c8
2017-08-09 20:20:48 -07:00
Ryan Campbell
725fa57109 Merge "Include asan options from data partition."
am: 5d89e6c7fe

Change-Id: I22bfd9e46cd377b4532e1726522b8c9fdcdfeb04
2017-08-10 01:11:22 +00:00
Treehugger Robot
5d89e6c7fe Merge "Include asan options from data partition." 2017-08-10 01:05:44 +00:00
Tom Cherry
2a978d32d2 init: move property_service.cpp to libinit
service.cpp, which is part of libinit, references symbols in
property_service.cpp, which causes the linker to complain when linking
libinit.a in some situations.

Therefore, we move property_service.cpp to libinit.

Separately, this will make it easier to write tests for
property_service.cpp, which we will want to do in the future.

Test: build, init unit tests
Change-Id: If1cffa8510b97e9436efed3c8ea0724272383eba
2017-08-09 17:13:21 -07:00
Tom Cherry
45a9d67cec init: statically link libselinux to init_tests
The shared libselinux library does not export all of the symbols that
we use in init and the linker is now complaining about this, so let's
use the static libselinux library in init_tests to match init itself.

Test: build, init unit tests
Change-Id: I9011a959a7c49446b3529740e606140a4ee8c32d
2017-08-09 17:09:04 -07:00
Christopher Ferris
188072f6a4 Merge "Small clean ups"
am: 5cd87d39d7

Change-Id: I4eea11359afef8c377c646e613733ddb4cc02776
2017-08-09 23:26:44 +00:00
Mark Salyzyn
b5a69e8e70 Merge "logcat: transition to Android.bp"
am: ad7f1bc0b3

Change-Id: I689b94aad609a4fd9734b159f305868eae5764ea
2017-08-09 23:26:24 +00:00
Christopher Ferris
5cd87d39d7 Merge "Small clean ups" 2017-08-09 23:22:22 +00:00
Mark Salyzyn
ad7f1bc0b3 Merge "logcat: transition to Android.bp" 2017-08-09 23:18:00 +00:00
Ryan Campbell
ce30d07b11 Include asan options from data partition.
Look for asan options under /data/asan so that multi-process coverage
can be enabled on a newly-started remote process without disabling
verity and without forcing it to be always-on.

Test: adb shell echo "include_if_exists=/data/asan/asan.options.%b" >>
/system/asan.options && adb shell echo
"coverage=1\ncoverage_dir=/data/misc/trace" >
/data/asan/asan.options.android.hardware.light@2.0-service && adb shell killall
android.hardware.light@2.0-service
Bug: 64019182

Change-Id: I241ad8478439323681dc1cfde2fa0770f030ae75
2017-08-09 15:32:23 -07:00
Mark Salyzyn
c3ad75be84 bootstat: switch from root.root to system.log
bootstat does not need root uid and root gid permissions to perform
its tasks.  It appears that system uid and log gid are adequate and
appropriate.

Test: manual
Bug: 63736262
Change-Id: I094c2cb054e441562fa8717a4d3dc0086fb70a7a
2017-08-09 15:08:21 -07:00
Christopher Ferris
3b4b075fea Small clean ups
- Remove redundant map_info checks.
- Initialize fde_count_ to zero.

Bug: 23762183

Contributed-By: Ivan Maidanski <i.maidanski@samsung.com>

Test: Builds, run backtrace_test modifying CreateNew to Create and vice-versa.
Change-Id: I6e9cdfa99734f8cc2d9915cc32c66a1455e79f1b
2017-08-09 14:22:12 -07:00
Mark Salyzyn
507f69f80e logcat: transition to Android.bp
Switch logcat, logcatd and liblogcat to use Android.bp.

Test: compile
Change-Id: I01c0d8cbc6a713ad5b4b413677574e3c6463afcb
2017-08-09 13:30:03 -07:00
Mark Salyzyn
94984cf4bd Merge "logcat: fix error propagation."
am: 2d1d8812cc

Change-Id: I0676572a6ff6e9591afb7f4e99cc64b92147dfef
2017-08-09 00:59:33 +00:00
Treehugger Robot
2d1d8812cc Merge "logcat: fix error propagation." 2017-08-09 00:45:20 +00:00
Mark Salyzyn
210e43c354 logcat: fix error propagation.
Fix some _serious_ error propagation issues discovered with
additional warning flags (-Wextra).

Test: compile
Change-Id: I5148550092e4ecb6cafba91229c350c516e7e244
2017-08-08 15:49:21 -07:00
Tom Cherry
3df3ec34e4 Merge "ueventd: add test to ensure selabel_lookup() is thread safe"
am: 2c3a2a8c5c

Change-Id: I57b1fb1906671950a4374f515438349f368f7cad
2017-08-08 22:48:04 +00:00
Tom Cherry
2c3a2a8c5c Merge "ueventd: add test to ensure selabel_lookup() is thread safe" 2017-08-08 22:00:26 +00:00
Tom Cherry
57ef66b6fa ueventd: add test to ensure selabel_lookup() is thread safe
selabel_lookup() must be threadsafe, but had failed in the past.

Bug: 63861738
Test: this newly added test
Change-Id: I78bdb8e555433e8217ac6d4be112ba91de9f03bb
2017-08-08 13:11:44 -07:00