Commit Graph

16747 Commits

Author SHA1 Message Date
Elliott Hughes 4417c38a1e am a54f14eb: Merge "adb unittest: get test_unicode_paths passing on win32"
* commit 'a54f14eb95d73c91aaa2a4387a79d897a4731060':
  adb unittest: get test_unicode_paths passing on win32
2015-08-28 20:07:47 +00:00
Elliott Hughes a54f14eb95 Merge "adb unittest: get test_unicode_paths passing on win32" 2015-08-28 20:00:53 +00:00
Elliott Hughes be881b65ca am 1d9253f2: Merge "adb: fix adb install and adb push exit code, error handling, unittest"
* commit '1d9253f255c60069c4187f0c43b2b22015fd5688':
  adb: fix adb install and adb push exit code, error handling, unittest
2015-08-28 19:52:18 +00:00
Elliott Hughes 1d9253f255 Merge "adb: fix adb install and adb push exit code, error handling, unittest" 2015-08-28 19:46:46 +00:00
Yabin Cui adab77ad50 am 7b6fa7ed: Merge "adb: remove adisconnect in aremotesocket."
* commit '7b6fa7ed304cbd682e4c4cb539f2e4f8047aedc4':
  adb: remove adisconnect in aremotesocket.
2015-08-28 18:57:35 +00:00
Yabin Cui 7b6fa7ed30 Merge "adb: remove adisconnect in aremotesocket." 2015-08-28 18:50:31 +00:00
Spencer Low d8cce1817b adb: fix adb install and adb push exit code, error handling, unittest
adb push was not returning a bad exit code when write_data_file() or
write_data_link() failed. I encountered this when running the unittest
on Windows which can get into situations where stat() succeeds, but
open() fails due to pre-existing exclusive file access (which typically
doesn't exist on unix).

The same code is used by adb install, so this also fixes its error
handling.

Fixed some fd leaks and propagation of errors when reading a file.

Fixed a unittest to close temp files before reading them.

Change-Id: Ieba0026fa4c79eb0484676e4f2faaac9603ef584
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-28 11:38:28 -07:00
Nick Kralevich 5e44f5cc0c am 2c58af52: Merge "VectorImpl.cpp: fix benign multiplication overflow"
* commit '2c58af52232f0c8b4ab09d75eba66d1283805cab':
  VectorImpl.cpp: fix benign multiplication overflow
2015-08-28 17:28:37 +00:00
Nick Kralevich 2c58af5223 Merge "VectorImpl.cpp: fix benign multiplication overflow" 2015-08-28 16:54:02 +00:00
Nick Kralevich c76698f24e VectorImpl.cpp: fix benign multiplication overflow
j is a ssize_t, which can go negative. If it goes negative,
the resulting multiplication of mItemSize*j doesn't make
any sense. Since the value is never used, just don't perform
the calculation if j < 0.

Bug: 23607865
Change-Id: I14f6f6506645d582f7d67a2e2d60ead3cb18b957
2015-08-28 06:40:23 -07:00
Spencer Low de4505f819 adb unittest: get test_unicode_paths passing on win32
The Python 2 subprocess class doesn't use Unicode, so as a work-around
write the command line to a UTF-8 batch file and run that.

I modified the test to use u'blah' without .encode('utf-8') because the
Python docs recommend dealing with string variables like that. When
formatting a string with a unicode parameter, use u'foo' on the constant
string to make it unicode.

I also tested this on Linux and it seems to work fine (I did ls in the
middle of the test to make sure the filenames came out right, etc.).

I had to close the temporary files before adb tries to read/write them
because filesystem semantics are different on Windows (technically I
might be able to modify adb to try to open files with more permissive
share flags, but then I'm not sure if Python uses the right share flags.
Basically, I'd be opening another can of worms.).

Fixed the test to delete a temp file on the device once it is done.

Change-Id: Id0c34e26d7697fbbb47a44ae45298bed5e8c59d6
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-28 01:20:03 -07:00
Yabin Cui fd28f327ee adb: remove adisconnect in aremotesocket.
The function of remote_socket_disconnect() is to make sure
the local_sockets and remote_sockets are closed when the binded
transport is disconnected. However, as we call close_all_sockets()
in handle_offline(), we don't need remote_socket_disconnect() any more.

Change-Id: I575f632d9f8703149f34e0210eb698a56e2516a9
2015-08-27 19:35:47 -07:00
Bill Yi 35cee26733 Merge commit 'f4ba463105646df0c4d65c368fbd201cfe62d08f' into HEAD 2015-08-27 16:30:48 -07:00
Nick Kralevich eb45890579 am f4355868: Merge "android_memset.c: Use sanitized shifts"
* commit 'f4355868cbce0713331bbb04b063515d6de4c795':
  android_memset.c: Use sanitized shifts
2015-08-27 23:24:35 +00:00
Nick Kralevich f4355868cb Merge "android_memset.c: Use sanitized shifts" 2015-08-27 23:17:22 +00:00
Yabin Cui a483eae5b1 am 4f8d5b01: Merge "adb: disconnect: fix write-after-free memory corruption and crash."
* commit '4f8d5b01281e751168718c7b0a74db34352aaf1e':
  adb: disconnect: fix write-after-free memory corruption and crash.
2015-08-27 23:05:43 +00:00
Yabin Cui 4f8d5b0128 Merge "adb: disconnect: fix write-after-free memory corruption and crash." 2015-08-27 22:58:03 +00:00
Yabin Cui f4b9928563 adb: disconnect: fix write-after-free memory corruption and crash.
Transport atransport objects are semi-reference counted: the input and
output threads each hold a reference. The adb disconnect command was
calling transport_unref to release a reference that it never had in the
first place. This meant that the refcount dropped to zero and the object
was deleted before either the input or output thread released its
reference. When that last thread released its reference, it wrote to
freed memory and also sometimes crashed.

This fix is to not release any unheld reference, instead it just kicks
the transport to break remote_read in output_thread. So all transport
close flow goes the following way:
output_thread (exit) -> main thread (offline the transport) ->
input thread (exit) -> main thread (destroy the transport)

Change-Id: Iad1fe718acc8716f3a79c8c22b426a1b2450452c
2015-08-27 14:41:07 -07:00
Duane Sand c348a88376 android_memset.c: Use sanitized shifts
Avoid checks and traps on msb=1 unsigned shifts.

Change-Id: I5203a4290296b5557c0420ce0debad3b60d48233
2015-08-27 14:32:17 -07:00
Nick Kralevich b7699c6550 am e6d3cf39: Merge "android_memset.c: Use __attribute__((no_sanitize("integer")))"
* commit 'e6d3cf393749556d6bb6b8ea51bb1252cfb061f3':
  android_memset.c: Use __attribute__((no_sanitize("integer")))
2015-08-27 20:44:40 +00:00
Nick Kralevich e6d3cf3937 Merge "android_memset.c: Use __attribute__((no_sanitize("integer")))" 2015-08-27 20:36:08 +00:00
Nick Kralevich d9eda62875 android_memset.c: Use __attribute__((no_sanitize("integer")))
Turn off integer sanitization on android_memset. memset()ing is
expected to be a fast operation.

Avoid the use of the "while (size--) { }" construct, which harmlessly
underflows.

Change-Id: Ia61ff2323c759bf52df7e70b8be2fae0b0366dda
2015-08-27 13:14:36 -07:00
Yabin Cui 9f91681d50 am f3068123: Merge "adb: fix a fake data race on transport:kick reported by tsan."
* commit 'f3068123039e81cee85ce9103d01b5b2aceb2ba3':
  adb: fix a fake data race on transport:kick reported by tsan.
2015-08-27 18:29:50 +00:00
Yabin Cui f306812303 Merge "adb: fix a fake data race on transport:kick reported by tsan." 2015-08-27 18:25:02 +00:00
Bertrand Simonnet 414f6226fc am c3f866f6: Merge "metricsd: Use system properties to store build time metadata."
* commit 'c3f866f60cedc7eade674a7a8eec740dd938264f':
  metricsd: Use system properties to store build time metadata.
2015-08-27 18:01:45 +00:00
Nick Kralevich 212e4f1fe1 am d34f4198: Merge "strdup16to8.c: fix benign integer underflow."
* commit 'd34f419826e74640dfe88c50d171a0cd8580eeda':
  strdup16to8.c: fix benign integer underflow.
2015-08-27 18:01:44 +00:00
Bertrand Simonnet c3f866f60c Merge "metricsd: Use system properties to store build time metadata." 2015-08-27 17:58:23 +00:00
Nick Kralevich d34f419826 Merge "strdup16to8.c: fix benign integer underflow." 2015-08-27 17:54:32 +00:00
Nick Kralevich 2b98a9eec0 strdup16to8.c: fix benign integer underflow.
A size_t value is not allowed to go below zero.

Change-Id: Ic888c6605d911e0b5dbee1a2fe1daf41e616e106
2015-08-27 10:30:50 -07:00
William Luh a03c55c7e4 am 001c87c3: Merge "Add macro to call event logger for errors."
* commit '001c87c3cd4676ef14f7c08ade380fbb7870eda6':
  Add macro to call event logger for errors.
2015-08-27 16:26:24 +00:00
William Luh 001c87c3cd Merge "Add macro to call event logger for errors." 2015-08-27 16:22:02 +00:00
Mark Salyzyn 928c6124ee am 96ac40af: Merge "logd: klogd and Mediatek"
* commit '96ac40afbf9671e3feaaeb09735fcbb65b0ef733':
  logd: klogd and Mediatek
2015-08-27 14:23:18 +00:00
Mark Salyzyn 96ac40afbf Merge "logd: klogd and Mediatek" 2015-08-27 14:15:42 +00:00
Yabin Cui 860169cbf8 am 804180b2: Merge "adb: fix a data race in local_socket_event_func."
* commit '804180b2ccf2ef4dedad7d136c060ecbdda7aac5':
  adb: fix a data race in local_socket_event_func.
2015-08-27 05:22:52 +00:00
Bart Sears f4ba463105 am d239dbb2: am 170bde83: (-s ours) resolved conflicts for merge of 7c327194 to lmp-mr1-ub-dev
* commit 'd239dbb2578ca70cb4cd44b78a0295bdd8af0e36':
  libutils: fix overflow in SharedBuffer [DO NOT MERGE]
2015-08-27 01:38:06 +00:00
Bart Sears d239dbb257 am 170bde83: (-s ours) resolved conflicts for merge of 7c327194 to lmp-mr1-ub-dev
* commit '170bde83ae90e03b7964edf2a00da6f83c406910':
  libutils: fix overflow in SharedBuffer [DO NOT MERGE]
2015-08-27 01:27:29 +00:00
William Luh 964428c0a6 Add macro to call event logger for errors.
Bug:23180694
Change-Id: I566a290334345f48013029534efef3e08e726e40
2015-08-26 15:59:06 -07:00
Yabin Cui d8459b3d3c adb: fix a fake data race on transport:kick reported by tsan.
It is reported by tsan as a double checked locking. But I think
it is not a real data race. Because I think the old code is able
to make sure t->kick() is only called once, and the caller of
kick_transport is not relying on the side-effect of calling
t->kick().
But as it is not perf critical, I don't mind breaking the double
checked locking pattern.

Bug: 23385662
Change-Id: Ie3597dd56bb514117c3865d2afcfd7c115731a78
2015-08-26 15:22:56 -07:00
Yabin Cui 804180b2cc Merge "adb: fix a data race in local_socket_event_func." 2015-08-26 22:11:26 +00:00
Yabin Cui 0067412421 adb: fix a data race in local_socket_event_func.
If s->peer->enqueue() failed, s may be freed. So we should use
saved_xxx instead of s->xxx before verifying the return value.

Change-Id: I6c072406dceb98e2d02798d0dcdc428fa99e66fb
2015-08-26 15:06:43 -07:00
Mark Salyzyn 46d159d462 logd: klogd and Mediatek
- sniff for PID in kernel log messages if available
- properly deal with klogd watermark in face of modified output
- deal more stringently with priority tag, must have [ following
- suppress process-name stutter in tag that can happen
- do not use : to demark tag if within [ ]

Mediatek-special change that adds <printk_state>(<cpu>)[<pid>:<comm>]
as a prefix to the printk messages. Along the lines of (simplified
for entertainment purposes, YMMV):

    char tbuf[50]; /* printk prefix */
    int this_cpu = smp_processor_id();
    char state = __raw_get_cpu_var(printk_state);
    unsigned tlen = snprintf(tbuf, sizeof(tbuf), "%c(%x)[%d:%s]",
               state, this_cpu, current->pid, current->comm);

Bug: 23517551
Change-Id: I568e25c5aa6d8474835454a0e83b19c2921b7985
2015-08-26 14:57:16 -07:00
Abhishek Arya 09f2d36e1d am 5b33306d: Merge "libutils: fix overflow in SharedBuffer [DO NOT MERGE]" into mnc-dev
* commit '5b33306dba456ec906f7c9bd522681c1de137f78':
  libutils: fix overflow in SharedBuffer [DO NOT MERGE]
2015-08-26 20:12:44 +00:00
Abhishek Arya 5b33306dba Merge "libutils: fix overflow in SharedBuffer [DO NOT MERGE]" into mnc-dev 2015-08-26 20:06:19 +00:00
Bart Sears 170bde83ae resolved conflicts for merge of 7c327194 to lmp-mr1-ub-dev
Change-Id: I236367bd60046ba06669cbcdae81184f9d0a74c7
2015-08-26 12:59:28 -07:00
Yabin Cui 4edb97abb7 am f03aa667: am fbdd5ee2: Merge "adb: keep all asocket operations in the main thread."
* commit 'f03aa6670e39ef1a46211960d134b2528a3649f5':
  adb: keep all asocket operations in the main thread.
2015-08-26 19:55:19 +00:00
Yabin Cui f03aa6670e am fbdd5ee2: Merge "adb: keep all asocket operations in the main thread."
* commit 'fbdd5ee2f6d35f8fde53c37e0ef83765aa7f5981':
  adb: keep all asocket operations in the main thread.
2015-08-26 19:46:37 +00:00
Yabin Cui fbdd5ee2f6 Merge "adb: keep all asocket operations in the main thread." 2015-08-26 19:40:54 +00:00
Nick Kralevich 3192689b21 am 63141512: am 53f11b62: Merge "libcutils: enable LOCAL_SANITIZE := integer"
* commit '631415129c51a24cd5c9843694bd5283fe3b9345':
  libcutils: enable LOCAL_SANITIZE := integer
2015-08-26 18:51:02 +00:00
Nick Kralevich 78d632a01d am 38f4a139: am 532e6cde: Merge "libcutils: cleanups for -fsanitize=integer"
* commit '38f4a1391e499c2392cd8136061153cc35438eb3':
  libcutils: cleanups for -fsanitize=integer
2015-08-26 18:51:00 +00:00
Nick Kralevich 631415129c am 53f11b62: Merge "libcutils: enable LOCAL_SANITIZE := integer"
* commit '53f11b620d2be294d3f04acd801e6a5c2f2f4a69':
  libcutils: enable LOCAL_SANITIZE := integer
2015-08-26 18:41:11 +00:00