Commit graph

84484 commits

Author SHA1 Message Date
Mitchell Wills
908056efeb Add logs in SuperLayoutBuilder::Open when the metadata isn't supported
Change-Id: Ic9733775616b642f669ceb7459cccd33631ae12b
2023-07-20 06:07:18 +00:00
David Anderson
e1132a9c2f snapuserd: Fix ubsan when reading a single aligned sector.
When a read request is for a single sector, and the sector is
block-aligned, it falls into the ReadAlignedSector path, which assumes
block-sized reads. Fix this by clamping the expected size.

Bug: 291862304
Test: manual test of ReadWorker::ReadAlignedSector
      full OTA
Change-Id: I00e460c333e8a9a4dc2433443e3633f3d794da1d
2023-07-19 23:05:58 -07:00
Treehugger Robot
b26bf3e48e Merge "storageproxyd: Start binder thread pool" into main am: fe1fa35823 am: 3fbf1e39e7 am: d629c4e04e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2660288

Change-Id: I65d8a88239c659b4bd14b86bc486aaa7fd0a76a7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-20 01:04:12 +00:00
Treehugger Robot
d629c4e04e Merge "storageproxyd: Start binder thread pool" into main am: fe1fa35823 am: 3fbf1e39e7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2660288

Change-Id: I23d9824bcdc746286bed53bef533fe15419acb72
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-20 00:20:30 +00:00
Treehugger Robot
3fbf1e39e7 Merge "storageproxyd: Start binder thread pool" into main am: fe1fa35823
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2660288

Change-Id: I02a7a84427e04b2e9e4b1f741230e838e3d52023
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-19 23:39:20 +00:00
Treehugger Robot
fe1fa35823 Merge "storageproxyd: Start binder thread pool" into main 2023-07-19 22:52:21 +00:00
Stephen Crane
fb92cd3c22 storageproxyd: Start binder thread pool
The Trusty storage proxy requires that the suspend service is started to
acquire a wakelock for UFS RPMB operations. Without the binder thread
pool running, starting this service results in at least a 1s polling
delay. This change ensures that we start the thread pool before handling
any RPMB operations, so acquiring the wakelock will complete as soon as
the service is ready without needing to poll once per second.

Test: m storageproxyd
Test: Artificially delay suspend_service to check if we poll
Bug: 281951047
Change-Id: I1a4cdd48d57201b0cf9c24523d22e5bdbcea376a
2023-07-19 18:37:52 +00:00
Jakob Vukalovic
e377432924 ueventd: Fix creation of VFIO dev nodes
VFIO nodes, both the container (`vfio`) node and group (numbered)
nodes, should be located in `/dev/vfio`. This change prevents
ueventd from flattening that structure.

Test: Bind a device to VFIO driver to create a VFIO group
Change-Id: I635e9febe6bb52718df263e735479f361eacad4c
2023-07-19 10:03:10 +01:00
Eric Miao
7239722199 Merge "String8: fix infinite loop and segmentation fault in removeAll()" into main am: 4a33c22c77 am: 339fecf742 am: e9f38cfe0f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2659075

Change-Id: I4e01a5b5738ce5e5af1d8e75d3b77695ce031bcc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-19 04:20:10 +00:00
Eric Miao
e9f38cfe0f Merge "String8: fix infinite loop and segmentation fault in removeAll()" into main am: 4a33c22c77 am: 339fecf742
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2659075

Change-Id: Ib9b22b342289a1f98bac979d0a9218ca697773d5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-19 03:35:06 +00:00
Eric Miao
339fecf742 Merge "String8: fix infinite loop and segmentation fault in removeAll()" into main am: 4a33c22c77
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2659075

Change-Id: Ia793f3deb7ff7cfbd455749d3a61fba55320d0ad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-19 02:52:36 +00:00
Daniel Zheng
3b65562b0a Merge "Adding documentation" into main am: f161ee2771 am: f28f589f34 am: 6294727697
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2663995

Change-Id: I99d3e4fdc638750c71b7cdf0ed12970ed688ae3c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-19 02:50:12 +00:00
Eric Miao
4a33c22c77 Merge "String8: fix infinite loop and segmentation fault in removeAll()" into main 2023-07-19 02:03:40 +00:00
Daniel Zheng
6294727697 Merge "Adding documentation" into main am: f161ee2771 am: f28f589f34
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2663995

Change-Id: I2482fdaec2f7e2a36f24137e3beb1b6021c6e54b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-19 02:03:38 +00:00
Eric Biggers
7acaea6770 init.rc: stop calling 'fsverity_init --load-verified-keys'
Since Android 14, Android does not use fsverity builtin signatures.
(fsverity remains supported, but signatures are verified in userspace,
or fsverity is used for integrity-only use cases.)  Therefore, the only
reason to still run 'fsverity_init --load-verified-keys' at boot time is
to ensure that old files can still be opened, if:

- They were created by Android 13 or earlier, with an fsverity builtin
  signature by a key in /{system,product}/etc/security/fsverity/.

- *And*, the kernel still has CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y.

However, it appears that this isn't actually needed anymore.  Only two
features could potentially be affected: APK verity and updatable fonts.
APK verity wasn't widely rolled out before being disabled, and updatable
fonts have recovery logic in place for when the files cannot be opened.
And in any case, disabling CONFIG_FS_VERITY_BUILTIN_SIGNATURES in the
kernel is recommended and would avoid any problem.

Bug: 290064770
Test: presubmit
Change-Id: I3376c3f0b4b9bd4ba2fd614259522be0c1daafb6
2023-07-19 01:13:15 +00:00
Daniel Zheng
f28f589f34 Merge "Adding documentation" into main am: f161ee2771
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2663995

Change-Id: I08f4c424c8a6de3d0501a83c03616cdbe79e4b7e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-19 00:55:47 +00:00
Daniel Zheng
f161ee2771 Merge "Adding documentation" into main 2023-07-19 00:20:59 +00:00
Treehugger Robot
9a482cab25 Merge "Fix libutils_fuzz_string8 deadlock." into main am: 435b520bf0 am: 86c5609deb am: d2a81b3db4
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2656902

Change-Id: I9fc36c724178b3f6acfe41b5f4d5b5a7bd2d9bd7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-19 00:06:51 +00:00
Hao Chen
a60bfe1898 Merge "threads.h: avoid defining gettid on glibc >= 2.30" into main am: 8dad4b2b8a am: b91d39f83d am: 3aebf3f499
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2662659

Change-Id: I2cfcef5687fc88b25d5d9438167e016438f4f58b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-19 00:06:39 +00:00
Treehugger Robot
d2a81b3db4 Merge "Fix libutils_fuzz_string8 deadlock." into main am: 435b520bf0 am: 86c5609deb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2656902

Change-Id: Ia89d8d6942fed86873c1c80e3cd822c7ab690ed5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 23:22:11 +00:00
Hao Chen
3aebf3f499 Merge "threads.h: avoid defining gettid on glibc >= 2.30" into main am: 8dad4b2b8a am: b91d39f83d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2662659

Change-Id: Ib19c8b42b2ccc1de7e0c51d6c147d753109c49d7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 23:21:59 +00:00
Eric Miao
c6ce48ef19 String8: fix infinite loop and segmentation fault in removeAll()
Bug: 290835996
Test: libutils_fuzz_string8 for several minutes

String8::removeAll() has 2 serious problems:

1. When `other` is an empty string, `removeAll()` will loop infinitely
   due to below process:

   a) with `other` being empty string `""`, find() will call strstr()
      on an empty string, which always returns `mString`, and thus
      find() always return 0 in this case
   b) with find() returns 0 for empty string, the next while loop in
      String8::removeAll() will keep loop infinitely as `index` will
      always be 0

   This CL fixes this problem by returning true if `other` is an empty
   string (i.e. `strlen(other) == 0`), this follows the logic that an
   empty string will always be found and no actual remove needs to be
   done.

2. When `other` is a NULL string, strstr() has undefined behavior. See
   https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf.

   This undefined behavior on Android unfortunately causes immediate
   segmentation fault as the current `strstr` implementation in bionic
   libc doesn't check `needle` being NULL, and an access to a NULL
   location is performed to check if the `needle` string is an empty
   string, and thus causes segmentation fault.

   This CL gives an error message and aborts instead of having a
   segfault, and to keep some backward compatibility.

   This CL also adds test for String8::removeAll()

Change-Id: Ie2ccee6767efe0fed476db4ec6072717198279e9
2023-07-18 16:02:07 -07:00
Treehugger Robot
86c5609deb Merge "Fix libutils_fuzz_string8 deadlock." into main am: 435b520bf0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2656902

Change-Id: I7473133ab6c634e108f08e00136ebc3984a72fb2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 22:39:42 +00:00
Hao Chen
b91d39f83d Merge "threads.h: avoid defining gettid on glibc >= 2.30" into main am: 8dad4b2b8a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2662659

Change-Id: I2bf43d79104988db28944ffd44c63912fdb40a36
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 22:39:30 +00:00
Daniel Zheng
658182b8e7 Adding documentation
adding --help documentation to fastboot for --disable-super-optimization
and --disable-fastboot-info

Test: fastboot -h
Change-Id: Ia8993b3894d302a63cc97796d66e0af3fb004eef
2023-07-18 15:36:26 -07:00
Treehugger Robot
435b520bf0 Merge "Fix libutils_fuzz_string8 deadlock." into main 2023-07-18 21:49:06 +00:00
Hao Chen
8dad4b2b8a Merge "threads.h: avoid defining gettid on glibc >= 2.30" into main 2023-07-18 21:38:34 +00:00
Steven Moreland
749becfa68 Fix libutils_fuzz_string8 deadlock.
Bug: 290835996
Test: libutils_fuzz_string8 for several minutes
Change-Id: I9b312dd968c380f4fa2a837d38121d0a7a7ac7b1
2023-07-18 21:04:07 +00:00
Hao Chen
253445ce3a threads.h: avoid defining gettid on glibc >= 2.30
The issue in https://bugs.chromium.org/p/chromium/issues/detail?id=1182060 also
exists on glibc 2.30 and 2.31 since `gettid` was Introduced in glibc 2.30.

See https://man7.org/linux/man-pages/man2/gettid.2.html

Bug: 285204695
Test: Build
Change-Id: I7e534edf8c0a20c415232bcfffabbf2c1d6eec98
2023-07-18 19:52:19 +00:00
David Anderson
98c5abe651 Merge "snapuserd: Refactor how buffers are managed." into main am: 72c3ca1604 am: a99f70a27b am: f5714e7779
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2633935

Change-Id: I520f49f558d3484cf0a5d5411478d2e297933770
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 19:03:45 +00:00
David Anderson
f5714e7779 Merge "snapuserd: Refactor how buffers are managed." into main am: 72c3ca1604 am: a99f70a27b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2633935

Change-Id: Ie1a566d6e28e192861efe3f060740bd7c22043f0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 18:14:01 +00:00
Eric Biggers
c0fa980bd0 Merge "init: avoid ERROR log due to missing SEPolicy.zip" into main am: 0306bc1a31 am: a636a8877a am: 2535b14b16
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2660281

Change-Id: Ia47dc83c216266a88c9ee85ee26227a98c1fb00b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 17:55:00 +00:00
David Anderson
a99f70a27b Merge "snapuserd: Refactor how buffers are managed." into main am: 72c3ca1604
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2633935

Change-Id: Ia76296ec20f62095d3d49f1e78a9789727beedea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 17:32:58 +00:00
Eric Biggers
2535b14b16 Merge "init: avoid ERROR log due to missing SEPolicy.zip" into main am: 0306bc1a31 am: a636a8877a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2660281

Change-Id: Ie196e472c267eb22a0ec9c04506c6c97a281af06
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 17:08:16 +00:00
David Anderson
72c3ca1604 Merge "snapuserd: Refactor how buffers are managed." into main 2023-07-18 16:42:22 +00:00
Eric Biggers
a636a8877a Merge "init: avoid ERROR log due to missing SEPolicy.zip" into main am: 0306bc1a31
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2660281

Change-Id: I1237548986b9796337a0b426394d5e208777b74f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 16:23:38 +00:00
Eric Biggers
0306bc1a31 Merge "init: avoid ERROR log due to missing SEPolicy.zip" into main 2023-07-18 15:38:20 +00:00
David Anderson
3930625074 snapuserd: Refactor how buffers are managed.
Currently all I/O is processed through BufferSink. However, the
allocation of buffers is implicit in low-level helper functions, which
have no knowledge of how much data will actually be sent. As a result,
"allocation of buffers" and "tracking of how many bytes were written" is
disjoint. This will make it very difficult to break dependence on
dm-user, without a much more complex API.

This patch refactors how BufferSink is used. First, GetPayloadBuffer has
been deprecated in favor of AcquireBuffer. AcquireBuffer performs both
allocation and write tracking. The number of bytes written is not
necessarily the number of bytes allocated, and the new API allows for
this.

The "Process" helpers now take in an explicit buffer, and their callers
are responsible for allocating a buffer. This allows for
ReadUnalignedSector to have proper buffer offset tracking.

Because write tracking is now accurate, no explicit size needs to be
passed to WriteDmUserPayload. It can simply read the current watermark
in BufferSink.

This patch also removes XorSink, since its dependence on BufferSink made
this change more difficult.

Bug: 288273605
Test: snapuserd_test
Change-Id: Id9ca5044f9c0386f351b250349793b6b276b01b7
2023-07-17 17:10:19 -07:00
Treehugger Robot
4472827bdc Merge "Look for radio.img and bootloader.img in ANDROID_PRODUCT_OUT" into main am: 1c77579a06 am: 6471b231d7 am: 730d82c236
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2660282

Change-Id: I6c6d890f944971aaa3799db4617b0a44f09b94f8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 23:59:56 +00:00
Treehugger Robot
730d82c236 Merge "Look for radio.img and bootloader.img in ANDROID_PRODUCT_OUT" into main am: 1c77579a06 am: 6471b231d7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2660282

Change-Id: I5159144e26c629045503098afa730f0a2390e531
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 23:15:57 +00:00
Treehugger Robot
6471b231d7 Merge "Look for radio.img and bootloader.img in ANDROID_PRODUCT_OUT" into main am: 1c77579a06
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2660282

Change-Id: I15feb6104e468b591208d1f966c00a9a8df1cb97
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 22:33:56 +00:00
Eric Biggers
7fad65e822 Merge changes from topic "fsverity-init-cleanup" into main am: 42164ff920 am: 0a4764fa46 am: 2bbf32dae5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2650779

Change-Id: Ie242ff19e3ca31fb3f47138cf78149baaeb92eec
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 22:08:56 +00:00
Eric Biggers
50ff0ce938 init: remove unfinished fsverity signature support for APEX sepolicy am: 0b2c5cde1f am: 53e35f410d am: 5518f236e8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2647684

Change-Id: I0b5adbee8f4e3a255fb51eb145729ca65a6cf6e9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 22:08:53 +00:00
Treehugger Robot
1c77579a06 Merge "Look for radio.img and bootloader.img in ANDROID_PRODUCT_OUT" into main 2023-07-17 21:51:01 +00:00
Eric Biggers
2bbf32dae5 Merge changes from topic "fsverity-init-cleanup" into main am: 42164ff920 am: 0a4764fa46
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2650779

Change-Id: Ie281f2296131a79d023a121905c715049db06a13
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 21:25:03 +00:00
Eric Biggers
5518f236e8 init: remove unfinished fsverity signature support for APEX sepolicy am: 0b2c5cde1f am: 53e35f410d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2647684

Change-Id: I1171b166e45cd1b79a1941da1a4cf6b4632b564d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 21:24:59 +00:00
Paul Lawrence
556c46bfb9 Look for radio.img and bootloader.img in ANDROID_PRODUCT_OUT
Test: fastboot flash bootloader and fastboot flash radio both work
Change-Id: I79674469c0df3dd592e5fcf840fef0dcc3f11d33
2023-07-17 14:05:21 -07:00
David Anderson
26c9f17984 Merge changes I1625d1a6,I2db9cfa2,I59c31318,Ic0ed1a8d,I612374bb into main am: 83ebc4376d am: b19326fbad am: dff3daad7a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2637513

Change-Id: I5d7305e4447e0e3ce41783290e1ab48b0c89b10c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 21:02:05 +00:00
Eric Biggers
53ed745e3f init: avoid ERROR log due to missing SEPolicy.zip
One of the first ERROR messages in logcat of a normal boot of Cuttlefish
is from failure to open SEPolicy.zip.  This condition is expected.
Therefore don't try to load SEPolicy.zip when it doesn't exist.  This
replaces the following log messages:

0     0 I init    : Error: Apex SEPolicy failed signature check
0     0 I init    : Loading APEX Sepolicy from /system/etc/selinux/apex/SEPolicy.zip
0     0 E init    : Failed to open package /system/etc/selinux/apex/SEPolicy.zip: No such file or directory

... with just:

0     0 I init    : No APEX Sepolicy found

Change-Id: If3a77407c35130165df5782b9ef91912e8374dbf
2023-07-17 20:45:44 +00:00
Eric Biggers
0a4764fa46 Merge changes from topic "fsverity-init-cleanup" into main am: 42164ff920
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2650779

Change-Id: I1dce6c7a7f66f4bce149e9a46da75fb7636f6c77
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 20:39:20 +00:00