-
Notifications
You must be signed in to change notification settings - Fork 260
File corruption using protected files #2663
Comments
Interesting, I guess the reason this slipped unnoticed is that Flushing after each p.s. thank you for taking your time to make this report high-quality! :) |
You can't use different kinds of paths (absolute vs relative) when encrypting protected files (via |
This sounds like the culprit in this particular case. @bvavala It looks like you could write your own very simple test in C, to strip all the unnecessary fluff of invoking |
Description of the problem
A large file can get corrupted when stored on disk as a protected file.
Steps to reproduce
The bug was tested on 851f708, and earlier versions using the previous
pal_loader
way to run the apps.compress ~1MB of text in a tar file
-rw-rw-r-- 1 bruno bruno 4852 Aug 21 00:12 scripts/1mb.txt.tar.gz
untar the file in graphene in a protected folder (i.e.,
encrypted-data
)graphene-sgx tar xvfz scripts/1mb.txt.tar.gz -C encrypted-data
copy the file in graphene from the protected folder to another (plain) folder
graphene-sgx cp encrypted-data/1mb.txt scripts/
check that the copied and the original text file do not match
Expected results
No file corruption.
Actual results
File corruption, more precisely, a truncated file.
Original (uncompressed) file:
Protected (uncompressed) file:
A (probably inefficient) solution
Force a flush at the end of
ipf_write
before returning.After the modification, the file is not corrupted, and the protected (uncompressed) file size is larger than before:
Additional comments
tar
reports an error withutime
, which is not implemented in the shim table. This does not appear to be related to the file corruption. It would be nice to have an implementation of the feature and, in the case of security implications, possibly allow a developer to enable it manually in the manifest.This problem did not appear in previous version using the previous
pal_loader
way to run the apps.The text was updated successfully, but these errors were encountered: