Commit graph

86844 commits

Author SHA1 Message Date
Jooyung Han
39e8be43eb Add check_builtins to libinit_host
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
2024-02-16 17:36:12 +09:00
AleX Pelosi
1242da780f Merge "Revert "healthd: BatteryMonitor: doLogValues: reduce log level to debug"" into main 2024-02-15 23:12:47 +00:00
AleX Pelosi
f08aeded81 Revert "healthd: BatteryMonitor: doLogValues: reduce log level to debug"
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
2024-02-15 19:28:02 +00:00
Dennis Shen
48a452423b Merge "init.rc: create /metadata/aconfig, /metadata/aconfig/flags and /metadta/aconfig/boot dirs" into main 2024-02-15 13:20:02 +00:00
Akilesh Kailash
c65b6e62cb Merge "create_snapshot: Enable v3 writer + variable block size" into main 2024-02-15 08:33:14 +00:00
Treehugger Robot
c0e1b607d3 Merge "fastboot: Increase maximum usbfs bulk size for writes to 256KiB" into main 2024-02-15 03:47:49 +00:00
Peter Collingbourne
ab8cc2f7f3 fastboot: Increase maximum usbfs bulk size for writes to 256KiB
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
2024-02-14 16:09:47 -08:00
Florian Mayer
920d95b1c8 use new location of crash_detail API
Bug: 155462331
Change-Id: I862f91368d421363adbbf002fe3c7d446c437b03
2024-02-14 12:58:18 -08:00
Treehugger Robot
8097002e09 Merge "Check if ALWAYS_INLINE is already defined" into main 2024-02-14 20:40:30 +00:00
Florian Mayer
aced3aa5c6 Add tests for android_replace_crash_detail_[name|data]
Bug: 155462331
Change-Id: I1ca4ae6d700dfbaf0bc4e511da0788edd969fca3
2024-02-14 12:01:49 -08:00
Serdar Kocdemir
593b19b5ce Check if ALWAYS_INLINE is already defined
Fixes build errors when using callstack library in gfxstream
project, where the definition is already made.

Test: build
Change-Id: I80d4038160725b5dc70f9af93d338aca66a2f0d5
2024-02-14 17:52:19 +00:00
Florian Mayer
75800c9c3a Merge "Read data set by android_add_crash_detail into tombstone." into main 2024-02-14 17:06:07 +00:00
Treehugger Robot
619042f207 Merge "first_stage_console: Address compiler warning" into main 2024-02-14 15:34:45 +00:00
Snehal Koukuntla
66dc1bde80 Merge "Sync tipc.h with one from trusty" into main 2024-02-14 09:07:24 +00:00
Florian Mayer
5fa6663458 Read data set by android_add_crash_detail into tombstone.
Bug: 155462331
Bug: 309446525
Change-Id: I6d01aafca48e0e5e8cbd5ae87add6aec0c429503
2024-02-13 18:13:22 -08:00
Vilas Bhat
89fa277dcb Merge "ashmem: Remove hardcoded PAGE_SIZE usage in ashmem_test" into main 2024-02-14 00:51:11 +00:00
Treehugger Robot
222ba3e8bd Merge "Change debuggerd client param from pid to tid" into main 2024-02-14 00:13:33 +00:00
Vilas Bhat
f791b99628 ashmem: Remove hardcoded PAGE_SIZE usage in ashmem_test
Bug: 323061793
Test: atest libcutils_test
Change-Id: I8defd5225859b52a1b96a638d418188b328a23bc
2024-02-13 20:50:00 +00:00
Dennis Shen
61d9e2ab8d init.rc: create /metadata/aconfig, /metadata/aconfig/flags and
/metadta/aconfig/boot dirs

Create aconfig dirs on /metadata to store aconfig storage related files.

Under /metadata/aconfig we will store the following pb files:

1, aconfig_storage_location.pb, store the location of the storage files for
each container.

2, aconfig_flag_persistent_overrides.pb, store the local flag value overrides.

Under /metadata/aconfig/flags we will store flag value and info files
for each container, this include:

1, <container_name>.val flag value file
2, <container_name>.info flag info file

Under /metadata/aconfig/boot we will store read only flag value files
copied from /metadata/aconfig/flags at boot. These read only files are
used to serve flag read queries.

Bug: 312444587
Test: m
Change-Id: I8ae06e56fc9b9e8c0b06f86e3deb4219d7f49660
2024-02-13 20:47:13 +00:00
Snehal
f425428c2d Sync tipc.h with one from trusty
Bug: 325069766

Test: Android boot and crasher test

Change-Id: I36244cfb698a81be79c204eb019e1a59b90d2e6c
2024-02-13 18:10:00 +00:00
Pierre-Clément Tosi
914ccc5664 first_stage_console: Address compiler warning
Re-order the fields in the declaration to address the following

  ISO C++ requires field designators to be specified in declaration order;
  field 'sigaction::(anonymous union at bionic/libc/include/bits/signal_types.h:76:20)'
  will be initialized after field 'sa_flags' [-Wreorder-init-list]

Test: TH
Change-Id: I3f1d4739f1677aad50d4f07361aa264da43bdd13
2024-02-12 18:57:16 +00:00
Akilesh Kailash
e5bc36900e create_snapshot: Enable v3 writer + variable block size
1: Move to v3 COW writer

2: Enable variable block size. Default compression set to lz4
with compression factor 64KiB

3: Prepare merge sequence so that device can initiate the merge

4: Verify the merge order

Bug: 319309466

Test: On Pixel 6

This was tested on live builds where the actual builds/testing
is done on CI.

Patch-Create+Apply = Create the snapshot patches between two
builds and apply them to the device

Branch(main)            Patch-Creation+Apply  Snapshot-size
=============================================================
Build-1 -> Build-2      14 seconds            160MB

Build-2 -> Build-3      21 seconds            331MB

Build-3 -> Build-4      30 seconds            375MB

Build X -> Build X      3 seconds             8MB

Change-Id: I96437032de029d89de62ba11fe37d9287b0a4071
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-02-11 23:19:22 -08:00
Ryan Prichard
18744c17c1 Merge "libsnapshot: replace non-character basic_string[_view]<T>" into main 2024-02-09 20:00:06 +00:00
Treehugger Robot
0bd010d9ae Merge "Remove obsolete __STDC_LIMIT_MACROS references." into main 2024-02-09 19:11:47 +00:00
Elliott Hughes
29cd07132d Remove obsolete __STDC_LIMIT_MACROS references.
None of our libcs need this any more.

Test: treehugger
Change-Id: I8a942ad6b3860633a6d722bd237a7c75482499eb
2024-02-09 16:40:02 +00:00
Treehugger Robot
22e1c5dcb0 Merge "Replace lazy_static with once_cell" into main 2024-02-09 15:41:46 +00:00
Ryan Prichard
abb472c238 libsnapshot: replace non-character basic_string[_view]<T>
In newer versions of libc++, std::char_traits<T> is no longer defined
for non-character types, and a result, std::basic_string<T> and
std::basic_string_view<T> are also no longer defined for non-character
types. See
https://discourse.llvm.org/t/deprecating-std-string-t-for-non-character-t/66779.

Replace them with std::vector<T> and std::span<const T>.

Bug: 175635923
Test: m MODULES-IN-system-core-fs_mgr
Test: /data/nativetest64/cow_api_test/cow_api_test
Change-Id: Ife2e87833ced43ff24e5765998cb6993e4f9b4c0
2024-02-08 23:20:10 -08:00
Treehugger Robot
ff239bb0fc Merge "Add test mapping" into main 2024-02-08 18:30:25 +00:00
T.J. Mercier
c902df07b0 Add test mapping
Bug: 315371696
Change-Id: If8448e703cc5accde11bcdccf7585ef6779f59b0
2024-02-08 16:57:43 +00:00
Treehugger Robot
2d686d7b71 Merge "fastboot: Use clock_gettime(CLOCK_MONOTONIC) in now()" into main 2024-02-08 16:09:44 +00:00
Treehugger Robot
4e4d918689 Merge "Remove unused addKernelPanicSubReason() return value." into main 2024-02-08 16:09:04 +00:00
Neill Kapron
2b2fcaea46 Merge "healthd: BatteryMonitor: doLogValues: reduce log level to debug" into main 2024-02-08 03:24:16 +00:00
Treehugger Robot
241046adaa Merge "fastboot: Remove '\n' from interface name on linux" into main 2024-02-08 03:11:53 +00:00
Peter Collingbourne
cc1bf34ba6 fastboot: Use clock_gettime(CLOCK_MONOTONIC) in now()
If the system time changes during the execution of fastboot we might
see some strange output such as:

Sending sparse 'super' 4/20 (254972 KB)            OKAY [-516.263s]

Fix it by changing now() to use clock_gettime(CLOCK_MONOTONIC).
I confirmed that all callers of now() are using it for relative time
and not time since the epoch.

Change-Id: Ic3e9442c2ab21dfb076bfed88915085a183754b0
2024-02-07 16:55:49 -08:00
Matt Schulte
28f4807dd3 fastboot: Remove '\n' from interface name on linux
If the device provides an interface string, we should remove the newline
from the read file that is added from by the linux kernel.

Bug: 324320178
Test: Ran the same command with my local changes vs not

```
bash$ ./fastboot devices -l
5f42ad5ad259c90cf14ea222791b6aaa fastboot usb:7-3

bash$ fastboot devices -l
5f42ad5ad259c90cf14ea222791b6aaa fastboot
 usb:7-3
```

Change-Id: Ida3316fdba8e35f0c66784f83455a4d82e90ba1c
2024-02-07 16:24:26 -08:00
Neill Kapron
aeccbb8f3a healthd: BatteryMonitor: doLogValues: reduce log level to debug
This is log spam and fills the kernel log. Reduce log level from warning
to debug.

Test: manual
Bug: 36785118
Change-Id: I70fc3a0d796cb1a984705236fe7527e266a69a03
Signed-off-by: Neill Kapron <nkapron@google.com>
2024-02-07 23:37:50 +00:00
Elliott Hughes
1c5911fade Remove unused addKernelPanicSubReason() return value.
The only caller that was looking at the return value just stopped.

Test: treehugger
Change-Id: Icf2508e8e1ee4969918eadeb580f70236ba53496
2024-02-07 22:22:13 +00:00
Elliott Hughes
c72c9a6d3c Merge "We don't need __STDC_FORMAT_MACROS any more." into main 2024-02-07 21:56:38 +00:00
Elliott Hughes
6225d6f3eb We don't need __STDC_FORMAT_MACROS any more.
Test: treehugger
Change-Id: Iada8b959f61bfa55b61d2ed4b345801ed9cea0c6
2024-02-07 18:27:47 +00:00
Treehugger Robot
0c78cf96a1 Merge "bootstat: Remove long key press check" into main 2024-02-07 18:23:30 +00:00
Treehugger Robot
277533b7a3 Merge "fastboot: Use asynchronous operations to send data" into main 2024-02-07 03:42:00 +00:00
Zheng Pan
fa544b551b bootstat: Remove long key press check
Current check is kind of device specfic and causes false positive.

Bug: 320829712
Test: Trigger long key press and check boot reason
Change-Id: I5b2b8307f16eecd05513bfa51494da174fc839bd
2024-02-06 17:39:27 -08:00
Peter Collingbourne
8635c016db fastboot: Use asynchronous operations to send data
The fastboot command currently uses USBDEVFS_BULK to transfer data
(including image data) to the target. On the kernel side it looks
like this:

1. Allocate a contiguous memory region and copy the user data into
   the memory region (which may involve accessing storage).
2. Instruct the driver to start a DMA operation.
3. Wait for the DMA to finish.

This is suboptimal because it misses out on a pipelining
opportunity. We could be doing 3 for the current operation in parallel
with 1 for the next operation, so that the next DMA is ready to go
as soon as the current DMA finishes.

The kernel supports asynchronous operations on usbdevfs file
descriptors (USBDEVFS_SUBMITURB and USBDEVFS_REAPURB), so we can
implement this like so:

1. Submit URB 0
2. Submit URB 1
3. Wait for URB 0
4. Submit URB 2
5. Wait for URB 1
and so on.

That is what this CL implements. On my machine it increases transfer
speed from 125 MB/s to 160 MB/s using a USB 3.0 connection to the
target (Pixel 8).

Bug: 324107907
Change-Id: I20db7ea14af85db48f6494091c8279ef7a21033d
2024-02-06 13:10:27 -08:00
Jeffrey Vander Stoep
40b6a8f0c6 Merge "Replace use of deprecated logging functions" into main 2024-02-06 16:09:30 +00:00
Mitch Phillips
bf2d6dd7d4 Update debuggerd for stack MTE.
Two things need changing for debuggerd_test to pass.

 1. The seccomp policy needs to allow for PROT_MTE (0x20) in both
    mprotect() and mmap(). Stack MTE processes do a mprotect()/mmap() of
    the stack when launching a process.
 2. The fault address and stack pointer need to be untagged when trying
    to figure out the stack overflow cause.

Bug: 320448268
Bug: 292478827
Test: atest debuggerd_test --iterations=10
Change-Id: I56471c32ca40edffbb61b7547bdf2b85a6eb1ff7
2024-02-06 15:18:04 +01:00
Jeff Vander Stoep
56aedd5551 Replace use of deprecated logging functions
This is needed to upgrade the android_logger crate from 0.12.0
to 0.13.3.

with_max_level provides the same functionality as with_min_level.
The renaming is admittedly confusing, but the new name is accurate
and it makes sense that they deprecated and then removed the
previously poorly named with_min_level.

See crate documentation [1] and code [2].

[1]: https://docs.rs/android_logger/0.12.0/android_logger/struct.Config.html#method.with_min_level
[2]: https://docs.rs/android_logger/0.12.0/src/android_logger/lib.rs.html#227

Bug: 322718401
Test: build and run CF with the change.
Test: m aosp_cf_x86_64_phone
Change-Id: Ib4fbd486267d30e74e886139846950b066848d43
2024-02-06 12:32:36 +01:00
David Dai
161b80bd02 Merge "Add AID for Virtual Machines" into main 2024-02-06 01:21:39 +00:00
Treehugger Robot
eadf6b4bda Merge "remount: Auto remount option (-R) also tries to gain root" into main 2024-02-05 23:47:54 +00:00
David Dai
851c9c825f Add AID for Virtual Machines
Add a new AID for Virtual Machines so we can grant
capabilities such as CAP_SYS_NICE.

Bug: 322197421
Test: Build and boots, and verified capabilities

Change-Id: Ie893ba8ed6956a554bccfbd00e4e6fe9212ea77d
Signed-off-by: David Dai <davidai@google.com>
2024-02-05 23:38:44 +00:00
Kenn Frankel
7833f27c25 Merge "Update libstatssocket_lazy to support StringArray" into main 2024-02-05 19:16:33 +00:00