[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <152587072544.17316.5950935243917346341.stgit@devbox>
Date: Wed, 9 May 2018 21:58:45 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: x86@...nel.org, LKML <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>, Ingo Molnar <mingo@...nel.org>
Cc: Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>,
Alexei Starovoitov <ast@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
"David S . Miller" <davem@...emloft.net>,
Steven Rostedt <rostedt@...dmis.org>,
Francis Deslauriers <francis.deslauriers@...icios.com>,
Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
Borislav Petkov <bp@...e.de>, Yonghong Song <yhs@...com>
Subject: [PATCH 2/2] uprobes: x86: Prohibit probing on MOV SS instruction
Since MOV SS and POP SS instructions will delay the exceptions
until the next instruction is executed, we should not do
single-stepping on it by uprobes.
uprobe already rejects probing on POP SS (0x1f), but allows
probing on MOV SS (0x8e and reg == 2).
This checks the target instruction and if it is MOV SS
or POP SS, returns -ENOTSUPP to reject probing.
Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
---
arch/x86/kernel/uprobes.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
index 85c7ef23d99f..c84bb5396958 100644
--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -299,6 +299,10 @@ static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool
if (is_prefix_bad(insn))
return -ENOTSUPP;
+ /* We should not singlestep on the exception masking instructions */
+ if (insn_masking_exception(insn))
+ return -ENOTSUPP;
+
if (x86_64)
good_insns = good_insns_64;
else
Powered by blists - more mailing lists