提交 4da15e13 编写于 作者: J Jakob Koschel 提交者: Zheng Zengkai

vt_ioctl: add array_index_nospec to VT_ACTIVATE

stable inclusion
from stable-v5.10.101
commit f1b25737156c49d3bc353ee6d6d822fafca6954b
bugzilla: https://gitee.com/openeuler/kernel/issues/I5669Z

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f1b25737156c49d3bc353ee6d6d822fafca6954b

--------------------------------

commit 28cb138f upstream.

in vt_setactivate an almost identical code path has been patched
with array_index_nospec. In the VT_ACTIVATE path the user input
is from a system call argument instead of a usercopy.
For consistency both code paths should have the same mitigations
applied.

Kasper Acknowledgements: Jakob Koschel, Brian Johannesmeyer, Kaveh
Razavi, Herbert Bos, Cristiano Giuffrida from the VUSec group at VU
Amsterdam.
Co-developed-by: NBrian Johannesmeyer <bjohannesmeyer@gmail.com>
Signed-off-by: NBrian Johannesmeyer <bjohannesmeyer@gmail.com>
Signed-off-by: NJakob Koschel <jakobkoschel@gmail.com>
Link: https://lore.kernel.org/r/20220127144406.3589293-2-jakobkoschel@gmail.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 68526199
...@@ -945,6 +945,7 @@ int vt_ioctl(struct tty_struct *tty, ...@@ -945,6 +945,7 @@ int vt_ioctl(struct tty_struct *tty,
return -ENXIO; return -ENXIO;
arg--; arg--;
arg = array_index_nospec(arg, MAX_NR_CONSOLES);
console_lock(); console_lock();
ret = vc_allocate(arg); ret = vc_allocate(arg);
console_unlock(); console_unlock();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册