Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/copy_interpose.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,18 @@ void *memcpy(void *dest, const void *src, size_t n) {
perror("register with WP");
abort();
}
struct uffdio_writeprotect wp;
wp.range.start = (uint64_t)(src_entry->addr + src_entry->offset);
wp.range.len = (uint64_t)src_entry->len;
wp.mode = UFFDIO_WRITEPROTECT_MODE_WP;
if (ioctl(uffd, UFFDIO_WRITEPROTECT, &wp) == -1) {
if (errno == EINVAL) {
LOG("[%s] write-protection fault by userfaultfd may not be"
"supported by the current kernel\n");
}
perror("Writeprotect pages");
abort();
}
}

size_t left_fringe_len = LEFT_FRINGE_LEN(dest);
Expand Down