Commit aosp/1259140 moved fdsan_table into debugger_process_info, which
is populated conditionally. This introduced a bug where the process that
receives BIONIC_SIGNAL_DEBUGGER (35) does not propagate the fdsan_table
pointer to crash_dump:
$ adb shell kill -SIG35 <pid>
$ adb logcat -s DEBUG
E DEBUG : failed to read fdsan table entry 0: I/O error
Fdsan in warn-only mode uses BIONIC_SIGNAL_DEBUGGER[1], so the generated
tombstones don't have any fd ownership info.
Fix it by calling get_process_info() irrespective of the signal being
handled, taking care to preserve the previous behavior of not showing
abort messages set by applications in non-fatal dumps.
Test: debuggerd_test
Test: send SIG35 to arbitrary process and inspect the log and tombstone
Test: crasher fdsan_file
[1] 20ad9129e7/libc/bionic/fdsan.cpp (166)
Change-Id: I76931ca4825e846fc99f26fa590c045130abb850
aosp/2452605 might've accidentally omitted force flash functionality
from fastboot. Some users need to flash dynamic partitions from
bootloader, so we are readding this feature back into fastboot
Test: adb reboot bootloader, fastboot flash system --force
Change-Id: I37a51ebbe38b27ed428c38068d30c0febd7db09c
Also add the missing `.size` directives to all the assembler functions
for slightly improved backtraces.
Test: crasher64 pac; crasher64 bti
Change-Id: I8e0c127cbff56c33637e6ca8f1d927b971951807
* changes:
snapuserd: Reduce size of COWs in tests.
snapuserd: Add unit tests for ReadWorker::ReadAlignedSector.
snapuesrd: Build snapuserd_test on host.
snapuserd: Add an ITestHarness implementation for hosts.
snapuserd: Don't specify a path to TemporaryFile.
cleaning up a bit of code for consistency + adding in zstd to
FromString() function
Test: m libsnapshot
Change-Id: Ic8b7243c5a5ee25326a46e944c13578136f27078
* changes:
snapuserd: Factor a base class out of tests.
snapuserd: Add error propagation to tests.
snapuserd: Add diagnostics for debugging races.
snapuserd: Fix race condition in HandleManager shutdown.
snapuserd: Remove test dependence on LoopDevice.
This greatly reduces the runtime of snapuserd_test, from 4 minutes to
about 1.5 minutes.
Bug: 269361087
Test: snapuserd_test
Change-Id: Ic18443d4e4318f6ef6adadeabd47ccceeeb19b6f
This factors a lighter weight class out of SnapuserdTest, so we can
construct tests without needing a HandlerManager/daemon.
Bug: 288273605
Test: snapuserd_test
Change-Id: Ib33dc593a5b3d3df86853e73f245918ef36fd9fa
These tests are for real bugs that were previously not testable.
Bug: 288273605
Test: snapuserd_test
Change-Id: I9e9af999e4f5f988f4538750eba109f6b2fe448c
snapuserd_test in general doesn't propagate errors, which means the
first failure will cascade into many failures. This can make it harder
to figure out what's going on.
Unfortunately error propagation is difficult with gtest, since bool
returns don't work with ASSERT_EQ and Android doesn't use exceptions.
Use ASSERT_NO_FATAL_FAILURE for now, since that is the least invasive
change.
Bug: 288273605
Test: snapuserd_test
Change-Id: I6550682fd63602bc15649f705def2915f6329357
This adds an implementation of ITestHarness suitable for running tests
on the host. IUserDevice and ProcessRequests are implemented just enough
for shutdown of ReadWorker to work. Most snapuserd tests are focused on
merging, and do not need a ReadWorker accepting requests.
Bug: 288273605
Test: snapuserd_test
Change-Id: I00cf6ec941fb6423290f7a299e5321adea7d8919
Placing temporary files in the executable dir creates unexpected files
in the build dir when running on the host, which linger if snapuserd
crashes.
Bug: 288273605
Test: snapuserd_test
Change-Id: Ia1ea4ba70b645a9d2f49419b91003bc62fb03cb2
Adds calls to pthread_setname_np for each thread.
Clarify error messages from io_uring calls that return -errno.
Add log messages for some failure paths that didn't have any.
Add an ostream overload for MERGE_IO_TRANSITION, and add an INVALID
state for initialization.
Bug: 288273605
Test: builds
Change-Id: Ic0681cbf0017af67bcf52b98db184a9b48752faf
When HandlerManager shuts down, the monitor thread is left detached. The
monitor thread does not hold a shared_ptr reference to the
HandlerManager, so the pointer can be left dangling.
Fix this by not detaching the monitor merge thread.
This patch also changes the test harness to destroy
SnapshotHandlerManager on "shutdown", to avoid state leaking into the
next instance of snapuserd.
Bug: 288273605
Test: snapuserd_test
Change-Id: Iaaf96a37657c85cff4d2a8b15ccfde4aa03d3220
LoopDevice requires root, which is an obstacle to running this test in
automation. The test also requires memfd which is not available in our
included glibc. Create an IBackingDevice layer so we can use temporary
files instead on host tests, while keeping the block-device code for
on-device tests, which more closely matches how snapuserd runs.
Bug: 288273605
Test: snapuserd_test
Change-Id: I89b154921b6bbcf8fe213ef7f5c4da4d48322909
Since we're adding compression levels should consolidate this
information into one structure. Adding in CowCompression struct
to hold this information and refactoring code to work off this struct
Test: ota
Change-Id: I969a3ae19ec80fd964bcfb76b39f42f8dd31a56d
* changes:
snapuserd: Factor setpriority/settid calls into a helper.
snapuserd: Add a harness to run tests without dm-user specific code.
snapuserd: Add an IBlockServerFactory abstraction.
* changes:
snapuserd: Remove dm-user specific code from ReadWorker.
snapuserd: Add an IBlockServer abstraction around dm-user.
snapuserd: Rename snapuserd_merge to merge_worker.
This allows disabling the code in host builds, since settid() isn't
available in the glibc prebuilt.
Bug: 288273605
Test: snapuserd_test
Change-Id: Ifddb5cb8b04484a1ab0a29794d65c9839759a919
This patch adds an abstraction layer around Tempdevice (which wraps
device-mapper), and a layer to replace hardcoding of DmUserBlockServer.
The only implementation of the new layer, currently, is for dm-user.
However this will allow the harness to run with a backend chosen at
runtime, making testing on the host or of ublk much easier.
Bug: 288273605
Test: snapuserd_test
Change-Id: I8735ef6c373f3e5c5cdf3df461668ddd8e551f63
To avoid SnapshotHandler hardcoding specifics about dm-user, this patch
adds a factory interface, responsible for providing IBlockServerOpener
objects.
The test harness will use this to facilitate dm-user-less testing on
host devices.
Bug: 288273605
Test: snapuserd_test
Change-Id: Ifd33c28ee7076f30a8a90f745353893188f97a08
BufferSink is not needed/used in all worker types, so move it explicitly
to MergeWorker. This also moves the sizeof(dm_user_header) computation
to BufferSink::Initialize.
Bug: 288273605
Test: snapuserd_test
Change-Id: I8fcea6f0e587ca6d8672df5ec58c4d4d14d4b72e
This adds the planned interface that will abstract around dm-user (for
now), and later ublk at which point it can be adjusted as needed.
This declares the interface and implements it, but does not yet switch
snapuserd to use it. The implementation is copied from read_worker.cpp.
Bug: 288273605
Test: snapuserd_test
Change-Id: I060788c91dba78e52d315b5616b84b37eaf4040f
* With platform-tools-34.0.4 if you try to wipe data
as apart of the fastboot update command it will not
work, will just reboot to userspace without running
the wipe task.
Test: fastboot -w update image.zip, observe that data
gets wiped. Also verified 'fastboot update image.zip'
does *not* wipe data.
Change-Id: I57a2c64029fd4f78968324bdf60251e1e962b3fd