Commit graph

88899 commits

Author SHA1 Message Date
Akilesh Kailash
ea798470a0 Merge "libsnapshot: Fetch device size from header" into main am: 7428705371
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2974622

Change-Id: I42f1f048d6a8298c8cb82f7f3eef710998598743
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-24 07:17:43 +00:00
Akilesh Kailash
7428705371 Merge "libsnapshot: Fetch device size from header" into main 2024-02-24 06:36:36 +00:00
Treehugger Robot
a1e7728329 Merge "minor doc improvement for tombstone fd code" into main am: 1076e7f7a3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2976171

Change-Id: I780a2f085005c7f603b086324b3354bdde21316e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-24 05:32:59 +00:00
Treehugger Robot
1076e7f7a3 Merge "minor doc improvement for tombstone fd code" into main 2024-02-24 05:02:23 +00:00
Florian Mayer
877d1f6694 Make tombstones 664.
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
2024-02-23 15:31:30 -08:00
Akilesh Kailash
69d574c612 libsnapshot: Fetch device size from header
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>
2024-02-23 22:26:42 +00:00
Florian Mayer
23e9289e69 minor doc improvement for tombstone fd code
Change-Id: I8037d9dd5a6c0e86e853d001ccedc472ce61d107
2024-02-23 22:16:03 +00:00
Elliott Hughes
f795d2bf16 Merge "Reduce <CallStack.h> namespace pollution." into main am: d6ccb0b1d9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2974871

Change-Id: Iffec5a500704a4738bb4240eef3da612250d2782
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-23 16:56:34 +00:00
Elliott Hughes
d6ccb0b1d9 Merge "Reduce <CallStack.h> namespace pollution." into main 2024-02-23 16:15:06 +00:00
Daniel Zheng
f8dc763dd6 Merge "libsnapshot: stride compression" into main am: 4edb9c0088
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2958927

Change-Id: Ie82f6011ed81d7dc10671927472c5dec475fd158
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-23 06:34:20 +00:00
Daniel Zheng
4edb9c0088 Merge "libsnapshot: stride compression" into main 2024-02-23 05:39:29 +00:00
Daniel Zheng
bee3f962fc libsnapshot: stride compression
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
2024-02-22 21:38:47 -08:00
Christopher Ferris
b7e384b5fd Merge "Fix up the debuggerd policy files." into main am: 184d42f889
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2974226

Change-Id: I31974d3319e942663731e7dbcabdbfa85f9e24bb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-23 04:02:47 +00:00
Christopher Ferris
184d42f889 Merge "Fix up the debuggerd policy files." into main 2024-02-23 03:25:48 +00:00
Automerger Merge Worker
1fdfdc1212 Merge "Merge "Drop CtsInitTestCases from cts" into android14-tests-dev am: 6681eac2d5" into main am: 6f86bdcd68
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2972833

Change-Id: Ic686987bb47f1c19c2ac31467ed8527a38ed4784
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-23 02:12:21 +00:00
Automerger Merge Worker
6f86bdcd68 Merge "Merge "Drop CtsInitTestCases from cts" into android14-tests-dev am: 6681eac2d5" into main 2024-02-23 01:28:57 +00:00
Jiyong Park
f310ecdb42 Merge "Drop CtsInitTestCases from cts" into android14-tests-dev am: 6681eac2d5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2972833

Change-Id: Ia7f8c34ee40e0d8c2bb78b38913c0fabda6e3ec6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-23 01:28:50 +00:00
Jiyong Park
6681eac2d5 Merge "Drop CtsInitTestCases from cts" into android14-tests-dev 2024-02-23 00:51:01 +00:00
Elliott Hughes
fdc642643d Reduce <CallStack.h> namespace pollution.
Use the CALLSTACK_ prefix uniformly, and undefine all the macros
at the end of the file.

Change-Id: Ie5f92bb8cb8b3753082b1c1145696a1e0409e04d
2024-02-23 00:46:16 +00:00
Christopher Ferris
3e662d3c7f Fix up the debuggerd policy files.
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
2024-02-22 16:23:46 -08:00
Ed Tsai
43de4ef22d Support for striped in libdm
Add dm stripe in dmctl framework to support stripe on two block devices.

Bug: 321628121
Change-Id: I2f326f19f7ccff1ee03598743022fb702b3e8d6a
Signed-off-by: Ed Tsai <ed.tsai@mediatek.com>
2024-02-23 08:11:30 +08:00
Kalesh Singh
20eab6f58b Merge "init: snapuserd: Fix ranges for mlock()" into main am: df09f80cf4
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2964563

Change-Id: Ie80dbe09c6afb8d5973a3fa06941015f2667ff9a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-22 21:05:09 +00:00
Kalesh Singh
df09f80cf4 Merge "init: snapuserd: Fix ranges for mlock()" into main 2024-02-22 20:27:13 +00:00
Andy Hung
66c057f062 Merge "RefBase: update sp and wp to allow constinit" into main am: 0288e96035
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2972278

Change-Id: I3a66e31491c2b1736c9e37b0572b9ccaaef05023
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-22 18:55:14 +00:00
Andy Hung
0288e96035 Merge "RefBase: update sp and wp to allow constinit" into main 2024-02-22 18:00:31 +00:00
Treehugger Robot
6b803bcfaa Merge changes Ifaab2be0,I54df888e into main am: 8687d25c0d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2959289

Change-Id: I376f6b0e8697733e395edd7257eb21f814c587e3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-22 15:26:00 +00:00
Treehugger Robot
8687d25c0d Merge changes Ifaab2be0,I54df888e into main
* changes:
  first_stage_console: Refactor RunScript()
  first_stage_console: Fix waitpid() as SA_NOCLDWAIT
2024-02-22 14:44:44 +00:00
Andy Hung
071880f5cb RefBase: update sp and wp to allow constinit
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
2024-02-21 21:34:22 -08:00
Kalesh Singh
f90de49e0e init: snapuserd: Fix ranges for mlock()
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>
2024-02-21 18:40:45 -08:00
Jiyong Park
5dd72ac496 Drop CtsInitTestCases from cts
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)
2024-02-22 01:36:58 +00:00
Daniel Zheng
fd81c5e306 Merge "libsnapshot: log compression algorithm" into main am: 7cf49320ba
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2972271

Change-Id: I8f6f3787dd3cf730e110137abbd436e72d7d072e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-21 22:59:02 +00:00
Daniel Zheng
7cf49320ba Merge "libsnapshot: log compression algorithm" into main 2024-02-21 22:17:03 +00:00
Daniel Zheng
25de579429 libsnapshot: log compression algorithm
Log the compression algorithm and compression factor used during OTA for easier debugging

Test: th
Change-Id: Ic50989d7e233983d6299163fc647eb739a0b7cb2
2024-02-21 10:14:06 -08:00
Daniel Zheng
4fd465b987 Merge "libsnapshot: update opcountcheck" into main am: 4f5a9950b2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2958926

Change-Id: I57648690242813efb9c12a3fe3c522ac5dbb2f6f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-21 17:36:29 +00:00
Daniel Zheng
4f5a9950b2 Merge "libsnapshot: update opcountcheck" into main 2024-02-21 17:22:40 +00:00
Daniel Zheng
dccf1b6e39 libsnapshot: update opcountcheck
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
2024-02-21 09:22:07 -08:00
David Drysdale
5a089ad035 Merge "Drop TODO for flag enablement" into main am: fdca8e2055
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2971137

Change-Id: Ib10f6e738100cca24ee694cd580758e9828855be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-21 17:14:02 +00:00
David Drysdale
fdca8e2055 Merge "Drop TODO for flag enablement" into main 2024-02-21 16:35:04 +00:00
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