-
Notifications
You must be signed in to change notification settings - Fork 613
Optimize reboots with Android emulator initialization #5280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jardondiego
wants to merge
21
commits into
master
Choose a base branch
from
optimize-android-reboots
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+75
−15
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
c339307
Optimize Android emulator initialization by batching reboots
8c579ed
Fix reboot_done tracking to ensure device settings are applied
af62e75
Revert previous fix and use accumulated state for reboot_done
a3c840d
Invert logic to needs_reboot and use bitwise OR operator to fix state…
c2fd3e2
Fix needs_reboot logic so ASan setup clears pending reboots
09273e2
Fix initialization reboot logic to correctly preserve base requirements
d6ab58f
Add unit tests for android device reboot logic
4b340a5
Fix formatting issues from linter in device_test.py
4d0dfa7
Address PR 5280 comments: Add return types and docstrings
9d8cd5c
Rename wait_for_reboot to should_reboot
baf5766
Update docstrings for test cases
98406b3
Simplify initialize_device logic and refactor tests
48f3468
Add descriptive docstring for InitializeEnvironmentTest
2c08a43
Add docstring to write_data_to_file
336400b
Move helpers import to module level in device_test.py
ccffa14
Ensure physical devices always reboot to lock /system
829ac70
Merge branch 'master' into optimize-android-reboots
jardondiego c347ad6
Fix linter errors in device_test.py
baec846
Merge branch 'master' into optimize-android-reboots
jardondiego 4f7a511
Optimize Android system partition writes with manual read-only remount
511b555
Update docstring for write_data_to_file based on PR feedback
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure I understand, this means that the next time the app is started, it will read from the options file?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. We write the ASan options to the system file. When the target fuzzer application is launched in a new process shortly after this, the new options file are read from disk during its initialization. A full device reboot isn't required for this step, so we can safely skip it to save time. Forcing a ~60s kernel reboot to update a text string that a process is going to read 2 seconds later is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks. IIUC the logic in
write_data_to_file(), that means we'll leave/systemin read-write mode. Is that intentional?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I don't think it would be a problem for emulated devices since they would be launched and destroyed in every task bit it might be an issue for non-virtual devices since a fuzzing job could break a system file and we would have to address that issue in a physical device, and that could mean having to physically check such device. We could either skip this optimization for virtual devices or manually trigger a read-only re-mounting. What do you suggest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I applied Option A for now, but I'm all ears for any suggestions from you. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See other comment, I don't think option A was applied in the end.
In any case, I don't think it's a big deal to lose 1m per fuzzing session - they last 3 hours anyway. I would rather go for option B and avoid the risk of weird issues where /system files get corrupted. I agree with you that for emulated devices that should be safe, but I'm not 100% confident :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think something weird happened in my workspace, I was moving around several branches and got confused. Agreed! I will adjust as suggested!