Commit Graph

24258 Commits

Author SHA1 Message Date
Nick Kralevich c21169c59f give zygote AID_READPROC
In zygote wrapping mode, ZygoteConnection does a check to see if the pid
reported by the wrapped process is either child process that was
forked, or a decendent of it. This requires read access to other
processes /proc files. Grant zygote AID_READPROC to allow this access.

Bug: 32610632
Test: manual inspection of /proc files to verify group.
Test: manual inspection of zygote's children to make sure they do not
      inherit AID_READPROC

Change-Id: I3619a9ae33c8077e068e8024f7c7d44cfca6fb76
2016-11-02 13:48:32 -07:00
Treehugger Robot c54c533cf6 Merge "Return nullptr from FindNamespaceByClassLoader for NB-enabled apps." 2016-11-02 16:00:45 +00:00
Treehugger Robot 043bc971f2 Merge "init: Add support for ambient capabilities." 2016-11-02 15:47:01 +00:00
Jorge Lucangeli Obes 24b29132a0 init: Add support for ambient capabilities.
Ambient capabilities are inherited in a straightforward way across
execve(2):

"
If you are nonroot but you have a capability, you can add it to pA.
If you do so, your children get that capability in pA, pP, and pE.
For example, you can set pA = CAP_NET_BIND_SERVICE, and your
children can automatically bind low-numbered ports.
"

This will allow us to get rid of the special meaning for AID_NET_ADMIN
and AID_NET_RAW, and if desired, to reduce the use of file capabilities
(which grant capabilities to any process that can execute the file). An
additional benefit of the latter is that a single .rc file can specify
all properties for a service, without having to rely on a separate file
for file capabilities.

Ambient capabilities are supported starting with kernel 4.3 and have
been backported to all Android common kernels back to 3.10.

I chose to not use Minijail here (though I'm still using libcap) for
two reasons:

1-The Minijail code is designed to work in situations where the process
is holding any set of capabilities, so it's more complex. The situation
when forking from init allows for simpler code.

2-The way Minijail is structured right now, we would not be able to
make the required SELinux calls between UID/GID dropping and other priv
dropping code. In the future, it will make sense to add some sort of
"hook" to Minijail so that it can be used in situations where we want
to do other operations between some of the privilege-dropping
operations carried out by Minijail.

Bug: 32438163
Test: Use sample service.
Change-Id: I3226cc95769d1beacbae619cb6c6e6a5425890fb
2016-11-01 19:56:14 -04:00
Dimitry Ivanov 800083d229 Return nullptr from FindNamespaceByClassLoader for NB-enabled apps.
This function is always called by the frameworks in order to
initialize vulkan layer path. For NB apps returning nullptr
disables vulkan layer library lookup as expected.

Bug: http://b/32542970
Test: mm
Change-Id: I426b2b9f5ea7227b00f063ed6040f37bb2b4f21f
2016-11-01 14:48:45 -07:00
Josh Gao 0945380e36 Merge "adb: add `adb reconnect offline` to reconnect offline devices." 2016-10-31 21:26:23 +00:00
Treehugger Robot 995560919c Merge "init: Put init in group AID_READPROC" 2016-10-31 19:13:35 +00:00
Treehugger Robot fff1669341 Merge "Fix log for early_mount" 2016-10-31 15:04:38 +00:00
Treehugger Robot b5ce6f02dd Merge "Add FuseBridgeLoop to libappfuse." 2016-10-31 06:09:32 +00:00
Nick Kralevich 80960d2a9a init: Put init in group AID_READPROC
bootcharts currently only show root's processes, which isn't very
useful. To investigate and track boot duration issues, we need a way for
init to see all the pids. Add init to GID 3009 (aka AID_READPROC)

Ensure that init's children don't inherit this GID by always clearing
supplementary group IDs on fork.

Bug: 32506197
Test: Device boots and /proc/1/status says init is in gid 3009
Test: zygote starts and the Group: line in /proc/ZYGOTEPID/status is empty
Change-Id: Iba90717aaa591f1d6030a379a272aee003600c0a
Not-Tested: bootchart actually works. Speculative fix.
2016-10-29 12:20:00 -07:00
Wei Wang 313b352382 Fix log for early_mount
Test: on device
Bug: 32508724
Change-Id: Ib2908b19f6068012d5597ac4cc590ffb0c063b75
2016-10-28 18:05:36 -07:00
Treehugger Robot cd368c640a Merge "Log when bootcharting ends." 2016-10-29 00:29:09 +00:00
Treehugger Robot 9112b419bd Merge "Add UID for vehicle network" 2016-10-28 21:03:09 +00:00
Elliott Hughes 5ee97e8ec0 Log when bootcharting ends.
Bug: http://b/26863004
Test: bootcharted N9
Change-Id: Ie91a4342d05ac5e7b6a8d37fa729edf36c38912b
2016-10-28 12:30:32 -07:00
Keun-young Park 42e802c2fb Add UID for vehicle network
- Access to vehicle network is done in vehicle network service process.

Test: build
bug: 32508433
Change-Id: I340d1f4964d70b53f10d84fb15a62107e1dedc0e
2016-10-28 12:08:07 -07:00
Treehugger Robot e381ecf63b Merge "Add utility functions for FUSE." 2016-10-28 06:22:33 +00:00
Josh Gao 22d2b3e1c2 adb: add `adb reconnect offline` to reconnect offline devices.
Add a command to reconnect offline/unauthorized devices, mainly for use
with the inotify-monitoring of vendor key directories added by 2e671202.

Bug: http://b/29273531
Test: manually tested with a sailfish + copying vendor keys
Change-Id: If34cccee4ae553ada65d128b57d03cba8c0d7c46
2016-10-27 17:13:23 -07:00
Daichi Hirono c613476297 Add FuseBridgeLoop to libappfuse.
The CL adds FuseBridgeLoop class to libappfuse, which is used in the
system service to proxy fuse commands to applications.

Bug: 29970149
Test: libappfuse_test
Change-Id: I0708f608b3868721ab16ba4028fd2c17a6735af7
2016-10-27 15:04:15 +09:00
Daichi Hirono 7f8e819ded Add utility functions for FUSE.
The CL adds utility functions to framework to parse FUSE messages
from the kernel. The library will be used from framework JNI and service
JNI.

Bug: 32260320
Test: libappfuse_test
Change-Id: Ib89b26d34789e6c26a3288beceb3ea145c1ae780
2016-10-27 12:40:24 +09:00
Treehugger Robot b838ff65d9 Merge "Make "adb logcat" pass $ANDROID_LOG_TAGS through again." 2016-10-27 01:02:56 +00:00
Treehugger Robot 459ec807a7 Merge "liblog: remove reference to log/logger.h" 2016-10-26 23:43:46 +00:00
Treehugger Robot d70a5feb60 Merge "Make sure wait for the dm device" 2016-10-26 22:31:23 +00:00
Elliott Hughes 90390302d5 Make "adb logcat" pass $ANDROID_LOG_TAGS through again.
But not for Windows, because even dealing with environment variables is
too hard there (and no Windows user has complained yet).

Bug: http://b/30184452
Test: manual
Change-Id: I2d60049ed0049a9532414a7cdecbd0687e06aba7
2016-10-26 15:12:14 -07:00
Mark Salyzyn a28525293d liblog: remove reference to log/logger.h
Test: compile
Bug: 31992412
Change-Id: Idd52072d0f8c657ac53dc3e6b505a66c47a94357
2016-10-26 14:59:42 -07:00
Wei Wang dba750e0e0 Make sure wait for the dm device
Bug: 32408249
Test: on m/s
Change-Id: I65fa4fec94c82ef51d2c8d0aabf9e90b8448f27f
2016-10-26 13:40:23 -07:00
Dimitry Ivanov 28c0c0762e Merge "Upgrade native bridge to version 3 to support namespace" 2016-10-26 18:27:38 +00:00
Treehugger Robot a16ae8717c Merge "Improve "adb install" diagnostics." 2016-10-26 18:25:59 +00:00
Pirama Arumuga Nainar f6653de814 Merge "Make libbacktrace build with LLVM r275480" 2016-10-26 17:35:52 +00:00
Treehugger Robot d879e0c750 Merge "init: allow '.' and '@' in service names" 2016-10-26 17:29:06 +00:00
Iliyan Malchev f655480b48 init: allow '.' and '@' in service names
Services implementing HIDL HALs must be named the same as the HIDL
package, e.g. android.hardware.nfc@1.0.  Allow init to accept names
containing '.' and '@'.

Also combined logic for legal property names and legal service names.

Bug: 31458381
Bug: 32109611
Test: Tested creating service nfc@1.0-service which creates property
'init.svc.nfc@1.0-service' with and without this change. This service
successfully started only with this change.

Change-Id: Ie7a4310742bc03498d774d37b3b5fafa7c6068cc
Signed-off-by: Iliyan Malchev <malchev@google.com>
2016-10-26 08:46:24 -07:00
Treehugger Robot da6fe65000 Merge "Make "adb bugreport"'s .zip check case-insensitive." 2016-10-26 15:34:04 +00:00
Treehugger Robot fbe0b45544 Merge "logd: getTag() functional for chatty entries" 2016-10-26 14:11:27 +00:00
Pirama Arumuga Nainar 80fb4b09f4 Make libbacktrace build with LLVM r275480
Bug: http://b/31320715

Test: No regression in 32-bit and 64-bit backtrace_test on host and
angler.

Change-Id: Ic5c5511e89ca7707ed9c13d5ba0539e09310dfe3
2016-10-25 22:16:47 -07:00
Elliott Hughes 7acce1b0ab Make "adb bugreport"'s .zip check case-insensitive.
Bug: TODO
Test: manual
Change-Id: I0ece7d8dcb708e3755477f7df5ff03807fd227f2
2016-10-25 17:24:54 -07:00
Elliott Hughes 7288478443 Improve "adb install" diagnostics.
Bug: http://b/32094640
Test: manual testing
Change-Id: I661936eabd3bdd8aa7ee8cc0e398a7cc7d4ddbbb
2016-10-25 17:23:40 -07:00
Treehugger Robot 61131fc92f Merge "Add StartsWithIgnoreCase/EndsWithIgnoreCase." 2016-10-25 23:48:14 +00:00
Roshan Pius 4376d21e7f Merge "Rename 'wifi_legacy_hal' to 'android.hardware.wifi@1.0-service'" 2016-10-25 23:24:14 +00:00
Elliott Hughes 42937492c8 Add StartsWithIgnoreCase/EndsWithIgnoreCase.
This has come up a couple of times now.

Bug: wanted as part of http://b/32094640
Test: ran tests
Change-Id: I51b67074b7ddeedd771d7be9651ba33e05491b33
2016-10-25 14:56:04 -07:00
Mark Salyzyn 60636fa872 logd: getTag() functional for chatty entries
getTag() becomes invalid when entry is dropped because mMsg
disappears to save space; but the per-tag spam filter depends on it
still being valid.  Conserve space in LogBufferElement by optimizing
the size of the fields, then add a new mTag field that is set in the
object constructor.  Add an isBinary() method.

SideEffects: save 12 bytes/log message overhead on 64-bit.
Test: define DEBUG_CHECK_FOR_STALE_ENTRIES and look for stale entries
Bug: 32247044
Change-Id: Iaa5f416718a92c9e0e6ffd56bd5260d8b908d5c0
2016-10-25 21:48:33 +00:00
Treehugger Robot d97efe0383 Merge "log/logd.h should point to log/log.h" 2016-10-25 19:18:50 +00:00
Zhenhua WANG f2804e5985 Upgrade native bridge to version 3 to support namespace
Native bridge implements namespace related interfaces in version 3.
The namespace semantic here is same as Android dynamic linker's.
Native loader wraps library loading functions of dynamic linker and
native bridge. Thus, Android runtime is able to load native library
of different ISA on one device by calling native loader directly.

Bug: http://b/28242460
Test: mm && make test-art-host -j48
Change-Id: Idde2b9d99fb6ebe547407c716b5478a231f745a7
Signed-off-by: Zhenhua WANG <zhenhua.wang@intel.com>
2016-10-25 11:11:38 -07:00
Mark Salyzyn 57ba9c96e3 log/logd.h should point to log/log.h
Test: compile
Bug: 32395896
Bug: 30465923
Change-Id: I1ee85594a0dc6b094480161dc5dbec71eaecdfb9
2016-10-25 09:21:00 -07:00
Elliott Hughes 4818194a25 Merge "Allow multiple tcp adb connection to same device." 2016-10-24 23:31:14 +00:00
Treehugger Robot dd153ef247 Merge "logd: address code fragility in last watermarks" 2016-10-24 23:09:15 +00:00
Treehugger Robot 9fa133cc28 Merge "fix regression from android_lookupEventTag_len()" 2016-10-24 23:08:47 +00:00
Treehugger Robot 291fd678e5 Merge changes I8c58d6bd,I0a19fd87
* changes:
  bootstat: drop event_log_list_builder
  liblog: logd: logcat: Split out log/logger.h into public and private.
2016-10-24 22:49:29 +00:00
Josh Gao 63660add3f Merge changes I34ba5757,Ie65a762a
* changes:
  adb: fix test_sighup.
  adb: fix race condition in test_non_interactive_sigint.
2016-10-24 21:13:18 +00:00
Treehugger Robot 11a7165ecf Merge "liblog: restructure log/log.h and android/log.h" 2016-10-24 20:42:29 +00:00
Mark Salyzyn 9f53cac1b4 fix regression from android_lookupEventTag_len()
Commit 807e40ecc9 'liblog: logd: Add
android_lookupEventTag_len()' which addressed a Dirty Shared memory
leak resulted in a regression. Most notably logcat <tag> stopped
working for the events log buffer.

AndroidLogEntry::tag also requires callers to check out
AndroidLogEntry::tagLen as tag is no longer guaranteed to be
nul terminated.

Test: logcat-unit-tests --gtest_filter=logcat.event_tag_filter
Bug: 31456426
Change-Id: Ibe5236131b640eb5b7e3df0ab4b5f3e25b85ad45
2016-10-24 13:39:19 -07:00
Josh Gao 470622f064 adb: fix test_sighup.
Bug: http://b/32336914
Test: python test_device.py
Change-Id: I34ba5757b5e650d79327dc6779064acd850ce28e
2016-10-24 13:34:20 -07:00