Re: [PATCH v14 10/10] secretmem: test: add basic selftest for memfd_secret(2)

Mike Rapoport
2020-12-12T14:00:02Z

Hi John,

On Fri, Dec 11, 2020 at 10:16:23PM -0800, John Hubbard wrote:
> On 12/2/20 10:29 PM, Mike Rapoport wrote:
> > From: Mike Rapoport <rppt@linux.ibm.com>
> ...
> > +#include "../kselftest.h"
> > +
> > +#define fail(fmt, ...) ksft_test_result_fail(fmt, ##__VA_ARGS__)
> > +#define pass(fmt, ...) ksft_test_result_pass(fmt, ##__VA_ARGS__)
> > +#define skip(fmt, ...) ksft_test_result_skip(fmt, ##__VA_ARGS__)
> > +
> > +#ifdef __NR_memfd_secret
> > +
> > +#include <linux/secretmem.h>
>
> Hi Mike,
>
> Say, when I tried this out from today's linux-next, I had to delete the
> above line. In other words, the following was required in order to build:
>
> diff --git a/tools/testing/selftests/vm/memfd_secret.c b/tools/testing/selftests/vm/memfd_secret.c
> index 79578dfd13e6..c878c2b841fc 100644
> --- a/tools/testing/selftests/vm/memfd_secret.c
> +++ b/tools/testing/selftests/vm/memfd_secret.c
> @@ -29,8 +29,6 @@
>
> #ifdef __NR_memfd_secret
>
> -#include <linux/secretmem.h>
> -
> #define PATTERN 0x55
>
> static const int prot = PROT_READ | PROT_WRITE;
>
>
> ...and that makes sense to me, because:
>
> a) secretmem.h is not in the uapi, which this selftests/vm build system
> expects (it runs "make headers_install" for us, which is *not* going
> to pick up items in the kernel include dirs), and
>
> b) There is nothing in secretmem.h that this test uses, anyway! Just these:
>
> bool vma_is_secretmem(struct vm_area_struct *vma);
> bool page_is_secretmem(struct page *page);
> bool secretmem_active(void);
>
>
> ...or am I just Doing It Wrong? :)

You are perfectly right, I had a stale header in uapi from the prevoius
versions, the include in the test remained from then.

@Andrew, can you please add the hunk above as a fixup?

> thanks,
> --
> John Hubbard
> NVIDIA

--
Sincerely yours,
Mike.