It's used only by host_init_verifier. This is to remove the unnecessary
dependency from clients of init_host_defaults.
Bug: 326509378
Test: mmma system/core/init
Change-Id: I983fbfe616f0bcb87940c934e19f614d3bf51030
They are still restricted by SELinux, and apps still cannot open them
because they don't have `open` SELinux permission.
Bug: 312740614
Change-Id: I83b7e6ed39f5af64f161af3b3e8e33af0d125b20
Now that V3 is enabled, relax the header version check.
For V3, header op_count_max contains the information of the device size.
Bug: 299011882
Test: snapshotctl map-snapshots on Pixel with V3 format
Change-Id: Ia1cb20b24857136a742e20408ee95e56e98b256a
Signed-off-by: Akilesh Kailash <akailash@google.com>
Alternate dispatching blocks between threads rather than splitting the
data beforehand and then sending to threads in order to ensure that
single threading + multithreading chunks data at the same locations.
Without this change, the resulting op count + data section of the cow
will differ between --enable-threading && --disable-threading at
runtime, which is a result we don't want
Test: th
Change-Id: I3ed8add0552745a281fce2aa7f1d1d32eb547e63
A few files were changed without using the generate script. Modify
the original policy file and generate all of the policy files
properly.
Test: Verify the generated files are the same as before.
Change-Id: Ic6979c06c5d290b3047c8307e86ec1e78a242d44
A constexpr ctor is useful for static initialization.
We also modernize the unit test for static variable best practices.
Test: atest libutils_binder_test
Change-Id: If42c0939fb1a2dcb8eb101ed0e10051f67e2150d
It cannot be assumed that file mappings in /proc/<pid>/maps will be
completely backed by the underlying file. [1]
Use MappedFileSize() to deduce the correct ranges for the mlock()
calls when locking system pages in the OTA path.
While at it also clean up the some unreachable code (mlockall()),
and improve error logging.
[1] SIGBUS at https://man7.org/linux/man-pages/man2/mmap.2.html#RETURN_VALUE
Test: Incremental OTA
Bug: 324952273
Change-Id: Ia2ab150e1b8de8c638f5b1acc1de83deb7ac5cff
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
The test is not eligible for CTS. Reasons:
1. The init behavior does not directly affect app compat. App interact
with init only for the property service and that part is covered by
the Bionic test already.
2. This test doesn't run against the init binary installed on the
device. libinit where most of the init functionalities are
implemented is statically linked to this test binary. In other words,
this test is closer to a unit test for init.
3. This test is not compatible with Trunk stable where test and DUT are
built in different branches. The test depends on several (private)
libraries like libbase and libutils. Since the interfaces of the
libraries may have changed in the main branch, the test binary built
from the old test-dev branch may break.
This change does not remove the test. The test will still run as a unit
test during pre/post submit.
I didn't drop the `Cts` prefix from the name, because that requires
broader changes.
Bug: 320800872
Test: N/A
Change-Id: I1402c08b79b57ad6daa7948fe37f14fbbe36f1d6
(cherry picked from commit 75070b37e2)
Log the compression algorithm and compression factor used during OTA for easier debugging
Test: th
Change-Id: Ic50989d7e233983d6299163fc647eb739a0b7cb2
Since variable block compresses blocks and there is no longer a 1:1
mapping between ops to blocks, we need to update this check in
EmitBlocks to the actual number of compressed blocks written.
Since single threaded + multi threaded + no compression invoke different
code paths. Ensure that that blocks written are still equivalent to
blocks.size(). Adding two test cases to cover these situations.
Test: th
Change-Id: If81eccf74333292a114268862dde0fe49681ef35
Flag control for enabling Secretkeeper is done in the device-specific
makefiles, triggering whether they set SECRETKEEPER_ENABLED:=true
Test: none, comment change
Change-Id: I399d1840519864687aca6c53697317d449eed325
Introduce SpawnImage() as a reusable single-argument wrapper around
posix_spawn(), to avoid having to manually manage the child process.
Note that Bionic currently doesn't return the errno from the child's
exec() call to the caller in the parent process, which may temporarily
hide errors such as ENOENT in first_stage_console until Bionic improves.
Also, this introduces a subtle change in behavior as the first_stage.sh
script is now passed directly to the loader, which will only properly
invoke the Shell if the file contains the right shebang.
Inline the call to RunScript() to hopefully make it simpler for readers
to track the lifetime of the various processes on different code paths.
Test: run first_stage_init
Change-Id: Ifaab2be032b2080a039209295d0b5a3759764ea7
From wait(2):
POSIX.1-2001 specifies that if [...] the SA_NOCLDWAIT flag is set for
SIGCHLD, then children that terminate do not become zombies and a call
to [...] waitpid() will block until all children have terminated, and
then fail with errno set to ECHILD.
As we call sigaction(SIGCHLD, { SIG_DFL, SA_NOCLDWAIT }), running
pid_t w = waitpid(pid, &status, 0);
LOG(INFO) << "..." << status << " " << w << " " << errno;
shows that the calls consistently return (status=0, w=-1, errno=ECHILD).
Therefore, clarify the parent code by prefering wait(2) over waitpid(2),
as SA_NOCLDWAIT makes the kernel ignore the passed PID, and stop logging
the irrelevant status, to avoid confusion when the logs say the exit
status was 0 but the child actually returned an error.
Test: run first_stage_console
Change-Id: I54df888e38b947e206e374ad28ebb044c70c6640
If the /first_stage.sh is not present on the system, the child process
which attempted to execv() ends up returning from the function along
with its parent, which can be seen in early logs e.g.
[ 10.747576][ T51] init: Attempting to run /first_stage.sh...
[ 10.757371][ T52] init: unable to execv /first_stage.sh, returned -1 errno 2
[ 10.767527][ T52] init: unable to execv, returned -1 errno 2
[...]
[ 10.789189][ T51] init: unable to execv, returned -1 errno 2
where both T51 and T52 end up executing the "rest" of StartConsole().
Instead, terminate the child if its execv() failed.
Test: run first_stage_init
Change-Id: I20bc0aeae627761a60fb2b55bae39871ad506f69
This requires a bit of refactoring: moving things around.
libinit_host is used by host_apex_verifier which needs check_builtins as
well.
Bug: 325565247
Test: atest host-apex-verifier
Test: m out/target/product/vsoc_x86_64/host_init_verifier_output.txt
Change-Id: Ifed54dd2149afbab2bf63f7e42c410c2354895fc
This reverts commit aeccbb8f3a.
Reason for revert: needed for debug and investigations of battery and charging issues. The tooling depends on these lines (and have been for years). You should have these lines only on SOC changes and in the presence of a serious problem. Please do not remove logging without consulting with the BMS SW team first.
Change-Id: Ife0079a7e0c1499b22e843429832b019139c0d89
With a device capable of saturating the bus at SuperSpeed+,
the next bottleneck is the fixed (size-independent) overhead of
the usbfs ioctl() system calls, which includes entering/exiting
the kernel, allocating/deallocating a contiguous buffer for DMA,
configuring/deconfiguring the IOMMU and issuing the DMA to the HC. In
order to saturate the bus from the host software perspective, we must
reach the schedule() call in reap_as() before the next interrupt from
the HC indicating the completion of the URB.
In my experimental setup, with an SS+ capable host and device
and 16 KiB URBs, we reach the schedule() call in 25us, but the
URB is serviced in an estimated 16us, so we lose roughly a third
of the bandwidth. Increasing the URB size to 64KiB there are
65us between interrupts and 55us until schedule(). This means
we usually reach schedule() in time but not always, so we lose a
bit of bandwidth. Increasing it again to 128KiB and we have 128us
between interrupts and 65us until schedule(), so we're now comfortably
saturating the bus. In order to account for differences between hosts,
this CL uses a doubled maximum of 256KiB.
With larger allocation sizes we now risk contiguous allocation
failures, so I implemented a fallback where we try smaller sizes if
a larger one fails.
With this CL download speeds on my hosts are now around 980 MB/s over
SS+ and 440 MB/s over SS.
Bug: 325128548
Change-Id: Ie5ad480c73f2f71a50ce7f75ffb4aaa93ded2f0b
Fixes build errors when using callstack library in gfxstream
project, where the definition is already made.
Test: build
Change-Id: I80d4038160725b5dc70f9af93d338aca66a2f0d5