Commit graph

26604 commits

Author SHA1 Message Date
Colin Cross
2e253cbcc6 Allow tkill
tkill and tgkill are syscalls that do not have glibc wrappers, but
they are required in order to send a signal to a specific thread.
Non-android software may call them directly with syscall().  Bionic
provides a wrapper for tgkill, so seccomp allows it, but not for
tkill.  Add tkill to the whitelist.

This can be reproduced with:
sleep 1000 & sleep 1 ; strace -p $!
then hit ctrl-C, and the shell will print "Bad system call" because
the strace process died with SIGSYS

Bug: 34586922
Test: repro case is fixed
Change-Id: Ib6962a967f2cc757f2906de7905e75e1b6d6f39f
2017-01-23 17:10:51 -08:00
Colin Cross
47afc6b64e Allow restart_syscall
restart_syscall is used by the kernel whenever a syscall with a
timeout is interrupted.  Whitelist it in seccomp to prevent
processes being killed with SIGSYS when being ptraced.

Bug: 34586922
Test: hwui_unit_tests
Change-Id: Ic47dcad33f3082eb5673c3c67fe17200d4daaf74
2017-01-23 17:05:01 -08:00
Mark Salyzyn
13c15e05d0 Merge "logcat: do not report security buffer errors" 2017-01-23 15:25:04 +00:00
Treehugger Robot
41ee55a875 Merge "adb: check for and report inotify_init1 failure." 2017-01-21 01:05:02 +00:00
Mark Salyzyn
26a1facfbf logcat: do not report security buffer errors
Do not report security buffer errors if not specifically
named in the buffer list.

Test: gTest logcat-unit-test --gtest_filter=logcat.security
Bug: 34511645
Change-Id: I028d51abad0329fcf42e467b135d035b06c1d2e3
2017-01-20 15:30:34 -08:00
Josh Gao
fb9a7e5995 adb: check for and report inotify_init1 failure.
Bug: http://b/34396687
Test: mma
Change-Id: I55ea84db49017a6533ac54db5072e3e75ba30097
2017-01-20 15:26:00 -08:00
Treehugger Robot
b479a5002e Merge "init: don't start tombstoned until /data is mounted." 2017-01-20 22:13:38 +00:00
Treehugger Robot
b5e530f720 Merge "bootstat: Remove debug logging of bootstat_mtime_matches_content." 2017-01-20 21:46:56 +00:00
Josh Gao
42a0fed78b init: don't start tombstoned until /data is mounted.
When vold mounts the encrypted /data partition, it first checks for and
kills processes that have open fds to the tmpfs placeholder at /data.
This resulted in a 20 second boot-time regression (vold's timeout period)
when tombstoned was started before vold.

Bug: http://b/34461270
Test: boot is faster, no messages from vold in console spew
Test: tombstoned still started by init
Change-Id: Ib5e9ddb05f40c9da852f00e103861c6ff2d94888
2017-01-20 13:18:51 -08:00
Josh Gao
ac0403b1e5 Merge "crash_dump: don't abort if we fail to attach a sibling." 2017-01-20 21:02:30 +00:00
Josh Gao
42fd74bd1f crash_dump: don't abort if we fail to attach a sibling.
A TOCTOU race can occur between listing threads and attaching them.
Don't abort and leave the process in a stopped state when this happens.

Bug: http://b/34472671
Test: while true; do debuggerd -b `pidof audioserver`; done
Change-Id: Ib1632c3423fddf506b5c7874223c82fada78a85e
2017-01-20 12:55:07 -08:00
Dave Weinstein
c734a0a9ee Merge "Move the kptr_restrict setting from init.rc to init.cpp." 2017-01-20 20:24:10 +00:00
Treehugger Robot
d289e36847 Merge "logd: test: switch to /data/backup/ for sepolicy avc injection" 2017-01-20 19:42:51 +00:00
James Hawkins
a51b165c7a bootstat: Remove debug logging of bootstat_mtime_matches_content.
Bug: 34507152
Test: bootstat_tests
Change-Id: I97f84dd04eb44e6a5d00cf9a2f6b24a5b3e9297f
2017-01-20 11:20:36 -08:00
Mark Salyzyn
9d3722be72 Merge "liblog: BM_log_latency improvement" 2017-01-20 19:04:54 +00:00
Mark Salyzyn
142b43d4ab liblog: BM_log_latency improvement
This reduces BM_log_latency from ~300ns to ~100ns.  Because, well, we
read the clock earlier and that is what BM_log_latency tries to
measure.  The one major improvement in the switch from kernel logger
to user space logger was that we picked up the timestamp in the
context of the caller before doing anything else, but alas changes
over time neglected this fact and placed isloggable checking ahead
of this important fact.

Test: liblog_benchmarks, check results
Change-Id: I4bc9fc3cf8b1659e88417d967b1d0f3743f9e456
2017-01-20 17:53:27 +00:00
Mark Salyzyn
c3c06294e5 logd: test: switch to /data/backup/ for sepolicy avc injection
Resolve issues seen on continuous testing frame:

- statistics test, info instead of fail on missing radio log data.
- sepolicy switch from /data/misc/logd/ to /data/backup/ as the
  directory we access(2) to inject sepolicy violations.  The key here
  is we are still root, but we are in u:r:shell:s0, and the directory
  does not provide us DAC access (0700 system system) so we trigger
  the pair dac_override and dac_read_search on every try to get past
  the message de-duper.  /data/misc/logd is not always there, until
  logpersist is enabled, but /data/backup is always there.
- a stricter signature of '): avc: denied'
- put in a looser threshold for sepolicy_rate_limiter_spam test.

Test: gTest logd-unit-tests --gtest_filter=logd.sepolicy*
Bug: 34454758
Change-Id: I28ce4fdb51dc4869944e3253b593ce222d16ec98
2017-01-20 09:42:02 -08:00
Dave Weinstein
44f7e4f421 Move the kptr_restrict setting from init.rc to init.cpp.
Also ensure that it uses the highest supported value, and
abort if the value is not above a minimum threshold.

Test: Tested against the curent kernel (maximum value of 2,
      set to 0 by the kernel initially) and against a
      modified kernel (maximum value of 4, set to 4 by the
      kernel initially)

Bug: 30368199
Change-Id: I608db577258b68b390ffe96f452e1f7c0bc9ad8a
2017-01-20 09:40:43 -08:00
Treehugger Robot
8dbab358f0 Merge "Load default/build props from each partition" 2017-01-20 03:58:52 +00:00
Treehugger Robot
18044da576 Merge "Fix a call to openat with incorrect arguments" 2017-01-19 23:58:22 +00:00
Treehugger Robot
cfb8800e18 Merge "Enable seccomp in init with generated policy" 2017-01-19 23:26:10 +00:00
George Burgess IV
7008c8484d Fix a call to openat with incorrect arguments
Caught by running clang-FORTIFY over Android.

Bug: None
Test: Builds
Change-Id: If138c4bbb7f5fb40bbb20e24adbb25a6ef1286ac
2017-01-19 13:33:52 -08:00
Jeff Sharkey
1e7cdf3c7d Merge "Define GID range for external data and OBBs." 2017-01-19 16:16:40 +00:00
Treehugger Robot
c42bd0931f Merge changes Icb8e6290,Iadde7b21,I743ab92c,Ie078fbc2,I2ab3cd46, ...
* changes:
  libsync: tests: redefine PollOnDestroyedTimeline()
  libsync: tests: remove WaitOnDestroyedTimeline test
  libsync: add support to new Sync API
  libsync: open new location of sw_sync file
  libsync: add new Sync kernel API
  libsync: move kernel headers for sync ioctls to sync.h
2017-01-19 00:39:36 +00:00
Jeff Sharkey
7e5d0b1fae Define GID range for external data and OBBs.
To quickly answer the question of "how much data is a UID using?" we
need a GID range to label files on external storage, similar to
the GID ranges already defined for cached and shared data.

Also define a new GID that will be used to label the OBB files shared
between all users under /data/media/obb.

Test: builds, newly added tests pass
Bug: 34263266
Change-Id: I16fb7d166c3dcdeafbf477162d191d3b73ae8ac2
2017-01-18 17:11:05 -07:00
Jaekyun Seok
de21de7a42 Load default/build props from each partition
The following files will be loaded additionally.
- /odm/default.prop and /vendor/default.prop for default props.
- /odm/build.prop for build props.

The props files must follow the following priority order.
- /default.prop > /odm/default.prop > /vendor/default.prop
- /system/build.prop > /odm/build.prop > /vendor/buid.prop

Test: tested default/build prop files with enabling early mount, but
didn't test files of odm partition because odm partition doesn't
exist now.
Bug: 34116668
Change-Id: I946d076dae38f2288865dd986fb16d801d4abcc0
2017-01-19 08:45:40 +09:00
Josh Gao
230201dcbf Merge "debuggerd: advance our amazing bet." 2017-01-18 23:04:09 +00:00
Colin Cross
80112f73cd Merge "Export android_filesystem_config.h as a filegroup" 2017-01-18 16:53:26 +00:00
Jorim Jaggi
8e81cd6609 Merge "Revert "init: split property context into platform & non-platform components"" 2017-01-18 16:33:32 +00:00
Jorim Jaggi
328cb5d141 Revert "init: split property context into platform & non-platform components"
This reverts commit 871c306855.

Change-Id: I3e14b71e9fc5f37c9691405ce20031451643f9b4
2017-01-18 15:33:26 +00:00
Treehugger Robot
b8e5553887 Merge "init: split property context into platform & non-platform components" 2017-01-18 06:09:02 +00:00
Colin Cross
1207ba3d5a Export android_filesystem_config.h as a filegroup
bionic/libc/Android.bp needs to reference android_filesystem_config.h,
export it using a filegroup module.

Bug: 34283327
Test: builds
Change-Id: Id7650f3b64d7eb52f945f538d05b691b8b3c3fcb
2017-01-17 18:20:28 -08:00
Treehugger Robot
56098eed3b Merge "init: usb: fix audio_source function typo" 2017-01-18 01:39:39 +00:00
James Hawkins
bde89da5fc Merge "bootstat: Fix false metrics due to soft reboots." 2017-01-17 23:46:58 +00:00
Gustavo Padovan
801492b8a6 libsync: tests: redefine PollOnDestroyedTimeline()
On mainline if the sw_sync timeline is destroyed the fences doesn't not
signal or error. So change the test to check if the fence is still there
by polling the fence with timeout zero and asserting if it is not
signalled.

Test: Sync unit tests still passes.
Change-Id: Icb8e629018eef35074ae91d0f29ed1f12e90492b
2017-01-17 14:29:41 -08:00
Gustavo Padovan
e4682802cb libsync: tests: remove WaitOnDestroyedTimeline test
The mainline Sync File implementation doesn't have wait ioctl anymore.
Only poll is supported now, and we already have a test for that.

Test: Sync unit tests still passes.
Change-Id: Iadde7b2173024af9b8d20316e640297cf214c645
2017-01-17 14:29:18 -08:00
Gustavo Padovan
61ab0d74d2 libsync: add support to new Sync API
Change libsync functions in a way that it can run dynamically on both
APIs.

v2: fix whitespace changes and poll return handling

v3: handle error cases on sync_wait()

Test: Sync unit tests still passes.
Change-Id: I743ab92ce39cbfa75dca41dd0a435efa9f2aab66
hange-Id: Ib56f2c6441b41028bc9f66998676790b7713988a
2017-01-17 14:29:01 -08:00
Gustavo Padovan
ffc687baad libsync: open new location of sw_sync file
sw_sync file for debug was moved to debugfs. Try to open it and if it
fails try to open /dev/sw_sync.

Test: Sync unit tests still passes.
Change-Id: Ie078fbc2eb5294f28b916a9e65b7fcd3a18a8580
hange-Id: I216874964368d939bed2779d98cd89e527a57d45
2017-01-17 14:28:45 -08:00
Gustavo Padovan
6786575d42 libsync: add new Sync kernel API
Add the new API to the internal sync.h file. As there is two different
APIs we will need to discovery dynamically which one to use.

v2: Fix Documentation

Test: Sync unit tests still passes.
Change-Id: I2ab3cd46e48ba5d9c73d54f9583b1a8141566581
2017-01-17 14:28:26 -08:00
Gustavo Padovan
d6bbc5de66 libsync: move kernel headers for sync ioctls to sync.h
This patch moves the legacy API to the internal sync.h header
and add documentation to it.

Test: Sync unit tests still passes.
Change-Id: I9b17eb23af30043b3df5fb9e857affad68ba8521
2017-01-17 14:28:00 -08:00
Winter Wang
60c763ed52 init: usb: fix audio_source function typo
for audio_source function instance, there exist 2 function name here:
    "audio_source.gs2" and "audio_source.gs3"
I believe this usb accessory audio name "audio_source.gs2" is a typo,
as there is no need to create another audio_source instance.

Test: Manual

Change-Id: I70b513db474632eb990131c285c8d5105c17970f
Signed-off-by: Winter Wang <wente.wang@nxp.com>
2017-01-17 14:27:34 -08:00
Josh Gao
cbe70cb0a8 debuggerd: advance our amazing bet.
Remove debuggerd in favor of a helper process that gets execed by
crashing processes.

Bug: http://b/30705528
Test: debuggerd_test
Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906
2017-01-17 13:57:57 -08:00
James Hawkins
800ceb45b1 bootstat: Fix false metrics due to soft reboots.
Use a flag to enable/disable logging metrics, set to false during soft
reboots.

Bug: 32807863
Change-Id: Ib1359327af4e18d40400c29961c454f7be1b8d0c
Test: None
2017-01-17 13:28:17 -08:00
Tao Bao
4c5c9db17b Merge "Revert "init: add ro.boot.init_rc"" 2017-01-17 20:19:23 +00:00
Tao Bao
01519a207c Revert "init: add ro.boot.init_rc"
This reverts commit 7e6d30e5f2.

Bug: 26639863
Bug: 34318089
Change-Id: Ie71d773ee7c6c6a90e8298f8e0798eacba12d0be
2017-01-17 20:16:45 +00:00
Treehugger Robot
c160675a93 Merge "Remove fs_mgr's bogus external/openssl/include LOCAL_C_INCLUDES entry." 2017-01-16 18:10:46 +00:00
Elliott Hughes
ebeaa67c0c Remove fs_mgr's bogus external/openssl/include LOCAL_C_INCLUDES entry.
Bug: N/A
Test: builds
Change-Id: Icaf095f0c25fae5c1175dbb630bc05c63af72d75
2017-01-15 11:52:35 -08:00
Elliott Hughes
89e99f9e0e Merge "bootable/recovery wants EqualsIgnoreCase." 2017-01-14 18:22:32 +00:00
Treehugger Robot
0cf5e36c00 Merge "init: add ro.boot.init_rc" 2017-01-14 08:06:09 +00:00
Elliott Hughes
2140782d24 bootable/recovery wants EqualsIgnoreCase.
Bug: N/A
Test: ran tests
Change-Id: I4a6ee9eba0514b8bb8fb0489f4d370964ce9c1c2
2017-01-13 18:51:32 -08:00