Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 7/7] vt: Remove old-style con_blank
Date: Fri, 16 Oct 2026 10:38:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-174187@kernel.org> (raw)
In-Reply-To: <20261016093357.33294-8-tzimmermann@suse.de>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] vt: loss of text mode on unblanking if VT was blanked prior to KD_GRAPHICS
- [Medium] vt: display corruption due to premature vga_is_gfx assignment
--

commit 397a971ae2e535d87f46ac40e90cdd6df9d84c84
Author: Thomas Zimmermann <tzimmermann@suse.de>
Subject: vt: Remove old-style con_blank

This commit removes the mode_switch parameter from con_blank and con_unblank
callbacks. Consoles are now updated to detect mode switches internally from
the console state and vc_mode.

> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -4674,10 +4674,7 @@ void do_blank_screen(int entering_gfx)
>  	if (console_blanked) {
>  		if (blank_state == blank_vesa_wait) {
>  			blank_state = blank_off;
> -			if (vc->vc_sw->con_unblank)
> -				vc->vc_sw->con_blank(vc, vesa_blank_mode, 0);
> -			else
> -				vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0);
> +			vc->vc_sw->con_blank(vc, vesa_blank_mode);
>  		}
>  		return;
>  	}

[Severity: High]
If the console is already blanked and not in the vesa_wait state,
do_blank_screen() returns early and skips the con_blank callback entirely.

Because this patch removes the leaving_gfx parameter from the unblank
callback, fbcon_unblank() must now deduce the mode switch internally by
checking if par->graphics is true.

Since par->graphics is only set to true inside fbcon_blank(), skipping
fbcon_blank() leaves it as false:

do_blank_screen()
    if (console_blanked) {
        return; /* fbcon_blank is skipped, par->graphics remains false */
    }

When fbcon_unblank() is later called to switch back to KD_TEXT:

fbcon_unblank()
    bool mode_switch = par->graphics && vc->vc_mode == KD_TEXT;
    if (mode_switch) {
        /* restore text mode */
    }

Does this cause the hardware text mode restoration to be bypassed when
mode_switch evaluates to false, leaving the VT frozen?

> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -797,15 +797,16 @@ static void vga_pal_blank(struct vgastate *state)
>  	}
>  }
>  
> -static bool vgacon_blank(struct vc_data *c, enum vesa_blank_mode blank,
> -			 bool mode_switch)
> +static bool vgacon_blank(struct vc_data *c, enum vesa_blank_mode blank)
>  {
> +	bool mode_switch = !vga_is_gfx && c->vc_mode == KD_GRAPHICS;
> +
> +	if (mode_switch)
> +		vga_is_gfx = true;
> +

[Severity: Medium]
Does setting vga_is_gfx = true here cause vgacon_set_origin() to abort
early?

vgacon_set_origin() is called later in this function during normal blanking:

vgacon_blank()
    if (mode_switch)
        vga_is_gfx = true;

    switch (blank) {
    case VESA_NO_BLANKING:
        vgacon_set_origin(c);

However, vgacon_set_origin() includes an early return if vga_is_gfx is true:

vgacon_set_origin()
    if (vga_is_gfx || ... )
        return;

If vgacon_set_origin() is skipped, the hardware CRTC offset won't be
reset to vga_vram_base. Even though scr_memsetw() clears the memory
at vga_vram_base, will the unreset CRTC offset cause the display hardware
to continue showing old memory, resulting in display corruption?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261016093357.33294-1-tzimmermann@suse.de?part=7

      reply	other threads:[~2026-10-16 10:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  9:11 [PATCH v2 0/7] vt: Simplify console-blanking interface Thomas Zimmermann
2026-10-16  9:11 ` [PATCH v2 1/7] vt: Add con_unblank callback to struct consw Thomas Zimmermann
2026-10-16  9:44   ` sashiko-bot
2026-10-16  9:11 ` [PATCH v2 2/7] dummycon: Implement struct consw.con_unblank Thomas Zimmermann
2026-10-16  9:46   ` sashiko-bot
2026-10-16  9:11 ` [PATCH v2 3/7] fbcon: " Thomas Zimmermann
2026-10-16 10:01   ` sashiko-bot
2026-10-16  9:11 ` [PATCH v2 4/7] newport_con: " Thomas Zimmermann
2026-10-16 10:07   ` sashiko-bot
2026-10-16  9:11 ` [PATCH v2 5/7] sticon: " Thomas Zimmermann
2026-10-16 10:13   ` sashiko-bot
2026-10-16  9:11 ` [PATCH v2 6/7] vgacon: " Thomas Zimmermann
2026-10-16 10:26   ` sashiko-bot
2026-10-16  9:11 ` [PATCH v2 7/7] vt: Remove old-style con_blank Thomas Zimmermann
2026-10-16 10:38   ` 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-174187@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tzimmermann@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox