linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 06/25] mm/arm64: Use mm_fault_accounting()
       [not found] <20200615221607.7764-7-peterx@redhat.com>
@ 2020-06-16 20:46 ` kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-06-16 20:46 UTC (permalink / raw)
  To: Peter Xu, linux-kernel
  Cc: kbuild-all, Andrea Arcangeli, Will Deacon, Catalin Marinas,
	peterx, linux-arm-kernel, Andrew Morton,
	Linux Memory Management List, Gerald Schaefer

[-- Attachment #1: Type: text/plain, Size: 6978 bytes --]

Hi Peter,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sparc/master]
[cannot apply to mmotm/master sparc-next/master linus/master linux/master v5.8-rc1 next-20200616]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Peter-Xu/mm-Page-fault-accounting-cleanups/20200616-062640
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git master
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>, old ones prefixed by <<):

arch/arm64/mm/fault.c: In function 'do_page_fault':
>> arch/arm64/mm/fault.c:538:38: error: 'address' undeclared (first use in this function); did you mean 'addr'?
538 |   mm_fault_accounting(current, regs, address, major);
|                                      ^~~~~~~
|                                      addr
arch/arm64/mm/fault.c:538:38: note: each undeclared identifier is reported only once for each function it appears in
arch/arm64/mm/fault.c: At top level:
arch/arm64/mm/fault.c:725:6: warning: no previous prototype for 'do_el0_irq_bp_hardening' [-Wmissing-prototypes]
725 | void do_el0_irq_bp_hardening(void)
|      ^~~~~~~~~~~~~~~~~~~~~~~

vim +538 arch/arm64/mm/fault.c

   441	
   442	static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
   443					   struct pt_regs *regs)
   444	{
   445		const struct fault_info *inf;
   446		struct mm_struct *mm = current->mm;
   447		vm_fault_t fault, major = 0;
   448		unsigned long vm_flags = VM_ACCESS_FLAGS;
   449		unsigned int mm_flags = FAULT_FLAG_DEFAULT;
   450	
   451		if (kprobe_page_fault(regs, esr))
   452			return 0;
   453	
   454		/*
   455		 * If we're in an interrupt or have no user context, we must not take
   456		 * the fault.
   457		 */
   458		if (faulthandler_disabled() || !mm)
   459			goto no_context;
   460	
   461		if (user_mode(regs))
   462			mm_flags |= FAULT_FLAG_USER;
   463	
   464		if (is_el0_instruction_abort(esr)) {
   465			vm_flags = VM_EXEC;
   466			mm_flags |= FAULT_FLAG_INSTRUCTION;
   467		} else if (is_write_abort(esr)) {
   468			vm_flags = VM_WRITE;
   469			mm_flags |= FAULT_FLAG_WRITE;
   470		}
   471	
   472		if (is_ttbr0_addr(addr) && is_el1_permission_fault(addr, esr, regs)) {
   473			/* regs->orig_addr_limit may be 0 if we entered from EL0 */
   474			if (regs->orig_addr_limit == KERNEL_DS)
   475				die_kernel_fault("access to user memory with fs=KERNEL_DS",
   476						 addr, esr, regs);
   477	
   478			if (is_el1_instruction_abort(esr))
   479				die_kernel_fault("execution of user memory",
   480						 addr, esr, regs);
   481	
   482			if (!search_exception_tables(regs->pc))
   483				die_kernel_fault("access to user memory outside uaccess routines",
   484						 addr, esr, regs);
   485		}
   486	
   487		/*
   488		 * As per x86, we may deadlock here. However, since the kernel only
   489		 * validly references user space from well defined areas of the code,
   490		 * we can bug out early if this is from code which shouldn't.
   491		 */
   492		if (!down_read_trylock(&mm->mmap_sem)) {
   493			if (!user_mode(regs) && !search_exception_tables(regs->pc))
   494				goto no_context;
   495	retry:
   496			down_read(&mm->mmap_sem);
   497		} else {
   498			/*
   499			 * The above down_read_trylock() might have succeeded in which
   500			 * case, we'll have missed the might_sleep() from down_read().
   501			 */
   502			might_sleep();
   503	#ifdef CONFIG_DEBUG_VM
   504			if (!user_mode(regs) && !search_exception_tables(regs->pc)) {
   505				up_read(&mm->mmap_sem);
   506				goto no_context;
   507			}
   508	#endif
   509		}
   510	
   511		fault = __do_page_fault(mm, addr, mm_flags, vm_flags);
   512		major |= fault & VM_FAULT_MAJOR;
   513	
   514		/* Quick path to respond to signals */
   515		if (fault_signal_pending(fault, regs)) {
   516			if (!user_mode(regs))
   517				goto no_context;
   518			return 0;
   519		}
   520	
   521		if (fault & VM_FAULT_RETRY) {
   522			if (mm_flags & FAULT_FLAG_ALLOW_RETRY) {
   523				mm_flags |= FAULT_FLAG_TRIED;
   524				goto retry;
   525			}
   526		}
   527		up_read(&mm->mmap_sem);
   528	
   529		/*
   530		 * Handle the "normal" (no error) case first.
   531		 */
   532		if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP |
   533				      VM_FAULT_BADACCESS)))) {
   534			/*
   535			 * Major/minor page fault accounting is only done
   536			 * once.
   537			 */
 > 538			mm_fault_accounting(current, regs, address, major);
   539			return 0;
   540		}
   541	
   542		/*
   543		 * If we are in kernel mode at this point, we have no context to
   544		 * handle this fault with.
   545		 */
   546		if (!user_mode(regs))
   547			goto no_context;
   548	
   549		if (fault & VM_FAULT_OOM) {
   550			/*
   551			 * We ran out of memory, call the OOM killer, and return to
   552			 * userspace (which will retry the fault, or kill us if we got
   553			 * oom-killed).
   554			 */
   555			pagefault_out_of_memory();
   556			return 0;
   557		}
   558	
   559		inf = esr_to_fault_info(esr);
   560		set_thread_esr(addr, esr);
   561		if (fault & VM_FAULT_SIGBUS) {
   562			/*
   563			 * We had some memory, but were unable to successfully fix up
   564			 * this page fault.
   565			 */
   566			arm64_force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)addr,
   567					      inf->name);
   568		} else if (fault & (VM_FAULT_HWPOISON_LARGE | VM_FAULT_HWPOISON)) {
   569			unsigned int lsb;
   570	
   571			lsb = PAGE_SHIFT;
   572			if (fault & VM_FAULT_HWPOISON_LARGE)
   573				lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault));
   574	
   575			arm64_force_sig_mceerr(BUS_MCEERR_AR, (void __user *)addr, lsb,
   576					       inf->name);
   577		} else {
   578			/*
   579			 * Something tried to access memory that isn't in our memory
   580			 * map.
   581			 */
   582			arm64_force_sig_fault(SIGSEGV,
   583					      fault == VM_FAULT_BADACCESS ? SEGV_ACCERR : SEGV_MAPERR,
   584					      (void __user *)addr,
   585					      inf->name);
   586		}
   587	
   588		return 0;
   589	
   590	no_context:
   591		__do_kernel_fault(addr, esr, regs);
   592		return 0;
   593	}
   594	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 71792 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-16 20:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200615221607.7764-7-peterx@redhat.com>
2020-06-16 20:46 ` [PATCH 06/25] mm/arm64: Use mm_fault_accounting() kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).