Commit graph

83800 commits

Author SHA1 Message Date
Treehugger Robot
5faeba2780 Merge "Add safety comments." into main am: 406d43397c am: 947d407b3c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2672075

Change-Id: I4f1b988923ea87b03145fe7bf3564c989a2fdcd4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-25 08:34:33 +00:00
Treehugger Robot
947d407b3c Merge "Add safety comments." into main am: 406d43397c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2672075

Change-Id: Ib0b8e92f2d1d2d39b4836b56281a60d2e46ef377
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-25 07:53:54 +00:00
Treehugger Robot
406d43397c Merge "Add safety comments." into main 2023-07-25 07:00:16 +00:00
Treehugger Robot
661bf674cc Merge "libprocessgroup: UIDs in linux are unsigned" into main am: a414e2fd9b am: 6094c610ad
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2670104

Change-Id: Ie5ffd7da135c270a8ed437d23e3751b8ecbe1ce7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-25 00:08:56 +00:00
Treehugger Robot
6094c610ad Merge "libprocessgroup: UIDs in linux are unsigned" into main am: a414e2fd9b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2670104

Change-Id: I6e204bdaf1120e81aaae9d52736f5a86df522763
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-24 23:21:10 +00:00
Treehugger Robot
4e44f4f1f8 Merge "storageproxyd: Start only a single binder thread" into main am: e4cbd9a6a0 am: 8c048624e9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2670162

Change-Id: I1c8394d9571fb808475e8681f90dbfe0c6acc7db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-24 23:00:28 +00:00
Treehugger Robot
a414e2fd9b Merge "libprocessgroup: UIDs in linux are unsigned" into main 2023-07-24 22:44:22 +00:00
Treehugger Robot
8c048624e9 Merge "storageproxyd: Start only a single binder thread" into main am: e4cbd9a6a0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2670162

Change-Id: Icea468282ec0e808c1eff5c0951e302f1c598843
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-24 22:14:12 +00:00
Treehugger Robot
e4cbd9a6a0 Merge "storageproxyd: Start only a single binder thread" into main 2023-07-24 21:35:45 +00:00
Yi-Yo Chiang
0c813dbffd Merge changes I2581fd7c,I1ed57e6d into main am: 64062f8f4a am: 112b3505e9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2671040

Change-Id: I9c723b5531ebff8d4589268dbe4b60a2c0b6a9fb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-24 11:21:06 +00:00
Yi-Yo Chiang
112b3505e9 Merge changes I2581fd7c,I1ed57e6d into main am: 64062f8f4a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2671040

Change-Id: I6d8a5c24fcbafcb2fa0ec513d6bdf0b41cb0e527
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-24 10:39:19 +00:00
Yi-Yo Chiang
64062f8f4a Merge changes I2581fd7c,I1ed57e6d into main
* changes:
  fs_mgr: Refactor by inlining trivial helpers
  fs_mgr_overlayfs: Make all string constants constexpr
2023-07-24 09:53:26 +00:00
Akilesh Kailash
db59d43aaa Merge "snapuserd: use local buffers for xor processing during sync I/O" into main am: da2fc1c6af am: 4a875cf948
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2670338

Change-Id: Id2c4b2a4c1ab740a90f47d6c2de049d791d183ac
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-21 23:44:58 +00:00
Akilesh Kailash
4a875cf948 Merge "snapuserd: use local buffers for xor processing during sync I/O" into main am: da2fc1c6af
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2670338

Change-Id: I74d7b735946334b824d88baee8ad2b3a51751e10
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-21 23:02:26 +00:00
Akilesh Kailash
da2fc1c6af Merge "snapuserd: use local buffers for xor processing during sync I/O" into main 2023-07-21 22:18:21 +00:00
Akilesh Kailash
37c18b30cb snapuserd: use local buffers for xor processing during sync I/O
Bug: 291862304
Test: Incremental OTA on Pixel - Verify first stage boot logs
Change-Id: Ifc4f1ec912ccc1d24673f7bb03b05129ce504fa1
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-07-21 20:08:37 +00:00
Stephen Crane
b05b870671 storageproxyd: Start only a single binder thread
We only need a single binder thread to receive notifications, so we
should set the thread pool max to 0 rather than 1. startThreadPool()
starts one thread + the max count.

Test: m storageproxyd
Bug: 281951047
Fixes: 292030372
Change-Id: I53a90eaa2aa69469fd3a00b6da0d7061318c8ba9
2023-07-21 19:23:45 +00:00
Andrew Walbran
f580fe5799 Add safety comments.
These will soon be required by a lint.

Bug: 290018030
Test: m rust
Change-Id: I0b25bcaa18d167fb9c2d63e637833d4935dc8ff4
2023-07-21 19:13:48 +01:00
Yi-Yo Chiang
98e3522762 fs_mgr: Refactor by inlining trivial helpers
Inline some trivial helpers and remove unused header declarations.

Remove fs_mgr_*access() as it is really just access().
Remove fs_mgr_overlayfs_super_device() as we always want the primary
slot and having this wrapper isn't particularly helpful.

Test: adb-remount-test
Change-Id: I2581fd7c7d5071cbb97778535b7811dbcb80d76e
2023-07-22 00:08:51 +08:00
Yi-Yo Chiang
b2e0edcaae fs_mgr_overlayfs: Make all string constants constexpr
According to https://abseil.io/tips/140, string constants should be
constexpr char array or string_view object. This avoids subtle bugs due
to the toolchain shuffling object initialization order between/within
compilation units.

string_view has bad interoperability between C APIs as many of those
functions require string values to be null-terminated. Thus we can only
rely on good old c-string constants.

This change groups all string constants together and change them all to
constexpr char array for consistent style.
Also remove some duplicated method definition.

Test: adb-remount-test
Change-Id: I1ed57e6dc24ce3750e72c5538c388a6872cd2b40
2023-07-21 20:44:50 +08:00
Yi-Yo Chiang
6e6b357d4e Merge "init_first_stage: Disable ThinLTO" into main am: 6b57c885d3 am: fe0b2355fc
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2667055

Change-Id: I5431ec4d0edf855d10c123f9b3ad83a0392025e4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-21 06:19:11 +00:00
Yi-Yo Chiang
fe0b2355fc Merge "init_first_stage: Disable ThinLTO" into main am: 6b57c885d3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2667055

Change-Id: I5958bd4a5f62527cd1578c6dea21876b18993b5d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-21 05:37:17 +00:00
Yi-Yo Chiang
6b57c885d3 Merge "init_first_stage: Disable ThinLTO" into main 2023-07-21 05:08:13 +00:00
T.J. Mercier
bf2bebd8e7 libprocessgroup: UIDs in linux are unsigned
We use the %d format specificier for uid_t, which maps to
__kernel_uid32_t, which is unsigned. [1] This is undefined behavior
which can lead to paths with negative UIDs when erroneously large
values are passed for uid:

E libprocessgroup: No such cgroup attribute: /sys/fs/cgroup/uid_-89846/cgroup.freeze

Fix it with %u.

[1] https://cs.android.com/search?q=typedef.*__kernel_uid32_t&ss=android%2Fplatform%2Fsuperproject%2Fmain

Change-Id: Ibb52ba2503e30e2f20770b7d23629167e38d076a
2023-07-21 00:39:57 +00:00
David Anderson
3f70214563 Merge "snapuserd: Fix ubsan when reading a single aligned sector." into main am: 89d22239d2 am: 1eb661531e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2666388

Change-Id: Iec477dc7dc137f02d06a7b1eaa516a86e15dcde1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-20 17:38:39 +00:00
David Anderson
1eb661531e Merge "snapuserd: Fix ubsan when reading a single aligned sector." into main am: 89d22239d2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2666388

Change-Id: I1465b5194faa9ff8f17327281c5a6a5186538405
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-20 16:55:52 +00:00
David Anderson
89d22239d2 Merge "snapuserd: Fix ubsan when reading a single aligned sector." into main 2023-07-20 16:23:08 +00:00
Yi-Yo Chiang
4d6fa8ccaf init_first_stage: Disable ThinLTO
Static executables + x86 target build + ThinLTO produces bug behavior.
Global variables are not constructor initialized, resulting in faulty
runtime behavior.

Bug: 169004486
Bug: 291033685
Test: Treehugger
Change-Id: I777016cceb4851f2b432a37bc4d29aed56c23804
2023-07-20 18:47:16 +08:00
Jakob Vukalović
1fae39537b Merge "ueventd: Fix creation of VFIO dev nodes" into main am: 998c3b4fbe am: fcd6f0fb11
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2664635

Change-Id: I748da01fd401365e539b0b2697dddcf894beb0fe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-20 10:19:30 +00:00
Jakob Vukalović
fcd6f0fb11 Merge "ueventd: Fix creation of VFIO dev nodes" into main am: 998c3b4fbe
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2664635

Change-Id: I8c8cf82dcf4ec2195888faf4066ea457c2321a40
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-20 09:34:30 +00:00
Jakob Vukalović
998c3b4fbe Merge "ueventd: Fix creation of VFIO dev nodes" into main 2023-07-20 09:04:25 +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
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
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
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
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
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