Hi Peter, Thank you for the patch! Yet something to improve: [auto build test ERROR on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/Peter-Xu/mm-uffd-Always-wr-protect-pte-in-pte_mkuffd_wp/20221206-050912 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/Y45duzmGGUT0%2Bu8t%40x1n patch subject: [PATCH] mm/uffd: Always wr-protect pte in pte_mkuffd_wp() config: i386-randconfig-a003-20221205 compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/ddd9626e3f22a7c2c263c0db4d062a7cc60dfa15 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Peter-Xu/mm-uffd-Always-wr-protect-pte-in-pte_mkuffd_wp/20221206-050912 git checkout ddd9626e3f22a7c2c263c0db4d062a7cc60dfa15 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from fs/btrfs/disk-io.c:13: In file included from include/linux/migrate.h:8: In file included from include/linux/hugetlb.h:830: In file included from arch/x86/include/asm/hugetlb.h:6: >> include/asm-generic/hugetlb.h:40:9: error: implicit declaration of function 'huge_pte_wrprotect' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return huge_pte_wrprotect(pte_mkuffd_wp(pte)); ^ >> include/asm-generic/hugetlb.h:40:9: error: returning 'int' from a function with incompatible result type 'pte_t' return huge_pte_wrprotect(pte_mkuffd_wp(pte)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> include/asm-generic/hugetlb.h:108:21: error: static declaration of 'huge_pte_wrprotect' follows non-static declaration static inline pte_t huge_pte_wrprotect(pte_t pte) ^ include/asm-generic/hugetlb.h:40:9: note: previous implicit declaration is here return huge_pte_wrprotect(pte_mkuffd_wp(pte)); ^ 3 errors generated. -- In file included from mm/mprotect.c:13: In file included from include/linux/hugetlb.h:830: In file included from arch/x86/include/asm/hugetlb.h:6: >> include/asm-generic/hugetlb.h:40:9: error: implicit declaration of function 'huge_pte_wrprotect' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return huge_pte_wrprotect(pte_mkuffd_wp(pte)); ^ >> include/asm-generic/hugetlb.h:40:9: error: returning 'int' from a function with incompatible result type 'pte_t' return huge_pte_wrprotect(pte_mkuffd_wp(pte)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> include/asm-generic/hugetlb.h:108:21: error: static declaration of 'huge_pte_wrprotect' follows non-static declaration static inline pte_t huge_pte_wrprotect(pte_t pte) ^ include/asm-generic/hugetlb.h:40:9: note: previous implicit declaration is here return huge_pte_wrprotect(pte_mkuffd_wp(pte)); ^ In file included from mm/mprotect.c:15: include/linux/mman.h:154:9: warning: division by zero is undefined [-Wdivision-by-zero] _calc_vm_trans(flags, MAP_SYNC, VM_SYNC ) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/mman.h:132:21: note: expanded from macro '_calc_vm_trans' : ((x) & (bit1)) / ((bit1) / (bit2)))) ^ ~~~~~~~~~~~~~~~~~ 1 warning and 3 errors generated. vim +/huge_pte_wrprotect +40 include/asm-generic/hugetlb.h 37 38 static inline pte_t huge_pte_mkuffd_wp(pte_t pte) 39 { > 40 return huge_pte_wrprotect(pte_mkuffd_wp(pte)); 41 } 42 43 static inline pte_t huge_pte_clear_uffd_wp(pte_t pte) 44 { 45 return pte_clear_uffd_wp(pte); 46 } 47 48 static inline int huge_pte_uffd_wp(pte_t pte) 49 { 50 return pte_uffd_wp(pte); 51 } 52 53 #ifndef __HAVE_ARCH_HUGE_PTE_CLEAR 54 static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, 55 pte_t *ptep, unsigned long sz) 56 { 57 pte_clear(mm, addr, ptep); 58 } 59 #endif 60 61 #ifndef __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE 62 static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, 63 unsigned long addr, unsigned long end, 64 unsigned long floor, unsigned long ceiling) 65 { 66 free_pgd_range(tlb, addr, end, floor, ceiling); 67 } 68 #endif 69 70 #ifndef __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT 71 static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, 72 pte_t *ptep, pte_t pte) 73 { 74 set_pte_at(mm, addr, ptep, pte); 75 } 76 #endif 77 78 #ifndef __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR 79 static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, 80 unsigned long addr, pte_t *ptep) 81 { 82 return ptep_get_and_clear(mm, addr, ptep); 83 } 84 #endif 85 86 #ifndef __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH 87 static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma, 88 unsigned long addr, pte_t *ptep) 89 { 90 return ptep_clear_flush(vma, addr, ptep); 91 } 92 #endif 93 94 #ifndef __HAVE_ARCH_HUGE_PTE_NONE 95 static inline int huge_pte_none(pte_t pte) 96 { 97 return pte_none(pte); 98 } 99 #endif 100 101 /* Please refer to comments above pte_none_mostly() for the usage */ 102 static inline int huge_pte_none_mostly(pte_t pte) 103 { 104 return huge_pte_none(pte) || is_pte_marker(pte); 105 } 106 107 #ifndef __HAVE_ARCH_HUGE_PTE_WRPROTECT > 108 static inline pte_t huge_pte_wrprotect(pte_t pte) 109 { 110 return pte_wrprotect(pte); 111 } 112 #endif 113 -- 0-DAY CI Kernel Test Service https://01.org/lkp