[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aN49Qt4dezOqAmoo@arch-box>
Date: Thu, 2 Oct 2025 04:52:18 -0400
From: Albin Babu Varghese <albinbabuvarghese20@...il.com>
To: Helge Deller <deller@....de>
Cc: Simona Vetter <simona@...ll.ch>,
syzbot+48b0652a95834717f190@...kaller.appspotmail.com,
linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fbdev: Add bounds checking in bit_putcs to fix
vmalloc-out-of-bounds
Hi Helge, I tested your suggestions and they seem to work well.
> Do you know if this affects the selection?
> If so, would modifying (reducing/shortening) the selection maybe fix it?
The syzkaller reproducer uses really weird values where xs > xe and ys > ye
(xs=0xa00, xe=0x101, ys=0xc7e, ye=0x100) and set_selection() already swaps them
if needed and clamps the values.
I added debug prints to check what's happening and the clamping in
set_selection() is working and the values coming through are within bounds. But
the crash still happens when you remap the framebuffer because of a slight
overflow.
I also discovered that when image.width is clipped on the X-axis, the character
count (cnt) must also be updated to match, otherwise bit_putcs_aligned()
receives mismatched buffer size and character count parameters, causing
out-of-bounds writes.
So I changed it to something like this:
+ if (image.dx >= info->var.xres)
+ break;
+ if (image.dx + image.width > info->var.xres) {
+ image.width = info->var.xres - image.dx;
+ cnt = image.width / vc->vc_font.width;
+ if (cnt == 0)
+ break;
+ image.width = cnt * vc->vc_font.width;
+ }
I tested it in syzbot, with the syzkaller reproducer, and also manually in QEMU
and verified that the buffer switches from tty1 to tty2 work correctly.
I couldn’t find a dedicated fbdev/fbcon test suite. Beyond kselftests, do you
recommend anything specific before sending v2?
Thanks,
Albin
Powered by blists - more mailing lists