Skip to content

Commit

Permalink
[LibOS] Do not flush unopened Encrypted File during checkpoint
Browse files Browse the repository at this point in the history
Without this check, the called `encrypted_file_flush(enc)` assumes that
the Encrypted File is opened and fails on an assert / with a segfault
because it tries to access `enc->pf`.

Kudos to Anees Sahib <[email protected]> for root causing the bug.

Signed-off-by: Dmitrii Kuvaiskii <[email protected]>
  • Loading branch information
dimakuv authored and mkow committed Jun 20, 2022
1 parent 6f82e17 commit 63d8dca
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions LibOS/src/fs/shim_fs_encrypted.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,11 @@ BEGIN_CP_FUNC(encrypted_file) {
struct shim_encrypted_file* enc = obj;
struct shim_encrypted_file* new_enc = NULL;

int ret = encrypted_file_flush(enc);
if (ret < 0)
return ret;
if (enc->pf) {
int ret = encrypted_file_flush(enc);
if (ret < 0)
return ret;
}

size_t off = ADD_CP_OFFSET(sizeof(struct shim_encrypted_file));
new_enc = (struct shim_encrypted_file*)(base + off);
Expand Down

0 comments on commit 63d8dca

Please sign in to comment.