On Wed, May 14, 2025 at 03:38:57PM +0800, kernel test robot wrote: > > > Hello, > > kernel test robot noticed "WARNING:at_include/linux/fs.h:#file_has_valid_mmap_hooks" on: > > commit: 54fc2b63585940cce17810a9ef5d273087b0939e ("mm: introduce new .mmap_prepare() file callback") > https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master > > [test failed on linux-next/master edef457004774e598fc4c1b7d1d4f0bcd9d0bb30] > > in testcase: trinity > version: trinity-i386-abe9de86-1_20230429 > with following parameters: > > runtime: 300s > group: group-00 > nr_groups: 5 > > Thanks for the report. > > config: i386-randconfig-141-20250512 > compiler: clang-20 > test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G > > (please refer to attached dmesg/kmsg for entire log/backtrace) > > > +----------------------------------------------------------+------------+------------+ > | | 7661dba205 | 54fc2b6358 | > +----------------------------------------------------------+------------+------------+ > | WARNING:at_include/linux/fs.h:#file_has_valid_mmap_hooks | 0 | 12 | > | EIP:file_has_valid_mmap_hooks | 0 | 12 | > +----------------------------------------------------------+------------+------------+ > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <oliver.sang@xxxxxxxxx> > | Closes: https://lore.kernel.org/oe-lkp/202505141434.96ce5e5d-lkp@xxxxxxxxx > > > [ 81.501132][ T3731] ------------[ cut here ]------------ > [ 81.502015][ T3731] WARNING: CPU: 0 PID: 3731 at include/linux/fs.h:2251 file_has_valid_mmap_hooks (kbuild/obj/consumer/i386-randconfig-141-20250512/include/linux/fs.h:2251 (discriminator 14)) This is: static inline bool file_has_valid_mmap_hooks(struct file *file) { ... if (WARN_ON_ONCE(!has_mmap && !has_mmap_prepare)) <--- here return false; return true; } Called from: if (!file_has_valid_mmap_hooks(file)) return -ENODEV; So I think probably we should make this NOT a warning, as it seems (it turns out...) there are legitimate scenarios where this is not specified, or perhaps a test is explicitly relying on this. Previously this code was: if (!file->f_op->mmap) return -ENODEV; With no warning... so this would get things in line with what was previously the case. I will send a patch. Cheers, Lorenzo > [ 81.503344][ T3731] Modules linked in: > [ 81.503951][ T3731] CPU: 0 UID: 65534 PID: 3731 Comm: trinity-c1 Not tainted 6.15.0-rc5-00294-g54fc2b635859 #1 PREEMPT(lazy) > [ 81.505454][ T3731] EIP: file_has_valid_mmap_hooks (kbuild/obj/consumer/i386-randconfig-141-20250512/include/linux/fs.h:2251 (discriminator 14)) > [ 81.506235][ T3731] Code: 8b 48 30 8b 90 84 00 00 00 85 c9 0f 95 c0 85 d2 0f 95 c4 20 c4 80 fc 01 74 0c b0 01 09 d1 74 0a 5d 31 c9 31 d2 c3 0f 0b eb 02 <0f> 0b 31 c0 eb f0 90 90 90 90 90 90 90 90 90 90 3e 8d 74 26 00 55 > All code > ======== > 0: 8b 48 30 mov 0x30(%rax),%ecx > 3: 8b 90 84 00 00 00 mov 0x84(%rax),%edx > 9: 85 c9 test %ecx,%ecx > b: 0f 95 c0 setne %al > e: 85 d2 test %edx,%edx > 10: 0f 95 c4 setne %ah > 13: 20 c4 and %al,%ah > 15: 80 fc 01 cmp $0x1,%ah > 18: 74 0c je 0x26 > 1a: b0 01 mov $0x1,%al > 1c: 09 d1 or %edx,%ecx > 1e: 74 0a je 0x2a > 20: 5d pop %rbp > 21: 31 c9 xor %ecx,%ecx > 23: 31 d2 xor %edx,%edx > 25: c3 ret > 26: 0f 0b ud2 > 28: eb 02 jmp 0x2c > 2a:* 0f 0b ud2 <-- trapping instruction > 2c: 31 c0 xor %eax,%eax > 2e: eb f0 jmp 0x20 > 30: 90 nop > 31: 90 nop > 32: 90 nop > 33: 90 nop > 34: 90 nop > 35: 90 nop > 36: 90 nop > 37: 90 nop > 38: 90 nop > 39: 90 nop > 3a: 3e 8d 74 26 00 ds lea 0x0(%rsi,%riz,1),%esi > 3f: 55 push %rbp > > Code starting with the faulting instruction > =========================================== > 0: 0f 0b ud2 > 2: 31 c0 xor %eax,%eax > 4: eb f0 jmp 0xfffffffffffffff6 > 6: 90 nop > 7: 90 nop > 8: 90 nop > 9: 90 nop > a: 90 nop > b: 90 nop > c: 90 nop > d: 90 nop > e: 90 nop > f: 90 nop > 10: 3e 8d 74 26 00 ds lea 0x0(%rsi,%riz,1),%esi > 15: 55 push %rbp > [ 81.508815][ T3731] EAX: d1880001 EBX: fffffff3 ECX: 00000000 EDX: 00000000 > [ 81.509606][ T3731] ESI: ebd21c00 EDI: 00000001 EBP: ee6fbebc ESP: ee6fbebc > [ 81.510420][ T3731] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068 EFLAGS: 00010246 > [ 81.511506][ T3731] CR0: 80050033 CR2: 042df000 CR3: 2e7c0000 CR4: 00040690 > [ 81.512398][ T3731] Call Trace: > [ 81.512840][ T3731] do_mmap (kbuild/obj/consumer/i386-randconfig-141-20250512/mm/mmap.c:?) > [ 81.513390][ T3731] vm_mmap_pgoff (kbuild/obj/consumer/i386-randconfig-141-20250512/mm/util.c:579) > [ 81.513966][ T3731] __ia32_sys_mmap_pgoff (kbuild/obj/consumer/i386-randconfig-141-20250512/mm/mmap.c:607 (discriminator 256)) > [ 81.514625][ T3731] ia32_sys_call (kbuild/obj/consumer/i386-randconfig-141-20250512/./arch/x86/include/generated/asm/syscalls_32.h:318 (discriminator 201523200)) > [ 81.515267][ T3731] __do_fast_syscall_32 (kbuild/obj/consumer/i386-randconfig-141-20250512/arch/x86/entry/syscall_32.c:?) > [ 81.515980][ T3731] do_fast_syscall_32 (kbuild/obj/consumer/i386-randconfig-141-20250512/arch/x86/entry/syscall_32.c:331) > [ 81.516686][ T3731] do_SYSENTER_32 (kbuild/obj/consumer/i386-randconfig-141-20250512/arch/x86/entry/syscall_32.c:369) > [ 81.517325][ T3731] entry_SYSENTER_32 (kbuild/obj/consumer/i386-randconfig-141-20250512/arch/x86/entry/entry_32.S:836) > [ 81.517972][ T3731] EIP: 0xb7f71539 > [ 81.518452][ T3731] Code: 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 90 90 90 58 b8 77 00 00 00 cd 80 90 90 90 > All code > ======== > 0: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi > 4: 10 07 adc %al,(%rdi) > 6: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi > a: 10 08 adc %cl,(%rax) > c: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi > ... > 20: 00 51 52 add %dl,0x52(%rcx) > 23:* 55 push %rbp <-- trapping instruction > 24: 89 e5 mov %esp,%ebp > 26: 0f 34 sysenter > 28: cd 80 int $0x80 > 2a: 5d pop %rbp > 2b: 5a pop %rdx > 2c: 59 pop %rcx > 2d: c3 ret > 2e: 90 nop > 2f: 90 nop > 30: 90 nop > 31: 90 nop > 32: 90 nop > 33: 90 nop > 34: 90 nop > 35: 58 pop %rax > 36: b8 77 00 00 00 mov $0x77,%eax > 3b: cd 80 int $0x80 > 3d: 90 nop > 3e: 90 nop > 3f: 90 nop > > Code starting with the faulting instruction > =========================================== > 0: 5d pop %rbp > 1: 5a pop %rdx > 2: 59 pop %rcx > 3: c3 ret > 4: 90 nop > 5: 90 nop > 6: 90 nop > 7: 90 nop > 8: 90 nop > 9: 90 nop > a: 90 nop > b: 58 pop %rax > c: b8 77 00 00 00 mov $0x77,%eax > 11: cd 80 int $0x80 > 13: 90 nop > 14: 90 nop > 15: 90 nop > > > The kernel config and materials to reproduce are available at: > https://download.01.org/0day-ci/archive/20250514/202505141434.96ce5e5d-lkp@xxxxxxxxx > > > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki >