What is the role of an undefined exception handler (__und_svc) in kprobes?

I tried converting kprobe as a loadable kernel module.

I can run the samples available in the folder samples/kprobes/from the kernel tree.

If we configure kprobes in the kernel ( CONFIG_KPROBES), the macro svc_entrywill be expanded with 64 bytes in the handler __und_svc().

Link: http://lxr.free-electrons.com/source/arch/arm/kernel/entry-armv.S?a=arm#L245

My goal is not about the kernel side, make kprobe as a kernel module.

therefore, the kernel was compiled without including CONFIG_KPROBES. so the svc_entry macro will be expanded with 0 in __ und_svc ()

I would like to clear myself of these doubts.

  • If kprobe is handled by an undefined command exception (bcos kprobe just created), then why is it called __und_svc(). what is the role of the handler __und_svc()in relation to kprobes ??

  • If 64-byte memory is required, then how to allocate without compiling the kernel. ie How to do it dynamically.

Share your knowledge.

+4
source share
1 answer

You cannot receive answers because your understanding of things is not very good, and it will take some time for each of the linux-arm-kernel lists. Read kprobes.txt and learn more about ARM architecture.

kprobe undefined ( bcos kprobe), __und_svc(). __und_svc() kprobes?

ARM 0b11011 - undefined. , undefined, -

  • lr_und = pc undef + 4
  • SPSR_und = CPSR , .
  • ARM .
  • PC = + 4

4 __vectors_start, vector_und. , vector_stub, __und_svc, __und_usr. - 4/8k , . , , .

kprobe , undefined , . .. undefined. . : call_fpe do_undefinstr(), , call_undef_hook(). register_undef_hook(); arch_init_kprobes(). kprobe_handler struct pt_regs *regs, , __und_svc. , , kretprobe_trampoline(), , .

64- , . i.e .?

, . , kprobes. , . 64 . , kmalloc(). / . , undefined (ISR, / IRQ, work_queue, ) kprobed-. , , , . arch_init_kprobes() , __und_svc; 64 , , . .., ,

__und_svc:
    @ Always reserve 64 bytes, even if kprobe is not active.
    svc_entry 64

arch_init_kprobes() - , .

+5

All Articles