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] [day] [month] [year] [list]
Message-ID: <202210032030.BAyHYTtZ-lkp@intel.com>
Date:   Mon, 3 Oct 2022 20:51:00 +0800
From:   kernel test robot <lkp@...el.com>
To:     ira.weiny@...el.com, Andrew Morton <akpm@...ux-foundation.org>
Cc:     llvm@...ts.linux.dev, 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: x86_64-randconfig-a003-20221003
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/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
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 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:549:8: error: implicit declaration of function 'arch_kmap_local_map_idx' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           idx = arch_kmap_local_map_idx(kmap_local_idx_push(), pfn);
                 ^
   mm/highmem.c:549:8: note: did you mean 'arch_kmap_local_high_get'?
   mm/highmem.c:499:21: note: 'arch_kmap_local_high_get' declared here
   static inline void *arch_kmap_local_high_get(struct page *page)
                       ^
>> mm/highmem.c:609:8: error: implicit declaration of function 'kmap_local_calc_idx' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           idx = arch_kmap_local_unmap_idx(kmap_local_idx(), addr);
                 ^
   mm/highmem.c:495:47: note: expanded from macro 'arch_kmap_local_unmap_idx'
   #define arch_kmap_local_unmap_idx(idx, vaddr)   kmap_local_calc_idx(idx)
                                                   ^
   mm/highmem.c:609:8: note: did you mean 'kmap_local_idx'?
   mm/highmem.c:495:47: note: expanded from macro 'arch_kmap_local_unmap_idx'
   #define arch_kmap_local_unmap_idx(idx, vaddr)   kmap_local_calc_idx(idx)
                                                   ^
   mm/highmem.c:471:19: note: 'kmap_local_idx' declared here
   static inline int kmap_local_idx(void)
                     ^
   mm/highmem.c:660:9: error: implicit declaration of function 'arch_kmap_local_map_idx' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                   idx = arch_kmap_local_map_idx(i, pte_pfn(pteval));
                         ^
   mm/highmem.c:691:9: error: implicit declaration of function 'arch_kmap_local_map_idx' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                   idx = arch_kmap_local_map_idx(i, pte_pfn(pteval));
                         ^
   4 errors generated.


vim +/arch_kmap_local_map_idx +549 mm/highmem.c

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  
298fa1ad5571f5 Thomas Gleixner       2020-11-03  563  void *__kmap_local_page_prot(struct page *page, pgprot_t prot)
298fa1ad5571f5 Thomas Gleixner       2020-11-03  564  {
298fa1ad5571f5 Thomas Gleixner       2020-11-03  565  	void *kmap;
298fa1ad5571f5 Thomas Gleixner       2020-11-03  566  
0e91a0c6984c83 Thomas Gleixner       2020-11-18  567  	/*
0e91a0c6984c83 Thomas Gleixner       2020-11-18  568  	 * To broaden the usage of the actual kmap_local() machinery always map
0e91a0c6984c83 Thomas Gleixner       2020-11-18  569  	 * pages when debugging is enabled and the architecture has no problems
0e91a0c6984c83 Thomas Gleixner       2020-11-18  570  	 * with alias mappings.
0e91a0c6984c83 Thomas Gleixner       2020-11-18  571  	 */
0e91a0c6984c83 Thomas Gleixner       2020-11-18  572  	if (!IS_ENABLED(CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP) && !PageHighMem(page))
298fa1ad5571f5 Thomas Gleixner       2020-11-03  573  		return page_address(page);
298fa1ad5571f5 Thomas Gleixner       2020-11-03  574  
298fa1ad5571f5 Thomas Gleixner       2020-11-03  575  	/* Try kmap_high_get() if architecture has it enabled */
298fa1ad5571f5 Thomas Gleixner       2020-11-03  576  	kmap = arch_kmap_local_high_get(page);
298fa1ad5571f5 Thomas Gleixner       2020-11-03  577  	if (kmap)
298fa1ad5571f5 Thomas Gleixner       2020-11-03  578  		return kmap;
298fa1ad5571f5 Thomas Gleixner       2020-11-03  579  
298fa1ad5571f5 Thomas Gleixner       2020-11-03  580  	return __kmap_local_pfn_prot(page_to_pfn(page), prot);
298fa1ad5571f5 Thomas Gleixner       2020-11-03  581  }
298fa1ad5571f5 Thomas Gleixner       2020-11-03  582  EXPORT_SYMBOL(__kmap_local_page_prot);
298fa1ad5571f5 Thomas Gleixner       2020-11-03  583  
39ade048a32ea6 Fabio M. De Francesco 2022-07-06  584  void kunmap_local_indexed(const void *vaddr)
298fa1ad5571f5 Thomas Gleixner       2020-11-03  585  {
298fa1ad5571f5 Thomas Gleixner       2020-11-03  586  	unsigned long addr = (unsigned long) vaddr & PAGE_MASK;
825c43f50e3aa8 Ard Biesheuvel        2021-11-19  587  	pte_t *kmap_pte;
298fa1ad5571f5 Thomas Gleixner       2020-11-03  588  	int idx;
298fa1ad5571f5 Thomas Gleixner       2020-11-03  589  
298fa1ad5571f5 Thomas Gleixner       2020-11-03  590  	if (addr < __fix_to_virt(FIX_KMAP_END) ||
298fa1ad5571f5 Thomas Gleixner       2020-11-03  591  	    addr > __fix_to_virt(FIX_KMAP_BEGIN)) {
0e91a0c6984c83 Thomas Gleixner       2020-11-18  592  		if (IS_ENABLED(CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP)) {
0e91a0c6984c83 Thomas Gleixner       2020-11-18  593  			/* This _should_ never happen! See above. */
0e91a0c6984c83 Thomas Gleixner       2020-11-18  594  			WARN_ON_ONCE(1);
0e91a0c6984c83 Thomas Gleixner       2020-11-18  595  			return;
0e91a0c6984c83 Thomas Gleixner       2020-11-18  596  		}
2a656cad337e0e Thomas Gleixner       2020-11-12  597  		/*
2a656cad337e0e Thomas Gleixner       2020-11-12  598  		 * Handle mappings which were obtained by kmap_high_get()
2a656cad337e0e Thomas Gleixner       2020-11-12  599  		 * first as the virtual address of such mappings is below
2a656cad337e0e Thomas Gleixner       2020-11-12  600  		 * PAGE_OFFSET. Warn for all other addresses which are in
2a656cad337e0e Thomas Gleixner       2020-11-12  601  		 * the user space part of the virtual address space.
2a656cad337e0e Thomas Gleixner       2020-11-12  602  		 */
2a656cad337e0e Thomas Gleixner       2020-11-12  603  		if (!kmap_high_unmap_local(addr))
298fa1ad5571f5 Thomas Gleixner       2020-11-03  604  			WARN_ON_ONCE(addr < PAGE_OFFSET);
298fa1ad5571f5 Thomas Gleixner       2020-11-03  605  		return;
298fa1ad5571f5 Thomas Gleixner       2020-11-03  606  	}
298fa1ad5571f5 Thomas Gleixner       2020-11-03  607  
298fa1ad5571f5 Thomas Gleixner       2020-11-03  608  	preempt_disable();
298fa1ad5571f5 Thomas Gleixner       2020-11-03 @609  	idx = arch_kmap_local_unmap_idx(kmap_local_idx(), addr);
298fa1ad5571f5 Thomas Gleixner       2020-11-03  610  	WARN_ON_ONCE(addr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
298fa1ad5571f5 Thomas Gleixner       2020-11-03  611  
825c43f50e3aa8 Ard Biesheuvel        2021-11-19  612  	kmap_pte = kmap_get_pte(addr, idx);
298fa1ad5571f5 Thomas Gleixner       2020-11-03  613  	arch_kmap_local_pre_unmap(addr);
825c43f50e3aa8 Ard Biesheuvel        2021-11-19  614  	pte_clear(&init_mm, addr, kmap_pte);
298fa1ad5571f5 Thomas Gleixner       2020-11-03  615  	arch_kmap_local_post_unmap(addr);
5fbda3ecd14a53 Thomas Gleixner       2020-11-18  616  	current->kmap_ctrl.pteval[kmap_local_idx()] = __pte(0);
298fa1ad5571f5 Thomas Gleixner       2020-11-03  617  	kmap_local_idx_pop();
298fa1ad5571f5 Thomas Gleixner       2020-11-03  618  	preempt_enable();
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  619  	migrate_enable();
298fa1ad5571f5 Thomas Gleixner       2020-11-03  620  }
298fa1ad5571f5 Thomas Gleixner       2020-11-03  621  EXPORT_SYMBOL(kunmap_local_indexed);
5fbda3ecd14a53 Thomas Gleixner       2020-11-18  622  

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

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

Powered by blists - more mailing lists