Commit graph

14421 commits

Author SHA1 Message Date
Andres Morales
835d96eae5 [gatekeeperd] handle upgrades from software version to HAL
Certain devices, like Shamu, are currently running an interim
software-only gatekeeper. When the HAL for those devices is merged,
we need to handle upgrading to the HAL smoothly.

Bug: 21090356
Change-Id: I5352bc547a43671a08249eae532e8b3ce6b90087
2015-06-22 13:12:41 -07:00
Andres Morales
c7ab1e8177 [gatekeeperd] add fast path for SW password verification
Bug: 21445004
Change-Id: I5e36ddbefaf1fa8de8623858fd785ac8fb651a4f
2015-06-22 12:05:57 -07:00
Elliott Hughes
1cddc2092f Ignore ro.adb.secure in user builds.
Require authorization by default, and remove the ability to override
that in user builds. (userdebug and eng are still free to do whatever
they want.)

Bug: http://b/21862859
Change-Id: Ibf8af375be5bf1141c1ad481eee7a59fb10a7adb
(cherry picked from commit 5cba504215)
2015-06-19 13:26:02 -07:00
Mike Lockwood
6ee7ff4268 Merge "libusbhost: Fix problem reading USB string descriptors on some quirky devices" into mnc-dev 2015-06-18 22:24:42 +00:00
Mike Lockwood
0dd1aab7b5 libusbhost: Fix problem reading USB string descriptors on some quirky devices
Some devices fail to send USB string descriptors if you attempt to read more
than 255 bytes

Bug: 21871761
Change-Id: Id5b8865179f80523f0ad5b6028d49dd99db2b36b
2015-06-18 13:38:31 -07:00
Erik Kline
60adb5fac8 Merge "Qualify IPv6 link-local DNS servers with an interface name" into mnc-dev 2015-06-18 08:35:30 +00:00
Erik Kline
ba48ff7a59 Qualify IPv6 link-local DNS servers with an interface name
Bug: 21562630
Bug: 21764392
Change-Id: I7d271ae0f3fd92f70049017d38ccc15e3c1dda83
2015-06-18 15:44:41 +09:00
Elliott Hughes
e79d0d556f init support for cgroups.
This adds the "writepid" option that instructs init to write the child's
pid to the given filenames (such as /dev/cpuctl/bg_non_interactive/cgroup.procs
and/or /dev/cpuset/foreground/cgroup.procs).

Bug: http://b/21163745
Change-Id: I121bb22aa208bc99c4fb334eb552fdd5bcc47c1a
(cherry picked from commit d62f0608d9)
2015-06-17 15:21:52 -07:00
Yusuke Sato
d50393057a processgroup: change the polling interval for killProcessGroup()
to make the function faster on average. Since killing a process
takes about 40-60ms on a recent device, the previous logic tends
to sleep too long. This CL does not significantly change the total
timeout (old code: 204ms, new code: 200ms).

Bug: 21813611
Change-Id: Ica44b2437ccccaebadcf585d7a09d993ce71a499
2015-06-16 13:59:32 -07:00
Mark Salyzyn
d5600fd40f logd: missing klogd content
(cherry pick from commit ee49c6a670)

- regression in log_strtok_r (part deux) In commit
      'logd: fix kernel logline stutter'
  2c3b300fd8 we introduced log_strtok_r.
  as a replacement for strtok_r that dealt with a problem with
  some kernel log messages. Fix is to refine definition of
  is_timestamp to not match on patterns like [0], requiring
  a single period. Another fix is to refine definition of
  is_prio to properly escape non-digit content.
- Missing content because SYSLOG_ACTION_SIZE_BUFFER with added logging
  is too short for full read of SYSLOG_ACTION_READ_ALL dropping
  initial content. Add a margin for additional 1024 bytes.
- Absolute _first_ log entry has sequence number of 1, which is
  specifically dropped, start sequence count at 1 rather than 0.
- Remove trailing space for efficiency.
- If tag exists but no content, trick into kernel logging.

Bug: 21851884
Change-Id: I0867a555a3bca09bbf18d18e75e41dffffe57a23
2015-06-15 14:22:02 -07:00
Mark Salyzyn
bd1ef90448 logd: filter on __android_log_is_loggable
(cherry pick from commit e59c469fa8)

- Default level when not specified is ANDROID_LOG_VERBOSE
  which is inert.

Bug: 20416721
Bug: 19544788
Bug: 17760225
Change-Id: Icc098e53dc47ceaaeb24ec42eb6f61d6430ec2f6
2015-06-15 07:41:03 -07:00
Mark Salyzyn
e9c9106fbb liblog: __android_log_is_loggable support global properties
(cherry pick from commit c158456f50)

- Add support for "log.tag" and "persist.log.tag" global
  logging properties, effectively a runtime default minimum
  logging level.
- Add a thread-safe single level cache plus selective logic for the
  four properties being checked to help speed up logging decision
  on subsequent identical calls.
- Using new __system_property_area_serial() to make for
  efficient (<100ns) handling of cache misses. Despite adding
  two new properties, we are 8 times faster on subsequent calls
  even if the properties do not exist.
- A NULL or blank tag is no longer directed to return default,
  it will check the pair of global logging properties first.
- Add liblog.is_loggable gTest
- Fixup liblog.android_logger_get_, allow no content in crash buffer
- Fixup liblog.max_payload, lowered logd priority increases latency

Bug: 19544788
Bug: 21696721
Change-Id: Ideb887755aa3f1fd14a2603bda1fe23cba49642c
2015-06-15 07:34:07 -07:00
Christopher Ferris
5c57518b6f Remove PtraceRead error message.
This error message has no meaning and makes it look like an unwinding
failure occurred. These messages are showing up more often now
that a lot more of debuggerd is using the ReadWord and Read calls.

If a higher level function wants to indicate there is an error, then
it can add a more meaningful error.

Bug: 21818730
(cherry picked from commit 35c8136d96)

Change-Id: Ie6e20fbc18702fde935f2cf8cbf1b297fda43282
2015-06-12 23:32:20 -07:00
Tim Murray
e5b0c83785 Merge "add cpuset support to libcutils" into mnc-dev 2015-06-12 18:38:36 +00:00
Spencer Low
d62bce8040 adb: win32: fix key files reading/writing
The issue is that adb uses fopen() with "e" (presumably to open the file
with O_CLOEXEC), but that flag causes MSVCRT.DLL to return an error. So
when adb_auth_host.cpp goes to read or write the adbkey files, it fails.

The quick fix is to not use the "e" option on adb host code since it
isn't necessary there, compared to adbd.

An alternative fix would be to have a fopen() wrapper on Windows that
filters out the "e" option.

Bug: http://b/21806456
Bug: https://code.google.com/p/android/issues/detail?id=175077
Change-Id: I7d8ba2847dab0ed558ffe156e79093251eb253c9
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
(cherry picked from commit 9b9603148b)
2015-06-12 11:02:37 -07:00
Tim Murray
b769c8d24f add cpuset support to libcutils
bug 21782794

Change-Id: I249531754fb29442dc3c7434d77dbb103f4220a7
2015-06-11 18:35:46 -07:00
Sasha Levitskiy
350926ef2f Merge "Fingerprint: Use integral types for remove()" into mnc-dev 2015-06-10 21:35:25 +00:00
Sasha Levitskiy
53afac018d Fingerprint: Use integral types for remove()
Bug 21282699

Change-Id: I8fdb2112f3f930f080571da6a6b908f5f0581bdd
Signed-off-by: Sasha Levitskiy <sanek@google.com>
2015-06-10 14:29:17 -07:00
Oleksiy Vyalov
a08d313bb8 Extend run-as with optional --user argument.
1. Calculate AID for spawned process as (100000 * $user) + uid_from_packages.list
2. Use /data/user/$user/$packageDir as a root of a new process if $user != 0.

Change-Id: I761dfb481114bd51e5a950307fcaf403e96eef10
(cherry picked from commit da31778f3b)
2015-06-10 12:09:10 -07:00
Jeff Sharkey
4d7f052afb Merge "New "selinux.restorecon" control property." into mnc-dev 2015-06-09 23:30:09 +00:00
Jeff Sharkey
76417519ec New "selinux.restorecon" control property.
This new property is used as a control verb for running a recursive
restorecon at the path contained in the property value.

Shifts both SELinux actions to occur before the actual property set
occurs, so setters can watch for completion.

Bug: 21121357
Change-Id: I3db3eb876ae66e144b3bfd648349b66a028511fd
2015-06-09 13:39:17 -07:00
Ying Wang
c26e391dc4 Merge "Fix comparison between signed and unsigned error on darwin" into mnc-dev 2015-06-09 19:55:36 +00:00
Colin Cross
20bbd4f449 Fix comparison between signed and unsigned error on darwin
mode_t is a uint16_t on darwin, which causes
sb.st_mode & ~S_IFMT
to produce an int when the uint16_t is promoted for the operator.
Cast to unsigned int before comparing against 0660U.

Change-Id: Ib1439c08d9e2b297eeeba701891508d269c19a3d
(cherry-pick from commit 56b37345d9)
2015-06-09 12:44:41 -07:00
Mark Salyzyn
3a1ff5ab65 Merge "Lower the priority of the threads in logd/logcat." into mnc-dev 2015-06-09 19:42:45 +00:00
Riley Andrews
d98f4e8af5 Lower the priority of the threads in logd/logcat.
sched_batch implies only a penalty to latency in scheduling, but
does not imply that the process will be given less cpu time. Increase
the nice level to 10 to prioritize it below ui threads.

Bug: 21696721
Change-Id: I075af059dc755402f7df9b0d7a66cca921ff04b2
2015-06-09 12:36:45 -07:00
Mark Salyzyn
03196c9c75 logd: build breakage
(cherry pick from 3e21de2915)

OPEN_BRACKET_SPACE comparison always false

Change-Id: I1ff4288b4b79a49702727d3a8b8c8f179f500951
2015-06-08 14:57:07 -07:00
Mark Salyzyn
4d5f54174a Merge "logd: fix kernel logline stutter" into mnc-dev 2015-06-08 20:56:02 +00:00
Mark Salyzyn
df5902c4f3 logd: fix kernel logline stutter
(cherry pick from commit 2c3b300fd8)

- look for cases where one log line contains two without a newline.
- rare condition, occurs when a printk does not have
  a terminating newline under certain race conditions.
- the newline may be performed broken up as a second call
- the timestamps can be reversed (showing the race effects).
- driver(s) should really have the newline in their log messages.

Change-Id: Ibfb56b32047da3d6513db059ca6edad0f0105168
2015-06-08 13:55:14 -07:00
Eino-Ville Talvala
414fb90eae Camera: Add new set video format/dataspace command
This allows the video encoding subsystem inform the camera what format
and dataspace should be used for metadata-mode buffers.

This is necessary to allow software encoders and other generic
consumers that cannot interpret
HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED buffers.

Bug: 13222807
Change-Id: I01090dc4dce11f075f7d3cd86daca5ecf3d9e995
2015-06-08 13:21:27 -07:00
Mark Salyzyn
dca1bb5e79 Merge "logd: filters remove leading expire messages and rate" into mnc-dev 2015-06-05 21:58:07 +00:00
Elliott Hughes
8bdd4bbc1c Add a working Windows tmpfile(3) to fastboot.
Windows' tmpfile(3) implementation requires administrator rights because
it creates temporary files in the root directory. Write an alternative
that uses the user's temporary directory instead.

Bug: http://b/21558406
Change-Id: Ic9aece5c69429797a332a97681a76b76ac3551bf
(cherry picked from commit a26fbeeaa4)
2015-06-05 13:28:44 -07:00
Jim Miller
72ffc3c02a Fix error on systems where ssize_t isn't 64-bits
Fixes bug 21491366

Change-Id: If34ab89fdb410350fa5773b5495a27493a6d1211
2015-06-05 12:25:17 -07:00
Mark Salyzyn
c1e9d6dada logd: filters remove leading expire messages and rate
(cherry pick from commit 047cc0729f)

- Cleanup resulting from experience and feedback
- When filtering inside logd, drop any leading expire messages, they
  are cluttering up leading edge of tombstones (which filter by pid)
- Increase and introduce EXPIRE_RATELIMIT from 1 to 10 seconds
- Increase EXPIRE_THRESHOLD from 4 to 10 count
- Improve the expire messages from:
   logd : uid=1000(system) too chatty comm=com.google.android.phone,
                                                   expire 2800 lines
  change tag to be more descriptive, and reduce accusatory tone to:
   chatty : uid=1000(system) com.google.android.phone expire 2800
                                                               lines
- if the UID name forms a prefix for comm name, then drop UID name

Change-Id: Ied7cc04c0ab3ae02167649a0b97378e44ef7b588
2015-06-05 10:20:55 -07:00
Christopher Ferris
5a9233444b Merge "Change the 64 bit map address format." into mnc-dev 2015-06-05 01:02:42 +00:00
Paul Lawrence
3678a5fb8d Merge "Move crypt commands to a different listener in vold" into mnc-dev 2015-06-04 21:32:44 +00:00
Elliott Hughes
25a1341f44 Merge changes from topic 'fastboot' into mnc-dev
* changes:
  Don't say "update package missing" unless we mean it.
  'usb' doesn't need to be global in fastboot.
  Add "fastboot --version".
  libziparchive: fix fallocate failures
  Use base::WriteFully in zip_archive.
  libziparchive: fix clang build
  Avoid mapping output to memory while writing to a file.
2015-06-04 20:47:23 +00:00
Elliott Hughes
966339b2d6 Don't say "update package missing" unless we mean it.
unzip_to_file reports failures itself these days, so there's it's unhelpful
of the caller to just guess what might have gone wrong.

Bug: http://b/21558406
Change-Id: I1e3d06c6cf902b8c6ef333dc60fd8f49680a493b
(cherry picked from commit acdbe92c60)
2015-06-04 13:26:57 -07:00
Elliott Hughes
c688c23286 'usb' doesn't need to be global in fastboot.
Bug: http://b/21558406
Change-Id: Id014399640865d889918661bae0161b3165eee48
(cherry picked from commit c0ce65f961)
2015-06-04 13:26:48 -07:00
Elliott Hughes
e283ca29c5 Add "fastboot --version".
So bug reporters can actually tell us what they're running.

Bug: http://b/21558406
Bug: http://b/21583225
Change-Id: If2a4ae97b4792aa321566603ce2c354a72d32307
(cherry picked from commit 379646b2ca)
2015-06-04 13:26:40 -07:00
Badhri Jagan Sridharan
71aebefe49 libziparchive: fix fallocate failures
The objective of fallocate call seems to be to
make sure that we have enough enough space left
in the disk to house the uncompressed file.
But, fallocate is only supported in the following
file systems:
btrfs, ext4, ocfs2, and xfs

Return error only when fallocate fails due to
lack of space. The immediate ftruncate call is
going to take of the majority of other errors.

Bug: http://b/21558406
Bug: 21561449
Change-Id: I7083f3c7e5d745bd6e8a190ac9020297d638d9d4
(cherry picked from commit a68d0d1fe4)
2015-06-04 13:26:29 -07:00
Narayan Kamath
67ab5d9505 Use base::WriteFully in zip_archive.
We're already linking against libbase but we'll have to add
a libbase dependency to every target that includes libziparchive
as a STATIC_LIBRARY dependency, given that there's no way to
express that what we want (except by adding a LOCAL_WHOLE_STATIC_LIBRARY
dependency on libbase to libziparchive but that seems bad too)

Bug: http://b/21558406
Change-Id: I294ad389a9c61a1134a7bc323da25b0004a8f1e0
(cherry picked from commit e97e66ea7c)
2015-06-04 13:26:22 -07:00
Greg Hackmann
4ba18cf3ff libziparchive: fix clang build
Bug: http://b/21558406
Change-Id: I69105a9cde05b182f65c7e574282bb4b48b66e95
Signed-off-by: Greg Hackmann <ghackmann@google.com>
(cherry picked from commit d6eac24aac)
2015-06-04 13:26:12 -07:00
Narayan Kamath
785a128aec Avoid mapping output to memory while writing to a file.
It's unnecessary, and causes issues when the uncompressed
output is large.

Bug: http://b/21558406
Change-Id: I99cfb3933b094c2826c7e6c6de9aab03478fcc53
(cherry picked from commit f899bd534b)
2015-06-04 13:25:52 -07:00
Mark Salyzyn
6f1457adc5 logd: switch to unordered_map from BasicHashtable
(charry pick from commit 511338dd57)

BasicHashtable is relatively untested, move over to
a C++ template library that has more bake time.

Bug: 20419786
Bug: 21590652
Bug: 20500228
Change-Id: I926aaecdc8345eca75c08fdd561b0473504c5d95
2015-06-04 11:03:37 -07:00
Mark Salyzyn
5d332907f0 liblog: logcat: Add printable format modifier
(cherry pick from commit b932b2f8ba)

- added printable format modifier:
  logcat -v printable
- opencoded borrowed individual utf8 validity checking algorithm
  from utf8_length() in libutils/Unicode.cpp
- if considered basic one-character ASCII, use popular \x escape
  sequences for non-printable
- logprint convert to C comments to drop mixed-mode

Bug: 19000361
Change-Id: I122a5b8fb41216fc0bc816178c0b768f3df56586
2015-06-04 08:37:14 -07:00
Andres Morales
b8216007c6 Merge "[gatekeeperd] track gk failure record changes" into mnc-dev 2015-06-04 01:27:34 +00:00
Andres Morales
e1f827fc1f [gatekeeperd] track gk failure record changes
Bug:21118563
Change-Id: Ia726dc4db6ec5c6a1e8e08a689ec82568ff1e5aa
2015-06-03 18:24:36 -07:00
Paul Lawrence
37fcc5d73e Move crypt commands to a different listener in vold
In order to prevent this bug from happening, we must allow vold cryptfs
commands to complete while a long running mount is underway.

While waiting for vold to be changed to a binder interface, we will simply
create two listeners, one for cryptfs and one for everything else.

Bug: 19197175
Change-Id: Ie3d9567819ced7757b0a8f391547f27db944153c
2015-06-03 14:19:29 -07:00
Nick Kralevich
32512e7167 tzdatacheck: don't hard code SELinux domain name
An automatic domain transition is already defined by SELinux
policy. Avoid having redundant information on the exec line.

This commit depends on commit 17fff893c0
which made the SELinux process label optional.

(cherrypicked from commit 221fca7ddd)

Change-Id: I89464f2bd218c7d6e8db08aa6bed2b62ec6dad2a
2015-06-03 13:36:24 -07:00
Christopher Ferris
21bd040eff Change the 64 bit map address format.
Previously, the map printing in tombstones for 64 bit devices uses
a variable length value. This means that the maps are not lined up.
The new format is to print the map as 00000000'00000000 in all ways.

Also fix a bug where the backtrace_map_t did not initialize all
parameters.

Add unit tests for all of the dump_all_maps function.

Bug: 20950813
(cherry picked from commit 862fe02919)

Change-Id: Ife5c48bddeb19006a98f9e87520474e97b97f6d9
2015-06-03 12:12:31 -07:00