-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add flock, fcntl record locking virtualization #21
Open
andriyolo
wants to merge
19
commits into
virtualsquare:master
Choose a base branch
from
andriyolo:master
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.
Conversation
This file contains 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
Include `linux/sockios.h` to make SIOCGSTAMP visible.
Add a demo folder Add some utility scripts
Fix an error with the fcntl/flock wrapper functions that did not set the SC's actual return value Add some comments in VUOS Add some examples Fix some code/examples
Add the possibility for a module to export custom "sc"s. Add custom sc export conformance to all modules.
The struct flock argument now is correctly read from the tracee memory using umvu's peek/poke functions.
Remove flock out function since it's no longer needed.
Add initial support for fcntl and flock virtualization
File descriptor opened from vu_vufs_fcntl are now correctly closed. Needs testing. vu_vufs_fcntl now uses the fsa to perform its operations. Minor fixes.
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add flock and fcntl SCs virtualization as part of the VUFS module.
The two implementations are very similar: they both use the vufsa FSA to perform the operations and they behave like the open SC.
When one of the two SC is invoked, the correct wrap in function retrieves all the invocation parameters and then calls the (actual or module-implementation) SC.
Here, if the (vu)mount mode permits it, a copy of the file is created (or opened) in the virtual hierarchy and the lock is applied onto that file. Doing so, a mapping between the original target fd and the newly acquired one is created, but this is completely invisible to the client program.
A drawback of this approach is that this mapping has to be stored in an array inside VUFS. The values is this array are then checked against when a fd is closed, to see if another one has been created earlier by one of the locking SCs implementations. This could cause some inconsistencies between the client program and the VUFS internal state due to the flock/fcntl semantics in relation to multiple threads/fds/processes.
I tested this implementation and it seemed to work correctly but I think that further testing is needed.