BUG: stack guard page was hit in vsock_connectible_recvmsg

From: Ubisectech Sirius
Date: Sun Jul 28 2024 - 22:23:19 EST



Hello.
We are Ubisectech Sirius Team, the vulnerability lab of China ValiantSec. Recently, our team has discovered a issue in Linux kernel 6.8. Attached to the email were a PoC file of the issue.

Stack dump:
BUG: TASK stack guard page was hit at ffffc90001b27f88 (stack is ffffc90001b28000..ffffc90001b30000)
stack guard page: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 0 PID: 8069 Comm: syz-executor293 Not tainted 6.8.0 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
RIP: 0010:mark_lock+0x25/0xd60 kernel/locking/lockdep.c:4639
Code: 90 90 90 90 90 55 48 89 e5 41 57 41 56 41 55 41 54 41 89 d4 48 ba 00 00 00 00 00 fc ff df 53 48 83 e4 f0 48 81 ec 10 01 00 00 <48> c7 44 24 30 b3 8a b5 41 48 8d 5c 24 30 48 c7 44 24 38 00 88 b9
RSP: 0018:ffffc90001b27f90 EFLAGS: 00010086
RAX: 0000000000000004 RBX: ffff888042cd2fa2 RCX: ffff888042cd2f64
RDX: dffffc0000000000 RSI: ffff888042cd2f80 RDI: ffff888042cd24c0
RBP: ffffc90001b280c8 R08: 0000000000000001 R09: fffffbfff2711214
R10: ffffffff938890a7 R11: 0000000000000000 R12: 0000000000000002
R13: 0000000000000000 R14: ffff888042cd24c0 R15: 000000000004073c
FS: 00005555558f13c0(0000) GS:ffff88802c600000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffc90001b27f88 CR3: 0000000048cb8000 CR4: 0000000000750ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<#DF>
</#DF>
<TASK>
mark_usage kernel/locking/lockdep.c:4587 [inline]
__lock_acquire+0x91e/0x3bc0 kernel/locking/lockdep.c:5091
lock_acquire kernel/locking/lockdep.c:5754 [inline]
lock_acquire+0x1b1/0x530 kernel/locking/lockdep.c:5719
lock_sock_nested+0x3a/0xf0 net/core/sock.c:3523
lock_sock include/net/sock.h:1691 [inline]
vsock_connectible_recvmsg+0xdd/0xba0 net/vmw_vsock/af_vsock.c:2196
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
__vsock_recvmsg net/vmw_vsock/vsock_bpf.c:67 [inline]
vsock_bpf_recvmsg+0xb41/0x11a0 net/vmw_vsock/vsock_bpf.c:105
vsock_connectible_recvmsg+0x92b/0xba0 net/vmw_vsock/af_vsock.c:2240
sock_recvmsg_nosec net/socket.c:1046 [inline]
sock_recvmsg+0x1de/0x240 net/socket.c:1068
____sys_recvmsg+0x216/0x670 net/socket.c:2803
___sys_recvmsg+0xff/0x190 net/socket.c:2845
__sys_recvmsg+0xfb/0x1d0 net/socket.c:2875
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xd5/0x270 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x6f/0x77
RIP: 0033:0x7f6c450819cd
Code: c3 e8 a7 1f 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcae667888 EFLAGS: 00000246 ORIG_RAX: 000000000000002f
RAX: ffffffffffffffda RBX: 0000000000016644 RCX: 00007f6c450819cd
RDX: 0000000000000000 RSI: 00000000200003c0 RDI: 0000000000000005
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffcae66789c
R13: 431bde82d7b634db R14: 00007f6c450fe4f0 R15: 0000000000000001
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:mark_lock+0x25/0xd60 kernel/locking/lockdep.c:4639
Code: 90 90 90 90 90 55 48 89 e5 41 57 41 56 41 55 41 54 41 89 d4 48 ba 00 00 00 00 00 fc ff df 53 48 83 e4 f0 48 81 ec 10 01 00 00 <48> c7 44 24 30 b3 8a b5 41 48 8d 5c 24 30 48 c7 44 24 38 00 88 b9
RSP: 0018:ffffc90001b27f90 EFLAGS: 00010086
RAX: 0000000000000004 RBX: ffff888042cd2fa2 RCX: ffff888042cd2f64
RDX: dffffc0000000000 RSI: ffff888042cd2f80 RDI: ffff888042cd24c0
RBP: ffffc90001b280c8 R08: 0000000000000001 R09: fffffbfff2711214
R10: ffffffff938890a7 R11: 0000000000000000 R12: 0000000000000002
R13: 0000000000000000 R14: ffff888042cd24c0 R15: 000000000004073c
FS: 00005555558f13c0(0000) GS:ffff88802c600000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffc90001b27f88 CR3: 0000000048cb8000 CR4: 0000000000750ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
----------------
Code disassembly (best guess):
0: 90 nop
1: 90 nop
2: 90 nop
3: 90 nop
4: 90 nop
5: 55 push %rbp
6: 48 89 e5 mov %rsp,%rbp
9: 41 57 push %r15
b: 41 56 push %r14
d: 41 55 push %r13
f: 41 54 push %r12
11: 41 89 d4 mov %edx,%r12d
14: 48 ba 00 00 00 00 00 movabs $0xdffffc0000000000,%rdx
1b: fc ff df
1e: 53 push %rbx
1f: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp
23: 48 81 ec 10 01 00 00 sub $0x110,%rsp
* 2a: 48 c7 44 24 30 b3 8a movq $0x41b58ab3,0x30(%rsp) <-- trapping instruction
31: b5 41
33: 48 8d 5c 24 30 lea 0x30(%rsp),%rbx
38: 48 rex.W
39: c7 .byte 0xc7
3a: 44 24 38 rex.R and $0x38,%al
3d: 00 .byte 0x0
3e: 88 .byte 0x88
3f: b9 .byte 0xb9

Thank you for taking the time to read this email and we look forward to working with you further.



Attachment: poc.c
Description: Binary data