All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Masami Hiramatsu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mhiramat@kernel.org, yhs@fb.com, torvalds@linux-foundation.org,
	bp@suse.de, luto@kernel.org,
	ricardo.neri-calderon@linux.intel.com,
	linux-kernel@vger.kernel.org, oleg@redhat.com, mingo@kernel.org,
	francis.deslauriers@efficios.com, rostedt@goodmis.org,
	ast@kernel.org, hpa@zytor.com, tglx@linutronix.de,
	davem@davemloft.net
Subject: [tip:x86/urgent] uprobes/x86: Prohibit probing on MOV SS instruction
Date: Sun, 13 May 2018 10:58:17 -0700	[thread overview]
Message-ID: <tip-13ebe18c94f5b0665c01ae7fad2717ae959f4212@git.kernel.org> (raw)
In-Reply-To: <152587072544.17316.5950935243917346341.stgit@devbox>

Commit-ID:  13ebe18c94f5b0665c01ae7fad2717ae959f4212
Gitweb:     https://git.kernel.org/tip/13ebe18c94f5b0665c01ae7fad2717ae959f4212
Author:     Masami Hiramatsu <mhiramat@kernel.org>
AuthorDate: Wed, 9 May 2018 21:58:45 +0900
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 13 May 2018 19:52:56 +0200

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, 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 <mhiramat@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Cc: Francis Deslauriers <francis.deslauriers@efficios.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "David S . Miller" <davem@davemloft.net>
Link: https://lkml.kernel.org/r/152587072544.17316.5950935243917346341.stgit@devbox

---
 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

  parent reply	other threads:[~2018-05-13 17:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 12:57 [PATCH 0/2] uprobes: x86: Reject probing MOV SS Masami Hiramatsu
2018-05-09 12:58 ` [PATCH 1/2] kprobes: x86: Prohibit probing on exception masking instructions Masami Hiramatsu
2018-05-13 17:57   ` [tip:x86/urgent] kprobes/x86: " tip-bot for Masami Hiramatsu
2018-05-09 12:58 ` [PATCH 2/2] uprobes: x86: Prohibit probing on MOV SS instruction Masami Hiramatsu
2018-05-09 16:39   ` Oleg Nesterov
2018-05-13 17:58   ` tip-bot for Masami Hiramatsu [this message]
2018-05-09 13:01 ` [PATCH 0/2] uprobes: kprobes: x86: Reject probing MOV SS/POP SS Masami Hiramatsu
2018-05-09 14:36 ` [PATCH 0/2] uprobes: x86: Reject probing MOV SS Andy Lutomirski
2018-05-09 22:25   ` Masami Hiramatsu

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=tip-13ebe18c94f5b0665c01ae7fad2717ae959f4212@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=ast@kernel.org \
    --cc=bp@suse.de \
    --cc=davem@davemloft.net \
    --cc=francis.deslauriers@efficios.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=ricardo.neri-calderon@linux.intel.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=yhs@fb.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.