Commit Graph

58486 Commits

Author SHA1 Message Date
Josh Gao 450e83eb8f Merge "adb: implement zstd compression for file sync." 2020-06-03 01:56:31 +00:00
Treehugger Robot f476677b4e Merge "check_ms_os_desc: fix buffer overflow." am: f7fed04ace
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1322275

Change-Id: I5bb717db05585f9c119b1b60f4a4f013da9e87a6
2020-06-03 01:32:40 +00:00
Treehugger Robot f7fed04ace Merge "check_ms_os_desc: fix buffer overflow." 2020-06-03 01:09:48 +00:00
Alex Buynytskyy 3fc21d4802 Merge "Signature checks." am: 0aa0581404
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1321890

Change-Id: Ia2249d3db0e7b7dd048b6ef09780bc156d1bcc6b
2020-06-03 00:44:25 +00:00
Alex Buynytskyy 0aa0581404 Merge "Signature checks." 2020-06-03 00:30:34 +00:00
Alex Buynytskyy 7405a92e35 Signature checks.
- signature size validation,
- no-signature files support (e.g. .dm).

Bug: 157077910 150803885
Fixes: 157077910
Test: atest adb_test adbd_test

Change-Id: I03a4f32a87568bd6f447f66c8aab666fb0b27199
2020-06-02 23:12:58 +00:00
Tom Cherry 3dd3ec3514 logd: Drop the LogStatistics dependency on LogBufferElement
Other log buffers may not use LogBufferElement, so we should decouple
the two classes.  This uses an intermediate LogStatisticsElement
structs instead of passing a large number of parameters to each
function.

This additionally moves IsBinary() and the GetTag() functions out into
LogUtils.h since they can be used generically by other users.

Test: logging unit tests
Change-Id: I71f53257342c067bcccd5aa00bae47f714cd7c66
2020-06-02 16:02:56 -07:00
Josh Gao a2929d5751 check_ms_os_desc: fix buffer overflow.
Bug: http://b/155505587
Test: check_ms_os_desc
Change-Id: Ie99715ab62571d24460c3a1fb859d22951f30cb8
2020-06-02 15:24:47 -07:00
Tom Cherry a9b4222196 Merge "logd: move leading_dropped logic into FlushTo()" am: a8b8d108e5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1320576

Change-Id: I8129ea7791ef4291e2a7d8ca8b14698a933fc8c7
2020-06-02 21:56:12 +00:00
Tom Cherry a8b8d108e5 Merge "logd: move leading_dropped logic into FlushTo()" 2020-06-02 21:51:17 +00:00
Treehugger Robot 1d73552164 Merge "adb: don't use parameterized in test_adb.py." am: 648266ab1c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1322179

Change-Id: Icca5eb952bc158013efdb6851d8d6f7a1c794cba
2020-06-02 21:49:15 +00:00
Treehugger Robot 648266ab1c Merge "adb: don't use parameterized in test_adb.py." 2020-06-02 21:31:21 +00:00
Tom Cherry b3e163399a logd: move leading_dropped logic into FlushTo()
This logic isn't generic, so it should not be in the generic
LogReaderThread.

Moreover, it's currently broken in essentially every case except when
filtering by UID, because it runs as in the filter functions before
the actual filtering by pid/etc takes place.  For example, when
filtering by pid, it's possible to get leading chatty messages.  The
newly added test was failing previously but is fixed by this change.

It's fundamentally broken in the tail case.  Take this example:
1: Normal message
2: Chatty message
3: Normal message
4: Normal message

If you read that log buffer with a tail value of 3, there are three
possible outcomes:
1) Messages #2-4, however this would include a leading chatty message,
   which is not allowed.
2) Messages #3-4, however this is only 2, not 3 messages.
3) Messages #1-4, however this is 4, more than the 3 requested
   messages.

This code chooses 2) as the correct solution, in this case, we don't
need to account for leading chatty messages when counting the total
logs in the buffer.  A test is added for this case as well.

Test: new unit test
Change-Id: Id02eb81a8e77390aba4f85aac659c6cab498dbcd
2020-06-02 13:26:48 -07:00
Tom Cherry 6e63019c63 Merge "logd: format LogBufferElement and LogStatistics correctly" am: 4ab0bc414d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1322875

Change-Id: I871b7dcbc38e911665a5df2565b2a2cb07c2a0e2
2020-06-02 20:23:30 +00:00
Josh Gao 3f2f3bacf9 adb: don't use parameterized in test_adb.py.
The test bots don't have this module installed.

Test: treehugger
Change-Id: I849a075b784eac296608e45bec7b2fce38f56ac4
2020-06-02 13:14:45 -07:00
Tom Cherry 4ab0bc414d Merge "logd: format LogBufferElement and LogStatistics correctly" 2020-06-02 20:07:52 +00:00
Tom Cherry 9787f9a054 logd: format LogBufferElement and LogStatistics correctly
Test: logging unit tests
Change-Id: If63be065e38f2a1c4cf2807ceaa9eea180b16c51
2020-06-02 11:38:44 -07:00
Tom Cherry 76dac24797 Merge changes Id47b288d,I969565eb,Iba2e654e am: 365fdb7acb
Original change: undetermined

Change-Id: I5478564414c48ce0ab0c84ecd4a1e31eb3ec2eec
2020-06-02 15:51:51 +00:00
Tom Cherry 365fdb7acb Merge changes Id47b288d,I969565eb,Iba2e654e
* changes:
  logd: drop can_read_security_logs
  logd: create FlushToState class
  logd: fix bug in FlushTo when requesting exact sequence number
2020-06-02 15:41:03 +00:00
Josh Gao e572f2fc44 Move libadbd_auth, libadbd_fs to adbd_system_binaries.
The required block inside the definition of "adbd" does nothing: we get
the libraries it contains via direct dependency when building from
source, and not at all when using a prebuilt. Move them to a phony
rule that's explicitly listed in PRODUCT_PACKAGES.

Bug: http://b/157709367
Test: treehugger
Change-Id: I97c0889558482cfbe18ae91b39b6889d3fee877c
2020-06-01 18:59:21 -07:00
Tom Cherry eb49b04e21 logd: drop can_read_security_logs
This has become useless after refactoring; we instead ensure that the
LOG_ID_SECURITY bit isn't set in log_mask, instead of having this
additional check.

Test: logging unit tests
Change-Id: Id47b288d056ebf2b5bd26be94006f17c24fafd31
2020-06-01 14:45:02 -07:00
Tom Cherry 855c7c87a3 logd: create FlushToState class
ChattyLogBuffer::FlushTo() needs an array of pid_t's to differentiate
between deduplication and spam removal chatty messages, but that won't
be useful to other log buffers, so it doesn't deserve its own entry in
the abstruct LogBuffer::FlushTo() function.

Other log buffers may need their own data stored for each reader, so
we create an interface that the reader itself owns and passes to the
log buffer.  It uses a unique_ptr, such that the when the reader is
destroyed, so will this state.

FlushToState will additionally contain the start point, that it will
increment itself and the log mask, which LogBuffers can use to
efficiently keep track of the next elements that will be read during a
call to FlushTo().

Side benefit: this allows ChattyLogBufferTests to correctly report
'identical' instead of 'expired' lines the deduplication tests.

Side benefit #2: This updates LogReaderThread::start() more
aggressively, which should result in readers being disconnected less
often, particularly readers who read only a certain UID.

Test: logging unit tests
Change-Id: I969565eb2996afb1431f20e7ccaaa906fcb8f6d1
2020-06-01 14:45:02 -07:00
Tom Cherry 90e9ce0c28 logd: fix bug in FlushTo when requesting exact sequence number
SimpleLogBuffer::FlushTo() attempts to find the iterator matching a
given sequence number, but the logic is wrong and will always skip one
element forward.  This change fixes this and adds a test for the
situation.

This likely contributed to some test instability in the past, but was
identified because subsequent changes that track the start value
closer exacerbated this issue.

Test: existing and new unit tests
Change-Id: Iba2e654e94234693dba20d4747a60bc79d195673
2020-06-01 14:44:56 -07:00
Yifan Hong 7a5b39709a Merge changes I845d2250,I4faa0785 am: 51b127c71e
Change-Id: Id4e378b449cd7939ff156199e189490b1de3ff56
2020-05-30 01:22:12 +00:00
Alessio Balsini c757b578f7 libsnapshot: Export COW image size am: 02e639d1f5
Change-Id: Icb741f3a9454a4e54cbb31e444272b6042a1340c
2020-05-30 01:22:10 +00:00
Yifan Hong 51b127c71e Merge changes I845d2250,I4faa0785
* changes:
  libsnapshot: proto use correct index
  libsnapshot: Export COW image size
2020-05-30 01:06:56 +00:00
Yifan Hong a30076404e libsnapshot: proto use correct index
Test: pass
Bug: 154016862
Change-Id: I845d2250ddb27bdbaee0d54663a2fdb45dbfbd11
2020-05-29 16:21:40 -07:00
Alessio Balsini 02e639d1f5 libsnapshot: Export COW image size
Enable libsnapshot to export the size of the COW image, representing the
fraction of the COW device that is temporarily created in the /data
partition, computed just before initializing a merge operation.
Thise additional information can be used by other components (i.e.,
update engine) to enrich Virtual A/B metrics.

Bug: 154016862
Test: manual OTA
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I4faa0785f23884e26161e0d51268dd7a305d86bf
Merged-In: I4faa0785f23884e26161e0d51268dd7a305d86bf
2020-05-29 23:19:39 +00:00
David Anderson aa5ee42194 Merge "libdm: Fallback to legacy ueventd logic if running on an older system." am: b0b5d4f400
Change-Id: I7aa899708869ab24d254cbebe33a73810e9ed0fa
2020-05-29 21:30:33 +00:00
David Anderson be1327eb52 Merge "fastboot: Allow fastboot to asynchronously differentiate between fastboot and fastbootd." am: e681cf01c8
Change-Id: Id921eb30a4ddbd0975d230f064321afa9a0fdad8
2020-05-29 21:26:59 +00:00
David Anderson b0b5d4f400 Merge "libdm: Fallback to legacy ueventd logic if running on an older system." 2020-05-29 05:06:22 +00:00
David Anderson e681cf01c8 Merge "fastboot: Allow fastboot to asynchronously differentiate between fastboot and fastbootd." 2020-05-29 04:47:35 +00:00
David Anderson a212760ec6 libdm: Fallback to legacy ueventd logic if running on an older system.
When delivering single-stage, non-AB OTAs, the updater binary is built
on a newer OS than recovery is compiled with. libdm relies on newer ueventd
behavior which therefore breaks this model. As a workaround, we allow
libdm to fallback to the old ueventd logic if the following conditions
hold true: (1) we're in recovery, (2) the device is not an AB device,
and (3) the release is <= 10.

Since the old ueventd behavior can lead to races in libdm, this fallback
should stay as narrow as possible.

Bug: 156536673
Bug: 155202260
Test: manual test
Change-Id: I7f9da49e4ba8dfe165e0923d9918827d51d090cd
2020-05-28 20:44:31 -07:00
Josh Gao 317d3e176f adb: implement zstd compression for file sync.
Bug: http://b/150827486
Test: test_device.py
Change-Id: I9fac4c760d9dbdce0b3b883db975cfa9b27a9e80
2020-05-28 13:00:01 -07:00
David Anderson 4e058cac0d fastboot: Allow fastboot to asynchronously differentiate between fastboot and fastbootd.
It's not possible to programmatically determine which fastboot mode a
device is in, without sending a getvar:is-userspace query. Unfortunately
this is not possible asynchronously, and may interrupt other queries
being processed.

This patch changes fastbootd's USB interface name to "fastbootd". Note
that tools use the protocol number/class and not this string, so it
should be safe to extend. When using "fastboot devices", the interface
name is now listed if set. Note that currently only the Linux version of
the fastboot tool is capable of reading the interface name.

Bug: 156966319
Test: fastboot devices on Linux
Change-Id: I57ccf2bec1dda573fe3ac628a646624b76f45905
2020-05-28 17:42:00 +00:00
Tom Cherry d090042c44 Merge changes I5cf0d014,Ib46f0646 am: 609630e7ba
Change-Id: I66754d24b58cde35284b4e0b0621e3f40b587948
2020-05-28 15:29:37 +00:00
Tom Cherry 609630e7ba Merge changes I5cf0d014,Ib46f0646
* changes:
  logd: remove LogBufferElement dependency of LogReaderThread
  logd: rename FlushToResult to FilterResult
2020-05-28 15:25:20 +00:00
Elliott Hughes 9e4815691d Merge "Make systemTime() abort on bad input." am: 49cd73754e
Change-Id: If0fe073f61a54a04abf8bb8f8d6a71bbaad204c4
2020-05-28 15:24:36 +00:00
Elliott Hughes 49cd73754e Merge "Make systemTime() abort on bad input." 2020-05-28 15:11:20 +00:00
Alistair Delva f19c48f85f Merge "Add ro.boot.fstab_suffix and modify mount_all to use it" am: 510d2437b4
Change-Id: Ic6737e2aaf9fc1309d4e5bd20e92378037686228
2020-05-28 00:19:05 +00:00
Alistair Delva 510d2437b4 Merge "Add ro.boot.fstab_suffix and modify mount_all to use it" 2020-05-28 00:04:02 +00:00
Elliott Hughes 842e1cc17e Make systemTime() abort on bad input.
There's no CHECK in libutils, sadly.

Bug: http://b/157167405
Test: treehugger
Change-Id: I1532bf80ba7fdafad016610be3c782b547417126
2020-05-27 15:31:55 -07:00
Tom Cherry 70fadea36f logd: remove LogBufferElement dependency of LogReaderThread
In the future, not all log buffers will be implemented in terms of
LogBufferElement.

Test: build
Change-Id: I5cf0d01414857b1bfa08c92a4f8035b43ef2aad7
2020-05-27 15:13:52 -07:00
Tom Cherry 3e61a1368a logd: rename FlushToResult to FilterResult
This was a typo; the enum corresponds to the result of the 'Filter'
function, not the 'FlushTo' function.

Test: build
Change-Id: Ib46f0646570b6dbaac17ae9fc95c990128cdbe72
2020-05-27 15:09:34 -07:00
Treehugger Robot f5a19271e1 Merge "liblp: delete unused function and fields" am: 37e8b5e587
Change-Id: I9217122c87b32d92664c22287a7ba45d5f204059
2020-05-27 18:47:47 +00:00
Treehugger Robot 37e8b5e587 Merge "liblp: delete unused function and fields" 2020-05-27 18:35:05 +00:00
Christopher Ferris a40e0504be Merge "Fail explicitly on length overflow." am: d46eb21906
Change-Id: I3722824bf8aad86ced2765a8eda8f6cd54fba805
2020-05-27 03:37:56 +00:00
Christopher Ferris d46eb21906 Merge "Fail explicitly on length overflow." 2020-05-27 03:17:03 +00:00
Yifan Hong bcf3cc8cce liblp: delete unused function and fields
Test: builds
Change-Id: Ib7c93cfadacedc4f8d983c490e55fb4672cc9c1d
2020-05-26 23:02:31 +00:00
Christopher Ferris 68604b9c29 Fail explicitly on length overflow.
Instead of aborting when FileMap::create detects an overflow, detect the
overflow directly and fail the call.

Bug: 156997193

Test: Ran unit tests, including new unit test that aborted before.
Change-Id: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
2020-05-26 12:00:07 -07:00