]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
x86/insn-eval: Use new for_each_insn_prefix() macro to loop over prefixes bytes
authorMasami Hiramatsu <mhiramat@kernel.org>
Thu, 3 Dec 2020 04:50:50 +0000 (13:50 +0900)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 20 Jan 2021 13:25:06 +0000 (14:25 +0100)
commitfbd9054cdaf6f44416d811da9fbcf75a577d9d97
tree0b8648be0347b5b8b686691e2aec59fd1bf29051
parentab2c4585862446fdc1ac2f8dfedabe730f2e79e0
x86/insn-eval: Use new for_each_insn_prefix() macro to loop over prefixes bytes

BugLink: https://bugs.launchpad.net/bugs/1910784
commit 12cb908a11b2544b5f53e9af856e6b6a90ed5533 upstream

Since insn.prefixes.nbytes can be bigger than the size of
insn.prefixes.bytes[] when a prefix is repeated, the proper check must
be

  insn.prefixes.bytes[i] != 0 and i < 4

instead of using insn.prefixes.nbytes. Use the new
for_each_insn_prefix() macro which does it correctly.

Debugged by Kees Cook <keescook@chromium.org>.

 [ bp: Massage commit message. ]

Fixes: 32d0b95300db ("x86/insn-eval: Add utility functions to get segment selector")
Reported-by: syzbot+9b64b619f10f19d19a7c@syzkaller.appspotmail.com
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/160697104969.3146288.16329307586428270032.stgit@devnote2
[sudip: adjust context]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
arch/x86/lib/insn-eval.c