Re: [PATCH v2 2/3] selftests/memfd_secret: add vmsplice() test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



+static void test_vmsplice(int fd, const char *desc)
+{
+       ssize_t transferred;
+       struct iovec iov;
+       int pipefd[2];
+       char *mem;
+
+       if (pipe(pipefd)) {
+               fail("pipe failed: %s\n", strerror(errno));
+               return;
+       }
+
+       mem = mmap(NULL, page_size, prot, mode, fd, 0);
+       if (mem == MAP_FAILED) {
+               fail("Unable to mmap secret memory\n");
+               goto close_pipe;
+       }
+
+       /*
+        * vmsplice() may use GUP-fast, which must also fail. Prefault the
+        * page table, so GUP-fast could find it.
+        */
+       memset(mem, PATTERN, page_size);

Shouldn't the non-prefault case be tested as well?

That's the "easy" case where GUP-fast is never involved, and it should mostly be covered by the ptrace/process_vm_read() tests already.

--
Cheers,

David / dhildenb





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux