Skip to content

Commit

Permalink
[Pal/Linux-SGX] Always open Protected Files in RW mode
Browse files Browse the repository at this point in the history
A Protected File sometimes needs to be read or written, regardless of
the actual open mode that was requested (e.g. to read or write some
metadata).

Signed-off-by: Borys Popławski <borysp@invisiblethingslab.com>
  • Loading branch information
boryspoplawski committed Sep 22, 2021
1 parent d9abbe1 commit ff5a2da
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Pal/src/host/Linux-SGX/db_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ static int file_open(PAL_HANDLE* handle, const char* type, const char* uri, int
goto fail_pf_unlock;
}

/* Protected files sometimes needs to be read and written (e.g. to read or save some
* metadata), regardless of the requested open mode. */
flags = (flags & ~O_ACCMODE) | O_RDWR;

fd = ocall_open(uri, flags, pal_share);
if (fd < 0) {
ret = unix_to_pal_error(fd);
Expand Down

0 comments on commit ff5a2da

Please sign in to comment.