LogTimes has evolved from being simply a store of the last timestamp
that each reader has read to being a class representing an individual
reader thread, including the thread function, so name it
appropriately.
Test: logging unit tests
Change-Id: I6914824376a6ff1f7509e657fa4dc044ead62954
This code has evolved to the point that it LogReader::notifyNewLog()
executes FlushCommand on every socket. FlushCommand then iterates
over all log reader threads in LogTimes and flushes triggers them to
flush logs if they match the client. This can be simplified to simply
looping over all of the reads in LogTimes.
Code readability was the primary motivation here, but note that 64% of
LogReader::notifyNewLog() was spent looping over the sockets, and an
additional 78% of FlushCommand::runSocketCommand() was spent
repeatedly locking and unlocking the LogTimes lock.
Overall, this reduces the cost of LogReader::notifyNewLog() in
LogListener::onDataAvailable() from 5.91% to 2.93%. This is the
critical path for handling incoming log messages, so it's a
non-trivial savings.
Test: logging unit tests
Test: unprivileged clients still cannot view privileged logs
Change-Id: Ic7620978a6c23e5e2cb179ff0c42b7cea52fc011
I added mOldest recently before mentally committing to have new code
follow the Google C++ style guide.
Test: build
Change-Id: I6d5bab5833e14ac3808862598a2a60989d805e18
logd needs a pointer to PruneList, but it should not own it and it
should not have initPrune() or formatPrune() functions.
Test: logging unit tests
Change-Id: Id1668c26d07eb5d1e4cf267f5748c20a79f711ae
It doesn't look like there are any users, since there is a much better
mechanism, `logd --reinit` that exists for this behavior. The
settings app and init.rc use that mechanism and they are the two major
clients that force logd to reinitialize.
This saves us from creating a thread and marginally cleans up
main.cpp.
Test: log reinitialization works
Change-Id: Icdb56b6f59adbba82812231a4f3a6ffd1a7955fc
LogBuffer needs a pointer to LogTags, but it should not own the
instance. It should not provide accessors into LogTags either.
Also, clean up CommandListener a bit.
Test: logging unit tests
Change-Id: Ic0c86a2bac0c4dd80262278588b9fdc2326dbe5b
When merging in recovery, the "imminent data wipe" code was used, which
made the assumption the /metadata and /data state would be zapped. This
caused future OTAs to error because the old snapshots were detected.
This CL allows OTAs to proceed even if unexpected snapshots are present.
It also forces the state to "MergeCompleted" after a merge in recovery,
so that the next normal boot can perform cleanup.
Bug: 155339165
Test: fastboot snapshot-update merge, then take another OTA
vts_libsnapshot_test
Change-Id: Ief6dea3ba76323044e61307272dda320a4494aea
* changes:
Enable automatic libsnapshot fuzzer runs
Also log corpus when aborted through libbase.
libsnapshot_fuzzer: Fuzz MapUpdateSnapshot.
libsnapshot_fuzzer: construct valid super partition metadata.
libsnapshot_fuzzer: Fuzz CreateUpdateSnapshots
libsnapshot_fuzzer: add additional tests for more APIs
libsnapshot_fuzzer: use protobuf
libsnapshot_fuzzer: map super image
Extend androidboot.first_stage_console cmdline property to enable
skipping module load failures without stopping at a serial console. This
is useful for GKI development.
Set androidboot.first_stage_console=2 for this behavior.
Bug: 155296582
Test: verify behavior for values 0, 1, and 2
Change-Id: I068c631a22c848e45a421b297b1acae1b3deb3c1
Libunwindstack would remove duplicated items and update the `prev_map`
during reparsing `/proc/self/maps`. But we leave `prev_real_map`
pointing toward a MapInfo that will be deleted soon. It will cause a
dangling pointer issue.
Add new tests to cover this dangling pointer issue.
Bug: 155511785
Test: libunwindstack_test
Change-Id: I62e1b97bcb73f07e9349671f0b758f5ec9de16c0
This won't happen in practice because device size is never
zero. Hypothetically, if it is, PartitionCowCreator still
suggests that a CoW size of 8192 bytes needs to be created. In
reality, it is not necessary.
Test: libsnapshot_fuzzer
Bug: 155484992
Change-Id: I6c69f54820522d50c699384eec90c474ca3a9402
If a CHECK or LOG(FATAL) is hit, also attempt to log the current
corpus.
Test: pass
Bug: 154633114
Change-Id: Id0f376021011924f5d64eb5b591b5ebab6dc7dbc
libcrypto_utils is not available as 32 bit library in 64 bit devices.
Import the library as static.
Bug: 148878078
Test: nativetest/fiemap_image_test
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I2b8cd69d06607f4216e4e2220dd8561e6eff323c
Use protobuf because it already has all the fuzzing implemenetations.
Delete fuzz_utils.
Pros:
- Fuzzing protobuf is faster; it is easy to achieve 4K exec/s
- It is more guided; protobufs are fuzzed using mutators, and mutators
should have better knowledge of the structure of the fuzz data
- No more hand-written parsing code of the fuzz data. That code in
fuzz_utils.h is deleted.
- Corpus data can be reused even after adding new fields in the protobuf
- Corpus data is human-readable and easily manually written (it is
the text format of the protobuf)
Cons:
- The "actions" are "declared" in protobuf definition and "defined" in
C++, so there's more boilerplate to write. Adding a new "Action"
requires changes in both.
Test: run libsnapshot_fuzzer
Bug: 154633114
Change-Id: Idc2a6b2c087e370e4cfef53142a244b9b275389e
Introduce new command to allow setting task profiles from inside .rc
script. This is to replace usage of writepid when a service is trying
to join a cgroup. Usage example from a .rc file:
service surfaceflinger /system/bin/surfaceflinger
task_profiles HighPerformance
Bug: 155419956
Test: change .rc file and confirm task profile is applied
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I0add9c3b363a7cb1ea89778780896cae1c8a303c
Some tests require root to be run, so we require_root to run all of
them.
Test: tests pass as root
Change-Id: I5b3ca4f08e41f16e81c5d5995043ab55d379a882
Bug: 65062446
Test: multi_connect_dgram_socket is skipped for non-root
Test: multi_connect_dgram_socket passes for root
Change-Id: I610bed5987580e0c5a01952efc2e32e7d8cdf9b4
Operations on (unsigned long) f_bsize and f_bfree are correctly handled
on 64 bit architectures, but when switching to 32 bit, the
multiplication between the two could result in an overflow, causing the
test to crash.
Fix by using a uint64_t operand, hinting the compiler to handle the
whole multiplication with 64 bit operands.
Bug: 154355449
Bug: 148889015
Test: vts_libsnapshot_test (32 bit)
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: Ief5c03ff7954c4a3e8597ef6e7df467f59428877
This code was duplicated throughout LogBuffer.cpp, so refactor it into
a single location and clean up some comments along the way.
This may fix a subtle bug: if `logcat -c` is used from a
non-privileged UID, the current code may set mLast to the oldest seen
log message *from that UID* and not not the oldest log message for
that log id. That may prevent pruning from the start of that log,
resulting in old log entries that are impossible to delete.
Bug: 144382260
Test: logging works, and above scenario is not seen
Change-Id: I1749293ce6ea1697dd8a9258cfd7eab29dbeac6e