[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1365c52b-2883-4b1a-aa9f-f587e38df695@redhat.com>
Date: Tue, 26 Mar 2024 16:36:16 +0100
From: David Hildenbrand <david@...hat.com>
To: Miklos Szeredi <mszeredi@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>, Mike Rapoport <rppt@...nel.org>,
Lorenzo Stoakes <lstoakes@...il.com>, xingwei lee <xrivendell7@...il.com>,
yue sun <samsun1006219@...il.com>
Subject: Re: [PATCH v2 2/3] selftests/memfd_secret: add vmsplice() test
>> +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
Powered by blists - more mailing lists