Commit graph

88810 commits

Author SHA1 Message Date
David Drysdale
f28e284141 Drop TODO for flag enablement
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
2024-02-21 13:50:12 +00:00
Pierre-Clément Tosi
b6b2afb6b3 first_stage_console: Refactor RunScript()
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
2024-02-21 12:35:55 +00:00
Treehugger Robot
1a7a68461f Merge changes from topics "crashapi2", "crashapi3" into main am: acafa40d82
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2962950

Change-Id: I27824726c2820b33b9b238469d9a727cdea3056c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-21 08:30:36 +00:00
Treehugger Robot
acafa40d82 Merge changes from topics "crashapi2", "crashapi3" into main
* changes:
  use new location of crash_detail API
  Add tests for android_replace_crash_detail_[name|data]
2024-02-21 07:42:42 +00:00
Pierre-Clément Tosi
b1d92c6508 first_stage_console: Fix waitpid() as SA_NOCLDWAIT
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
2024-02-19 15:01:11 +00:00
Treehugger Robot
dccae8ce3c Merge "first_stage_console: Fix execv() child error path" into main am: 3b79ada7ef
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2959288

Change-Id: I56ddf989130e37f9d3a5ca6b884da6eeac46c62f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-19 11:19:54 +00:00
Treehugger Robot
3b79ada7ef Merge "first_stage_console: Fix execv() child error path" into main 2024-02-19 10:49:01 +00:00
Treehugger Robot
ca95bfc10e Merge "Rename functions in libvendorsupport" into main am: f27d8cebbd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2964824

Change-Id: If033344bccfffd08fadda77c1d2617a788f2815a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-19 00:29:14 +00:00
Treehugger Robot
f27d8cebbd Merge "Rename functions in libvendorsupport" into main 2024-02-18 23:53:22 +00:00
Treehugger Robot
8a10b8a71d Merge "Add check_builtins to libinit_host" into main am: cb09ff33a3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2966903

Change-Id: Iac72d76a94521b33ce79c7c791b25945a4e05889
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-17 00:44:12 +00:00
Treehugger Robot
cb09ff33a3 Merge "Add check_builtins to libinit_host" into main 2024-02-17 00:13:19 +00:00
Pierre-Clément Tosi
0335dac70d first_stage_console: Fix execv() child error path
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
2024-02-16 15:23:32 +00:00
Justin Yun
8ce23dc44e Rename functions in libvendorsupport
Follow platform naming conventions for an LLNDK library.

Bug: 325093550
Test: atest libvendorsupport-tests
Change-Id: Id93f7e66a47ae9250191f9827a76ce819e8f6f88
2024-02-16 23:53:04 +09:00
Mitch Phillips
3d7a5c3a9b Merge "Update debuggerd for stack MTE." into main am: acd092ad4e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2952673

Change-Id: I6f4ea45267397fb694a2f16e2b8784bee3930e0c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-16 09:44:25 +00:00
Mitch Phillips
acd092ad4e Merge "Update debuggerd for stack MTE." into main 2024-02-16 09:01:34 +00:00
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
1cfe984af1 Merge "Revert "healthd: BatteryMonitor: doLogValues: reduce log level to debug"" into main am: 1242da780f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2965363

Change-Id: I87206087ffdcf74ae115d368c6d2450ff9d0bec2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-15 23:57:57 +00: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
44d2b204b0 Merge "init.rc: create /metadata/aconfig, /metadata/aconfig/flags and /metadta/aconfig/boot dirs" into main am: 48a452423b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2960463

Change-Id: Ief89fc5892275f3b52b237504aec5ab76341053e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-15 13:53:00 +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
321c71426a Merge "create_snapshot: Enable v3 writer + variable block size" into main am: c65b6e62cb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2954450

Change-Id: Icc1fd3401acdc39cf40eef759b651e56b275206b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-15 09:19:53 +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
26efc75858 Merge "fastboot: Increase maximum usbfs bulk size for writes to 256KiB" into main am: c0e1b607d3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2961895

Change-Id: Id7e7ca33204aadaba64c9bb870e3df68b33e80c4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-15 05:21:25 +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
Treehugger Robot
e7e3a9efb3 Merge "Check if ALWAYS_INLINE is already defined" into main am: 8097002e09
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2963982

Change-Id: I37f81d8ba382cd3cc7f57a0896b15d713895be5a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 21:36:53 +00: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
7dddcbbd2a Merge "Read data set by android_add_crash_detail into tombstone." into main am: 75800c9c3a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2955722

Change-Id: I88829e46f241d0028c4a671b32af5de0f0efedba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 17:40:42 +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
b422458e2d Merge "first_stage_console: Address compiler warning" into main am: 619042f207
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2959286

Change-Id: Id019cffe424167ff16eb939a63d8823d215e0583
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 16:18:47 +00:00
Treehugger Robot
619042f207 Merge "first_stage_console: Address compiler warning" into main 2024-02-14 15:34:45 +00:00
Snehal Koukuntla
880316f57d Merge "Sync tipc.h with one from trusty" into main am: 66dc1bde80
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2960970

Change-Id: Idde52332b6f82171d55ace13d94046e1d4d8e37e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 10:01:04 +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
89482bd443 Merge "ashmem: Remove hardcoded PAGE_SIZE usage in ashmem_test" into main am: 89fa277dcb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2954211

Change-Id: I5bbb4901353724821d7a1c06bf1df37986f804b4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 01:11:32 +00:00
Treehugger Robot
e233ba1d0e Merge "Change debuggerd client param from pid to tid" into main am: 222ba3e8bd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2941065

Change-Id: I1fcad6a0a9fa5299a09e8acd1dd19cab9c525ba4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 01:10:24 +00: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
2499c6d958 Merge "libsnapshot: replace non-character basic_string[_view]<T>" into main am: 18744c17c1
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2956695

Change-Id: I2f5f9e60cc8f0421e25764d7652be05e54dc2f49
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-09 20:00:33 +00: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
94a060ada0 Merge "Remove obsolete __STDC_LIMIT_MACROS references." into main am: 0bd010d9ae
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2955864

Change-Id: Ie8ab57eb4c3bd82a433e2bccef46e53e003a7f01
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-09 19:58:53 +00:00