2018-05-02 12:53:10

by Fengguang Wu

[permalink] [raw]
Subject: [dn_getsockopt] kernel BUG at mm/usercopy.c:100!

Hello,

FYI this happens in mainline kernel 4.17.0-rc3.
It dates back to at least v4.16 .

[ 84.345323] raw_sendmsg: trinity-c2 forgot to set AF_INET. Fix it!
[ 85.485647] synth uevent: /devices/virtual/misc/fuse: unknown uevent action string
[ 85.486293] misc fuse: uevent: failed to send synthetic uevent
[ 86.373915] usercopy: Kernel memory exposure attempt detected from SLAB object 'NSP' (offset 1144, size 20)!
[ 86.374651] ------------[ cut here ]------------
[ 86.374983] kernel BUG at mm/usercopy.c:100!
[ 86.375405] invalid opcode: 0000 [#1] SMP
[ 86.375700] CPU: 0 PID: 853 Comm: trinity-c1 Not tainted 4.17.0-rc3 #217
[ 86.376178] RIP: 0010:usercopy_abort+0x77/0x80:
usercopy_abort at mm/usercopy.c:88 (discriminator 12)
[ 86.376493] RSP: 0018:ffffc9000085fdf8 EFLAGS: 00010282
[ 86.376867] RAX: 0000000000000060 RBX: 0000000000000014 RCX: 0000000000000000
[ 86.377367] RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000246
[ 86.377871] RBP: ffffc9000085fe18 R08: 0000000000000001 R09: 0000000000000000
[ 86.378371] R10: ffffffff830ebd0a R11: 00000000000003c9 R12: 0000000000000001
[ 86.378876] R13: 0000000000000014 R14: ffff88001b2884cc R15: 0000000000000014
[ 86.379378] FS: 000000000104a880(0000) GS:ffff88001f800000(0000) knlGS:0000000000000000
[ 86.379948] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 86.380353] CR2: 000000003a3a3a3b CR3: 000000001b1a7005 CR4: 00000000001606b0
[ 86.380859] DR0: 00007f39dd868000 DR1: 00007f39dd868000 DR2: 0000000000000000
[ 86.381360] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
[ 86.381868] Call Trace:
[ 86.382050] __check_heap_object+0xb3/0xc0:
__check_heap_object at mm/slab.c:4445
[ 86.382344] __check_object_size+0xee/0x1d0:
__check_object_size at mm/usercopy.c:262
[ 86.382649] ? __might_sleep+0x68/0x70:
__might_sleep at kernel/sched/core.c:6142 (discriminator 14)
[ 86.382921] dn_getsockopt+0x201/0x300:
copy_to_user at include/linux/uaccess.h:155
(inlined by) __dn_getsockopt at net/decnet/af_decnet.c:1638
(inlined by) dn_getsockopt at net/decnet/af_decnet.c:1516
[ 86.383191] __sys_getsockopt+0x85/0xc0:
__sys_getsockopt at net/socket.c:1939
[ 86.383466] __x64_sys_getsockopt+0x1f/0x30:
__do_sys_getsockopt at net/socket.c:1951
(inlined by) __se_sys_getsockopt at net/socket.c:1948
(inlined by) __x64_sys_getsockopt at net/socket.c:1948
[ 86.383769] do_syscall_64+0x98/0x160:
do_syscall_64 at arch/x86/entry/common.c:287
[ 86.384038] entry_SYSCALL_64_after_hwframe+0x44/0xa9:
entry_SYSCALL_64_after_hwframe at arch/x86/entry/entry_64.S:247
[ 86.384396] RIP: 0033:0x457389
[ 86.384620] RSP: 002b:00007ffcd8e0fb88 EFLAGS: 00000246 ORIG_RAX: 0000000000000037
[ 86.385151] RAX: ffffffffffffffda RBX: 0000000000000037 RCX: 0000000000457389
[ 86.385654] RDX: 0000000000000001 RSI: 0000000042000000 RDI: 0000000000000189
[ 86.386153] RBP: 00007ffcd8e0fc30 R08: 0000000000000061 R09: 0000000076767676
[ 86.386675] R10: 0000000000000008 R11: 0000000000000246 R12: 0000000000000002
[ 86.387176] R13: 00007f8cd5a68058 R14: 000000000104a830 R15: 00007f8cd5a68000
[ 86.387682] Code: 0f 44 d0 53 48 c7 c0 8f a3 0a 83 51 48 c7 c6 85 a3 0a 83 41 53 48 89 f9 48 0f 45 f0 4c 89 d2 48 c7 c7 70 a4 0a 83 e8 7d 6e f0 ff <0f> 0b 0f 1f 80 00 00 00 00 48 85 f6 0f 84 b7 01 00 00 55 48 89
[ 86.389031] RIP: usercopy_abort+0x77/0x80:
usercopy_abort at mm/usercopy.c:88 (discriminator 12) RSP: ffffc9000085fdf8
[ 86.389481] ---[ end trace 5103f13a815fc1bf ]---
[ 86.389818] Kernel panic - not syncing: Fatal exception

Attached the full dmesg, kconfig and reproduce scripts.

Thanks,
Fengguang


Attachments:
(No filename) (3.73 kB)
dmesg-yocto-lkp-hsw01-105:20180501235610:x86_64-randconfig-s3-05012323:4.17.0-rc3:217 (54.66 kB)
.config (127.97 kB)
reproduce-yocto-lkp-hsw01-105:20180501235610:x86_64-randconfig-s3-05012323:4.17.0-rc3:217 (971.00 B)
Download all attachments