Skip to content
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
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

steppp
Copy link

@steppp steppp commented Aug 17, 2020

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.

steppp added 19 commits March 3, 2020 17:54
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.
@steppp steppp mentioned this pull request Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant