All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Helge Deller" <deller@gmx.de>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4] fbcon: Don't drop last logo line if logo is same size as screen
Date: Wed, 25 Nov 2026 21:05:18 +0000	[thread overview]
Message-ID: <sashiko-outbox-234155@kernel.org> (raw)
In-Reply-To: <20261125204846.428877-1-deller@gmx.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] fbcon: slab-out-of-bounds read in fbcon_prepare_logo() when
  rows < logo_lines
--

commit c7b7e4b07b9a1354bf2bc5159428ad41f71350a8
Author: Helge Deller <deller@gmx.de>

fbcon: Don't drop last logo line if logo is same size as screen

This commit allows full-screen boot logos to use all screen rows while
keeping vc_top at 0 so console text can still scroll across the full
screen.

> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index d7890e119dc7d..289e6ce37f96d 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -665,13 +665,15 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
>  		erase &= ~0x400;
>  	logo_height = fb_prepare_logo(info, par->rotate);
>  	logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height);
> -	logo_lines = min(logo_lines, rows);
> -	logo_lines = min(logo_lines, new_rows - 1);
> +	logo_lines = min(logo_lines, new_rows);
>  	if (logo_lines <= 0) {
>  		logo_lines = 0;
>  		logo_shown = FBCON_LOGO_DONTSHOW;
>  		return;
>  	}
> +	if (logo_lines >= vc->vc_bottom)
> +		goto logo_fullscreen;
> +
>  	q = (unsigned short *) (vc->vc_origin +
>  				vc->vc_size_row * rows);
>  	step = logo_lines * cols;

[Severity: High]
Does dropping logo_lines = min(logo_lines, rows) reintroduce the
out-of-bounds read before vc->vc_origin that 94e6a058b168 ("fbcon: Fix
KASAN slab-out-of-bounds Read in fbcon_prepare_logo") fixed?

In fbcon_init(), rows holds the pre-resize row count while vc_resize() has
already updated vc->vc_bottom to new_rows.  When the console grows (for
example during vgacon-to-fbcon takeover) and rows < logo_lines < new_rows,
the logo_lines >= vc->vc_bottom check is not taken, so
r = q - logo_lines * cols underflows before vc->vc_origin (the start of
vc->vc_screenbuf):

drivers/video/fbdev/core/fbcon.c:fbcon_prepare_logo() {
	...
	q = (unsigned short *) (vc->vc_origin +
				vc->vc_size_row * rows);
	step = logo_lines * cols;
	for (r = q - logo_lines * cols; r < q; r++)
		if (scr_readw(r) != vc->vc_video_erase_char)
			break;
	if (r != q && new_rows >= rows + logo_lines) {
		...
			r = q - step;
			for (cnt = 0; cnt < logo_lines; cnt++, r += i)
				scr_memcpyw(save + cnt * new_cols, r, 2 * i);
	...
}

scr_readw(r) then reads slab memory before vc->vc_screenbuf, and if
new_rows >= rows + logo_lines, scr_memcpyw() copies that out-of-bounds
heap data into save and then into the visible screen buffer.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125204846.428877-1-deller@gmx.de?part=1

      reply	other threads:[~2026-11-25 21:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 20:48 [PATCH v4] fbcon: Don't drop last logo line if logo is same size as screen Helge Deller
2026-11-25 21:05 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-234155@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.