Skip to contentSkip to conversation

rethook: add riscv rethook implementation.

PATCH Wangbinglei 1 participant 1 message Sep 22, 2022

lore
Share & tools
lore
#0 lore raw

Thanks for your tips, I resended modified patch using another mail addr([email protected]).

-----邮件原件-----
发件人: Conor Dooley [mailto:[email protected]]
发送时间: 2022年9月20日 18:32
收件人: wangbinglei (RD) <[email protected]>
抄送: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected] 主题: Re: [PATCH] rethook: add riscv rethook implementation.

Quoted 4 lines · Binglei Wang

From: "wang.binglei" <[email protected]>

Most of the code copied from
arch/riscv/kernel/probes/kprobes_trampoline.S

Hey Wang Binglei,

Please use the commit log to explain the reasons behind the change you are making:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes

Quoted 2 lines

Unfortunately I don't know much about Asian naming, but I assume that the . is not part of your name?

arch/riscv/kernel/probes/kprobes.c int __init arch_populate_kprobe_blacklist(void) · line 348

Quoted 9 lines
arch/riscv/kernel/probes/kprobes.c +1 -0
index e6e950b7c..2c1847921 100644
@@ -345,6 +345,7 @@ int __init arch_populate_kprobe_blacklist(void)
        return ret;
 }
 
+#ifndef CONFIG_KRETPROBE_ON_RETHOOK

This seems quite unusual, other archs don't seem to have ifdef-ery using CONFIG_KRETPROBE_ON_RETHOOK in their arch code so why should RISC-V?

Quoted 21 lines
arch/riscv/kernel/probes/kprobes.c +6 -0
 void __kprobes __used *trampoline_probe_handler(struct pt_regs *regs)
 {
        return (void *)kretprobe_trampoline_handler(regs, NULL);
@@ -357,6 +358,12 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
        ri->fp = NULL;
        regs->ra = (unsigned long) &__kretprobe_trampoline;
 }
+#else
+void __kprobes *trampoline_probe_handler(struct pt_regs *regs)
+{
+       return NULL;
+}
+#endif
 
 
arch/riscv/kernel/probes/rethook_trampoline.S new file +0 -0
new file mode 100644
index 000000000..aa79630ac

arch/riscv/kernel/probes/rethook_trampoline.S line 4

Quoted 4 lines
arch/riscv/kernel/probes/rethook_trampoline.S new file +4 -0
@@ -0,0 +1,94 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * rethook trampoline.
+ * Copied from arch/riscv/kernel/probes/kprobes_trampoline.S

Is this a 1:1 copy? If so, could the code be shared?

Quoted 6 lines

This e-mail and its attachments contain confidential information from New H3C, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

Uh-oh! You'll have to work with your IT to get this removed before your patches can be accepted:
https://lore.kernel.org/all/[email protected]/

The patch does not apply to -next for me either..

Thanks,
Conor.

-------------------------------------------------------------------------------------------------------------------------------------
本邮件及其附件含有新华三集团的保密信息,仅限于发送给上面地址中列出
的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、 或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本
邮件!
This e-mail and its attachments contain confidential information from New H3C, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!