Skip to contentSkip to conversation

general protection fault in vc_deallocate

syzbot In review syzbot 3 participants 8 messages Sep 8, 2025 – Sep 10, 2025 TTY layer and serial drivers

lore
Share & tools
lore

syzbot

author syzbot
#0 lore raw

Hello,

syzbot found the following issue on:

HEAD commit:    3e8e5822146b Add linux-next specific files for 20250908
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=11984642580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=69cfefa929ab96f7
dashboard link: https://syzkaller.appspot.com/bug?extid=f6cb41c144427dc0796a
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=17230934580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15984642580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/eaa87d8bc6ca/disk-3e8e5822.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6640e70f5002/vmlinux-3e8e5822.xz
kernel image: https://storage.googleapis.com/syzbot-assets/40f622291050/bzImage-3e8e5822.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:

Reported-by [email protected]
Oops: general protection fault, probably for non-canonical address 0xdffffc00000000b2: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000590-0x0000000000000597]
CPU: 0 UID: 0 PID: 6062 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
RIP: 0010:vc_deallocate+0x303/0x3e0 drivers/tty/vt/vt.c:1345
Code: e8 f2 1f d7 fc 49 c7 07 00 00 00 00 eb 0e e8 14 1d 73 fc eb 05 e8 0d 1d 73 fc 31 db 4c 8d b3 90 05 00 00 4d 89 f4 49 c1 ec 03 <43> 80 3c 2c 00 74 08 4c 89 f7 e8 ce 1e d7 fc 4d 8b 3e 4d 85 ff 74
RSP: 0018:ffffc900035f79e0 EFLAGS: 00010206
RAX: ffffffff854c8f03 RBX: 0000000000000000 RCX: ffff88807dd3dac0
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 000000000000003f
RBP: ffffc900035f7a90 R08: ffffffff8fc3c7cf R09: 1ffffffff1f878f9
R10: dffffc0000000000 R11: fffffbfff1f878fa R12: 00000000000000b2
R13: dffffc0000000000 R14: 0000000000000590 R15: ffffffff9a034a30
FS:  000055557fa10500(0000) GS:ffff8881259f1000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055557fa10808 CR3: 000000007ba62000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 vt_disallocate_all+0x60/0xe0 drivers/tty/vt/vt_ioctl.c:652
 vt_ioctl+0x1adc/0x1f20 drivers/tty/vt/vt_ioctl.c:886
 tty_ioctl+0x926/0xde0 drivers/tty/tty_io.c:2792
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:598 [inline]
 __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f97fa38ebe9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe553801c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f97fa5c5fa0 RCX: 00007f97fa38ebe9
RDX: 0000000000000000 RSI: 0000000000005608 RDI: 0000000000000004
RBP: 00007f97fa411e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f97fa5c5fa0 R14: 00007f97fa5c5fa0 R15: 0000000000000002
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:vc_deallocate+0x303/0x3e0 drivers/tty/vt/vt.c:1345
Code: e8 f2 1f d7 fc 49 c7 07 00 00 00 00 eb 0e e8 14 1d 73 fc eb 05 e8 0d 1d 73 fc 31 db 4c 8d b3 90 05 00 00 4d 89 f4 49 c1 ec 03 <43> 80 3c 2c 00 74 08 4c 89 f7 e8 ce 1e d7 fc 4d 8b 3e 4d 85 ff 74
RSP: 0018:ffffc900035f79e0 EFLAGS: 00010206
RAX: ffffffff854c8f03 RBX: 0000000000000000 RCX: ffff88807dd3dac0
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 000000000000003f
RBP: ffffc900035f7a90 R08: ffffffff8fc3c7cf R09: 1ffffffff1f878f9
R10: dffffc0000000000 R11: fffffbfff1f878fa R12: 00000000000000b2
R13: dffffc0000000000 R14: 0000000000000590 R15: ffffffff9a034a30
FS:  000055557fa10500(0000) GS:ffff8881259f1000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055557fa10808 CR3: 000000007ba62000 CR4: 00000000003526f0
----------------
Code disassembly (best guess):
   0:	e8 f2 1f d7 fc       	call   0xfcd71ff7
   5:	49 c7 07 00 00 00 00 	movq   $0x0,(%r15)
   c:	eb 0e                	jmp    0x1c
   e:	e8 14 1d 73 fc       	call   0xfc731d27
  13:	eb 05                	jmp    0x1a
  15:	e8 0d 1d 73 fc       	call   0xfc731d27
  1a:	31 db                	xor    %ebx,%ebx
  1c:	4c 8d b3 90 05 00 00 	lea    0x590(%rbx),%r14
  23:	4d 89 f4             	mov    %r14,%r12
  26:	49 c1 ec 03          	shr    $0x3,%r12
* 2a:	43 80 3c 2c 00       	cmpb   $0x0,(%r12,%r13,1) <-- trapping instruction
  2f:	74 08                	je     0x39
  31:	4c 89 f7             	mov    %r14,%rdi
  34:	e8 ce 1e d7 fc       	call   0xfcd71f07
  39:	4d 8b 3e             	mov    (%r14),%r15
  3c:	4d 85 ff             	test   %r15,%r15
  3f:	74                   	.byte 0x74

---
This report is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more information about syzbot. syzbot engineers can be reached at [email protected].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

#1 lore raw

#syz test

drivers/tty/vt/vt.c +4 -4
index 1d9abcfac4c9..6e0089b85c27 100644
@@ -1341,10 +1341,10 @@ struct vc_data *vc_deallocate(unsigned int currcons)
 		vc_uniscr_set(vc, NULL);
 		kfree(vc->vc_screenbuf);
 		vc_cons[currcons].d = NULL;
-	}
-	if (vc->vc_saved_screen != NULL) {
-		kfree(vc->vc_saved_screen);
-		vc->vc_saved_screen = NULL;
+		if (vc->vc_saved_screen != NULL) {
+			kfree(vc->vc_saved_screen);
+			vc->vc_saved_screen = NULL;
+		}
 	}
 	return vc;
 }
author syzbot Tested-by
#2 lore raw
syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Tested on:

commit:         3e8e5822 Add linux-next specific files for 20250908
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=14fdf562580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=69cfefa929ab96f7
dashboard link: https://syzkaller.appspot.com/bug?extid=f6cb41c144427dc0796a
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
patch:          https://syzkaller.appspot.com/x/patch.diff?x=170cd87c580000

Note: testing is done by a robot and is best-effort only.

#3 lore raw

PATCH 1/1 vt: move vc_saved_screen to within tty allocated judgment

In reply to syzbot

Everything starts with the assumption that a tty has been allocated. Therefore, Move it to within the tty allocation check.

Fixes 23743ba64709 ("vt: add support for smput/rmput escape codes")
Reported-by [email protected]
---
 drivers/tty/vt/vt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/vt/vt.c +4 -4
index 1d9abcfac4c9..6e0089b85c27 100644
@@ -1341,10 +1341,10 @@ struct vc_data *vc_deallocate(unsigned int currcons)
 		vc_uniscr_set(vc, NULL);
 		kfree(vc->vc_screenbuf);
 		vc_cons[currcons].d = NULL;
-	}
-	if (vc->vc_saved_screen != NULL) {
-		kfree(vc->vc_saved_screen);
-		vc->vc_saved_screen = NULL;
+		if (vc->vc_saved_screen != NULL) {
+			kfree(vc->vc_saved_screen);
+			vc->vc_saved_screen = NULL;
+		}
 	}
 	return vc;
 }
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#4 lore raw

Re: [PATCH Next] vt: move vc_saved_screen to within tty allocated judgment

Quoted 8 lines · Edward Adam Davis

Everything starts with the assumption that a tty has been allocated. Therefore, Move it to within the tty allocation check.

Fixes 23743ba64709 ("vt: add support for smput/rmput escape codes")
Reported-by [email protected]

Ugh, sure.

thanks,

Signature · 2 lines
js
suse labs
author syzbot
#5 lore raw
In reply to syzbot
syzbot has bisected this issue to:

syzbot has bisected this issue to:

commit 23743ba64709a9c137c1b928f8b8e00d846af9cc

Author: Calixte Pernot <[email protected]>
Date:   Mon Aug 25 12:56:09 2025 +0000

vt: add support for smput/rmput escape codes

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=16fded62580000
start commit:   3e8e5822146b Add linux-next specific files for 20250908
git tree:       linux-next
final oops:     https://syzkaller.appspot.com/x/report.txt?x=15fded62580000
console output: https://syzkaller.appspot.com/x/log.txt?x=11fded62580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=69cfefa929ab96f7
dashboard link: https://syzkaller.appspot.com/bug?extid=f6cb41c144427dc0796a
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=17230934580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15984642580000
Reported-by [email protected]
Fixes 23743ba64709 ("vt: add support for smput/rmput escape codes")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

maintainer
#6 lore raw
Quoted 18 lines · syzbot

syzbot has bisected this issue to:

commit 23743ba64709a9c137c1b928f8b8e00d846af9cc

Author: Calixte Pernot <[email protected]>
Date:   Mon Aug 25 12:56:09 2025 +0000

vt: add support for smput/rmput escape codes

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=16fded62580000
start commit:   3e8e5822146b Add linux-next specific files for 20250908
git tree:       linux-next
final oops:     https://syzkaller.appspot.com/x/report.txt?x=15fded62580000
console output: https://syzkaller.appspot.com/x/log.txt?x=11fded62580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=69cfefa929ab96f7
dashboard link: https://syzkaller.appspot.com/bug?extid=f6cb41c144427dc0796a
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=17230934580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15984642580000
Quoted 4 lines
Reported-by [email protected]
Fixes 23743ba64709 ("vt: add support for smput/rmput escape codes")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git/ tty-fix

Signature · 2 lines
js
suse labs
author syzbot Tested-by
#7 lore raw
syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Tested on:

commit:         55196010 vt: move vc_saved_screen to within tty alloca..
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git/ tty-fix
console output: https://syzkaller.appspot.com/x/log.txt?x=159bed62580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=69cfefa929ab96f7
dashboard link: https://syzkaller.appspot.com/bug?extid=f6cb41c144427dc0796a
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

Note: no patches were applied.
Note: testing is done by a robot and is best-effort only.