Re: [PATCH v4] mm: Create the new vm_fault_t type
From: kbuild test robot
Date: Wed Jan 09 2019 - 06:50:59 EST
Hi Souptick,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.0-rc1 next-20190109]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Souptick-Joarder/mm-Create-the-new-vm_fault_t-type/20190109-154216
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
>> arch/x86/mm/fault.c:1051:39: warning: restricted vm_fault_t degrades to integer
arch/x86/mm/fault.c:1057:29: warning: restricted vm_fault_t degrades to integer
arch/x86/mm/fault.c:1059:29: warning: restricted vm_fault_t degrades to integer
>> arch/x86/mm/fault.c:1094:62: warning: incorrect type in argument 4 (different base types)
arch/x86/mm/fault.c:1094:62: expected unsigned int fault
arch/x86/mm/fault.c:1094:62: got restricted vm_fault_t [usertype] fault
vim +1051 arch/x86/mm/fault.c
92181f190 Nick Piggin 2009-01-20 1031
2d4a71676 Ingo Molnar 2009-02-20 1032 static void
a6e04aa92 Andi Kleen 2009-09-16 1033 do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
27274f731 Eric W. Biederman 2018-09-18 1034 unsigned int fault)
92181f190 Nick Piggin 2009-01-20 1035 {
92181f190 Nick Piggin 2009-01-20 1036 struct task_struct *tsk = current;
92181f190 Nick Piggin 2009-01-20 1037
2d4a71676 Ingo Molnar 2009-02-20 1038 /* Kernel mode? Handle exceptions or die: */
1067f0309 Ricardo Neri 2017-10-27 1039 if (!(error_code & X86_PF_USER)) {
4fc349011 Andy Lutomirski 2011-11-07 1040 no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);
960545691 Linus Torvalds 2010-08-13 1041 return;
960545691 Linus Torvalds 2010-08-13 1042 }
2d4a71676 Ingo Molnar 2009-02-20 1043
cd1b68f08 Ingo Molnar 2009-02-20 1044 /* User-space => ok to do another page fault: */
92181f190 Nick Piggin 2009-01-20 1045 if (is_prefetch(regs, error_code, address))
92181f190 Nick Piggin 2009-01-20 1046 return;
2d4a71676 Ingo Molnar 2009-02-20 1047
e49d3cbef Andy Lutomirski 2018-11-19 1048 set_signal_archinfo(address, error_code);
2d4a71676 Ingo Molnar 2009-02-20 1049
a6e04aa92 Andi Kleen 2009-09-16 1050 #ifdef CONFIG_MEMORY_FAILURE
f672b49b0 Andi Kleen 2010-09-27 @1051 if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
40e553946 Eric W. Biederman 2018-01-19 1052 unsigned lsb = 0;
40e553946 Eric W. Biederman 2018-01-19 1053
40e553946 Eric W. Biederman 2018-01-19 1054 pr_err(
a6e04aa92 Andi Kleen 2009-09-16 1055 "MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n",
a6e04aa92 Andi Kleen 2009-09-16 1056 tsk->comm, tsk->pid, address);
40e553946 Eric W. Biederman 2018-01-19 1057 if (fault & VM_FAULT_HWPOISON_LARGE)
40e553946 Eric W. Biederman 2018-01-19 1058 lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault));
40e553946 Eric W. Biederman 2018-01-19 1059 if (fault & VM_FAULT_HWPOISON)
40e553946 Eric W. Biederman 2018-01-19 1060 lsb = PAGE_SHIFT;
40e553946 Eric W. Biederman 2018-01-19 1061 force_sig_mceerr(BUS_MCEERR_AR, (void __user *)address, lsb, tsk);
40e553946 Eric W. Biederman 2018-01-19 1062 return;
a6e04aa92 Andi Kleen 2009-09-16 1063 }
a6e04aa92 Andi Kleen 2009-09-16 1064 #endif
b4fd52f25 Eric W. Biederman 2018-09-18 1065 force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, tsk);
92181f190 Nick Piggin 2009-01-20 1066 }
92181f190 Nick Piggin 2009-01-20 1067
3a13c4d76 Johannes Weiner 2013-09-12 1068 static noinline void
2d4a71676 Ingo Molnar 2009-02-20 1069 mm_fault_error(struct pt_regs *regs, unsigned long error_code,
25c102d80 Eric W. Biederman 2018-09-18 1070 unsigned long address, vm_fault_t fault)
92181f190 Nick Piggin 2009-01-20 1071 {
1067f0309 Ricardo Neri 2017-10-27 1072 if (fatal_signal_pending(current) && !(error_code & X86_PF_USER)) {
4fc349011 Andy Lutomirski 2011-11-07 1073 no_context(regs, error_code, address, 0, 0);
3a13c4d76 Johannes Weiner 2013-09-12 1074 return;
b80ef10e8 KOSAKI Motohiro 2011-05-26 1075 }
b80ef10e8 KOSAKI Motohiro 2011-05-26 1076
2d4a71676 Ingo Molnar 2009-02-20 1077 if (fault & VM_FAULT_OOM) {
f86268549 Andrey Vagin 2011-03-09 1078 /* Kernel mode? Handle exceptions or die: */
1067f0309 Ricardo Neri 2017-10-27 1079 if (!(error_code & X86_PF_USER)) {
4fc349011 Andy Lutomirski 2011-11-07 1080 no_context(regs, error_code, address,
4fc349011 Andy Lutomirski 2011-11-07 1081 SIGSEGV, SEGV_MAPERR);
3a13c4d76 Johannes Weiner 2013-09-12 1082 return;
f86268549 Andrey Vagin 2011-03-09 1083 }
f86268549 Andrey Vagin 2011-03-09 1084
c2d23f919 David Rientjes 2012-12-12 1085 /*
c2d23f919 David Rientjes 2012-12-12 1086 * We ran out of memory, call the OOM killer, and return the
c2d23f919 David Rientjes 2012-12-12 1087 * userspace (which will retry the fault, or kill us if we got
c2d23f919 David Rientjes 2012-12-12 1088 * oom-killed):
c2d23f919 David Rientjes 2012-12-12 1089 */
c2d23f919 David Rientjes 2012-12-12 1090 pagefault_out_of_memory();
2d4a71676 Ingo Molnar 2009-02-20 1091 } else {
f672b49b0 Andi Kleen 2010-09-27 1092 if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|
f672b49b0 Andi Kleen 2010-09-27 1093 VM_FAULT_HWPOISON_LARGE))
27274f731 Eric W. Biederman 2018-09-18 @1094 do_sigbus(regs, error_code, address, fault);
33692f275 Linus Torvalds 2015-01-29 1095 else if (fault & VM_FAULT_SIGSEGV)
768fd9c69 Eric W. Biederman 2018-09-18 1096 bad_area_nosemaphore(regs, error_code, address);
92181f190 Nick Piggin 2009-01-20 1097 else
92181f190 Nick Piggin 2009-01-20 1098 BUG();
92181f190 Nick Piggin 2009-01-20 1099 }
2d4a71676 Ingo Molnar 2009-02-20 1100 }
92181f190 Nick Piggin 2009-01-20 1101
:::::: The code at line 1051 was first introduced by commit
:::::: f672b49b07a4a152fc4251f2aec6b4d05164c4cd x86: HWPOISON: Report correct address granuality for huge hwpoison faults
:::::: TO: Andi Kleen <ak@xxxxxxxxxxxxxxx>
:::::: CC: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip