4.14-stable review patch.  If anyone has any objections, please let me know.

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

From: Masami Hiramatsu <mhira...@kernel.org>

[ Upstream commit 13ebe18c94f5b0665c01ae7fad2717ae959f4212 ]

Since MOV SS and POP SS instructions will delay the exceptions until the
next instruction is executed, single-stepping on it by uprobes must be
prohibited.

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 <mhira...@kernel.org>
Signed-off-by: Thomas Gleixner <t...@linutronix.de>
Acked-by: Oleg Nesterov <o...@redhat.com>
Cc: Ricardo Neri <ricardo.neri-calde...@linux.intel.com>
Cc: Francis Deslauriers <francis.deslauri...@efficios.com>
Cc: Alexei Starovoitov <a...@kernel.org>
Cc: Steven Rostedt <rost...@goodmis.org>
Cc: Andy Lutomirski <l...@kernel.org>
Cc: "H . Peter Anvin" <h...@zytor.com>
Cc: Yonghong Song <y...@fb.com>
Cc: Borislav Petkov <b...@suse.de>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: "David S . Miller" <da...@davemloft.net>
Link: 
https://lkml.kernel.org/r/152587072544.17316.5950935243917346341.stgit@devbox
Signed-off-by: Sasha Levin <alexander.le...@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 arch/x86/kernel/uprobes.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -296,6 +296,10 @@ static int uprobe_init_insn(struct arch_
        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


Reply via email to