syzbot


general protection fault in ima_free_template_entry

Status: fixed on 2020/07/17 17:58
Subsystems: integrity lsm
[Documentation on labels]
Reported-by: syzbot+223310b454ba6b75974e@syzkaller.appspotmail.com
Fix commit: 42413b49804b ima: Directly free *entry in ima_alloc_init_template() if digests is NULL
First crash: 1447d, last: 1427d
Cause bisection: introduced by (bisect log) :
commit aa724fe18a8a8285d0071c3bfc932efb090d142d
Author: Roberto Sassu <roberto.sassu@huawei.com>
Date: Wed Mar 25 10:47:09 2020 +0000

  ima: Switch to dynamically allocated buffer for template digests

Crash: general protection fault in ima_free_template_entry (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] ima: Directly free *entry in ima_alloc_init_template() if digests is NULL 1 (1) 2020/06/05 06:50
general protection fault in ima_free_template_entry 1 (2) 2020/06/04 15:09

Sample crash report:
RBP: 000000000000dcd4 R08: 0000000000000002 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402160
R13: 00000000004021f0 R14: 0000000000000000 R15: 0000000000000000
general protection fault, probably for non-canonical address 0xdffffc0000000004: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000020-0x0000000000000027]
CPU: 0 PID: 6811 Comm: syz-executor925 Not tainted 5.7.0-rc7-next-20200529-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:ima_free_template_entry+0x4a/0x170 security/integrity/ima/ima_api.c:27
Code: fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 25 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 5d 10 48 8d 7b 20 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e d1 00 00 00 8b 5b 20 31 ff 89
RSP: 0018:ffffc900018e7598 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 1ffff9200031cece
RDX: 0000000000000004 RSI: ffffffff836d8716 RDI: 0000000000000020
RBP: ffff88809a078d80 R08: 0000000000000000 R09: ffffed1015cc719c
R10: ffff8880ae638cdb R11: ffffed1015cc719b R12: ffffc900018e7670
R13: ffffffff8a06d650 R14: ffff88809a078d90 R15: 00000000fffffff4
FS:  0000000000bc7880(0000) GS:ffff8880ae600000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 00000000a6570000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 ima_alloc_init_template+0x3de/0x570 security/integrity/ima/ima_api.c:80
 ima_add_violation+0x109/0x1e0 security/integrity/ima/ima_api.c:148
 ima_rdwr_violation_check security/integrity/ima/ima_main.c:140 [inline]
 process_measurement+0x1144/0x1750 security/integrity/ima/ima_main.c:237
 ima_file_check+0xb9/0x100 security/integrity/ima/ima_main.c:491
 do_open fs/namei.c:3236 [inline]
 path_openat+0x17a4/0x27d0 fs/namei.c:3351
 do_filp_open+0x192/0x260 fs/namei.c:3378
 do_sys_openat2+0x585/0x7a0 fs/open.c:1173
 do_sys_open+0xc3/0x140 fs/open.c:1189
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:359
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x441219
Code: e8 5c ae 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 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 0f 83 bb 0a fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffca22cc218 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441219
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000180
RBP: 000000000000dcd4 R08: 0000000000000002 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402160
R13: 00000000004021f0 R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
---[ end trace d5e7ae4ed8ee55df ]---
RIP: 0010:ima_free_template_entry+0x4a/0x170 security/integrity/ima/ima_api.c:27
Code: fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 25 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 5d 10 48 8d 7b 20 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e d1 00 00 00 8b 5b 20 31 ff 89
RSP: 0018:ffffc900018e7598 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 1ffff9200031cece
RDX: 0000000000000004 RSI: ffffffff836d8716 RDI: 0000000000000020
RBP: ffff88809a078d80 R08: 0000000000000000 R09: ffffed1015cc719c
R10: ffff8880ae638cdb R11: ffffed1015cc719b R12: ffffc900018e7670
R13: ffffffff8a06d650 R14: ffff88809a078d90 R15: 00000000fffffff4
FS:  0000000000bc7880(0000) GS:ffff8880ae600000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1d9c03f078 CR3: 00000000a6570000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/06/04 05:23 linux-next e7b08814b16b a5ce5de0 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2020/06/24 18:47 linux-next e7b08814b16b 54566aff .config console log report ci-upstream-linux-next-kasan-gce-root
2020/06/04 05:03 linux-next e7b08814b16b a5ce5de0 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.