2022-11-16 01:57:41

by kernel test robot

[permalink] [raw]
Subject: [linux-next:master] [ipc/shm] da74b30c77: BUG:kernel_NULL_pointer_dereference,address



Greeting,

FYI, we noticed BUG:kernel_NULL_pointer_dereference,address due to commit (built with gcc-11):

commit: da74b30c774a4a0c62fc3dc2b95a8a3a34a48c23 ("ipc/shm: call underlying open/close vm_ops")
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master

in testcase: trinity
version: trinity-static-i386-x86_64-1c734c75-1_2020-01-06
with following parameters:

runtime: 300s

test-description: Trinity is a linux system call fuzz tester.
test-url: http://codemonkey.org.uk/projects/trinity/


on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):


If you fix the issue, kindly add following tag
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-lkp/[email protected]


[ 37.140634][ T502] BUG: kernel NULL pointer dereference, address: 00000004
[ 37.141739][ T502] #PF: supervisor read access in kernel mode
[ 37.142563][ T502] #PF: error_code(0x0000) - not-present page
[ 37.143353][ T502] *pdpt = 000000002dd1c001 *pde = 0000000000000000
[ 37.144220][ T502] Oops: 0000 [#1] SMP PTI
[ 37.144892][ T502] CPU: 1 PID: 502 Comm: trinity Tainted: G E 6.1.0-rc4-00027-gda74b30c774a #1
[ 37.146300][ T502] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-4 04/01/2014
[ 37.147705][ T502] EIP: shm_close (shm.c:?)
[ 37.148341][ T502] Code: e8 d8 19 7c 00 e9 fd fe ff ff 8d 76 00 3e 8d 74 26 00 55 89 e5 57 56 53 83 ec 08 8b 50 3c 8b 9a 04 01 00 00 8b 53 0c 8b 73 04 <8b> 52 04 85 d2 74 02 ff d2 8d be c0 02 00 00 89 f8 e8 ad cf 7b 00
All code
========
0: e8 d8 19 7c 00 callq 0x7c19dd
5: e9 fd fe ff ff jmpq 0xffffffffffffff07
a: 8d 76 00 lea 0x0(%rsi),%esi
d: 3e 8d 74 26 00 lea %ds:0x0(%rsi,%riz,1),%esi
12: 55 push %rbp
13: 89 e5 mov %esp,%ebp
15: 57 push %rdi
16: 56 push %rsi
17: 53 push %rbx
18: 83 ec 08 sub $0x8,%esp
1b: 8b 50 3c mov 0x3c(%rax),%edx
1e: 8b 9a 04 01 00 00 mov 0x104(%rdx),%ebx
24: 8b 53 0c mov 0xc(%rbx),%edx
27: 8b 73 04 mov 0x4(%rbx),%esi
2a:* 8b 52 04 mov 0x4(%rdx),%edx <-- trapping instruction
2d: 85 d2 test %edx,%edx
2f: 74 02 je 0x33
31: ff d2 callq *%rdx
33: 8d be c0 02 00 00 lea 0x2c0(%rsi),%edi
39: 89 f8 mov %edi,%eax
3b: e8 ad cf 7b 00 callq 0x7bcfed

Code starting with the faulting instruction
===========================================
0: 8b 52 04 mov 0x4(%rdx),%edx
3: 85 d2 test %edx,%edx
5: 74 02 je 0x9
7: ff d2 callq *%rdx
9: 8d be c0 02 00 00 lea 0x2c0(%rsi),%edi
f: 89 f8 mov %edi,%eax
11: e8 ad cf 7b 00 callq 0x7bcfc3
[ 37.150789][ T502] EAX: ee1a6280 EBX: ee17e630 ECX: 00000000 EDX: 00000000
[ 37.158886][ T502] ESI: c292ede0 EDI: ee1a6280 EBP: edc69d30 ESP: edc69d1c
[ 37.159836][ T502] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 EFLAGS: 00010292
[ 37.160890][ T502] CR0: 80050033 CR2: 00000004 CR3: 2deb4000 CR4: 000406f0
[ 37.161851][ T502] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[ 37.162822][ T502] DR6: fffe0ff0 DR7: 00000400
[ 37.163502][ T502] Call Trace:
[ 37.164018][ T502] shm_mmap (shm.c:?)
[ 37.164618][ T502] mmap_region (??:?)
[ 37.165311][ T502] ? generic_get_unmapped_area_topdown (??:?)
[ 37.166209][ T502] ? shm_get_unmapped_area (shm.c:?)
[ 37.166978][ T502] ? security_mmap_addr (??:?)
[ 37.167737][ T502] do_mmap (??:?)
[ 37.168327][ T502] do_shmat (??:?)
[ 37.168925][ T502] ksys_ipc (??:?)
[ 37.169538][ T502] __ia32_sys_ipc (??:?)
[ 37.170188][ T502] __do_fast_syscall_32 (common.c:?)
[ 37.170910][ T502] ? syscall_exit_to_user_mode (??:?)
[ 37.171830][ T502] ? __do_fast_syscall_32 (common.c:?)
[ 37.172578][ T502] ? __do_fast_syscall_32 (common.c:?)
[ 37.173326][ T502] ? syscall_exit_to_user_mode (??:?)
[ 37.174108][ T502] ? lockdep_hardirqs_on_prepare (lockdep.c:?)
[ 37.174977][ T502] ? syscall_exit_to_user_mode (??:?)
[ 37.175905][ T502] ? __do_fast_syscall_32 (common.c:?)
[ 37.176656][ T502] ? __task_pid_nr_ns (??:?)
[ 37.177392][ T502] ? __do_fast_syscall_32 (common.c:?)
[ 37.178136][ T502] ? syscall_exit_to_user_mode (??:?)
[ 37.178894][ T502] ? lockdep_hardirqs_on_prepare (lockdep.c:?)
[ 37.179914][ T502] ? syscall_exit_to_user_mode (??:?)
[ 37.180674][ T502] ? __do_fast_syscall_32 (common.c:?)
[ 37.181426][ T502] ? __do_fast_syscall_32 (common.c:?)
[ 37.182128][ T502] ? lockdep_hardirqs_on_prepare (lockdep.c:?)
[ 37.188288][ T502] do_fast_syscall_32 (??:?)
[ 37.192396][ T502] do_SYSENTER_32 (??:?)
[ 37.193081][ T502] entry_SYSENTER_32 (??:?)
[ 37.193680][ T502] EIP: 0xb7eff559
[ 37.194228][ T502] Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76
All code
========
0: 03 74 c0 01 add 0x1(%rax,%rax,8),%esi
4: 10 05 03 74 b8 01 adc %al,0x1b87403(%rip) # 0x1b8740d
a: 10 06 adc %al,(%rsi)
c: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi
10: 10 07 adc %al,(%rdi)
12: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi
16: 10 08 adc %cl,(%rax)
18: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi
1c: 00 00 add %al,(%rax)
1e: 00 00 add %al,(%rax)
20: 00 51 52 add %dl,0x52(%rcx)
23: 55 push %rbp
24: 89 e5 mov %esp,%ebp
26: 0f 34 sysenter
28: cd 80 int $0x80
2a:* 5d pop %rbp <-- trapping instruction
2b: 5a pop %rdx
2c: 59 pop %rcx
2d: c3 retq
2e: 90 nop
2f: 90 nop
30: 90 nop
31: 90 nop
32: 8d 76 00 lea 0x0(%rsi),%esi
35: 58 pop %rax
36: b8 77 00 00 00 mov $0x77,%eax
3b: cd 80 int $0x80
3d: 90 nop
3e: 8d .byte 0x8d
3f: 76 .byte 0x76

Code starting with the faulting instruction
===========================================
0: 5d pop %rbp
1: 5a pop %rdx
2: 59 pop %rcx
3: c3 retq
4: 90 nop
5: 90 nop
6: 90 nop
7: 90 nop
8: 8d 76 00 lea 0x0(%rsi),%esi
b: 58 pop %rax
c: b8 77 00 00 00 mov $0x77,%eax
11: cd 80 int $0x80
13: 90 nop
14: 8d .byte 0x8d
15: 76 .byte 0x76


To reproduce:

# build kernel
cd linux
cp config-6.1.0-rc4-00027-gda74b30c774a .config
make HOSTCC=gcc-11 CC=gcc-11 ARCH=i386 olddefconfig prepare modules_prepare bzImage modules
make HOSTCC=gcc-11 CC=gcc-11 ARCH=i386 INSTALL_MOD_PATH=<mod-install-dir> modules_install
cd <mod-install-dir>
find lib/ | cpio -o -H newc --quiet | gzip > modules.cgz


git clone https://github.com/intel/lkp-tests.git
cd lkp-tests
bin/lkp qemu -k <bzImage> -m modules.cgz job-script # job-script is attached in this email

# if come across any failure that blocks the test,
# please remove ~/.lkp and /lkp dir to run from a clean state.



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



Attachments:
(No filename) (8.08 kB)
config-6.1.0-rc4-00027-gda74b30c774a (163.22 kB)
job-script (4.58 kB)
dmesg.xz (31.82 kB)
Download all attachments

2022-11-16 02:21:56

by Mike Kravetz

[permalink] [raw]
Subject: Re: [linux-next:master] [ipc/shm] da74b30c77: BUG:kernel_NULL_pointer_dereference,address

On 11/16/22 09:24, kernel test robot wrote:
>
>
> Greeting,
>
> FYI, we noticed BUG:kernel_NULL_pointer_dereference,address due to commit (built with gcc-11):
>
> commit: da74b30c774a4a0c62fc3dc2b95a8a3a34a48c23 ("ipc/shm: call underlying open/close vm_ops")
> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master
>

This should be addressed in the updated version of the patch. Commit
2d68cf69b8421542184b313f9b87ba14fea9fc4e in next-20221115.

--
Mike Kravetz