All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: x86@kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>, Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Steven Rostedt <rostedt@goodmis.org>,
	Francis Deslauriers <francis.deslauriers@efficios.com>,
	Ricardo Neri <ricardo.neri-calderon@linux.intel.com>,
	Borislav Petkov <bp@suse.de>, Yonghong Song <yhs@fb.com>
Subject: [PATCH 2/2] uprobes: x86: Prohibit probing on MOV SS instruction
Date: Wed,  9 May 2018 21:58:45 +0900	[thread overview]
Message-ID: <152587072544.17316.5950935243917346341.stgit@devbox> (raw)
In-Reply-To: <152587066475.17316.3035446966107675608.stgit@devbox>

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@kernel.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

  parent reply	other threads:[~2018-05-09 12: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 ` Masami Hiramatsu [this message]
2018-05-09 16:39   ` [PATCH 2/2] uprobes: x86: Prohibit probing on MOV SS instruction Oleg Nesterov
2018-05-13 17:58   ` [tip:x86/urgent] uprobes/x86: " tip-bot for Masami Hiramatsu
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=152587072544.17316.5950935243917346341.stgit@devbox \
    --to=mhiramat@kernel.org \
    --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=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --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=x86@kernel.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.