lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 4 Mar 2021 11:46:53 -0500
From:   Peter Xu <peterx@...hat.com>
To:     kernel test robot <lkp@...el.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Matthew Wilcox <willy@...radead.org>,
        Axel Rasmussen <axelrasmussen@...gle.com>,
        "Kirill A . Shutemov" <kirill@...temov.name>,
        Mike Rapoport <rppt@...ux.vnet.ibm.com>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Andrea Arcangeli <aarcange@...hat.com>
Subject: Re: [PATCH v4 1/4] hugetlb: Pass vma into huge_pte_alloc() and
 huge_pmd_share()

On Fri, Mar 05, 2021 at 12:31:00AM +0800, kernel test robot wrote:
> Hi Peter,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on arm64/for-next/core]
> [also build test ERROR on linux/master linus/master v5.12-rc1 next-20210304]
> [cannot apply to hnaz-linux-mm/master]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Peter-Xu/hugetlb-Disable-huge-pmd-unshare-for-uffd-wp/20210219-071334
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
> config: mips-randconfig-m031-20210304 (attached as .config)
> compiler: mipsel-linux-gcc (GCC) 9.3.0
> 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/0day-ci/linux/commit/7ede06d6f63e59db4b9dee54f78eeac0c9ca17e4
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Peter-Xu/hugetlb-Disable-huge-pmd-unshare-for-uffd-wp/20210219-071334
>         git checkout 7ede06d6f63e59db4b9dee54f78eeac0c9ca17e4
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@...el.com>
> 
> All errors (new ones prefixed by >>):
> 
> >> mm/hugetlb.c:5376:8: error: conflicting types for 'huge_pmd_share'
>     5376 | pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct vma,
>          |        ^~~~~~~~~~~~~~
>    In file included from mm/hugetlb.c:39:
>    include/linux/hugetlb.h:155:8: note: previous declaration of 'huge_pmd_share' was here
>      155 | pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct *vma,
>          |        ^~~~~~~~~~~~~~
> 
> 
> vim +/huge_pmd_share +5376 mm/hugetlb.c
> 
>   5343	
>   5344	/*
>   5345	 * unmap huge page backed by shared pte.
>   5346	 *
>   5347	 * Hugetlb pte page is ref counted at the time of mapping.  If pte is shared
>   5348	 * indicated by page_count > 1, unmap is achieved by clearing pud and
>   5349	 * decrementing the ref count. If count == 1, the pte page is not shared.
>   5350	 *
>   5351	 * Called with page table lock held and i_mmap_rwsem held in write mode.
>   5352	 *
>   5353	 * returns: 1 successfully unmapped a shared pte page
>   5354	 *	    0 the underlying pte page is not shared, or it is the last user
>   5355	 */
>   5356	int huge_pmd_unshare(struct mm_struct *mm, struct vm_area_struct *vma,
>   5357						unsigned long *addr, pte_t *ptep)
>   5358	{
>   5359		pgd_t *pgd = pgd_offset(mm, *addr);
>   5360		p4d_t *p4d = p4d_offset(pgd, *addr);
>   5361		pud_t *pud = pud_offset(p4d, *addr);
>   5362	
>   5363		i_mmap_assert_write_locked(vma->vm_file->f_mapping);
>   5364		BUG_ON(page_count(virt_to_page(ptep)) == 0);
>   5365		if (page_count(virt_to_page(ptep)) == 1)
>   5366			return 0;
>   5367	
>   5368		pud_clear(pud);
>   5369		put_page(virt_to_page(ptep));
>   5370		mm_dec_nr_pmds(mm);
>   5371		*addr = ALIGN(*addr, HPAGE_SIZE * PTRS_PER_PTE) - HPAGE_SIZE;
>   5372		return 1;
>   5373	}
>   5374	#define want_pmd_share()	(1)
>   5375	#else /* !CONFIG_ARCH_WANT_HUGE_PMD_SHARE */
> > 5376	pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct vma,
>   5377			      unsigned long addr, pud_t *pud)
>   5378	{
>   5379		return NULL;
>   5380	}
>   5381	

Sorry for this!  I think we need to squash below into this patch for
!CONFIG_ARCH_WANT_HUGE_PMD_SHARE:

-----8<-----
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index fc62932c31cb..94ac419f88cd 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5415,7 +5415,7 @@ int huge_pmd_unshare(struct mm_struct *mm, struct vm_area_struct *vma,
 }
 
 #else /* !CONFIG_ARCH_WANT_HUGE_PMD_SHARE */
-pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct vma,
+pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct *vma,
                      unsigned long addr, pud_t *pud)
 {
        return NULL;
-----8<-----

Andrew, please kindly let me know when a repost is needed.

Thanks,

-- 
Peter Xu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ