Commit graph

58468 commits

Author SHA1 Message Date
Tom Cherry
3f1381fbcd Merge changes I9638e90b,Ib2636dfc am: c58d1e4aec
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1349344

Change-Id: I54b5873749ec46f6489d6e6f8224759239b0b25e
2020-06-25 15:02:35 +00:00
Tom Cherry
c58d1e4aec Merge changes I9638e90b,Ib2636dfc
* changes:
  logd: replace std::vector<uint8_t> in SerializedLogChunk
  logd: fix use after resize of contents_ vector
2020-06-25 14:48:39 +00:00
Tom Cherry
b6cb992cf3 logd: replace std::vector<uint8_t> in SerializedLogChunk
Turns out std::vector::resize() and std::vector::clear() don't
actually deallocate any memory.  std::vector::shrink_to_fit() can be
used for this but isn't a 'guarantee'.  Instead of trying to get
std::vector to play nice, this change replaces std::vector<uint8_t>
with std::unique_ptr<uint8_t[]>, which is more accurate to how I'm
using this memory anyway.

Test: logging unit tests
Change-Id: I9638e90bbf50bcf316c5aa172c8278ea945d27e7
2020-06-24 16:19:28 -07:00
Tom Cherry
b07e339b53 logd: fix use after resize of contents_ vector
SerializedFlushToState::PopNextUnreadLog() was calling
AddMinHeapEntry() to replenish the element that was just popped off of
the heap, however AddMinHeapEntry() also manages reference counts for
the buffers, and this resulting in the following scenario:

PopNextUnreadLog() returns a pointer referencing log buffer #1
AddMinHeapEntry() sees that all logs from buffer #1 has been read, so
it decrements the reference count
The caller of PopNextUnreadLog() uses the result which references
invalid memory.

This calls CheckForNewLogs() within HasUnreadLogs() instead of
requiring a separate call, which fixes an additional issue where
continuing from the loop in SerializedLogBuffer::FlushTo() may not
pick up subsequent logs in a given log buffer, since CheckForNewLogs()
wouldn't be called.  This was exacerbated by the above change.

This adds a test to check the reference counts for this case and fixes
an argument mismatch in SerializedFlushToStateTest.

This adds the corpus that surfaced the issue.

Bug: 159753229
Bug: 159783005
Test: these unit tests, run fuzzer without error
Change-Id: Ib2636dfc14293b7e2cd00876b9def6e9dbbff4ce
2020-06-24 15:31:46 -07:00
Nikita Ioffe
b3a10e5220 Merge "Explicitly call restorecon_recursive on /metadata/apex" am: 5b2457ed34
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1348884

Change-Id: I42ac96691e09e203976c0c804da0132ba4053ccc
2020-06-24 17:00:40 +00:00
Nikita Ioffe
5b2457ed34 Merge "Explicitly call restorecon_recursive on /metadata/apex" 2020-06-24 16:40:52 +00:00
Nikita Ioffe
a462044ac8 Explicitly call restorecon_recursive on /metadata/apex
On some devices we see a weird in which /metadata/apex will have a wrong
selinux label. This will effectively prevent such devices from getting
any apex updates. Since we haven't figured out a root cause for this
bug, it's safer to explicitly call restorecon on /metadata/apex to make
sure it's correct.

This change shouldn't affect a normal boot flow, since /metadata/apex
will already have a correct label and restorecon_recursive will be a
no-op.

Test: rm -Rf /metadata/apex && \
    mkdir /metadata/apex &&
    mkdir /metadata/apex/sessions
Bug: 149317789
Merged-In: I971ffe35c93bb79d9e71106c24515ec0ee70333a
Change-Id: I971ffe35c93bb79d9e71106c24515ec0ee70333a
(cherry picked from commit cf7b6bad55)
2020-06-24 16:30:03 +01:00
Lorenzo Colitti
fc10e3f883 Merge "add a new trigger for launching the bpfloader" am: d9299c5119
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1345185

Change-Id: I9669ff9795fc78b006101030e6ba10f40d4d8b63
2020-06-24 03:10:33 +00:00
Lorenzo Colitti
d9299c5119 Merge "add a new trigger for launching the bpfloader" 2020-06-24 02:50:28 +00:00
Tom Cherry
cc37c07a8b Merge changes Id5f03945,I69c74471 am: 23ae9df08e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1346625

Change-Id: If6b639632128985911c1fe437771414d76a2dcec
2020-06-23 22:24:51 +00:00
Tom Cherry
23ae9df08e Merge changes Id5f03945,I69c74471
* changes:
  logd: add fuzzer for SerializedLogBuffer and other improvements
  logd: join() the SerializedLogBuffer deleter thread
2020-06-23 22:06:36 +00:00
Tom Cherry
f2774a04ca logd: add fuzzer for SerializedLogBuffer and other improvements
1) Add fuzzer for SerializedLogBuffer
2) Enable fuzzing on host
3) Read logs after writing them
4) Silence log tags error on host

Test: run these fuzzers
Change-Id: Id5f0394546ecbccf5281e3d8855853be90dee3f0
2020-06-23 11:37:49 -07:00
Tom Cherry
1fdbdbe148 logd: join() the SerializedLogBuffer deleter thread
Logd never deletes SerializedLogBuffer, so it seemed reasonable to
detach the deleter thread, however unit tests and fuzzers do delete
SerializedLogBuffer, so we must safely join the deleter thread in the
destructor.

This simplifies the deleter thread code and ensures that only one
deleter thread will be running at a time.

Test: fuzzing works
Change-Id: I69c7447109898a1bb7038a03337cadacb1213281
2020-06-23 11:37:49 -07:00
Treehugger Robot
2b5725828a Merge "Use standard colors in logcat color output" am: 7382be402a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1345183

Change-Id: Icfdb034b46a3378b0c83b1e3f0f07cc599eaf367
2020-06-22 21:56:22 +00:00
Treehugger Robot
7382be402a Merge "Use standard colors in logcat color output" 2020-06-22 21:43:14 +00:00
Tom Cherry
a182decd18 Merge "logd: make drop_privs work if neither klogd or auditd are used" am: ef8c9574c5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1345186

Change-Id: I35237aea8134335568a437c6b87f640deeb7f75d
2020-06-22 19:19:32 +00:00
Tom Cherry
ef8c9574c5 Merge "logd: make drop_privs work if neither klogd or auditd are used" 2020-06-22 18:51:56 +00:00
Tom Cherry
54b00a9e3c logd: make drop_privs work if neither klogd or auditd are used
Fix a bug that was causing cap_set_flag() fail and logd to exit.

Bug: 159588327
Test: caps are set correctly and logd functions with both, one of, or
      none of klogd and auditd enabled.
Change-Id: Ia51f078ad848535ce1ac29edd8a56a2b686a12cc
2020-06-22 10:20:44 -07:00
Maciej Żenczykowski
6c72c16e3d add a new trigger for launching the bpfloader
Test: built and booted
Bug: 150040815
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If80758b3d7bf499d428880efa5ed555076bfc291
2020-06-22 01:11:39 -07:00
Peter Kalauskas
8b477b6d10 Use standard colors in logcat color output
Previously, colors were specified from the 216 additional colors, which
typically specify an exact RGB color value. Instead, use escape codes
for standard colors (default foreground, red, green, yellow, etc.),
which are commonly adjusted by terminal emulators user preferences.

Bug: 159503129
Test: adb logcat --format color
Test: atest liblog
Change-Id: I0b10a70a76a29d896d04d6c49e716b09cb09b19a
2020-06-20 03:26:12 +00:00
Victor Khimenko
f3f15d2867 Merge "Make libbacktrace buildable for native_bridge" am: a2f97dbb0f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1343519

Change-Id: Ie5c0a7407838babda3eca8f1b12b26ee15a2184d
2020-06-19 21:35:09 +00:00
Victor Khimenko
a2f97dbb0f Merge "Make libbacktrace buildable for native_bridge" 2020-06-19 21:22:39 +00:00
Treehugger Robot
3ff439fe77 Merge "Explicitly show the destination filename for a bugreport." am: ca876d8037
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1343880

Change-Id: Ie577838df014386543d1392ae4d68567f39e441c
2020-06-19 21:04:52 +00:00
Treehugger Robot
ca876d8037 Merge "Explicitly show the destination filename for a bugreport." 2020-06-19 20:56:26 +00:00
Treehugger Robot
650d8dc4aa Merge "fastboot: copy AVB footer on boot image to end of partition" am: 626ca91668
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1343977

Change-Id: Ia250eed4efdca89fa43281dffb399f2f83d87dca
2020-06-19 17:26:09 +00:00
Treehugger Robot
626ca91668 Merge "fastboot: copy AVB footer on boot image to end of partition" 2020-06-19 17:13:18 +00:00
Steve Muckle
3af575bcad fastboot: copy AVB footer on boot image to end of partition
If the flashed boot image is smaller than the block device, the AVB
footer will not be at the end of the partition. Although images are
normally created to match the partition size the GKI boot.img must work
on all devices, and the size of the boot partition will vary.

Copy the AVB footer to the end of the partition before flashing, if it
is not there already.

Bug: 159377163
Change-Id: I5a5e25fb54dc9d6a2930fda63434968808ffa1f0
2020-06-18 21:56:14 -07:00
Paul Lawrence
d4ddb09f6f Merge "Don't call block checkpoint functions above dm-default-key" am: 73cab78084
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1330935

Change-Id: If04d1acf38089a649c3c8980c1d7d1b593267746
2020-06-18 22:00:47 +00:00
David Anderson
c14c99e093 Merge "remount: Do not allow remounting during checkpoints." am: 16a93c528f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1330933

Change-Id: I7e5413aa8ccbba7976f8f4ae3d490647d44b7bb0
2020-06-18 22:00:37 +00:00
Paul Lawrence
73cab78084 Merge "Don't call block checkpoint functions above dm-default-key" 2020-06-18 21:56:10 +00:00
David Anderson
16a93c528f Merge "remount: Do not allow remounting during checkpoints." 2020-06-18 21:45:21 +00:00
Victor Khimenko
7428c52ef2 Make libbacktrace buildable for native_bridge
Bug: http://b/153609531

Test: m -j64 libbacktrace.native_bridge

Change-Id: I2b8a881b4e952f3b68dbcaeb14f147a6d955b406
2020-06-18 22:02:46 +02:00
David Anderson
8696a5d11b remount: Do not allow remounting during checkpoints.
Bug: 157540389
Test: manual test
Change-Id: I5931a583e48ddac05f319629ae2f7f5f0f6cf032
2020-06-18 11:51:01 -07:00
Elliott Hughes
d4171773a5 Explicitly show the destination filename for a bugreport.
It's in the progress output, but typically gets truncated.

Bug: https://issuetracker.google.com/131112559
Test: adb bugreport
Change-Id: I35ba4f39941aea68f2412e7b64feaac4da2f82e3
2020-06-18 11:05:38 -07:00
Narayan Kamath
b82ec57b44 Merge "Fix Deadlock Issue On AppFuseBridge" am: 1e03ef5ac9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1219563

Change-Id: I5fddba76878a64f9e361151ae5b15bd821179b02
2020-06-18 12:45:47 +00:00
Narayan Kamath
1e03ef5ac9 Merge "Fix Deadlock Issue On AppFuseBridge" 2020-06-18 12:29:25 +00:00
Tom Cherry
7a5ae6dd88 Merge "logd: fix various clang-tidy issues" am: 4739f752e1
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1342013

Change-Id: I891a655abbdf9697024f51c22eeb18900f935cae
2020-06-17 21:01:21 +00:00
Tom Cherry
4739f752e1 Merge "logd: fix various clang-tidy issues" 2020-06-17 20:52:34 +00:00
Tom Cherry
9b4246dc2d logd: fix various clang-tidy issues
In order of severity:
1) Add a CHECK() that a pointer is not nullptr, where the analyzer
   believes this is possible.
2) Add `final` appropriately to functions called from constructors.
3) Add missing cloexec flags.
4) Add missing `noexcept` and other subtle performance warnings

Test: build with clang-tidy
Change-Id: Ifd9a1299a51027a47382926b2224748b5750d6cf
2020-06-17 11:40:55 -07:00
Tom Cherry
2dc7952e44 Merge "liblog: fix reading pmsg" am: a6dd55737a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1341014

Change-Id: I9535af260cf9eae83fa9b725b5cf1595c6429f7d
2020-06-17 18:27:41 +00:00
Tom Cherry
a6dd55737a Merge "liblog: fix reading pmsg" 2020-06-17 18:15:28 +00:00
Tom Cherry
520470249e Merge "logd: add missing static to CompressionEngine" am: 58c7c24765
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1340721

Change-Id: I1577618efe5c7fbe7e3dc2539f3e5be23606dc68
2020-06-17 17:21:07 +00:00
Tom Cherry
58c7c24765 Merge "logd: add missing static to CompressionEngine" 2020-06-17 17:13:04 +00:00
Tom Cherry
34d7bd98ad liblog: fix reading pmsg
d3ecc66b9c "liblog: support extended logger_entry headers" removed
the logger_entry::msg variable and instead uses hdr_size as an offset
from logger_entry to where the message starts in parent log_msg
buffer.

In pmsg, hdr_size is not recorded and therefore uninitialized when it
was referenced, causing corruption when reading last logcat.  This
change uses sizeof(log_msg->entry) instead.

Bug: 158263230
Test: last logcat works
Change-Id: Ic01e73bf4d8ba8419cc770138565aa1210a6078b
2020-06-17 09:34:51 -07:00
Tom Cherry
4f9fed24bc logd: add missing static to CompressionEngine
Test: build
Change-Id: I8b068e137835ce5e1ce2af1911f557cbcaca0fa2
2020-06-17 08:31:25 -07:00
Joshua Duong
4f1c40957a Merge "[adb] Check for null in mdns connect info." am: cf88259783
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1340738

Change-Id: Ibc07b1c4f7f2ace1093f434f755fc6a17ae79fc6
2020-06-17 01:33:33 +00:00
Joshua Duong
cf88259783 Merge "[adb] Check for null in mdns connect info." 2020-06-17 01:23:54 +00:00
Joshua Duong
282385f823 [adb] Check for null in mdns connect info.
Adb client does not use these values, so just ignore it.

Bug: b/158824677

Test: 'adb -H 127.0.0.1 -P 5037 devices' does not crash.
Change-Id: I4dada6e5e1714157bbf1af370510dfa7bfbd6b17
2020-06-16 16:40:46 -07:00
Tom Cherry
e2ef4c2369 Merge "logging: Use more inclusive language." am: e72b290c8e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1339609

Change-Id: I60ec83c3774610cccf87544efce512b592167600
2020-06-16 22:48:42 +00:00
Treehugger Robot
8d5b49845b Merge "libmodprobe: improve error reporting." am: 2ab39411eb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1339492

Change-Id: I741f095314ec535af90b5aee3baa24e58ef16c58
2020-06-16 22:48:07 +00:00