Files
Dmitrii Kuvaiskii 5173ff42e9 [LibOS,Pal/Linux-SGX] Fix sendfile() on protected files
Previously, Graphene would fail if application uses sendfile() on a
protected file. This happened because LibOS's emulation of sendfile
relies on PAL to allocate a temporary buffer for mmapped contents,
however mmap implementation in PFs did not allocate this buffer. This
commit adds logic in PFs to allocate the buffer (it is the
responsibility of LibOS to free it later). Also, since PFs propagate
changes to writable files only on flush/close, sendfile is augmented
with a forced flush. A sendfile test is added to FS/PF tests.
2020-08-26 10:08:58 -07:00

7 lines
217 B
C

#include "common.h"
void copy_data(int fi, int fo, const char* input_path, const char* output_path, size_t size) {
sendfile_fd(input_path, output_path, fi, fo, size);
printf("sendfile_fd(%zu) OK\n", size);
}