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]
Message-ID: <202210031536.czcpyFdz-lkp@intel.com>
Date:   Mon, 3 Oct 2022 15:23:34 +0800
From:   kernel test robot <lkp@...el.com>
To:     ira.weiny@...el.com, Andrew Morton <akpm@...ux-foundation.org>
Cc:     kbuild-all@...ts.01.org,
        Linux Memory Management List <linux-mm@...ck.org>,
        Ira Weiny <ira.weiny@...el.com>,
        "Fabio M. De Francesco" <fmdefrancesco@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Christoph Hellwig <hch@....de>,
        Al Viro <viro@...iv.linux.org.uk>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] highmem: Fix kmap_to_page() for kmap_local_page()
 addresses

Hi,

I love your patch! Yet something to improve:

[auto build test ERROR on 274d7803837da78dfc911bcda0d593412676fc20]

url:    https://github.com/intel-lab-lkp/linux/commits/ira-weiny-intel-com/highmem-Fix-kmap_to_page-for-kmap_local_page-addresses/20221003-120524
base:   274d7803837da78dfc911bcda0d593412676fc20
config: i386-tinyconfig
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/cd2106b2845310f5ee6e1a754c09e7caeabf3e01
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review ira-weiny-intel-com/highmem-Fix-kmap_to_page-for-kmap_local_page-addresses/20221003-120524
        git checkout cd2106b2845310f5ee6e1a754c09e7caeabf3e01
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make 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 <lkp@...el.com>

All errors (new ones prefixed by >>):

   mm/highmem.c: In function '__kmap_local_pfn_prot':
>> mm/highmem.c:549:15: error: implicit declaration of function 'arch_kmap_local_map_idx'; did you mean 'arch_kmap_local_unmap_idx'? [-Werror=implicit-function-declaration]
     549 |         idx = arch_kmap_local_map_idx(kmap_local_idx_push(), pfn);
         |               ^~~~~~~~~~~~~~~~~~~~~~~
         |               arch_kmap_local_unmap_idx
   mm/highmem.c: In function 'kunmap_local_indexed':
>> mm/highmem.c:495:49: error: implicit declaration of function 'kmap_local_calc_idx'; did you mean 'kmap_local_idx'? [-Werror=implicit-function-declaration]
     495 | #define arch_kmap_local_unmap_idx(idx, vaddr)   kmap_local_calc_idx(idx)
         |                                                 ^~~~~~~~~~~~~~~~~~~
   mm/highmem.c:609:15: note: in expansion of macro 'arch_kmap_local_unmap_idx'
     609 |         idx = arch_kmap_local_unmap_idx(kmap_local_idx(), addr);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +549 mm/highmem.c

298fa1ad5571f5 Thomas Gleixner 2020-11-03  493  
298fa1ad5571f5 Thomas Gleixner 2020-11-03  494  #ifndef arch_kmap_local_unmap_idx
298fa1ad5571f5 Thomas Gleixner 2020-11-03 @495  #define arch_kmap_local_unmap_idx(idx, vaddr)	kmap_local_calc_idx(idx)
298fa1ad5571f5 Thomas Gleixner 2020-11-03  496  #endif
298fa1ad5571f5 Thomas Gleixner 2020-11-03  497  
298fa1ad5571f5 Thomas Gleixner 2020-11-03  498  #ifndef arch_kmap_local_high_get
298fa1ad5571f5 Thomas Gleixner 2020-11-03  499  static inline void *arch_kmap_local_high_get(struct page *page)
298fa1ad5571f5 Thomas Gleixner 2020-11-03  500  {
298fa1ad5571f5 Thomas Gleixner 2020-11-03  501  	return NULL;
298fa1ad5571f5 Thomas Gleixner 2020-11-03  502  }
298fa1ad5571f5 Thomas Gleixner 2020-11-03  503  #endif
298fa1ad5571f5 Thomas Gleixner 2020-11-03  504  
a1dce7fd2ade8e Thomas Gleixner 2021-01-23  505  #ifndef arch_kmap_local_set_pte
a1dce7fd2ade8e Thomas Gleixner 2021-01-23  506  #define arch_kmap_local_set_pte(mm, vaddr, ptep, ptev)	\
a1dce7fd2ade8e Thomas Gleixner 2021-01-23  507  	set_pte_at(mm, vaddr, ptep, ptev)
a1dce7fd2ade8e Thomas Gleixner 2021-01-23  508  #endif
a1dce7fd2ade8e Thomas Gleixner 2021-01-23  509  
298fa1ad5571f5 Thomas Gleixner 2020-11-03  510  /* Unmap a local mapping which was obtained by kmap_high_get() */
2a656cad337e0e Thomas Gleixner 2020-11-12  511  static inline bool kmap_high_unmap_local(unsigned long vaddr)
298fa1ad5571f5 Thomas Gleixner 2020-11-03  512  {
298fa1ad5571f5 Thomas Gleixner 2020-11-03  513  #ifdef ARCH_NEEDS_KMAP_HIGH_GET
2a656cad337e0e Thomas Gleixner 2020-11-12  514  	if (vaddr >= PKMAP_ADDR(0) && vaddr < PKMAP_ADDR(LAST_PKMAP)) {
298fa1ad5571f5 Thomas Gleixner 2020-11-03  515  		kunmap_high(pte_page(pkmap_page_table[PKMAP_NR(vaddr)]));
2a656cad337e0e Thomas Gleixner 2020-11-12  516  		return true;
2a656cad337e0e Thomas Gleixner 2020-11-12  517  	}
298fa1ad5571f5 Thomas Gleixner 2020-11-03  518  #endif
2a656cad337e0e Thomas Gleixner 2020-11-12  519  	return false;
298fa1ad5571f5 Thomas Gleixner 2020-11-03  520  }
298fa1ad5571f5 Thomas Gleixner 2020-11-03  521  
298fa1ad5571f5 Thomas Gleixner 2020-11-03  522  static pte_t *__kmap_pte;
298fa1ad5571f5 Thomas Gleixner 2020-11-03  523  
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  524  static pte_t *kmap_get_pte(unsigned long vaddr, int idx)
298fa1ad5571f5 Thomas Gleixner 2020-11-03  525  {
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  526  	if (IS_ENABLED(CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY))
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  527  		/*
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  528  		 * Set by the arch if __kmap_pte[-idx] does not produce
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  529  		 * the correct entry.
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  530  		 */
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  531  		return virt_to_kpte(vaddr);
298fa1ad5571f5 Thomas Gleixner 2020-11-03  532  	if (!__kmap_pte)
298fa1ad5571f5 Thomas Gleixner 2020-11-03  533  		__kmap_pte = virt_to_kpte(__fix_to_virt(FIX_KMAP_BEGIN));
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  534  	return &__kmap_pte[-idx];
298fa1ad5571f5 Thomas Gleixner 2020-11-03  535  }
298fa1ad5571f5 Thomas Gleixner 2020-11-03  536  
298fa1ad5571f5 Thomas Gleixner 2020-11-03  537  void *__kmap_local_pfn_prot(unsigned long pfn, pgprot_t prot)
298fa1ad5571f5 Thomas Gleixner 2020-11-03  538  {
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  539  	pte_t pteval, *kmap_pte;
298fa1ad5571f5 Thomas Gleixner 2020-11-03  540  	unsigned long vaddr;
298fa1ad5571f5 Thomas Gleixner 2020-11-03  541  	int idx;
298fa1ad5571f5 Thomas Gleixner 2020-11-03  542  
f3ba3c710ac5a3 Thomas Gleixner 2020-11-18  543  	/*
f3ba3c710ac5a3 Thomas Gleixner 2020-11-18  544  	 * Disable migration so resulting virtual address is stable
f0953a1bbaca71 Ingo Molnar     2021-05-06  545  	 * across preemption.
f3ba3c710ac5a3 Thomas Gleixner 2020-11-18  546  	 */
f3ba3c710ac5a3 Thomas Gleixner 2020-11-18  547  	migrate_disable();
298fa1ad5571f5 Thomas Gleixner 2020-11-03  548  	preempt_disable();
298fa1ad5571f5 Thomas Gleixner 2020-11-03 @549  	idx = arch_kmap_local_map_idx(kmap_local_idx_push(), pfn);
298fa1ad5571f5 Thomas Gleixner 2020-11-03  550  	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  551  	kmap_pte = kmap_get_pte(vaddr, idx);
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  552  	BUG_ON(!pte_none(*kmap_pte));
298fa1ad5571f5 Thomas Gleixner 2020-11-03  553  	pteval = pfn_pte(pfn, prot);
825c43f50e3aa8 Ard Biesheuvel  2021-11-19  554  	arch_kmap_local_set_pte(&init_mm, vaddr, kmap_pte, pteval);
298fa1ad5571f5 Thomas Gleixner 2020-11-03  555  	arch_kmap_local_post_map(vaddr, pteval);
5fbda3ecd14a53 Thomas Gleixner 2020-11-18  556  	current->kmap_ctrl.pteval[kmap_local_idx()] = pteval;
298fa1ad5571f5 Thomas Gleixner 2020-11-03  557  	preempt_enable();
298fa1ad5571f5 Thomas Gleixner 2020-11-03  558  
298fa1ad5571f5 Thomas Gleixner 2020-11-03  559  	return (void *)vaddr;
298fa1ad5571f5 Thomas Gleixner 2020-11-03  560  }
298fa1ad5571f5 Thomas Gleixner 2020-11-03  561  EXPORT_SYMBOL_GPL(__kmap_local_pfn_prot);
298fa1ad5571f5 Thomas Gleixner 2020-11-03  562  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (29413 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ