Commit graph

81772 commits

Author SHA1 Message Date
Daniel Zheng
e259c2dc17 Merge "Adding flag to disable fastboot_info" into main 2023-07-12 16:51:50 +00:00
Tomasz Wasilczyk
0de2195738 Migrate gettid to GetThreadId
Bug: 289414897
Test: it builds
Change-Id: If1214a181d4e9a193adf1bac0d35e7e3ac6c27db
2023-07-12 08:58:02 -07:00
David Anderson
80afdc08f5 Merge "snapuserd: Restrict where reads/writes to dm_user_header happen." into main 2023-07-12 03:09:06 +00:00
Daniel Zheng
dc8ae8c55a Merge "Fastboot-info testing" into main 2023-07-11 21:05:35 +00:00
Daniel Zheng
e1a473cdef Merge "Asserting flashing plan is used in do_flash" into main 2023-07-11 20:51:52 +00:00
Daniel Zheng
460631c028 Merge "Mocking get_uint_var()" into main 2023-07-11 20:51:47 +00:00
Daniel Zheng
6acfe9bcd0 Turning on fastboot-info
turning on fastboot-info by default again

Test: fastboot flashall
Change-Id: I6b8bb0d145af37d437419a5e6cee70158ed553ae
2023-07-11 12:53:30 -07:00
Daniel Zheng
63dfeaae7a Adding flag to disable fastboot_info
Adding flag to override fastboot_info for a quick fix in case
fastboot_info format is wrong

Test: fastboot flashall
Change-Id: I1f41646f14d747ce7ac7636ca9ced7279e13f7b0
2023-07-11 12:53:30 -07:00
Daniel Zheng
eabfe272c3 Fastboot-info testing
adding test to compare task list formed from fastboot-info vs list
formed from image list. To test, we need to set sparse_limit in flashing
plan and turn off update-super-optimization. The list of partitions to
be flashed by parsing fastboot-info should be a superset of the
partitions flashed by the hardcoded list. Changing is_retrofit_device()
to also take in a fastboot driver so we can pass in a mock

Test: fastboot_test
Bug: 194686221
Change-Id: Ib860c24c85779de1fbaa6bec8778e1f5ebb9475a
2023-07-11 12:53:29 -07:00
Daniel Zheng
59589d47db Asserting flashing plan is used in do_flash
Adding check to ensure flashing plan is used in do_flash. FlashingPlan
should never be null

Test: fastboot flashall -w
Change-Id: I8e69326c59b31c7b54d6d2e04c8ce5c0f12693a7
2023-07-11 12:44:13 -07:00
Daniel Zheng
a0d2401d23 Mocking get_uint_var()
Changing implementation to have mock fastboot driver return a the
sparse_limit rather than modifying the variable inside of flashing plan

Test: fastboot_test
Change-Id: I850ccd5bd09b6a8479ccc8cf7bf1d227abb87e3a
2023-07-11 12:44:13 -07:00
Treehugger Robot
b95f100640 Merge "NetlinkEvent: trivial simplification." into main 2023-07-11 19:03:06 +00:00
Eric Biggers
620ea56515 Merge "init.rc: merge the zygote-start actions" into main 2023-07-11 15:56:36 +00:00
Eric Biggers
6e8e8ac71f init.rc: start update_verifier instead of update_verifier_nonencrypted
The "update_verifier_nonencrypted" service is being replaced with simply
"update_verifier", so update init.rc accordingly.

Bug: 208476087
Test: presubmit
Change-Id: I58f3fb25167ff7d3679c72e5e9c012f02fa5b516
2023-07-11 00:05:35 +00:00
Eric Biggers
fac2b18fff init.rc: merge the zygote-start actions
The three actions for "zygote-start" are identical except for their
property triggers.  This seems to have been left over from when Android
supported both File Based Encryption (FBE) and Full Disk Encryption
(FDE), causing there to be four possible encryption states:

- ro.crypto.state=unsupported (No encryption configured)
- ro.crypto.state=encrypted && ro.crypto.type=file (FBE enabled)
- ro.crypto.state=unencrypted (FDE supported but disabled)
- ro.crypto.state=encrypted && ro.crypto.type=block (FDE enabled)

It seems that the reason the zygote-start action was duplicated three
times was to exclude the "FDE enabled" case, which could only be done by
explicitly listing the other three cases.

However, now that FDE is no longer supported, only the first two cases
are possible.  Therefore, zygote-start can just be the whole trigger.

Bug: 208476087
Test: presubmit
Change-Id: Icd6e4b0d2fb3f9f20595c0af4e2e35350564da8d
2023-07-10 23:33:13 +00:00
Elliott Hughes
1563250410 NetlinkEvent: trivial simplification.
free(NULL) is defined as a no-op. Don't overcomplicate things.

Bug: http://b/287138549
Test: treehugger
Change-Id: I9ae532a71f986d9468f191972a9b7acf6e709d13
2023-07-10 22:46:12 +00:00
David Anderson
9b567001ca Merge "snapuserd: Return void from RespondIOError." into main 2023-07-10 20:59:04 +00:00
Eric Biggers
5c79501ab8 Merge "init: simplify queue_fs_event()" into main 2023-07-10 19:34:10 +00:00
Eric Biggers
ab74dbb197 init: simplify queue_fs_event()
Combine some cases that are handled identically, and remove the
'userdata_remount' parameter which is unused.  No change in behavior.

Test: presubmit
Change-Id: I0567e47d02942af7865c155dab76e6d0e9d71a1f
2023-07-10 17:58:36 +00:00
David Anderson
740c0d274c Merge "snapuserd: Make header_response a state variable." into main 2023-07-10 17:42:50 +00:00
Andrew Walbran
9fbd1683d4 Add safety comments.
These will soon be required by a lint.

Bug: 290018030
Test: m vm virtmgr
Change-Id: Id628b2a88f1cb0235fbccc748c52514e64561fe5
2023-07-10 14:56:20 +01:00
Nikita Ioffe
7f9b2c1739 Merge "Only allow debuggable Microdroid VMs to mount /vendor" into main 2023-07-07 15:46:39 +00:00
Nikita Ioffe
230af76757 Merge changes from topic "mount-vendor-in-microdroid" into main
* changes:
  Support for conditionally mounting /vendor partition in Microdroid
  Small refactoring in first_stage_mount
2023-07-07 15:28:33 +00:00
Nikita Ioffe
df0e96e962 Only allow debuggable Microdroid VMs to mount /vendor
Until the verification of the /vendor partition we restrict the usage of
the feature to only debuggable VMs. If a non-debuggable Microdroid VM
is requested to mount /vendor, first_stage_init will crash and the VM
won't boot.

Bug: 285855436
Test: vm run-microdroid --debug none --vendor test_vendor.img
Change-Id: I9d44ad5c1d971bac1a9173c291ce61b628f2f8e9
2023-07-07 14:46:23 +01:00
Nikita Ioffe
440354afa0 Support for conditionally mounting /vendor partition in Microdroid
first_stage_init will only mount the /vendor partition in Microdroid if
the androidboot.microdroid.mount_vendor=1 is provided in the kernel
cmdline.

Bug: 285855433
Test: atest MicrodroidTestApp
Change-Id: I5b840b5474bc52ec2696a0ba6ead0476acddfb1a
2023-07-07 14:45:58 +01:00
Nikita Ioffe
f17079ff58 Small refactoring in first_stage_mount
The existing approach in first_stage_init/first_stage_mount makes it
harder to add conditional logic that should only be applied for
Microdroid. Additionally, it forces the FirstStageMount object to be
created twice.

This change refactors the control flow to make first_stage_init take the
ownership of the FirstStageMount object. It will help with the follow up
change (which will add logic to conditionally mount /vendor partition
while booting Microdroid). As a nice side effect, this refactoring also
fixes the problem of the FirstStageMount being created twice.

This change also merges the FirstStageMount and FirstStageMountVBootV2
in a single class, since nobody actually uses FirstStageMount.

Bug: 285855433
Test: device boots
Test: atest MicrodroidTestApp
Change-Id: I38a72c0f20e7c1ac70031498aeeca22b091fa827
2023-07-07 14:45:01 +01:00
Eric Biggers
79a67391bd init.rc: stop using fsverity_init --lock
Remove the code that "locked" the .fs-verity keyring at a certain point
in the boot.  It probably was thought that this achieved some useful
security property, which is a bit questionable.  Regardless, Android no
longer uses fsverity builtin signatures.  The only code that is still
being kept around is enough to access existing files on old kernels, and
for this "locking" the keyring is definitely not essential.

Bug: 290064770
Test: presubmit and booting Cuttlefish
Change-Id: Ide5729aeac5772658b2a3f0abe835988b8842b02
2023-07-06 18:39:22 +00:00
Eric Biggers
0b2c5cde1f init: remove unfinished fsverity signature support for APEX sepolicy
The APEX sepolicy feature has unfinished support for verifying the
sepolicy file using fsverity with a builtin signature.  However, this
was never finished and doesn't really make sense, since the
already-implemented scheme that uses a full-file hash combined with a
userspace signature check is better suited to the problem.  Therefore,
remove this unfinished code.

Bug: 290064770
Test: presubmit and booting Cuttlefish
Change-Id: I3403a3303bcea32c7340642b843cd1541fe1fd2f
2023-07-06 18:39:01 +00:00
Kelvin Zhang
314e70966a Merge "Move libbinderwrapper to update_engine" 2023-07-06 02:45:14 +00:00
Kelvin Zhang
57e3c32bcc Move libbinderwrapper to update_engine
libbinderwrapper is only used by update_engine, it's better to move it
inside update_engine repo

Change-Id: Ia489f38a311b221744f7cf89c9da9c4f3682bb4c
2023-07-05 16:07:05 -07:00
Daniel Zheng
4f3d6e2be8 Merge "Adding parsing for fastboot-info" 2023-07-05 21:52:15 +00:00
Treehugger Robot
3c381ee074 Merge "Replace usage of base::Callback with std::function" 2023-07-05 21:15:04 +00:00
Daniel Zheng
c97eeed5e4 Adding parsing for fastboot-info
Adding back the parsing for fastboot info

Test: m fastboot, fastboot flashall
Change-Id: I0075266bad5d45dcb99dbf91aa431008ca336216
2023-07-05 13:17:39 -07:00
Kelvin Zhang
40e78443e9 Replace usage of base::Callback with std::function
base::Callback comes from libchrome which is undermaintained. Since
C++11 there's standard library support for function objects. Migrate to
a more well knowned solution for function objects.

Test: th
Change-Id: Id19bcd7e92691f57d97520f8f1f4909ca9c25b33
2023-07-05 12:48:13 -07:00
Daniel Zheng
c596830f16 Merge "Changing name of flash super layout" 2023-07-05 19:17:48 +00:00
David Anderson
80ebe8c35d snapuserd: Restrict where reads/writes to dm_user_header happen.
Only write to dm_user_header in the functions which explicitly need to
marshal it. This avoids leakage of dm-user specifics into core logic.

This also simplifies the existing control flow by allowing us to set an
error anywhere, or nowhere, as any "return false" from ProcessIORequest
will automatically set an error header.

Bug: 288273605
Test: snapuserd_test
Change-Id: I85f67208197d7ecc49e348ab3013827a38e84761
2023-07-05 12:10:42 -07:00
David Anderson
b6df0138e5 snapuserd: Return void from RespondIOError.
RespondIOError could return "true" which is not the correct value for
its callers, usually. However since RespondIOError is not specifically
needed anymore, we can also avoid calling it in most places.

This also fixes a bug where ReadUnalignedSector's return value was
implicitly converted to boolean.

Bug: 288273605
Test: snapuserd_test
Change-Id: I62140b2b05d0f9f53cb669c5c0d7e0ffc7f4c9a1
2023-07-05 12:10:42 -07:00
David Anderson
572692c04c snapuserd: Make header_response a state variable.
header_response is meant to only be true for the first call to
WriteDmUserPayload. Codify this by making it a member variable and
resetting it on each request.

Bug: 288273605
Test: snapuserd_test
Change-Id: Ic92f5932391a607b63345d579f379d12e78e8f6c
2023-07-05 12:10:42 -07:00
Treehugger Robot
732d410d21 Merge "add 'nodad' support to ifc_add_address()" 2023-07-01 03:15:34 +00:00
Treehugger Robot
f5d4edaa31 Merge "libutils: rewrite Vector fuzzer" 2023-07-01 01:28:13 +00:00
Steven Moreland
379d5c83d5 libutils: rewrite Vector fuzzer
It could never have gotten much coverage.

Bug: 288741501
Test: libutils_fuzz_vector (2,000,000 iterations)
                           (~60k-100k iterations/s)
Change-Id: I6f442642b5a3246dd08784f735db5aad5fd4d398
2023-07-01 00:28:48 +00:00
Maciej Żenczykowski
25ec9c4db1 add 'nodad' support to ifc_add_address()
Test: TreeHugger
Bug: 242067762
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2c022f6af45eac7631213801a89aa270709d4a57
2023-06-30 16:36:21 +00:00
Jiakai Zhang
f43e20c9b4 Merge "Add a variant of ReadFstabFromFile for /proc/mounts." 2023-06-30 13:24:25 +00:00
Tomasz Wasilczyk
6ecea169ce Merge "Make atrace_*_body explicitly a part of API." 2023-06-29 22:23:16 +00:00
Jiakai Zhang
29ad6c2aa2 Add a variant of ReadFstabFromFile for /proc/mounts.
The variant excludes the code that is not for /proc/mounts, and
therefore saves code size when being called.

Also, after this change, the call to `SkipMountingPartitions` is skipped
for /proc/mounts because it is not needed.

Bug: 287958783
Test: atest CtsFsMgrTestCases
Change-Id: Ie243257fa2e87e666be7decf97ec36c806bc4524
2023-06-29 21:46:15 +00:00
Tomasz Wasilczyk
0c44d8d68d Make atrace_*_body explicitly a part of API.
Also, remove leftover atrace_set_debuggable(bool) symbol.

Bug: 289151149
Test: it builds
Change-Id: Id9fdf9451567d85b64971a6bb409336b12d3f535
2023-06-29 13:28:37 -07:00
Treehugger Robot
a33362ed50 Merge "libmodprobe: LPM: Cleanup of redundant check" 2023-06-29 17:21:18 +00:00
Daeho Jeong
47c0bfa8c7 Merge "init.rc: set f2fs seq_file_ra_mul to 128" 2023-06-29 15:52:51 +00:00
Tomasz Wasilczyk
d0e499f287 Merge "Drop const assignment operator." 2023-06-29 13:36:00 +00:00
Daeho Jeong
d6d8c1f81c init.rc: set f2fs seq_file_ra_mul to 128
Based on experiments, we fount out 128 (128 x global readahead window
size = 16mb) is the optimal multiple to boost up read speeds for the
sequentially accessed files with POSIX_FADV_SEQUENTIAL.

Bug: 195311558
Test: check the /sys/fs/f2fs/<userdata partition>/seq_file_ra_mul value
Change-Id: I7563ad6e47b9ab76ae7fe36978d0e5970a7490e8
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2023-06-28 14:35:30 -07:00