From: Greg KH <gregkh@linuxfoundation.org>
To: Wang Zihan <jiyu03@qq.com>
Cc: jirislaby@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vt: add mode validation in vt_setactivate
Date: Sun, 26 Jul 2026 15:26:45 +0200 [thread overview]
Message-ID: <2026072618-scrounger-eskimo-3a01@gregkh> (raw)
In-Reply-To: <tencent_6A7DAE2E1288663D23AACBE2950D6E535007@qq.com>
On Sun, May 03, 2026 at 03:46:15AM +0800, Wang Zihan wrote:
> The vt_setactivate() function accepts any mode value without validation,
> while VT_SETMODE correctly rejects invalid values (only VT_AUTO and
> VT_PROCESS are valid).
>
> This allows users to set invalid mode values (e.g., 0xFF) which bypasses
> VT_PROCESS signal handling and causes undefined VT switching behavior.
>
> Fix this by adding the same validation as VT_SETMODE.
>
> Signed-off-by: Wang Zihan <jiyu03@qq.com>
> ---
> drivers/tty/vt/vt_ioctl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
> index 28993a3d0acb..b8787283a0fa 100644
> --- a/drivers/tty/vt/vt_ioctl.c
> +++ b/drivers/tty/vt/vt_ioctl.c
> @@ -596,6 +596,8 @@ static int vt_setactivate(struct vt_setactivate __user *sa)
> return -EFAULT;
> if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
> return -ENXIO;
> + if (vsa.mode.mode != VT_AUTO && vsa.mode.mode != VT_PROCESS)
> + return -EINVAL;
Are you sure this isn't intentional? How was this tested? If an
"invalid" mode is set, what happens?
thanks,
greg k-h
next prev parent reply other threads:[~2026-07-26 13:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-02 19:46 Wang Zihan
2026-07-26 13:26 ` Greg KH [this message]
[not found] <20260502194615.3345069-1-jiyu03@qq.com>
2026-07-25 3:27 ` Wang Zihan
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=2026072618-scrounger-eskimo-3a01@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=jiyu03@qq.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®