[syzbot] memory leak in fbcon_set_font (2)

23 views
Skip to first unread message

syzbot

unread,
Dec 4, 2022, 11:34:45 PM12/4/22
to dan...@ffwll.ch, del...@gmx.de, dri-...@lists.freedesktop.org, geert+...@glider.be, linux...@vger.kernel.org, linux-...@vger.kernel.org, s...@ravnborg.org, syzkall...@googlegroups.com, tzimm...@suse.de
Hello,

syzbot found the following issue on:

HEAD commit: c2bf05db6c78 Merge tag 'i2c-for-6.1-rc8' of git://git.kern..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=171883d5880000
kernel config: https://syzkaller.appspot.com/x/.config?x=979161df0e247659
dashboard link: https://syzkaller.appspot.com/bug?extid=25bdb7b1703639abd498
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14fff84d880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=135806a7880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/63cd45bf1d68/disk-c2bf05db.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/bafbfb42c660/vmlinux-c2bf05db.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9f803a721cfc/bzImage-c2bf05db.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+25bdb7...@syzkaller.appspotmail.com

BUG: memory leak
unreferenced object 0xffff888111648000 (size 18448):
comm "syz-executor148", pid 3653, jiffies 4294970435 (age 13.520s)
hex dump (first 32 bytes):
85 44 7e c7 00 00 00 00 00 48 00 00 00 00 00 00 .D~......H......
92 30 86 d2 8c 38 30 9e e7 a3 05 00 9f 09 33 bb .0...80.......3.
backtrace:
[<ffffffff814ee6d3>] __do_kmalloc_node mm/slab_common.c:943 [inline]
[<ffffffff814ee6d3>] __kmalloc+0xb3/0x120 mm/slab_common.c:968
[<ffffffff8250c359>] kmalloc include/linux/slab.h:558 [inline]
[<ffffffff8250c359>] fbcon_set_font+0x1a9/0x470 drivers/video/fbdev/core/fbcon.c:2508
[<ffffffff8262cd59>] con_font_set drivers/tty/vt/vt.c:4667 [inline]
[<ffffffff8262cd59>] con_font_op+0x3a9/0x600 drivers/tty/vt/vt.c:4713
[<ffffffff82618e3d>] vt_k_ioctl drivers/tty/vt/vt_ioctl.c:474 [inline]
[<ffffffff82618e3d>] vt_ioctl+0x14fd/0x1a80 drivers/tty/vt/vt_ioctl.c:752
[<ffffffff825fdaf5>] tty_ioctl+0x6d5/0xbe0 drivers/tty/tty_io.c:2771
[<ffffffff816200bc>] vfs_ioctl fs/ioctl.c:51 [inline]
[<ffffffff816200bc>] __do_sys_ioctl fs/ioctl.c:870 [inline]
[<ffffffff816200bc>] __se_sys_ioctl fs/ioctl.c:856 [inline]
[<ffffffff816200bc>] __x64_sys_ioctl+0xfc/0x140 fs/ioctl.c:856
[<ffffffff8485c5e5>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8485c5e5>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84a00087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff888110b18000 (size 18448):
comm "syz-executor148", pid 3655, jiffies 4294971001 (age 7.860s)
hex dump (first 32 bytes):
85 44 7e c7 00 00 00 00 00 48 00 00 00 00 00 00 .D~......H......
92 30 86 d2 8c 38 30 9e e7 a3 05 00 9f 09 33 bb .0...80.......3.
backtrace:
[<ffffffff814ee6d3>] __do_kmalloc_node mm/slab_common.c:943 [inline]
[<ffffffff814ee6d3>] __kmalloc+0xb3/0x120 mm/slab_common.c:968
[<ffffffff8250c359>] kmalloc include/linux/slab.h:558 [inline]
[<ffffffff8250c359>] fbcon_set_font+0x1a9/0x470 drivers/video/fbdev/core/fbcon.c:2508
[<ffffffff8262cd59>] con_font_set drivers/tty/vt/vt.c:4667 [inline]
[<ffffffff8262cd59>] con_font_op+0x3a9/0x600 drivers/tty/vt/vt.c:4713
[<ffffffff82618e3d>] vt_k_ioctl drivers/tty/vt/vt_ioctl.c:474 [inline]
[<ffffffff82618e3d>] vt_ioctl+0x14fd/0x1a80 drivers/tty/vt/vt_ioctl.c:752
[<ffffffff825fdaf5>] tty_ioctl+0x6d5/0xbe0 drivers/tty/tty_io.c:2771
[<ffffffff816200bc>] vfs_ioctl fs/ioctl.c:51 [inline]
[<ffffffff816200bc>] __do_sys_ioctl fs/ioctl.c:870 [inline]
[<ffffffff816200bc>] __se_sys_ioctl fs/ioctl.c:856 [inline]
[<ffffffff816200bc>] __x64_sys_ioctl+0xfc/0x140 fs/ioctl.c:856
[<ffffffff8485c5e5>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8485c5e5>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84a00087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory
write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory


---
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 syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

Tetsuo Handa

unread,
Dec 5, 2022, 5:57:02 AM12/5/22
to syzbot, syzkall...@googlegroups.com
syzbot is reporting memory leak at fbcon_do_set_font() [1], for
commit a5a923038d70 ("fbdev: fbcon: Properly revert changes when
vc_resize() failed") missed that the buffer might be newly allocated
by fbcon_set_font().

Link: https://syzkaller.appspot.com/bug?extid=25bdb7b1703639abd498 [1]
Reported-by: syzbot <syzbot+25bdb7...@syzkaller.appspotmail.com>
Signed-off-by: Tetsuo Handa <penguin...@I-love.SAKURA.ne.jp>
Fixes: a5a923038d70 ("fbdev: fbcon: Properly revert changes when vc_resize() failed")
---
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

drivers/video/fbdev/core/fbcon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 098b62f7b701..8363f3b2b452 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2450,7 +2450,8 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount,

if (userfont) {
p->userfont = old_userfont;
- REFCOUNT(data)--;
+ if (--REFCOUNT(data) == 0)
+ kfree(data - FONT_EXTRA_WORDS * sizeof(int));
}

vc->vc_font.width = old_width;
--
2.34.1

syzbot

unread,
Dec 5, 2022, 10:34:17 AM12/5/22
to penguin...@i-love.sakura.ne.jp, syzkall...@googlegroups.com
Hello,

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

Reported-and-tested-by: syzbot+25bdb7...@syzkaller.appspotmail.com

Tested on:

commit: 76dcd734 Linux 6.1-rc8
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=147923ad880000
kernel config: https://syzkaller.appspot.com/x/.config?x=42749c1fdf4b30b0
dashboard link: https://syzkaller.appspot.com/bug?extid=25bdb7b1703639abd498
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=151ed1d5880000

Note: testing is done by a robot and is best-effort only.
Reply all
Reply to author
Forward
0 new messages