Commit graph

84775 commits

Author SHA1 Message Date
Treehugger Robot
68fbe13281 Merge "Don't overwrite persistent property files" into main 2023-10-20 17:19:58 +00:00
Jiyong Park
c7230a1eb1 Don't overwrite persistent property files
This fixes a bug introduced by I81b6bd984aad8f7ddec93ce74f4543e4f71be508

In the original CL, setting a sysprop `next_boot.<name>` and then
rebooting the device could remove all the persistent properties stored
in /data/property/persistent_properties. It happened because the
function `WritePersistentProperty` is called with a properties set which
is initialized as an empty set and then added with the properties which
had the next_boot prefix.

As a result...

Before the boot:
* persist.a = 1
* next_boot.b = 2
* next_boot.persist.c = 3

After the reboot:
* b = 2
* persist.c = 3

persist.a gets lost.

This change fixes the issue by populating properties set from the memory
and then save it to the file.

Bug: 306062513
Bug: 300111812
Test: do the following.
$ adb root
$ adb shell setprop persist.a 1
$ adb shell setprop next_boot.b 1
$ adb shell setprop next_boot.persist.c 1

$ adb reboot
$ adb shell getprop persist.a
1    // was (none) before this change
$ adb shell getprop b
1
$ adb shell getprop persist.c
1

$ adb reboot
$ adb shell getprop persist.a
1    // was (none) before this change
$ adb shell getprop b
     // (none) because b isn't persisted. WAI.
$ adb shell getprop persist.c
1

Change-Id: I85d3777f9b32523b010e49b8ca53f4319dd2ce05
2023-10-20 21:20:50 +09:00
Yi-Yo Chiang
f2e7170cba fs_mgr_overlayfs: Don't try to mount scratch if already mounted
This eliminates spammy logs.

Bug: 306124139
Test: adb remount -v && check the output logs
Change-Id: I3143f5865b5292ba581009179c7e7141afa8fda5
2023-10-20 10:19:52 +00:00
Jason Chiu
d07ec30423 bootstat: add more bootreasons
add more bootreasons for new design.

Bug: 296637681
Test: trigger apc watchdog then "adb root; adb shell bootstat -p"
Change-Id: Ia78146ba9299eea45e7d89376179e01cbd37cca8
Signed-off-by: Jason Chiu <jasoncschiu@google.com>
2023-10-20 05:56:34 +00:00
Thiébaud Weksteen
3ef4da2f6a Merge "Remove write to /sys/fs/selinux/checkreqprot" into main 2023-10-20 00:54:53 +00:00
Nate Myren
c25abe4739 Initialize the appcompat system property folder
Certain applications may have their system properties overlaid with the
contents overlaid for appcompat purposes. Init must initialize the
appcompat folder, same as it does the standard folder.

Bug: 291814949
Test: manual
Change-Id: I6d239e0a10a1c81a05d4121e5fc2c41da5b3dbc4
Merged-In: I0c6a0f66dc543c6e861bc86a417e4feb5ecd7789
2023-10-19 20:17:55 +00:00
Christopher Ferris
2ae67e7119 Merge "Add ability to handle multiple intercepts per pid." into main 2023-10-19 16:43:42 +00:00
Christopher Ferris
b92b52c071 Add ability to handle multiple intercepts per pid.
While doing this, refactor the intercept code to be easier to understand.

The primary use case for this is to perform a parallel stack dump (both Java and native) for specific ANRs.

Add tests for all of the different intercept conditions.

Modify the tests to display the error message from the intercept
response if there is an error.

Bug: 254634348
Test: All unit tests pass.
Test: Ran debuggerd on native and java processes.
Test: Created a bugreport without error.
Change-Id: Ic531ccee05b9a470748b815cf109e0076150a0b6
2023-10-19 15:13:59 +00:00
David Drysdale
9d6d134e44 Merge "Add tipc fuzzer for KeyMint/Rust" into main 2023-10-19 08:31:09 +00:00
Yi-Yo Chiang
aba8c1ee36 Merge "fs_mgr_overlayfs: Setup remount scratch dir with encoded mountpoint name" into main 2023-10-19 04:25:51 +00:00
Thiébaud Weksteen
b010393fe5 Remove write to /sys/fs/selinux/checkreqprot
This SELinux option has been deprecated in the kernel since v5.7. In
v6.4, commit a7e4676e made any write to this file a no-op.

Since v4.4, the default value of 0 is set by the kernel. Skip the
setting of this value since we only support kernel >= 4.14.

Test: presubmit
Change-Id: Ied5945532e10b156dc0d9996b2a41a99d04e750b
2023-10-19 11:39:42 +11:00
Steven Moreland
06e49c8c65 Merge "libvndksupport: log sphal namespace fallback" into main 2023-10-18 21:50:09 +00:00
Yi-Yo Chiang
9032b39ea5 fs_mgr_overlayfs: Setup remount scratch dir with encoded mountpoint name
Instead of using the basename(mounpoint) as partition scratch dir name,
which could lead to name collision, use the normalized and encoded
mountpoint as scratch dir name.

Bug: 243503963
Bug: 306124139
Test: adb-remount-test
Change-Id: I5a64f17bc3b88f0ce42bd0c5779c8dd23a07917f
2023-10-18 19:41:46 +08:00
Daniel Zheng
a16e0ba64e Merge "V3 writer header" into main 2023-10-18 08:41:20 +00:00
Treehugger Robot
e9741b25e5 Merge changes I9830baf7,I01da0a68,I05d0a6c7 into main
* changes:
  Added liblp_apis_fuzzer
  Added TestPartitionOpener_group
  Added liblp_builder_fuzzer and liblp_super_layout_builder_fuzzer
2023-10-18 04:58:25 +00:00
Daniel Zheng
7a9e007a01 Refactor off COW header v3
Cow reader will store header v3 in memory. ReadCowHeader can remain
mostly unchanged since the cow prefix is the same.
header->prefix.header_size will then tell us if we're reading a v3 or v2
header. v3 header is strictly a superset of v2 header so we can read a
v2 header into a v3 struct.

Added a test case to test_v3 where we write a header using v2_writer and
ensure CowReader is able to read it.

Test: cow_api_test
Change-Id: I142f18d871322930b7dc341c342c8b63a481341c
2023-10-17 16:45:06 -07:00
Daniel Zheng
91bab464ed Merge "Remove v2_writer lseek call" into main 2023-10-17 23:38:48 +00:00
Daniel Zheng
e48b3235cb Merge "Remove duplicate parser v2 code" into main 2023-10-17 23:10:36 +00:00
Daniel Zheng
f2270d2bb6 V3 writer header
V3 writer set up header. Anything related to cluster ops can be set to
zero, as V3 cow format will no longer support this. All footer related
code can also be dropped as the footer isn't being used.

Test: cow_api_test
Change-Id: I39ece8eaa0813c5991d53b5e0ff9271f27e0662a
2023-10-17 14:59:49 -07:00
Daniel Zheng
f8c50df1c7 Remove v2_writer lseek call
Removing lseek call as writefully() should be sufficient in ensuring our
fd is moved to the correct spot

Test: cow_api_test
Change-Id: I404b192335ab1672ed61de426e17e63ab9d51ece
2023-10-17 14:59:49 -07:00
Daniel Zheng
94a732e026 Remove duplicate parser v2 code
Remove a duplicate check

Test: th
Change-Id: Ia9c3c8ff1ee524005f95aa57dc3d6da9641ce2e6
2023-10-17 14:59:49 -07:00
Daniel Zheng
2851af055e Merge "Add write_cow functionality" into main 2023-10-17 21:59:34 +00:00
Daniel Zheng
d3445d98f0 Merge "Rename basic_v2_writer" into main 2023-10-17 20:40:24 +00:00
Daniel Zheng
f0a28dae28 Add write_cow functionality
Adding gflags + some basic functionality to this binary. We should be
able to use this to write v2 or v3 cow, and then use inspect_cow to
inspect the contents

Test: write_cow
Change-Id: I44bf5a8c807c4c4759e54624c51e966f2ea18ce9
2023-10-17 12:47:19 -07:00
Daniel Zheng
06c086dd73 Rename basic_v2_writer
Gonna add to this binary options to write v2 + v3 cow, + some additional
configurations (for testing purposes). I think this binary can serve as
something to use in parallel with inspect_cow

Test: m write_cow
Change-Id: I93c703b246baa5b400044436a94b33a32e03ea68
2023-10-17 09:39:40 -07:00
Elliott Hughes
3aee719660 Merge "init: don't use magic numbers for RLIMIT_ constants." into main 2023-10-17 15:34:56 +00:00
Akilesh Kailash
57b34ae34c Merge "libsnapshot: Remove consistency check after merge" into main 2023-10-17 01:31:07 +00:00
Elliott Hughes
7a19bf8e0d init: don't use magic numbers for RLIMIT_ constants.
Also, why are we accepting the completely made-up "RLIM_AS" but not the
real "RLIMIT_AS" in .rc files?

Bug: http://b/293894041
Test: treehugger
Change-Id: I18b10b6dd77265a9a14b88bfdf1cc0b474800a94
2023-10-16 22:29:47 +00:00
Steven Moreland
d9edd67b19 Merge changes from topic "libutils_binder_split" into main
* changes:
  libutils: split out libutils_binder
  libutils: remove unused 'CALLSTACKS'
2023-10-16 21:12:48 +00:00
Raymond Hernandez
00a14801bf Merge "Add monicamwang and rayhdez to system/core/libstats/OWNERS" into main 2023-10-16 20:40:40 +00:00
David Anderson
3c7d480214 Merge "snapuserd: Test both async and sync paths." into main 2023-10-16 20:23:53 +00:00
David Anderson
f7d07db679 snapuserd: Test both async and sync paths.
Rather than split this into two binaries as we did for libsnapshot, this
uses test parameterization. I went this route because even for async
builds, the sync path must always work as a fallback.

Bug: N/A
Test: snapuserd_test
Change-Id: Ib68c8fd831c345f41a4e14a99fd0a0b8b1d47b6d
2023-10-16 20:23:46 +00:00
Akilesh Kailash
e02b831aef libsnapshot: Remove consistency check after merge
Merge thread will mark merge-completion after msync on header is
complete. This should be definitive enough to track the completion
status.

Bug: 305187301
Test: OTA on Pixel
Change-Id: I366dc5052fa91a6eacf394a1970200cdebc0e135
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-10-16 11:32:54 -07:00
Daniel Zheng
452f176ca8 Merge "Add v3 to CreateCowWriter" into main 2023-10-16 15:20:47 +00:00
Yi-Yo Chiang
c0281978b0 Merge "fs_mgr: Don't run clean_scratch_files on non-dynamic devices" into main 2023-10-16 10:24:55 +00:00
Kelvin Zhang
9c949326bd Merge "Make partition metadata write atomic" into main 2023-10-14 00:01:41 +00:00
David Anderson
5233181ded Merge "Remove unused variable in snapuserd_core." into main 2023-10-13 23:03:26 +00:00
Kelvin Zhang
78d5352289 Make partition metadata write atomic
We have seen multiple OTA failures with invalid geometry magic
signature. Make partition metadata write atomic by writing to a tmpfile
first and then do a rename.

Test: th
Bug: 303770065
Bug: 298149189
Change-Id: Id1d565de73439b95b665144c2f02fc97273d341c
2023-10-13 15:46:28 -07:00
David Anderson
7e407514dd Remove unused variable in snapuserd_core.
Bug: N/A
Test: builds
Change-Id: I8fc3bd2dd8eb3cfa3c6bfe513f054a4d6a674de1
2023-10-13 21:34:12 +00:00
Bradley Furman
c6941de738 Merge "Update the fastboot command size from 64 to 4096 to cover the changes from https://android-review.git.corp.google.com/c/platform/system/core/+/2214970" into main 2023-10-13 18:28:17 +00:00
Dennis Shen
f307ee0767 Merge "apply staged property value when loading persistent props" into main 2023-10-13 18:22:56 +00:00
Dennis Shen
678d268848 apply staged property value when loading persistent props
Bug: b/300111812
Change-Id: I81b6bd984aad8f7ddec93ce74f4543e4f71be508
Merged-In: I81b6bd984aad8f7ddec93ce74f4543e4f71be508
2023-10-13 13:18:50 +00:00
Kalesh Singh
d469fdcd93 Merge "trusty: Remove explicit page-alignment of mmap and dmabuf allocations" into main 2023-10-12 22:19:26 +00:00
Treehugger Robot
58e7eda0b0 Merge "libtrusty: Remove PAGE_SIZE usage" into main 2023-10-12 21:32:33 +00:00
Treehugger Robot
8eda323bc2 Merge "trusty: tipc_fuzzer: Remove use of PAGE_SIZE" into main 2023-10-12 21:11:25 +00:00
Daniel Zheng
cab8646a07 Add v3 to CreateCowWriter
Adding v3 writer as a return type to CreateCowWriter

Test: write_cow
Change-Id: Ia68ddf17b9f5f9fae27da4d6ab5fb150078d0c38
2023-10-12 14:10:50 -07:00
Treehugger Robot
99414ad00b Merge "keymaster: Remove usage of PAGE_SIZE" into main 2023-10-12 20:58:34 +00:00
Kalesh Singh
623d140cc0 trusty: Remove explicit page-alignment of mmap and dmabuf allocations
bionic hard codes the PAGE_SIZE macro as 4096. This is going away as
Android begins to support larger page sizes.

trusty uses PAGE_SIZE to round up the allocation size of the DMA
buffers and mmap sizes. This is not explicitly needed since the kernel
will always give you a page-aligned and page-sized multiple allocation
when allocating a dmabuf or mmap-ing.

Remove this PAGE_SIZE usage from TrustyApp, app_fuzzer, coverage,
line-coverage, modulewrapper.

Bug: 294914413
Test: Boot test on 16k device
Change-Id: Iad922e0a152cb80db2e59e696d7556602fd17d67
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-10-12 13:50:31 -07:00
Kalesh Singh
efeb096c40 libtrusty: Remove PAGE_SIZE usage
bionic provides PAGE_SIZE macro which happens to also match the
4096 chunk size in the tips_test.

PAGE_SIZE is being removed as no other libc provides this and
Android is moving towards being page-size-agnostic.

Use 4096 chunk size for tipc-tests; fix incorrect size in
munmap cleanup; and add failure log for send-fd test.

Test: tipc-test -t "send-fd"
Bug: 294914413
Change-Id: I7e5ec6480fff6bc1b4e8eed57eadf081cf82a72f
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-10-12 13:35:29 -07:00
Kalesh Singh
bbc4bc54f2 keymaster: Remove usage of PAGE_SIZE
bionic provides PAGE_SIZE macro which happens to also match the
size keymaster send buffer (4096) and half the size of the recv
buffer.

PAGE_SIZE is being removed as no other libc provides this and
Android is moving towards being page-size-agnostic.

Use a 4096 constant instead.

Test: Boot 16k device
Bug: 294914413
Change-Id:  I2dc10b48811e24d25ba08cfe4ffb514e94d42a8f
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-10-12 20:03:08 +00:00