Greetings, I've noticed a corner case with writev() both modifying the file and returning -EFAULT at the same time. This happens on filesystems using generic_perform_write() (i.e. ext4, vfat) on 4.6.3 kernel and below, down to 3.16. Here's the reproducer: // 8<---- cut here ------------------------ >8 #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/uio.h> int main(int argc, char** argv) { int fd; ssize_t ret; struct iovec iov[] = { { .iov_base = NULL, .iov_len = 0, }, { .iov_base = NULL, .iov_len = 4096, }, }; system("dd if=/dev/zero bs=8k count=1 | tr '\\0' 'A' > foo"); fd = open("foo", O_RDWR); if (fd < 0) { perror("open()"); return 1; } ret = writev(fd, iov, 2); if (ret < 0) { perror("writev()"); return 1; } return 0; } // 8<---- cut here ------------------------ >8 Running that prints "writev(): Bad address" but also some NUL bytes have appeared at the beginning file, in addition to the 'A's by the dd. 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00001000 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAAAAAAAA| * 00002000 Is that intented behaviour? -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html