* [PATCH] vt: add mode validation in vt_setactivate
@ 2026-05-02 19:46 Wang Zihan
2026-07-26 13:26 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Wang Zihan @ 2026-05-02 19:46 UTC (permalink / raw)
To: gregkh, jirislaby; +Cc: linux-kernel, Wang Zihan
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;
vsa.console--;
vsa.console = array_index_nospec(vsa.console, MAX_NR_CONSOLES);
--
2.54.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vt: add mode validation in vt_setactivate
2026-05-02 19:46 [PATCH] vt: add mode validation in vt_setactivate Wang Zihan
@ 2026-07-26 13:26 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-07-26 13:26 UTC (permalink / raw)
To: Wang Zihan; +Cc: jirislaby, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vt: add mode validation in vt_setactivate
[not found] <20260502194615.3345069-1-jiyu03@qq.com>
@ 2026-07-25 3:27 ` Wang Zihan
0 siblings, 0 replies; 3+ messages in thread
From: Wang Zihan @ 2026-07-25 3:27 UTC (permalink / raw)
To: gregkh, jirislaby; +Cc: linux-kernel, Wang Zihan
Hi,
I'm writing to follow up on my patch "[PATCH] vt: add mode validation in vt_setactivate" which I sent on May 3, 2026.
Could you please let me know the status of this patch? Is there anything I need to address or update?
Thank you for your time.
Best regards,
Wang Zihan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-26 13:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-02 19:46 [PATCH] vt: add mode validation in vt_setactivate Wang Zihan
2026-07-26 13:26 ` Greg KH
[not found] <20260502194615.3345069-1-jiyu03@qq.com>
2026-07-25 3:27 ` Wang Zihan
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®