general protection fault in integrity_inode_get

From: Ubisectech Sirius
Date: Sun Apr 14 2024 - 22:22:53 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:
loop0: detected capacity change from 0 to 64
hfs: unable to locate alternate MDB
hfs: continuing without an alternate MDB
general protection fault, probably for non-canonical address 0xdffffc0000001cdb: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: probably user-memory-access in range [0x000000000000e6d8-0x000000000000e6df]
CPU: 1 PID: 8089 Comm: syz-executor264 Not tainted 6.8.0 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
RIP: 0010:integrity_inode_get+0x35e/0x5f0 security/integrity/iint.c:147
Code: 42 80 3c 30 00 0f 85 b6 01 00 00 49 8b 45 00 48 85 c0 74 46 48 89 c3 e8 c0 5c 70 fd 48 8d bb a8 00 00 00 48 89 f8 48 c1 e8 03 <42> 80 3c 30 00 0f 85 99 01 00 00 4c 8b ab a8 00 00 00 49 39 ed 77
RSP: 0018:ffffc90001c07720 EFLAGS: 00010206
RAX: 0000000000001cdb RBX: 000000000000e633 RCX: ffffffff816ad98e
RDX: ffff8880174e24c0 RSI: ffffffff841a4ff0 RDI: 000000000000e6db
RBP: ffff888042ad48d8 R08: 0000000000000001 R09: fffff52000380ed5
R10: 0000000000000003 R11: 0000000000000000 R12: ffff88804a3ca128
R13: ffff88804a391010 R14: dffffc0000000000 R15: ffff888042ad48d8
FS: 00005555556a53c0(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f8d72207c00 CR3: 0000000020238000 CR4: 0000000000750ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<TASK>
process_measurement+0x607/0x1ee0 security/integrity/ima/ima_main.c:251
ima_file_check+0xba/0x100 security/integrity/ima/ima_main.c:557
do_open fs/namei.c:3647 [inline]
path_openat+0x16fa/0x2670 fs/namei.c:3802
do_filp_open+0x1c9/0x420 fs/namei.c:3829
do_sys_openat2+0x164/0x1d0 fs/open.c:1404
do_sys_open fs/open.c:1419 [inline]
__do_sys_openat fs/open.c:1435 [inline]
__se_sys_openat fs/open.c:1430 [inline]
__x64_sys_openat+0x140/0x1f0 fs/open.c:1430
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:0x7f8d7a6a668d
Code: c3 e8 97 22 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:00007fffb08e2138 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000018fbc RCX: 00007f8d7a6a668d
RDX: 0000000000141842 RSI: 0000000020000380 RDI: 00000000ffffff9c
RBP: 0000000000000000 R08: 0000000000000260 R09: 00005555556a6080
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f8d7a6f80b9
R13: 00007f8d7a6f80c3 R14: 0000000000000008 R15: 00007fffb08e21a0
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:integrity_inode_get+0x35e/0x5f0 security/integrity/iint.c:147
Code: 42 80 3c 30 00 0f 85 b6 01 00 00 49 8b 45 00 48 85 c0 74 46 48 89 c3 e8 c0 5c 70 fd 48 8d bb a8 00 00 00 48 89 f8 48 c1 e8 03 <42> 80 3c 30 00 0f 85 99 01 00 00 4c 8b ab a8 00 00 00 49 39 ed 77
RSP: 0018:ffffc90001c07720 EFLAGS: 00010206
RAX: 0000000000001cdb RBX: 000000000000e633 RCX: ffffffff816ad98e
RDX: ffff8880174e24c0 RSI: ffffffff841a4ff0 RDI: 000000000000e6db
RBP: ffff888042ad48d8 R08: 0000000000000001 R09: fffff52000380ed5
R10: 0000000000000003 R11: 0000000000000000 R12: ffff88804a3ca128
R13: ffff88804a391010 R14: dffffc0000000000 R15: ffff888042ad48d8
FS: 00005555556a53c0(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f8d72207c00 CR3: 0000000020238000 CR4: 0000000000750ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
----------------
Code disassembly (best guess):
0: 42 80 3c 30 00 cmpb $0x0,(%rax,%r14,1)
5: 0f 85 b6 01 00 00 jne 0x1c1
b: 49 8b 45 00 mov 0x0(%r13),%rax
f: 48 85 c0 test %rax,%rax
12: 74 46 je 0x5a
14: 48 89 c3 mov %rax,%rbx
17: e8 c0 5c 70 fd call 0xfd705cdc
1c: 48 8d bb a8 00 00 00 lea 0xa8(%rbx),%rdi
23: 48 89 f8 mov %rdi,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 80 3c 30 00 cmpb $0x0,(%rax,%r14,1) <-- trapping instruction
2f: 0f 85 99 01 00 00 jne 0x1ce
35: 4c 8b ab a8 00 00 00 mov 0xa8(%rbx),%r13
3c: 49 39 ed cmp %rbp,%r13
3f: 77 .byte 0x77

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