All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Ingo Molnar <mingo@redhat.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	peterz@infradead.org,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Andrea Righi <righi.andrea@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	stable@vger.kernel.org
Subject: [PATCH 2/9] x86/kprobes: Move trampoline code into RODATA
Date: Thu, 10 Jan 2019 11:54:59 +0900	[thread overview]
Message-ID: <154708889905.6325.18090730996982550993.stgit@devbox> (raw)
In-Reply-To: <154708884117.6325.4454464467156828009.stgit@devbox>

Move optprobe trampoline code into RODATA since it is
not executed, but copied and modified to be used on
a trampoline buffer.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 arch/x86/kernel/kprobes/opt.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index 544bd41a514c..f14262952015 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -97,6 +97,7 @@ static void synthesize_set_arg1(kprobe_opcode_t *addr, unsigned long val)
 }
 
 asm (
+			".pushsection .rodata\n"
 			"optprobe_template_func:\n"
 			".global optprobe_template_entry\n"
 			"optprobe_template_entry:\n"
@@ -136,16 +137,10 @@ asm (
 #endif
 			".global optprobe_template_end\n"
 			"optprobe_template_end:\n"
-			".type optprobe_template_func, @function\n"
-			".size optprobe_template_func, .-optprobe_template_func\n");
+			".popsection\n");
 
 void optprobe_template_func(void);
 STACK_FRAME_NON_STANDARD(optprobe_template_func);
-NOKPROBE_SYMBOL(optprobe_template_func);
-NOKPROBE_SYMBOL(optprobe_template_entry);
-NOKPROBE_SYMBOL(optprobe_template_val);
-NOKPROBE_SYMBOL(optprobe_template_call);
-NOKPROBE_SYMBOL(optprobe_template_end);
 
 #define TMPL_MOVE_IDX \
 	((long)optprobe_template_val - (long)optprobe_template_entry)


  parent reply	other threads:[~2019-01-10  2:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10  2:54 [PATCH 0/9] kprobes: Fix and improve blacklist symbols Masami Hiramatsu
2019-01-10  2:54 ` [PATCH 1/9] x86/kprobes: Prohibit probing on optprobe template code Masami Hiramatsu
2019-01-10  6:07   ` Greg KH
2019-01-10 14:57     ` Masami Hiramatsu
2019-01-10 17:10       ` Steven Rostedt
2019-01-11  0:52         ` Masami Hiramatsu
2019-01-10  2:54 ` Masami Hiramatsu [this message]
2019-01-10  2:55 ` [PATCH 3/9] x86/kprobes: Prohibit probing on functions before kprobe_int3_handler() Masami Hiramatsu
2019-01-10  2:55 ` [PATCH 4/9] x86/kprobes: Prohibit probing on IRQ handlers directly Masami Hiramatsu
2019-01-10  2:56 ` [PATCH 5/9] kprobes: Search non-suffixed symbol in blacklist Masami Hiramatsu
2019-01-10  2:56 ` [PATCH 6/9] kprobes: Prohibit probing on hardirq tracers Masami Hiramatsu
2019-01-10 17:12   ` Steven Rostedt
2019-01-11 14:21     ` Masami Hiramatsu
2019-01-10  2:57 ` [PATCH 7/9] kprobes: Prohibit probing on preempt_check debug functions Masami Hiramatsu
2019-01-10  2:57 ` [PATCH 8/9] kprobes: Prohibit probing on RCU debug routine Masami Hiramatsu
2019-01-10  2:58 ` [PATCH 9/9] kprobes: Prohibit probing on lockdep functions 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=154708889905.6325.18090730996982550993.stgit@devbox \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=righi.andrea@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=stable@vger.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 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.