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: <202301061710.xHfPmVHD-lkp@intel.com>
Date:   Fri, 6 Jan 2023 17:18:38 +0800
From:   kernel test robot <lkp@...el.com>
To:     Sia Jee Heng <jeeheng.sia@...rfivetech.com>,
        paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu
Cc:     oe-kbuild-all@...ts.linux.dev, linux-riscv@...ts.infradead.org,
        linux-kernel@...r.kernel.org, jeeheng.sia@...rfivetech.com,
        leyfoon.tan@...rfivetech.com, mason.huo@...rfivetech.com
Subject: Re: [PATCH 3/3] RISC-V: Add arch functions to support
 hibernation/suspend-to-disk

Hi Sia,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 1f5abbd77e2c1787e74b7c2caffac97def78ba52]

url:    https://github.com/intel-lab-lkp/linux/commits/Sia-Jee-Heng/RISC-V-Change-suspend_save_csrs-and-suspend_restore_csrs-to-public-function/20230106-140835
base:   1f5abbd77e2c1787e74b7c2caffac97def78ba52
patch link:    https://lore.kernel.org/r/20230106060535.104321-4-jeeheng.sia%40starfivetech.com
patch subject: [PATCH 3/3] RISC-V: Add arch functions to support hibernation/suspend-to-disk
config: riscv-allyesconfig
compiler: riscv64-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/6ebc346a144af3bb328e7931c03d279f7797543c
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Sia-Jee-Heng/RISC-V-Change-suspend_save_csrs-and-suspend_restore_csrs-to-public-function/20230106-140835
        git checkout 6ebc346a144af3bb328e7931c03d279f7797543c
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash arch/riscv/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   In file included from arch/riscv/kernel/hibernate.c:12:
   arch/riscv/include/asm/kexec.h:62:38: error: unknown type name 'Elf_Shdr'
      62 |                                      Elf_Shdr *section,
         |                                      ^~~~~~~~
   arch/riscv/include/asm/kexec.h:63:44: error: unknown type name 'Elf_Shdr'
      63 |                                      const Elf_Shdr *relsec,
         |                                            ^~~~~~~~
   arch/riscv/include/asm/kexec.h:64:44: error: unknown type name 'Elf_Shdr'
      64 |                                      const Elf_Shdr *symtab);
         |                                            ^~~~~~~~
>> arch/riscv/kernel/hibernate.c:175:15: warning: no previous prototype for 'temp_pgtable_map_pte' [-Wmissing-prototypes]
     175 | unsigned long temp_pgtable_map_pte(pte_t *ptep, unsigned long vaddr, pgprot_t prot)
         |               ^~~~~~~~~~~~~~~~~~~~
>> arch/riscv/kernel/hibernate.c:184:15: warning: no previous prototype for 'temp_pgtable_map_pmd' [-Wmissing-prototypes]
     184 | unsigned long temp_pgtable_map_pmd(pmd_t *pmdp, unsigned long vaddr, pgprot_t prot)
         |               ^~~~~~~~~~~~~~~~~~~~
>> arch/riscv/kernel/hibernate.c:203:15: warning: no previous prototype for 'temp_pgtable_map_pud' [-Wmissing-prototypes]
     203 | unsigned long temp_pgtable_map_pud(pud_t *pudp, unsigned long vaddr, pgprot_t prot)
         |               ^~~~~~~~~~~~~~~~~~~~
>> arch/riscv/kernel/hibernate.c:223:15: warning: no previous prototype for 'temp_pgtable_map_p4d' [-Wmissing-prototypes]
     223 | unsigned long temp_pgtable_map_p4d(p4d_t *p4dp, unsigned long vaddr, pgprot_t prot)
         |               ^~~~~~~~~~~~~~~~~~~~
>> arch/riscv/kernel/hibernate.c:242:15: warning: no previous prototype for 'temp_pgtable_map_pgd' [-Wmissing-prototypes]
     242 | unsigned long temp_pgtable_map_pgd(pgd_t *pgdp, unsigned long vaddr, pgprot_t prot)
         |               ^~~~~~~~~~~~~~~~~~~~
>> arch/riscv/kernel/hibernate.c:261:15: warning: no previous prototype for 'temp_pgtable_mapping' [-Wmissing-prototypes]
     261 | unsigned long temp_pgtable_mapping(pgd_t *pgdp, unsigned long vaddr, pgprot_t prot)
         |               ^~~~~~~~~~~~~~~~~~~~
>> arch/riscv/kernel/hibernate.c:266:15: warning: no previous prototype for 'relocate_restore_code' [-Wmissing-prototypes]
     266 | unsigned long relocate_restore_code(void)
         |               ^~~~~~~~~~~~~~~~~~~~~


vim +/temp_pgtable_map_pte +175 arch/riscv/kernel/hibernate.c

   167	
   168	#define temp_pgtable_map_pgd_next(pgdp, vaddr, prot)			\
   169			(pgtable_l5_enabled ?					\
   170			temp_pgtable_map_p4d(pgdp, vaddr, prot) :		\
   171			(pgtable_l4_enabled ?					\
   172			temp_pgtable_map_pud((pud_t *)pgdp, vaddr, prot) :	\
   173			temp_pgtable_map_pmd((pmd_t *)pgdp, vaddr, prot)))
   174	
 > 175	unsigned long temp_pgtable_map_pte(pte_t *ptep, unsigned long vaddr, pgprot_t prot)
   176	{
   177		uintptr_t pte_idx = pte_index(vaddr);
   178	
   179		ptep[pte_idx] = pfn_pte(PFN_DOWN(__pa(vaddr)), prot);
   180	
   181		return 0;
   182	}
   183	
 > 184	unsigned long temp_pgtable_map_pmd(pmd_t *pmdp, unsigned long vaddr, pgprot_t prot)
   185	{
   186		uintptr_t pmd_idx = pmd_index(vaddr);
   187		pte_t *ptep;
   188	
   189		if (pmd_none(pmdp[pmd_idx])) {
   190			ptep = (pte_t *) get_safe_page(GFP_ATOMIC);
   191			if (!ptep)
   192				return -ENOMEM;
   193	
   194			memset(ptep, 0, PAGE_SIZE);
   195			pmdp[pmd_idx] = pfn_pmd(PFN_DOWN(__pa(ptep)), PAGE_TABLE);
   196		} else {
   197			ptep = (pte_t *) __va(PFN_PHYS(_pmd_pfn(pmdp[pmd_idx])));
   198		}
   199	
   200		return temp_pgtable_map_pte(ptep, vaddr, prot);
   201	}
   202	
 > 203	unsigned long temp_pgtable_map_pud(pud_t *pudp, unsigned long vaddr, pgprot_t prot)
   204	{
   205	
   206		uintptr_t pud_index = pud_index(vaddr);
   207		pmd_t *pmdp;
   208	
   209		if (pud_val(pudp[pud_index]) == 0) {
   210			pmdp = (pmd_t *) get_safe_page(GFP_ATOMIC);
   211			if (!pmdp)
   212				return -ENOMEM;
   213	
   214			memset(pmdp, 0, PAGE_SIZE);
   215			pudp[pud_index] = pfn_pud(PFN_DOWN(__pa(pmdp)), PAGE_TABLE);
   216		} else {
   217			pmdp = (pmd_t *) __va(PFN_PHYS(_pud_pfn(pudp[pud_index])));
   218		}
   219	
   220		return temp_pgtable_map_pmd(pmdp, vaddr, prot);
   221	}
   222	
 > 223	unsigned long temp_pgtable_map_p4d(p4d_t *p4dp, unsigned long vaddr, pgprot_t prot)
   224	{
   225		uintptr_t p4d_index = p4d_index(vaddr);
   226		pud_t *pudp;
   227	
   228		if (p4d_val(p4dp[p4d_index]) == 0) {
   229			pudp = (pud_t *) get_safe_page(GFP_ATOMIC);
   230			if (!pudp)
   231				return -ENOMEM;
   232	
   233			memset(pudp, 0, PAGE_SIZE);
   234			p4dp[p4d_index] = pfn_p4d(PFN_DOWN(__pa(pudp)), PAGE_TABLE);
   235		} else {
   236			pudp = (pud_t *) __va(PFN_PHYS(_p4d_pfn(p4dp[p4d_index])));
   237		}
   238	
   239		return temp_pgtable_map_pud(pudp, vaddr, prot);
   240	}
   241	
 > 242	unsigned long temp_pgtable_map_pgd(pgd_t *pgdp, unsigned long vaddr, pgprot_t prot)
   243	{
   244		uintptr_t pgd_idx = pgd_index(vaddr);
   245		void *nextp;
   246	
   247		if (pgd_val(pgdp[pgd_idx]) == 0) {
   248			nextp = (void *) get_safe_page(GFP_ATOMIC);
   249			if (!nextp)
   250				return -ENOMEM;
   251	
   252			memset(nextp, 0, PAGE_SIZE);
   253			pgdp[pgd_idx] = pfn_pgd(PFN_DOWN(__pa(nextp)), PAGE_TABLE);
   254		} else {
   255			nextp = (void *) __va(PFN_PHYS(_pgd_pfn(pgdp[pgd_idx])));
   256		}
   257	
   258		return temp_pgtable_map_pgd_next(nextp, vaddr, prot);
   259	}
   260	
 > 261	unsigned long temp_pgtable_mapping(pgd_t *pgdp, unsigned long vaddr, pgprot_t prot)
   262	{
   263		return temp_pgtable_map_pgd(pgdp, vaddr, prot);
   264	}
   265	
 > 266	unsigned long relocate_restore_code(void)
   267	{
   268		unsigned long ret;
   269		void *page = (void *)get_safe_page(GFP_ATOMIC);
   270	
   271		if (!page)
   272			return -ENOMEM;
   273	
   274		copy_page(page, core_restore_code);
   275	
   276		/* Make the page containing the relocated code executable */
   277		set_memory_x((unsigned long)page, 1);
   278	
   279		ret = temp_pgtable_mapping(resume_pg_dir, (unsigned long)page, PAGE_KERNEL_READ_EXEC);
   280		if (ret)
   281			return ret;
   282	
   283		return (unsigned long)page;
   284	}
   285	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ