Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1353813 > unrolled thread
| Started by | David Long <dave.long@linaro.org> |
|---|---|
| First post | 2016-03-09 06:40 +0100 |
| Last post | 2016-03-21 14:40 +0100 |
| Articles | 6 on this page of 26 — 6 participants |
Back to article view | Back to linux.kernel
[PATCH v11 0/9] arm64: Add kernel probes (kprobes) support David Long <dave.long@linaro.org> - 2016-03-09 06:40 +0100
[PATCH v11 4/9] arm64: add conditional instruction simulation support David Long <dave.long@linaro.org> - 2016-03-09 06:40 +0100
Re: [PATCH v11 4/9] arm64: add conditional instruction simulation support Marc Zyngier <marc.zyngier@arm.com> - 2016-03-13 13:10 +0100
Re: [PATCH v11 4/9] arm64: add conditional instruction simulation support Pratyush Anand <panand@redhat.com> - 2016-03-14 05:10 +0100
Re: [PATCH v11 4/9] arm64: add conditional instruction simulation support Marc Zyngier <marc.zyngier@arm.com> - 2016-03-14 08:40 +0100
Re: [PATCH v11 4/9] arm64: add conditional instruction simulation support David Long <dave.long@linaro.org> - 2016-03-21 09:40 +0100
[PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist David Long <dave.long@linaro.org> - 2016-03-09 06:40 +0100
Re: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist James Morse <james.morse@arm.com> - 2016-03-15 19:50 +0100
Re: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist Pratyush Anand <panand@redhat.com> - 2016-03-16 06:50 +0100
Re: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist James Morse <james.morse@arm.com> - 2016-03-16 11:30 +0100
Re: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist Pratyush Anand <panand@redhat.com> - 2016-03-17 09:00 +0100
Re: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist Pratyush Anand <panand@redhat.com> - 2016-03-18 14:30 +0100
Re: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist James Morse <james.morse@arm.com> - 2016-03-18 15:10 +0100
Re: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist Pratyush Anand <panand@redhat.com> - 2016-03-18 15:50 +0100
Re: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist James Morse <james.morse@arm.com> - 2016-03-18 19:20 +0100
Re: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist Pratyush Anand <panand@redhat.com> - 2016-03-21 06:20 +0100
Re: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist Will Deacon <will.deacon@arm.com> - 2016-03-21 16:00 +0100
Re: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist Pratyush Anand <panand@redhat.com> - 2016-03-22 18:00 +0100
RE: [PATCH v11 3/9] arm64: add copy_to/from_user to kprobes blacklist 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2016-03-17 13:10 +0100
[PATCH v11 5/9] arm64: Kprobes with single stepping support David Long <dave.long@linaro.org> - 2016-03-09 06:40 +0100
[PATCH v11 9/9] kprobes: Add arm64 case in kprobe example module David Long <dave.long@linaro.org> - 2016-03-09 06:40 +0100
[PATCH v11 2/9] arm64: Add more test functions to insn.c David Long <dave.long@linaro.org> - 2016-03-09 06:40 +0100
[PATCH v11 8/9] arm64: Add kernel return probes support (kretprobes) David Long <dave.long@linaro.org> - 2016-03-09 06:40 +0100
RE: [PATCH v11 8/9] arm64: Add kernel return probes support (kretprobes) 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2016-03-17 13:30 +0100
RE: [PATCH v11 8/9] arm64: Add kernel return probes support (kretprobes) 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2016-03-17 14:00 +0100
Re: [PATCH v11 8/9] arm64: Add kernel return probes support (kretprobes) David Long <dave.long@linaro.org> - 2016-03-21 14:40 +0100
Page 2 of 2 — ← Prev page 1 [2]
| From | David Long <dave.long@linaro.org> |
|---|---|
| Date | 2016-03-09 06:40 +0100 |
| Subject | [PATCH v11 9/9] kprobes: Add arm64 case in kprobe example module |
| Message-ID | <raF0L-3nW-47@gated-at.bofh.it> |
| In reply to | #1353813 |
From: Sandeepa Prabhu <sandeepa.s.prabhu@gmail.com>
Add info prints in sample kprobe handlers for ARM64
Signed-off-by: Sandeepa Prabhu <sandeepa.s.prabhu@gmail.com>
---
samples/kprobes/kprobe_example.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c
index 727eb21..0c72b8a 100644
--- a/samples/kprobes/kprobe_example.c
+++ b/samples/kprobes/kprobe_example.c
@@ -42,6 +42,10 @@ static int handler_pre(struct kprobe *p, struct pt_regs *regs)
" ex1 = 0x%lx\n",
p->addr, regs->pc, regs->ex1);
#endif
+#ifdef CONFIG_ARM64
+ pr_info("pre_handler: p->addr = 0x%p, pc = 0x%lx\n",
+ p->addr, (long)regs->pc);
+#endif
/* A dump_stack() here will give a stack backtrace */
return 0;
@@ -67,6 +71,10 @@ static void handler_post(struct kprobe *p, struct pt_regs *regs,
printk(KERN_INFO "post_handler: p->addr = 0x%p, ex1 = 0x%lx\n",
p->addr, regs->ex1);
#endif
+#ifdef CONFIG_ARM64
+ pr_info("post_handler: p->addr = 0x%p, pc = 0x%lx\n",
+ p->addr, (long)regs->pc);
+#endif
}
/*
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | David Long <dave.long@linaro.org> |
|---|---|
| Date | 2016-03-09 06:40 +0100 |
| Subject | [PATCH v11 2/9] arm64: Add more test functions to insn.c |
| Message-ID | <raF0L-3nW-49@gated-at.bofh.it> |
| In reply to | #1353813 |
From: "David A. Long" <dave.long@linaro.org>
Certain instructions are hard to execute correctly out-of-line (as in
kprobes). Test functions are added to insn.[hc] to identify these. The
instructions include any that use PC-relative addressing, change the PC,
or change interrupt masking. For efficiency and simplicity test
functions are also added for small collections of related instructions.
Signed-off-by: David A. Long <dave.long@linaro.org>
---
arch/arm64/include/asm/insn.h | 35 +++++++++++++++++++++++++++++++++++
arch/arm64/kernel/insn.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)
diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h
index 30e50eb..662b42a 100644
--- a/arch/arm64/include/asm/insn.h
+++ b/arch/arm64/include/asm/insn.h
@@ -120,6 +120,29 @@ enum aarch64_insn_register {
AARCH64_INSN_REG_SP = 31 /* Stack pointer: as load/store base reg */
};
+enum aarch64_insn_special_register {
+ AARCH64_INSN_SPCLREG_SPSR_EL1 = 0xC200,
+ AARCH64_INSN_SPCLREG_ELR_EL1 = 0xC201,
+ AARCH64_INSN_SPCLREG_SP_EL0 = 0xC208,
+ AARCH64_INSN_SPCLREG_SPSEL = 0xC210,
+ AARCH64_INSN_SPCLREG_CURRENTEL = 0xC212,
+ AARCH64_INSN_SPCLREG_DAIF = 0xDA11,
+ AARCH64_INSN_SPCLREG_NZCV = 0xDA10,
+ AARCH64_INSN_SPCLREG_FPCR = 0xDA20,
+ AARCH64_INSN_SPCLREG_DSPSR_EL0 = 0xDA28,
+ AARCH64_INSN_SPCLREG_DLR_EL0 = 0xDA29,
+ AARCH64_INSN_SPCLREG_SPSR_EL2 = 0xE200,
+ AARCH64_INSN_SPCLREG_ELR_EL2 = 0xE201,
+ AARCH64_INSN_SPCLREG_SP_EL1 = 0xE208,
+ AARCH64_INSN_SPCLREG_SPSR_INQ = 0xE218,
+ AARCH64_INSN_SPCLREG_SPSR_ABT = 0xE219,
+ AARCH64_INSN_SPCLREG_SPSR_UND = 0xE21A,
+ AARCH64_INSN_SPCLREG_SPSR_FIQ = 0xE21B,
+ AARCH64_INSN_SPCLREG_SPSR_EL3 = 0xF200,
+ AARCH64_INSN_SPCLREG_ELR_EL3 = 0xF201,
+ AARCH64_INSN_SPCLREG_SP_EL2 = 0xF210
+};
+
enum aarch64_insn_variant {
AARCH64_INSN_VARIANT_32BIT,
AARCH64_INSN_VARIANT_64BIT
@@ -223,8 +246,13 @@ static __always_inline bool aarch64_insn_is_##abbr(u32 code) \
static __always_inline u32 aarch64_insn_get_##abbr##_value(void) \
{ return (val); }
+__AARCH64_INSN_FUNCS(adr_adrp, 0x1F000000, 0x10000000)
+__AARCH64_INSN_FUNCS(prfm_lit, 0xFF000000, 0xD8000000)
__AARCH64_INSN_FUNCS(str_reg, 0x3FE0EC00, 0x38206800)
__AARCH64_INSN_FUNCS(ldr_reg, 0x3FE0EC00, 0x38606800)
+__AARCH64_INSN_FUNCS(ldr_lit, 0xBF000000, 0x18000000)
+__AARCH64_INSN_FUNCS(ldrsw_lit, 0xFF000000, 0x98000000)
+__AARCH64_INSN_FUNCS(exclusive, 0x3F800000, 0x08000000)
__AARCH64_INSN_FUNCS(stp_post, 0x7FC00000, 0x28800000)
__AARCH64_INSN_FUNCS(ldp_post, 0x7FC00000, 0x28C00000)
__AARCH64_INSN_FUNCS(stp_pre, 0x7FC00000, 0x29800000)
@@ -273,10 +301,14 @@ __AARCH64_INSN_FUNCS(svc, 0xFFE0001F, 0xD4000001)
__AARCH64_INSN_FUNCS(hvc, 0xFFE0001F, 0xD4000002)
__AARCH64_INSN_FUNCS(smc, 0xFFE0001F, 0xD4000003)
__AARCH64_INSN_FUNCS(brk, 0xFFE0001F, 0xD4200000)
+__AARCH64_INSN_FUNCS(exception, 0xFF000000, 0xD4000000)
__AARCH64_INSN_FUNCS(hint, 0xFFFFF01F, 0xD503201F)
__AARCH64_INSN_FUNCS(br, 0xFFFFFC1F, 0xD61F0000)
__AARCH64_INSN_FUNCS(blr, 0xFFFFFC1F, 0xD63F0000)
__AARCH64_INSN_FUNCS(ret, 0xFFFFFC1F, 0xD65F0000)
+__AARCH64_INSN_FUNCS(mrs, 0xFFF00000, 0xD5300000)
+__AARCH64_INSN_FUNCS(msr_imm, 0xFFF8F01F, 0xD500401F)
+__AARCH64_INSN_FUNCS(msr_reg, 0xFFF00000, 0xD5100000)
#undef __AARCH64_INSN_FUNCS
@@ -286,6 +318,8 @@ bool aarch64_insn_is_branch_imm(u32 insn);
int aarch64_insn_read(void *addr, u32 *insnp);
int aarch64_insn_write(void *addr, u32 insn);
enum aarch64_insn_encoding_class aarch64_get_insn_class(u32 insn);
+bool aarch64_insn_uses_literal(u32 insn);
+bool aarch64_insn_is_branch(u32 insn);
u64 aarch64_insn_decode_immediate(enum aarch64_insn_imm_type type, u32 insn);
u32 aarch64_insn_encode_immediate(enum aarch64_insn_imm_type type,
u32 insn, u64 imm);
@@ -367,6 +401,7 @@ bool aarch32_insn_is_wide(u32 insn);
#define A32_RT_OFFSET 12
#define A32_RT2_OFFSET 0
+u32 aarch64_extract_system_register(u32 insn);
u32 aarch32_insn_extract_reg_num(u32 insn, int offset);
u32 aarch32_insn_mcr_extract_opc2(u32 insn);
u32 aarch32_insn_mcr_extract_crm(u32 insn);
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
index 7371455..60c1c71 100644
--- a/arch/arm64/kernel/insn.c
+++ b/arch/arm64/kernel/insn.c
@@ -162,6 +162,32 @@ static bool __kprobes __aarch64_insn_hotpatch_safe(u32 insn)
aarch64_insn_is_nop(insn);
}
+bool __kprobes aarch64_insn_uses_literal(u32 insn)
+{
+ /* ldr/ldrsw (literal), prfm */
+
+ return aarch64_insn_is_ldr_lit(insn) ||
+ aarch64_insn_is_ldrsw_lit(insn) ||
+ aarch64_insn_is_adr_adrp(insn) ||
+ aarch64_insn_is_prfm_lit(insn);
+}
+
+bool __kprobes aarch64_insn_is_branch(u32 insn)
+{
+ /* b, bl, cb*, tb*, b.cond, br, blr */
+
+ return aarch64_insn_is_b(insn) ||
+ aarch64_insn_is_bl(insn) ||
+ aarch64_insn_is_cbz(insn) ||
+ aarch64_insn_is_cbnz(insn) ||
+ aarch64_insn_is_tbz(insn) ||
+ aarch64_insn_is_tbnz(insn) ||
+ aarch64_insn_is_ret(insn) ||
+ aarch64_insn_is_br(insn) ||
+ aarch64_insn_is_blr(insn) ||
+ aarch64_insn_is_bcond(insn);
+}
+
/*
* ARM Architecture Reference Manual for ARMv8 Profile-A, Issue A.a
* Section B2.6.5 "Concurrent modification and execution of instructions":
@@ -1175,6 +1201,14 @@ u32 aarch64_set_branch_offset(u32 insn, s32 offset)
BUG();
}
+/*
+ * Extract the Op/CR data from a msr/mrs instruction.
+ */
+u32 aarch64_insn_extract_system_reg(u32 insn)
+{
+ return (insn & 0x1FFFE0) >> 5;
+}
+
bool aarch32_insn_is_wide(u32 insn)
{
return insn >= 0xe800;
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | David Long <dave.long@linaro.org> |
|---|---|
| Date | 2016-03-09 06:40 +0100 |
| Subject | [PATCH v11 8/9] arm64: Add kernel return probes support (kretprobes) |
| Message-ID | <raF0L-3nW-51@gated-at.bofh.it> |
| In reply to | #1353813 |
From: Sandeepa Prabhu <sandeepa.s.prabhu@gmail.com>
The pre-handler of this special 'trampoline' kprobe executes the return
probe handler functions and restores original return address in ELR_EL1.
This way the saved pt_regs still hold the original register context to be
carried back to the probed kernel function.
Signed-off-by: Sandeepa Prabhu <sandeepa.s.prabhu@gmail.com>
Signed-off-by: David A. Long <dave.long@linaro.org>
---
arch/arm64/Kconfig | 1 +
arch/arm64/kernel/kprobes.c | 75 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 75 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c395386..72412de 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -82,6 +82,7 @@ config ARM64
select HAVE_RCU_TABLE_FREE
select HAVE_SYSCALL_TRACEPOINTS
select HAVE_KPROBES
+ select HAVE_KRETPROBES if HAVE_KPROBES
select IOMMU_DMA if IOMMU_SUPPORT
select IRQ_DOMAIN
select IRQ_FORCED_THREADING
diff --git a/arch/arm64/kernel/kprobes.c b/arch/arm64/kernel/kprobes.c
index bd3f233..13d3333 100644
--- a/arch/arm64/kernel/kprobes.c
+++ b/arch/arm64/kernel/kprobes.c
@@ -534,7 +534,80 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
void __kprobes __used *trampoline_probe_handler(struct pt_regs *regs)
{
- return NULL;
+ struct kretprobe_instance *ri = NULL;
+ struct hlist_head *head, empty_rp;
+ struct hlist_node *tmp;
+ unsigned long flags, orig_ret_addr = 0;
+ unsigned long trampoline_address =
+ (unsigned long)&kretprobe_trampoline;
+
+ INIT_HLIST_HEAD(&empty_rp);
+ kretprobe_hash_lock(current, &head, &flags);
+
+ /*
+ * It is possible to have multiple instances associated with a given
+ * task either because multiple functions in the call path have
+ * a return probe installed on them, and/or more than one return
+ * probe was registered for a target function.
+ *
+ * We can handle this because:
+ * - instances are always inserted at the head of the list
+ * - when multiple return probes are registered for the same
+ * function, the first instance's ret_addr will point to the
+ * real return address, and all the rest will point to
+ * kretprobe_trampoline
+ */
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
+ if (ri->task != current)
+ /* another task is sharing our hash bucket */
+ continue;
+
+ if (ri->rp && ri->rp->handler) {
+ __this_cpu_write(current_kprobe, &ri->rp->kp);
+ get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE;
+ ri->rp->handler(ri, regs);
+ __this_cpu_write(current_kprobe, NULL);
+ }
+
+ orig_ret_addr = (unsigned long)ri->ret_addr;
+ recycle_rp_inst(ri, &empty_rp);
+
+ if (orig_ret_addr != trampoline_address)
+ /*
+ * This is the real return address. Any other
+ * instances associated with this task are for
+ * other calls deeper on the call stack
+ */
+ break;
+ }
+
+ kretprobe_assert(ri, orig_ret_addr, trampoline_address);
+ /* restore the original return address */
+ instruction_pointer(regs) = orig_ret_addr;
+ reset_current_kprobe();
+ kretprobe_hash_unlock(current, &flags);
+
+ hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
+ hlist_del(&ri->hlist);
+ kfree(ri);
+ }
+
+ /* return 1 so that post handlers not called */
+ return (void *) orig_ret_addr;
+}
+
+void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
+ struct pt_regs *regs)
+{
+ ri->ret_addr = (kprobe_opcode_t *)regs->regs[30];
+
+ /* replace return addr (x30) with trampoline */
+ regs->regs[30] = (long)&kretprobe_trampoline;
+}
+
+int __kprobes arch_trampoline_kprobe(struct kprobe *p)
+{
+ return 0;
}
int __init arch_init_kprobes(void)
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> |
|---|---|
| Date | 2016-03-17 13:30 +0100 |
| Subject | RE: [PATCH v11 8/9] arm64: Add kernel return probes support (kretprobes) |
| Message-ID | <rdFdT-7nw-5@gated-at.bofh.it> |
| In reply to | #1353825 |
Hi,
>From: Sandeepa Prabhu <sandeepa.s.prabhu@gmail.com>
>
>The pre-handler of this special 'trampoline' kprobe executes the return
>probe handler functions and restores original return address in ELR_EL1.
>This way the saved pt_regs still hold the original register context to be
>carried back to the probed kernel function.
This patch seems not well separated.
>diff --git a/arch/arm64/kernel/kprobes.c b/arch/arm64/kernel/kprobes.c
>index bd3f233..13d3333 100644
>--- a/arch/arm64/kernel/kprobes.c
>+++ b/arch/arm64/kernel/kprobes.c
[snip]
>+void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
>+ struct pt_regs *regs)
>+{
>+ ri->ret_addr = (kprobe_opcode_t *)regs->regs[30];
>+
>+ /* replace return addr (x30) with trampoline */
>+ regs->regs[30] = (long)&kretprobe_trampoline;
So, where is the kretprobe_trampoline? It seems that function is
defined in other patch.
>+}
>+
>+int __kprobes arch_trampoline_kprobe(struct kprobe *p)
>+{
>+ return 0;
> }
And what this function is for??
Thank you,
>
> int __init arch_init_kprobes(void)
>--
>2.5.0
>
>
>_______________________________________________
>linux-arm-kernel mailing list
>linux-arm-kernel@lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[toc] | [prev] | [next] | [standalone]
| From | 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> |
|---|---|
| Date | 2016-03-17 14:00 +0100 |
| Subject | RE: [PATCH v11 8/9] arm64: Add kernel return probes support (kretprobes) |
| Message-ID | <rdFGW-7xG-7@gated-at.bofh.it> |
| In reply to | #1359802 |
>From: 平松雅巳 / HIRAMATU,MASAMI [mailto:masami.hiramatsu.pt@hitachi.com]
>
>Hi,
>
>>From: Sandeepa Prabhu <sandeepa.s.prabhu@gmail.com>
>>
>>The pre-handler of this special 'trampoline' kprobe executes the return
>>probe handler functions and restores original return address in ELR_EL1.
>>This way the saved pt_regs still hold the original register context to be
>>carried back to the probed kernel function.
>
>This patch seems not well separated.
>
>>diff --git a/arch/arm64/kernel/kprobes.c b/arch/arm64/kernel/kprobes.c
>>index bd3f233..13d3333 100644
>>--- a/arch/arm64/kernel/kprobes.c
>>+++ b/arch/arm64/kernel/kprobes.c
>
>[snip]
>
>>+void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
>>+ struct pt_regs *regs)
>>+{
>>+ ri->ret_addr = (kprobe_opcode_t *)regs->regs[30];
>>+
>>+ /* replace return addr (x30) with trampoline */
>>+ regs->regs[30] = (long)&kretprobe_trampoline;
>
>So, where is the kretprobe_trampoline? It seems that function is
>defined in other patch.
>
>>+}
>>+
>>+int __kprobes arch_trampoline_kprobe(struct kprobe *p)
>>+{
>>+ return 0;
>> }
>
>And what this function is for??
Ah, sorry, this was my fault. Yes, this function is required.
But this implementation also means there is an asm-based trampoline
function which should be included in this patch.
David, could you tell me the repository which I can get the latest
version of this series? I'd like to see the whole code of kprobes/arm64.
Thank you,
[toc] | [prev] | [next] | [standalone]
| From | David Long <dave.long@linaro.org> |
|---|---|
| Date | 2016-03-21 14:40 +0100 |
| Subject | Re: [PATCH v11 8/9] arm64: Add kernel return probes support (kretprobes) |
| Message-ID | <rf8dP-6jL-3@gated-at.bofh.it> |
| In reply to | #1359820 |
On 03/17/2016 08:58 AM, 平松雅巳 / HIRAMATU,MASAMI wrote:
>> From: 平松雅巳 / HIRAMATU,MASAMI [mailto:masami.hiramatsu.pt@hitachi.com]
>>
>> Hi,
>>
>>> From: Sandeepa Prabhu <sandeepa.s.prabhu@gmail.com>
>>>
>>> The pre-handler of this special 'trampoline' kprobe executes the return
>>> probe handler functions and restores original return address in ELR_EL1.
>>> This way the saved pt_regs still hold the original register context to be
>>> carried back to the probed kernel function.
>>
>> This patch seems not well separated.
>>
>>> diff --git a/arch/arm64/kernel/kprobes.c b/arch/arm64/kernel/kprobes.c
>>> index bd3f233..13d3333 100644
>>> --- a/arch/arm64/kernel/kprobes.c
>>> +++ b/arch/arm64/kernel/kprobes.c
>>
>> [snip]
>>
>>> +void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
>>> + struct pt_regs *regs)
>>> +{
>>> + ri->ret_addr = (kprobe_opcode_t *)regs->regs[30];
>>> +
>>> + /* replace return addr (x30) with trampoline */
>>> + regs->regs[30] = (long)&kretprobe_trampoline;
>>
>> So, where is the kretprobe_trampoline? It seems that function is
>> defined in other patch.
>>
>>> +}
>>> +
>>> +int __kprobes arch_trampoline_kprobe(struct kprobe *p)
>>> +{
>>> + return 0;
>>> }
>>
>> And what this function is for??
>
> Ah, sorry, this was my fault. Yes, this function is required.
> But this implementation also means there is an asm-based trampoline
> function which should be included in this patch.
>
> David, could you tell me the repository which I can get the latest
> version of this series? I'd like to see the whole code of kprobes/arm64.
>
> Thank you,
>
It can be found in:
http://git.linaro.org/people/dave.long/linux.git
...in the kprobes64-v11 branch.
Thanks,
-dl
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | linux.kernel
csiph-web