Re: [RFC PATCH] fbcon: Fix out-of-bounds memory in fbcon_putcs
From: Helge Deller
Date: Tue Mar 03 2026 - 09:21:38 EST
On 2/27/26 15:43, Chen Jun wrote:
When a font is set on an invisible console, the screen will not update.
However, the fontbuffer is not updated to match the new font dimensions.
This inconsistency leads to out-of-bounds memory access when writing to
the tty bound to fbcon, as demonstrated by the following KASAN report:
BUG: KASAN: slab-out-of-bounds in fb_pad_aligned_buffer+0xdf/0x140
Read of size 1 at addr ffff8881195a2280 by task a.out/971
Call Trace:
<TASK>
fb_pad_aligned_buffer+0xdf/0x140
ud_putcs+0x88a/0xde0
fbcon_putcs+0x319/0x430
do_update_region+0x23c/0x3b0
do_con_write+0x225c/0x67f0
con_write+0xe/0x30
n_tty_write+0x4b5/0xff0
file_tty_write.isra.41+0x46c/0x880
vfs_write+0x868/0xd60
ksys_write+0xf2/0x1d0
do_syscall_64+0xfa/0x570
Fix this by calling fbcon_rotate_font() if vc is invisible in
fbcon_do_set_font().
Signed-off-by: Chen Jun <chenjun102@xxxxxxxxxx>
---
drivers/video/fbdev/core/fbcon.c | 5 +++++
1 file changed, 5 insertions(+)
applied to fbdev git tree.
Thanks!
Helge