Commit graph

14406 commits

Author SHA1 Message Date
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
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
Christopher Ferris
c4b1f0a99c 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: I4269d2b96ebadcc405f478265a07a830aaf9713c
2015-06-03 12:02:31 -07:00
Mark Salyzyn
49ed105fd9 init.rc: logd: Add logpersistd (nee logcatd)
(cherry pick from commit 100658c303)

- logpersistd is defined as a thread or process in the context of the
  logd domain. Here we define logpersistd as logcat -f in logd domain
  and call it logcatd to represent its service mechanics.
- Use logcatd to manage content in /data/misc/logd/ directory.
- Only turn on for persist.logd.logpersistd = logcatd.
- Add logpersist.start, logpersist.stop and logpersist.cat debug
  class executables, thus only in the eng and userdebug builds.

ToDo: Wish to add Developer Options menu to turn this feature on or
off, complicated by the fact that user builds have no tools with
access rights to /data/misc/logd.

Bug: 19608716
Change-Id: I57ad757f121c473d04f9fabe9d4820a0eca06f31
2015-06-02 15:28:36 -07:00
Mark Salyzyn
cdb468abb3 logcat: -f run in background
(cherry pick from commit 3ef730c57f)

- if saving to file, set SP_BACKGROUND policy
- if saving to file, set BATCH priority
- sort include files

Bug: 19608716
Change-Id: I00acb8b8db0d2ff9ff36c97f9e74604d31938376
2015-06-02 15:27:41 -07:00
Mark Salyzyn
117c322040 logcat: -f flag to continue
(cherry pick from commit f3555d9427)

On startup, check the current logging content, then grab logs from
that time forward rather than restarting from the beginning. Add
support for reading tail time down to the nano-second.

Bonus, permits us to create a logcatd logpersist daemon

Bug: 19608716
Change-Id: Iaab58de4c02b7f97c69de12cf954fedc2163059e
2015-06-02 15:26:53 -07:00
Mark Salyzyn
cdb73b034d init: change exec parsing to make SECLABEL optional
(cherry pick from commit 17fff893c0)

Allow SECLABEL to be - to denote default

Change-Id: I58cdc6c805dc6e50dc42b7e13e72d0eaf4864f11
2015-06-02 15:26:02 -07:00
Mark Salyzyn
473a50f168 rootdir: init.trace.rc too early
(cherry pick from commit 89357d23a1)

debugfs is mounted on boot

Bug: 21566233
Change-Id: I2ba106fbb1e8164ff3d8b2d5b16a16d7926c2732
2015-06-02 14:40:10 -07:00
Andres Morales
c6d5cd18f8 Merge "[gatekeeperd] verify a password after enrolling successfully" into mnc-dev 2015-06-02 17:44:17 +00:00
Andres Morales
531e3e83c2 [gatekeeperd] verify a password after enrolling successfully
Bug: 20918106
Change-Id: Ia3cb6d1375d9ee2a6e543ee97d37b7c4f0459447
2015-06-02 10:43:21 -07:00
Svetoslav
23d8407465 Improve adb install help.
Bug: 21365060
Change-Id: I0a4ea5cf3a2f37a82161b30f7eec5781d175aa8f
2015-06-01 23:59:20 +00:00
Mark Salyzyn
42ac34f740 logd: test modernization
(cherry pick from commit 62d6a2a921)

Bug: 19603976
Change-Id: Ie920c128e7e6a436fea7a96c7d68bc39e13a2ad4
2015-06-01 14:27:02 -07:00
Mark Salyzyn
222f8c3ac7 logd: whitelist should not preserve expire messages
(cherry pick from commit c5bf3b8304)

Change-Id: I56275c73191b96aa21e7b4049d401e1f44211f9b
2015-06-01 14:27:02 -07:00
Mark Salyzyn
fbf96b55d9 logd: KISS & fix preserve a day
(cherry pick from commit 5921276a16)

Code in 833a9b1e38 was borken,
simpler approach is to simply check last entry (to save a
syscall) minus EXPIRE_HOUR_THRESHOLD. This does make longer logs
less likely to call upon the spam detection than the algorithm
being replaced, but sadly we ended up with a log entry in the
future at the beginning of the logs confounding the previous
algorithm.

Bug: 21555259
Change-Id: I04fad67e95c8496521dbabb73b5f32c19d6a16c2
2015-06-01 14:27:02 -07:00
Mark Salyzyn
d4bdb7df9b logd: deal with sloppy leading expire messages
(cherry pick from commit 5392aac95d)

The odds of chatty content also leading the logs is pretty high eg:

 1799 12017 I logd: uid=10007 chatty comm=Binder_B, expire 4 lines
 1799  1829 I logd: uid=10007 chatty comm=Binder_2, expire 4 lines
 1919 20637 I logd: uid=10007 chatty comm=m.sersistent, expire 1 line
 1919 20638 I logd: uid=10007 chatty comm=s.persistent, expire 1 line
 1919  2316 I logd: uid=10007 chatty comm=UlrDispatch, expire 4 lines
19379 20634 I logd: uid=10045 chatty, expire 14 lines
19379 19388 I logd: uid=10045 chatty comm=lizerDaemon, expire 4 lines
  591  4396 I logd: uid=1000 chatty comm=Thread-220, expire 5 lines
  591  1377 I logd: uid=1000 chatty comm=Thread-92, expire 4 lines
 1919  2267 I logd: uid=10007 chatty comm=WifiScanner, expire 4 lines
  591  4397 I logd: uid=1000 chatty comm=DhcpClient, expire 4 lines
  591  4398 I logd: uid=1000 chatty comm=Thread-222, expire 4 lines
  226   580 D CommandListener: Setting iface cfg

Change-Id: I5ab24bc7bf5d2690bae7e789831b07f23ff8bcc6
2015-06-01 14:27:02 -07:00
Christopher Ferris
7e2cb84e9c Modify the code to avoid potential deadlocks.
If the signal to dump a thread is never delivered, then it's
possible for a deadlock. The signal handler is responsible for
unlocking and deleting the ThreadEntry created for the pid/tid
combination. This means if the signal is lost, the ThreadEntry
gets stuck locked and never deleted. If a second attempt to get
a backtrace of this thread occurs, there is a deadlock.

Also, decrease the timeout from 10 seconds to 5 seconds. The original
10 seconds was because the unwind was actually done in the signal
handler. Now the signal handler does nothing but copy the ucontext
structure and let the caller do the unwind.

Bug: 21086132
(cherry picked from commit 2d09171758)

Change-Id: I414c500eb08983a5017caf3fce4f499465575a9d
2015-06-01 14:10:17 -07:00
Andreas Gampe
e2452b4bf3 LibNativeBridge: Version 2
Add a callback function to retrieve "signal handler" from the bridge,
if the bridge wants it to be managed by the runtime. The signal handler
will be invoked after the runtime's own one, and before any other
chained handler.

Add a callback function to check compatibility of the bridge with the
library.

Add a function to expose the native bridge version. Add a test for this
function.

Bug: 20217701

(cherry picked from commit a6ac9ce98b)

Change-Id: Ic23a60b949f119c7d8b0e7cb27a61e6c16532a23
2015-05-31 16:58:24 -07:00