<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br>Hi Mathew,<div><br></div><div>I have a question about this patch for lttng-modules and the use of register_kprobe() to fetch the function ptr.</div><div>The question in this regard is especially from PPC64 ELF_ABI_v1 perspective.</div><div><br></div><div>The functions on PPC64 are accessed via the Function descriptor while what register_kprobes returns is the entry point of the function. </div><div>Hence using the return pointer tends to interpret the addr as the address of the function descriptor and dereferences the ppc_inst as the function entry point and crashes</div><div><br></div><div>[ 4145.483594] kernel tried to execute exec-protected page (7c0802a6fb81ffe0) - exploit attempt? (uid: 0) <br></div><div> </div><div>here 7c0802a6 is the mfspr instruction from the code text section of the kallsyms_lookup_name()</div><div><br></div><div>note for PPC_ELF_ABI_v1 the register_kprobes() searches for the dot variant of the symbol and only in case if cannot find the dot variant looks for the normal symbol. </div><div>register_kprobe() -> kprobe_addr() -> kprobe_lookup_name() [arch variant replaces weak symbol] </div><div><a href="https://elixir.bootlin.com/linux/v5.10.174/C/ident/kprobe_lookup_name" target="_blank">https://elixir.bootlin.com/linux/v5.10.174/C/ident/kprobe_lookup_name</a> <br></div><div><br></div><div>Please let me know if i make sense or that i may have missed something.</div><div><br></div><div>I have looked at the code of 2.12.8 as well and 2.12.3 verstion of lttng-modules.</div><div><br></div><div>Regards,</div><div>Shashank</div><div><br></div></div>
</blockquote></div></div>