From: sashiko-bot@kernel.org
To: "Arun Iyengar" <aiyengar1990@gmail.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH] vt: allocate the screen buffers with kvzalloc()
Date: Thu, 19 Nov 2026 16:49:00 +0000 [thread overview]
Message-ID: <sashiko-outbox-223572@kernel.org> (raw)
In-Reply-To: <20261119-vt-kvzalloc-v1-1-5e5f59b37f61@gmail.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] tty: vt: workqueue list corruption in vc_allocate() [1]
--
commit 8bede9243468256cdb289eb4eeab40a8e30c6847
Author: Arun Iyengar <aiyengar1990@gmail.com>
vt: allocate the screen buffers with kvzalloc()
This commit replaces kzalloc(), kmemdup(), and kfree() with kvzalloc(),
kvmemdup(), and kvfree() for virtual console screen buffers and saved
alternate screen buffers so large allocations can fall back to vmalloc.
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 7dbc0072a40a9..cdc862be4d6fd 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
[ ... ]
> @@ -1483,10 +1483,10 @@ struct vc_data *vc_deallocate(unsigned int currcons)
> con_free_unimap(vc);
> put_pid(vc->vt_pid);
> vc_uniscr_set(vc, NULL);
> - kfree(vc->vc_screenbuf);
> + kvfree(vc->vc_screenbuf);
> vc_cons[currcons].d = NULL;
> if (vc->vc_saved_screen != NULL) {
> - kfree(vc->vc_saved_screen);
> + kvfree(vc->vc_saved_screen);
> vc->vc_saved_screen = NULL;
> }
> vc_uniscr_free(vc->vc_saved_uni_lines);
[Severity: Critical]
This problem wasn't introduced by this patch, but can vc_deallocate() leave
vc_cons[currcons].SAK_work pending [1] so that a subsequent
vc_allocate() corrupts the workqueue list?
When a Secure Attention Key event schedules vc_cons[currcons].SAK_work and
userspace immediately disallocates the console via VT_DISALLOCATE,
vc_deallocate() tears down the console without canceling SAK_work. If the
console is reallocated before the worker runs, vc_allocate() calls
INIT_WORK() on the queued work_struct:
drivers/tty/vt/vt.c:vc_allocate() {
...
vc_cons[currcons].d = vc;
tty_port_init(&vc->port);
vc->port.ops = &vc_port_ops;
INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
...
}
Reinitializing an active work_struct overwrites its internal list pointers
and corrupts the global workqueue.
[1] https://sashiko.dev/#/bug/linux-5b343630-72f6-4db2-9969-c2c292698bcb
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119-vt-kvzalloc-v1-1-5e5f59b37f61@gmail.com?part=1
prev parent reply other threads:[~2026-11-19 16:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 16:39 [PATCH] vt: allocate the screen buffers with kvzalloc() Arun Iyengar via B4 Relay
2026-11-19 16:49 ` 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-223572@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aiyengar1990@gmail.com \
--cc=linux-serial@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox