Re: [PATCH] mm: extend memfd with ability to create secret memory

From: kbuild test robot
Date: Sun Dec 08 2019 - 09:16:52 EST


Hi Mike,

I love your patch! Yet something to improve:

[auto build test ERROR on mmotm/master]
[also build test ERROR on linux/master v5.4]
[cannot apply to arm-soc/for-next linus/master next-20191208]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Mike-Rapoport/mm-extend-memfd-with-ability-to-create-secret-memory/20191207-130906
base: git://git.cmpxchg.org/linux-mmotm.git master
config: arm64-randconfig-a001-20191208 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

mm/secretmem.c: In function 'secretmem_fault':
>> mm/secretmem.c:45:9: error: implicit declaration of function 'set_pages_array_uc'; did you mean 'set_page_dirty_lock'? [-Werror=implicit-function-declaration]
err = set_pages_array_uc(&page, 1);
^~~~~~~~~~~~~~~~~~
set_page_dirty_lock
mm/secretmem.c: In function 'secretmem_close':
>> mm/secretmem.c:75:4: error: implicit declaration of function 'set_pages_array_wb'; did you mean 'set_page_dirty'? [-Werror=implicit-function-declaration]
set_pages_array_wb(&page, 1);
^~~~~~~~~~~~~~~~~~
set_page_dirty
cc1: some warnings being treated as errors

vim +45 mm/secretmem.c

21
22 static vm_fault_t secretmem_fault(struct vm_fault *vmf)
23 {
24 struct secretmem_state *state = vmf->vma->vm_file->private_data;
25 struct address_space *mapping = vmf->vma->vm_file->f_mapping;
26 pgoff_t offset = vmf->pgoff;
27 unsigned long addr;
28 struct page *page;
29 int err;
30
31 page = find_get_page(mapping, offset);
32 if (!page) {
33 page = pagecache_get_page(mapping, offset,
34 FGP_CREAT|FGP_FOR_MMAP,
35 vmf->gfp_mask);
36 if (!page)
37 return vmf_error(-ENOMEM);
38
39 __SetPageUptodate(page);
40 }
41
42 if (state->mode == SECRETMEM_EXCLUSIVE)
43 err = set_direct_map_invalid_noflush(page);
44 else if (state->mode == SECRETMEM_UNCACHED)
> 45 err = set_pages_array_uc(&page, 1);
46 else
47 BUG();
48
49 if (err) {
50 delete_from_page_cache(page);
51 return vmf_error(err);
52 }
53
54 addr = (unsigned long)page_address(page);
55 flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
56
57 vmf->page = page;
58 return 0;
59 }
60
61 static void secretmem_close(struct vm_area_struct *vma)
62 {
63 struct secretmem_state *state = vma->vm_file->private_data;
64 struct address_space *mapping = vma->vm_file->f_mapping;
65 struct page *page;
66 pgoff_t index;
67
68 xa_for_each(&mapping->i_pages, index, page) {
69 get_page(page);
70 lock_page(page);
71
72 if (state->mode == SECRETMEM_EXCLUSIVE)
73 set_direct_map_default_noflush(page);
74 else if (state->mode == SECRETMEM_UNCACHED)
> 75 set_pages_array_wb(&page, 1);
76 else
77 BUG();
78
79 __ClearPageDirty(page);
80 delete_from_page_cache(page);
81
82 unlock_page(page);
83 put_page(page);
84 }
85 }
86

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip