Commit graph

58319 commits

Author SHA1 Message Date
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
Elliott Hughes
854b9898ae Merge "libcutils: reimplement system property functions with libbase." am: 95e79c63a4
Change-Id: I2151d62faefced4e95ed7bef96be3580f59ac732
2020-05-26 17:40:42 +00:00
Elliott Hughes
95e79c63a4 Merge "libcutils: reimplement system property functions with libbase." 2020-05-26 17:27:56 +00:00
Tom Cherry
473b02289c Merge changes If6e29418,I6d90838e,Ie488f8ac am: f8f95a41f4
Change-Id: I6c6bfd78d879aaac8df26d0f387f280ce038889e
2020-05-26 15:31:59 +00:00
Tom Cherry
f8f95a41f4 Merge changes If6e29418,I6d90838e,Ie488f8ac
* changes:
  logd: create SimpleLogBuffer and implement ChattyLogBuffer in terms of it
  logd: separate Chatty only vs generic LogBufferTests
  logd: move current sequence from LogBufferElement to LogBuffer
2020-05-26 15:19:44 +00:00
Treehugger Robot
075f813c3b Merge "Update TEST_MAPPING." am: aa15ef4d0e
Change-Id: Ib8a1db306ab284880d56c08fe1d4023051591f5b
2020-05-22 02:03:36 +00:00
Treehugger Robot
aa15ef4d0e Merge "Update TEST_MAPPING." 2020-05-22 01:46:29 +00:00
Alistair Delva
a2cc1ebb72 Add ro.boot.fstab_suffix and modify mount_all to use it
Currently the ReadDefaultFstab function, which calls GetFstabPath,
makes some assumptions about what the fstab will be called and where
it is located. This is being used by vold to set up userdata encryption
and for gsid, and is even used in the default boot control HAL, so it
has become quite baked.

The original way for a board to specify things to mount was to use the
"mount_all /path/to/fstab" command in init.rc. However, due to the
above functionality, the path after mount_all is no longer very useful,
as it cannot differ from the inferred path, or userdata encryption and
other features will be broken.

On Cuttlefish, we have an interest in being able to test alternative
userdata configurations (ext4 vs f2fs, encryption on/off, etc.) and
currently the only way to achieve this is to either a) modify the
ro.hardware or ro.hardware.platform properties, which breaks a bunch
of things like default HAL filenames, or regenerate our odm.img or
vendor.img filesystems. We can't simply install another fstab and
point to it with "mount_all".

This change allows the fstab path to be omitted from "mount_all", and
adds another property which overrides the existing checks for
fstab.${ro.hardware} and fstab.${ro.hardware.platform}. Specifying
${ro.boot.fstab_suffix} will cause fstab.${ro.boot.fstab_suffix}
to be checked first.

Bug: 142424832
Test: booted cuttlefish with 'mount_all ${ro.hardware} --late'
Test: booted cuttlefish with 'mount_all --late'
Test: booted cuttlefish with 'mount_all --late' and fstab_suffix=f2fs
Test: partially booted cuttlefish with 'mount_all ${ro.hardware}'
Test: partially booted cuttlefish with 'mount_all'
Change-Id: I3e10f66aecfcd48bdb9ebf1d304b7aae745cbd3c
2020-05-21 16:38:40 -07:00
S Vasudev Prasad
100b08a848 libcutils: reimplement system property functions with libbase.
This makes the system property functions available on the host too, and
ensures a consistent view of system properties between libcutils and
libbase, if you have code running on the host that uses both.

Bug: http://b/151789258
Test: treehugger
Change-Id: Ie524a77d0c392d7b23e9d12becbb1bf53c81eac6
2020-05-21 16:20:16 -07:00
Elliott Hughes
ca3dd7ec34 Update TEST_MAPPING.
libbase and libziparchive both just moved out of system/core/, so I
don't think there's any value to running their tests when system/core/
changes. (I already added new TEST_MAPPING files to the two new projects.)

Test: treehugger
Change-Id: I0dd7acb525d9cca5349c55dc2724eab8d3a06afa
2020-05-21 14:26:34 -07:00
Tom Cherry
8f613464b8 logd: create SimpleLogBuffer and implement ChattyLogBuffer in terms of it
Test: unit tests with SimpleLogBuffer
Change-Id: If6e29418645b5491df9b8aeef8f95bb786aeba93
2020-05-21 14:23:45 -07:00
Tom Cherry
e18346d3d9 logd: separate Chatty only vs generic LogBufferTests
Separate these tests such that future log buffer implementations can
be run against the generic tests.  Use a parameterized fixture to
allow testing any number of log buffers.

Test: these unit tests
Change-Id: I6d90838e8efa019b934d08da25cab0c2405b66cd
2020-05-21 14:10:32 -07:00
Tom Cherry
a3c5ff5d3f logd: move current sequence from LogBufferElement to LogBuffer
This is required for tests that are aware of sequence numbers to pass;
each new LogBuffer instance should start from sequence = 1, which
isn't the case if the current sequence number is a static.

Test: unit tests
Change-Id: Ie488f8ac5e22b946b7e6237d1d5caf14929c0ec3
2020-05-21 14:10:17 -07:00
Tom Cherry
e288260524 Merge changes Ia7953e3c,Id1f29f4d,I38623130 am: f29cd20df5
Change-Id: Ide7fdcfd5b6060aec893991ed68a3ce95b75cf17
2020-05-21 21:03:47 +00:00
Tom Cherry
f29cd20df5 Merge changes Ia7953e3c,Id1f29f4d,I38623130
* changes:
  logd: use a std::list<> of values not pointers
  logd: refactor chatty deduplication logging
  logd: use RAII locks and thread annotations
2020-05-21 20:35:41 +00:00
Treehugger Robot
04c09d39cf Merge "emmc_optimized means stable_inodes" am: eb3be2e28f
Change-Id: Ie8f78b314d14f814df5f200a22ecb941bcefd16e
2020-05-21 20:05:15 +00:00
Treehugger Robot
4c199f5a28 Merge "libsnapshot: delete unused todo" am: 39fe8215e5
Change-Id: Idf419b8be3a8b1db6c33330b1f1ff83886dcb434
2020-05-21 20:05:04 +00:00