From: "tip-bot2 for Kirill A. Shutemov" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Joerg Roedel <jroedel@suse.de>,
Tom Lendacky <thomas.lendacky@amd.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/misc] x86/insn-eval: Handle insn_get_opcode() failure
Date: Tue, 30 Nov 2021 22:56:37 -0000 [thread overview]
Message-ID: <163831299708.11128.7866012474234259026.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20211130184933.31005-2-kirill.shutemov@linux.intel.com>
The following commit has been merged into the x86/misc branch of tip:
Commit-ID: 23ef731e4365196bfc186358eb4f6265d60ab352
Gitweb: https://git.kernel.org/tip/23ef731e4365196bfc186358eb4f6265d60ab352
Author: Kirill A. Shutemov <kirill@shutemov.name>
AuthorDate: Tue, 30 Nov 2021 21:49:30 +03:00
Committer: Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Tue, 30 Nov 2021 14:52:26 -08:00
x86/insn-eval: Handle insn_get_opcode() failure
is_string_insn() calls insn_get_opcode() that can fail, but does not
handle the failure.
is_string_insn() interface does not allow to communicate an error to the
caller.
Push insn_get_opcode() to the only non-static user of is_string_insn()
and fail it early if insn_get_opcode() fails.
[ dhansen: fix tabs-versus-spaces breakage ]
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Tested-by: Joerg Roedel <jroedel@suse.de>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lkml.kernel.org/r/20211130184933.31005-2-kirill.shutemov@linux.intel.com
---
arch/x86/lib/insn-eval.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/lib/insn-eval.c b/arch/x86/lib/insn-eval.c
index eb3ccff..1c51e8a 100644
--- a/arch/x86/lib/insn-eval.c
+++ b/arch/x86/lib/insn-eval.c
@@ -37,8 +37,6 @@ enum reg_type {
*/
static bool is_string_insn(struct insn *insn)
{
- insn_get_opcode(insn);
-
/* All string instructions have a 1-byte opcode. */
if (insn->opcode.nbytes != 1)
return false;
@@ -1405,6 +1403,9 @@ void __user *insn_get_addr_ref(struct insn *insn, struct pt_regs *regs)
if (!insn || !regs)
return (void __user *)-1L;
+ if (insn_get_opcode(insn))
+ return (void __user *)-1L;
+
switch (insn->addr_bytes) {
case 2:
return get_addr_ref_16(insn, regs);
next prev parent reply other threads:[~2021-11-30 22:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-30 18:49 [PATCHv4 0/4] Add generic MMIO instruction deconding to be used in SEV and TDX Kirill A. Shutemov
2021-11-30 18:49 ` [PATCHv4 1/4] x86/insn-eval: Handle insn_get_opcode() failure Kirill A. Shutemov
2021-11-30 22:56 ` tip-bot2 for Kirill A. Shutemov [this message]
2021-11-30 18:49 ` [PATCHv4 2/4] x86/insn-eval: Introduce insn_get_modrm_reg_ptr() Kirill A. Shutemov
2021-11-30 22:56 ` [tip: x86/misc] " tip-bot2 for Kirill A. Shutemov
2021-11-30 18:49 ` [PATCHv4 3/4] x86/insn-eval: Introduce insn_decode_mmio() Kirill A. Shutemov
2021-11-30 22:56 ` [tip: x86/misc] " tip-bot2 for Kirill A. Shutemov
2021-11-30 18:49 ` [PATCHv4 4/4] x86/sev-es: Use insn_decode_mmio() for MMIO implementation Kirill A. Shutemov
2021-11-30 22:56 ` [tip: x86/misc] " tip-bot2 for Kirill A. Shutemov
2021-11-30 22:11 ` [PATCHv4 0/4] Add generic MMIO instruction deconding to be used in SEV and TDX Tom Lendacky
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=163831299708.11128.7866012474234259026.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=dave.hansen@linux.intel.com \
--cc=jroedel@suse.de \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=thomas.lendacky@amd.com \
--cc=x86@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®