Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1700057 > unrolled thread

[PATCH -tip 0/2] kprobes/x86: RO text code bugfix and cleanup

Started byMasami Hiramatsu <mhiramat@kernel.org>
First post2017-07-31 15:40 +0200
Last post2017-07-31 15:50 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH -tip 0/2] kprobes/x86: RO text code bugfix and cleanup Masami Hiramatsu <mhiramat@kernel.org> - 2017-07-31 15:40 +0200
    [PATCH -tip 2/2] kprobes/x86: Remove addressof operators Masami Hiramatsu <mhiramat@kernel.org> - 2017-07-31 15:50 +0200

#1700057 — [PATCH -tip 0/2] kprobes/x86: RO text code bugfix and cleanup

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2017-07-31 15:40 +0200
Subject[PATCH -tip 0/2] kprobes/x86: RO text code bugfix and cleanup
Message-ID<u9j5o-6QC-23@gated-at.bofh.it>
Hi,

This series fixes a kprobe-x86 bug related to RO text and
cleans up addressof operators.

The first one is an obvious bug that misses to set memory
RO when the function fails. I've just add set_memory_ro()
on error exit.

And the second one is just a cleanup patch to remove
addressof operators ("&") since it is meaningless anymore.

Please apply these, since this series is independent from
another bugfix related to optprobe discussing in other
thread.

Thanks,

---

Masami Hiramatsu (2):
      kprobes/x86: Don't forget to set memory back to RO on failure
      kprobes/x86: Remove addressof operators


 arch/x86/include/asm/kprobes.h |    4 ++--
 arch/x86/kernel/kprobes/core.c |    4 +++-
 arch/x86/kernel/kprobes/opt.c  |    9 +++++----
 3 files changed, 10 insertions(+), 7 deletions(-)

--
Masami Hiramatsu <mhiramat@kernel.org>

[toc] | [next] | [standalone]


#1700060 — [PATCH -tip 2/2] kprobes/x86: Remove addressof operators

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2017-07-31 15:50 +0200
Subject[PATCH -tip 2/2] kprobes/x86: Remove addressof operators
Message-ID<u9jf3-6U3-5@gated-at.bofh.it>
In reply to#1700057
Since commit 54a7d50b9205 ("x86: mark kprobe templates as
character arrays, not single characters") changes
optprobe_template_* to arrays, we can remove addressof
operators from those symbols.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 arch/x86/include/asm/kprobes.h |    4 ++--
 arch/x86/kernel/kprobes/opt.c  |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h
index 6cf65437b5e5..9f2e3102e0bb 100644
--- a/arch/x86/include/asm/kprobes.h
+++ b/arch/x86/include/asm/kprobes.h
@@ -58,8 +58,8 @@ extern __visible kprobe_opcode_t optprobe_template_call[];
 extern __visible kprobe_opcode_t optprobe_template_end[];
 #define MAX_OPTIMIZED_LENGTH (MAX_INSN_SIZE + RELATIVE_ADDR_SIZE)
 #define MAX_OPTINSN_SIZE 				\
-	(((unsigned long)&optprobe_template_end -	\
-	  (unsigned long)&optprobe_template_entry) +	\
+	(((unsigned long)optprobe_template_end -	\
+	  (unsigned long)optprobe_template_entry) +	\
 	 MAX_OPTIMIZED_LENGTH + RELATIVEJUMP_SIZE)
 
 extern const int kretprobe_blacklist_size;
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index 853614560a4f..021eb6c9dde1 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -141,11 +141,11 @@ void optprobe_template_func(void);
 STACK_FRAME_NON_STANDARD(optprobe_template_func);
 
 #define TMPL_MOVE_IDX \
-	((long)&optprobe_template_val - (long)&optprobe_template_entry)
+	((long)optprobe_template_val - (long)optprobe_template_entry)
 #define TMPL_CALL_IDX \
-	((long)&optprobe_template_call - (long)&optprobe_template_entry)
+	((long)optprobe_template_call - (long)optprobe_template_entry)
 #define TMPL_END_IDX \
-	((long)&optprobe_template_end - (long)&optprobe_template_entry)
+	((long)optprobe_template_end - (long)optprobe_template_entry)
 
 #define INT3_SIZE sizeof(kprobe_opcode_t)
 
@@ -374,7 +374,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op,
 	op->optinsn.size = ret;
 
 	/* Copy arch-dep-instance from template */
-	memcpy(buf, &optprobe_template_entry, TMPL_END_IDX);
+	memcpy(buf, optprobe_template_entry, TMPL_END_IDX);
 
 	/* Set probe information */
 	synthesize_set_arg1(buf + TMPL_MOVE_IDX, (unsigned long)op);

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web