gramine
gramine copied to clipboard
[common] Add truncation to arbitrary size to Protected Files
Description of the changes
Truncation of PFs to arbitrary size is implemented in a slow and trivial way: read the file's contents into a temporary buffer, shrink the file to zero, write back the contents into the file.
Fixes #950.
How to test this PR?
CI. I added tests to libos/test/fs.
We hit this again on a ~~MariaDB~~ MongoDB workload -- without this PR it fails with ftruncate: Permission denied on a Protected File. With this PR, it succeeds initialization and continues working.
We should prioritize finishing this PR.