sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget!/translations/zh_CN/trace/kprobesmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget!/translations/zh_TW/trace/kprobesmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget!/translations/it_IT/trace/kprobesmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget!/translations/ja_JP/trace/kprobesmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget!/translations/ko_KR/trace/kprobesmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget!/translations/sp_SP/trace/kprobesmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hKernel Probes (Kprobes)h]hKernel Probes (Kprobes)}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhh;/var/lib/git/docbuild/linux/Documentation/trace/kprobes.rsthKubh field_list)}(hhh](hfield)}(hhh](h field_name)}(hAuthorh]hAuthor}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhKubh field_body)}(h"Jim Keniston h]h paragraph)}(hhh](hJim Keniston <}(hhhhhNhNubh reference)}(hjkenisto@us.ibm.comh]hjkenisto@us.ibm.com}(hhhhhNhNubah}(h]h ]h"]h$]h&]refurimailto:jkenisto@us.ibm.comuh1hhhubh>}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhubah}(h]h ]h"]h$]h&]uh1hhhubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hAuthorh]hAuthor}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhKubh)}(h7Prasanna S Panchamukhi h]h)}(hjh](hPrasanna S Panchamukhi <}(hjhhhNhNubh)}(hprasanna.panchamukhi@gmail.comh]hprasanna.panchamukhi@gmail.com}(hj$hhhNhNubah}(h]h ]h"]h$]h&]refuri%mailto:prasanna.panchamukhi@gmail.comuh1hhjubh>}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hAuthorh]hAuthor}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjJhhhKubh)}(h'Masami Hiramatsu h]h)}(h&Masami Hiramatsu h](hMasami Hiramatsu <}(hj_hhhNhNubh)}(hmhiramat@kernel.orgh]hmhiramat@kernel.org}(hjghhhNhNubah}(h]h ]h"]h$]h&]refurimailto:mhiramat@kernel.orguh1hhj_ubh>}(hj_hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj[ubah}(h]h ]h"]h$]h&]uh1hhjJubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]h ]h"]h$]h&]uh1hhhhhhhhKubhcomment)}(hX]CONTENTS 1. Concepts: Kprobes, and Return Probes 2. Architectures Supported 3. Configuring Kprobes 4. API Reference 5. Kprobes Features and Limitations 6. Probe Overhead 7. TODO 8. Kprobes Example 9. Kretprobes Example 10. Deprecated Features Appendix A: The kprobes debugfs interface Appendix B: The kprobes sysctl interface Appendix C: Referencesh]hX]CONTENTS 1. Concepts: Kprobes, and Return Probes 2. Architectures Supported 3. Configuring Kprobes 4. API Reference 5. Kprobes Features and Limitations 6. Probe Overhead 7. TODO 8. Kprobes Example 9. Kretprobes Example 10. Deprecated Features Appendix A: The kprobes debugfs interface Appendix B: The kprobes sysctl interface Appendix C: References}hjsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1jhhhhhhhKubh)}(hhh](h)}(h#Concepts: Kprobes and Return Probesh]h#Concepts: Kprobes and Return Probes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXKprobes enables you to dynamically break into any kernel routine and collect debugging and performance information non-disruptively. You can trap at almost any kernel code address [1]_, specifying a handler routine to be invoked when the breakpoint is hit.h](hKprobes enables you to dynamically break into any kernel routine and collect debugging and performance information non-disruptively. You can trap at almost any kernel code address }(hjhhhNhNubhfootnote_reference)}(h[1]_h]h1}(hjhhhNhNubah}(h]id1ah ]h"]h$]h&]refidid2docname trace/kprobesuh1jhjresolvedKubhH, specifying a handler routine to be invoked when the breakpoint is hit.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubhfootnote)}(hPsome parts of the kernel code can not be trapped, see :ref:`kprobes_blacklist`) h](hlabel)}(h1h]h1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh)}(hOsome parts of the kernel code can not be trapped, see :ref:`kprobes_blacklist`)h](h6some parts of the kernel code can not be trapped, see }(hjhhhNhNubh)}(h:ref:`kprobes_blacklist`h]hinline)}(hjh]hkprobes_blacklist}(hjhhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarn reftargetkprobes_blacklistuh1hhhhK!hjubh)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK!hjubeh}(h]jah ]h"]1ah$]h&]jajjuh1jhhhK!hjhhjKubh)}(hThere are currently two types of probes: kprobes, and kretprobes (also called return probes). A kprobe can be inserted on virtually any instruction in the kernel. A return probe fires when a specified function returns.h]hThere are currently two types of probes: kprobes, and kretprobes (also called return probes). A kprobe can be inserted on virtually any instruction in the kernel. A return probe fires when a specified function returns.}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK$hjhhubh)}(hXXIn the typical case, Kprobes-based instrumentation is packaged as a kernel module. The module's init function installs ("registers") one or more probes, and the exit function unregisters them. A registration function such as register_kprobe() specifies where the probe is to be inserted and what handler is to be called when the probe is hit.h]hX^In the typical case, Kprobes-based instrumentation is packaged as a kernel module. The module’s init function installs (“registers”) one or more probes, and the exit function unregisters them. A registration function such as register_kprobe() specifies where the probe is to be inserted and what handler is to be called when the probe is hit.}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK)hjhhubh)}(hThere are also ``register_/unregister_*probes()`` functions for batch registration/unregistration of a group of ``*probes``. These functions can speed up unregistration process when you have to unregister a lot of probes at once.h](hThere are also }(hjMhhhNhNubhliteral)}(h"``register_/unregister_*probes()``h]hregister_/unregister_*probes()}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1jUhjMubh? functions for batch registration/unregistration of a group of }(hjMhhhNhNubjV)}(h ``*probes``h]h*probes}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1jUhjMubhj. These functions can speed up unregistration process when you have to unregister a lot of probes at once.}(hjMhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK0hjhhubh)}(hXThe next four subsections explain how the different types of probes work and how jump optimization works. They explain certain things that you'll need to know in order to make the best use of Kprobes -- e.g., the difference between a pre_handler and a post_handler, and how to use the maxactive and nmissed fields of a kretprobe. But if you're in a hurry to start using Kprobes, you can skip ahead to :ref:`kprobes_archs_supported`.h](hXThe next four subsections explain how the different types of probes work and how jump optimization works. They explain certain things that you’ll need to know in order to make the best use of Kprobes -- e.g., the difference between a pre_handler and a post_handler, and how to use the maxactive and nmissed fields of a kretprobe. But if you’re in a hurry to start using Kprobes, you can skip ahead to }(hjhhhNhNubh)}(h:ref:`kprobes_archs_supported`h]j)}(hjh]hkprobes_archs_supported}(hjhhhNhNubah}(h]h ](j stdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjkprobes_archs_supporteduh1hhhhK5hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK5hjhhubh)}(hhh](h)}(hHow Does a Kprobe Work?h]hHow Does a Kprobe Work?}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK>ubh)}(hWhen a kprobe is registered, Kprobes makes a copy of the probed instruction and replaces the first byte(s) of the probed instruction with a breakpoint instruction (e.g., int3 on i386 and x86_64).h]hWhen a kprobe is registered, Kprobes makes a copy of the probed instruction and replaces the first byte(s) of the probed instruction with a breakpoint instruction (e.g., int3 on i386 and x86_64).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK@hjhhubh)}(hX.When a CPU hits the breakpoint instruction, a trap occurs, the CPU's registers are saved, and control passes to Kprobes via the notifier_call_chain mechanism. Kprobes executes the "pre_handler" associated with the kprobe, passing the handler the addresses of the kprobe struct and the saved registers.h]hX4When a CPU hits the breakpoint instruction, a trap occurs, the CPU’s registers are saved, and control passes to Kprobes via the notifier_call_chain mechanism. Kprobes executes the “pre_handler” associated with the kprobe, passing the handler the addresses of the kprobe struct and the saved registers.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhjhhubh)}(hX.Next, Kprobes single-steps its copy of the probed instruction. (It would be simpler to single-step the actual instruction in place, but then Kprobes would have to temporarily remove the breakpoint instruction. This would open a small time window when another CPU could sail right past the probepoint.)h]hX.Next, Kprobes single-steps its copy of the probed instruction. (It would be simpler to single-step the actual instruction in place, but then Kprobes would have to temporarily remove the breakpoint instruction. This would open a small time window when another CPU could sail right past the probepoint.)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKJhjhhubh)}(hAfter the instruction is single-stepped, Kprobes executes the "post_handler," if any, that is associated with the kprobe. Execution then continues with the instruction following the probepoint.h]hAfter the instruction is single-stepped, Kprobes executes the “post_handler,” if any, that is associated with the kprobe. Execution then continues with the instruction following the probepoint.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKPhjhhubeh}(h]how-does-a-kprobe-workah ]h"]how does a kprobe work?ah$]h&]uh1hhjhhhhhK>ubh)}(hhh](h)}(hChanging Execution Pathh]hChanging Execution Path}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKUubh)}(hXnSince kprobes can probe into a running kernel code, it can change the register set, including instruction pointer. This operation requires maximum care, such as keeping the stack frame, recovering the execution path etc. Since it operates on a running kernel and needs deep knowledge of computer architecture and concurrent computing, you can easily shoot your foot.h]hXnSince kprobes can probe into a running kernel code, it can change the register set, including instruction pointer. This operation requires maximum care, such as keeping the stack frame, recovering the execution path etc. Since it operates on a running kernel and needs deep knowledge of computer architecture and concurrent computing, you can easily shoot your foot.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKWhjhhubh)}(hIf you change the instruction pointer (and set up other related registers) in pre_handler, you must return !0 so that kprobes stops single stepping and just returns to the given address. This also means post_handler should not be called anymore.h]hIf you change the instruction pointer (and set up other related registers) in pre_handler, you must return !0 so that kprobes stops single stepping and just returns to the given address. This also means post_handler should not be called anymore.}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK^hjhhubh)}(hNote that this operation may be harder on some architectures which use TOC (Table of Contents) for function call, since you have to setup a new TOC for your function in your module, and recover the old one after returning from it.h]hNote that this operation may be harder on some architectures which use TOC (Table of Contents) for function call, since you have to setup a new TOC for your function in your module, and recover the old one after returning from it.}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKchjhhubeh}(h]changing-execution-pathah ]h"]changing execution pathah$]h&]uh1hhjhhhhhKUubh)}(hhh](h)}(h Return Probesh]h Return Probes}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjGhhhhhKiubh)}(hhh](h)}(hHow Does a Return Probe Work?h]hHow Does a Return Probe Work?}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjXhhhhhKlubh)}(hXWhen you call register_kretprobe(), Kprobes establishes a kprobe at the entry to the function. When the probed function is called and this probe is hit, Kprobes saves a copy of the return address, and replaces the return address with the address of a "trampoline." The trampoline is an arbitrary piece of code -- typically just a nop instruction. At boot time, Kprobes registers a kprobe at the trampoline.h]hXWhen you call register_kretprobe(), Kprobes establishes a kprobe at the entry to the function. When the probed function is called and this probe is hit, Kprobes saves a copy of the return address, and replaces the return address with the address of a “trampoline.” The trampoline is an arbitrary piece of code -- typically just a nop instruction. At boot time, Kprobes registers a kprobe at the trampoline.}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhjXhhubh)}(hXXWhen the probed function executes its return instruction, control passes to the trampoline and that probe is hit. Kprobes' trampoline handler calls the user-specified return handler associated with the kretprobe, then sets the saved instruction pointer to the saved return address, and that's where execution resumes upon return from the trap.h]hX\When the probed function executes its return instruction, control passes to the trampoline and that probe is hit. Kprobes’ trampoline handler calls the user-specified return handler associated with the kretprobe, then sets the saved instruction pointer to the saved return address, and that’s where execution resumes upon return from the trap.}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKuhjXhhubh)}(hX{While the probed function is executing, its return address is stored in an object of type kretprobe_instance. Before calling register_kretprobe(), the user sets the maxactive field of the kretprobe struct to specify how many instances of the specified function can be probed simultaneously. register_kretprobe() pre-allocates the indicated number of kretprobe_instance objects.h]hX{While the probed function is executing, its return address is stored in an object of type kretprobe_instance. Before calling register_kretprobe(), the user sets the maxactive field of the kretprobe struct to specify how many instances of the specified function can be probed simultaneously. register_kretprobe() pre-allocates the indicated number of kretprobe_instance objects.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK{hjXhhubh)}(hX;For example, if the function is non-recursive and is called with a spinlock held, maxactive = 1 should be enough. If the function is non-recursive and can never relinquish the CPU (e.g., via a semaphore or preemption), NR_CPUS should be enough. If maxactive <= 0, it is set to a default value: max(10, 2*NR_CPUS).h]hX;For example, if the function is non-recursive and is called with a spinlock held, maxactive = 1 should be enough. If the function is non-recursive and can never relinquish the CPU (e.g., via a semaphore or preemption), NR_CPUS should be enough. If maxactive <= 0, it is set to a default value: max(10, 2*NR_CPUS).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjXhhubh)}(hXCIt's not a disaster if you set maxactive too low; you'll just miss some probes. In the kretprobe struct, the nmissed field is set to zero when the return probe is registered, and is incremented every time the probed function is entered but there is no kretprobe_instance object available for establishing the return probe.h]hXGIt’s not a disaster if you set maxactive too low; you’ll just miss some probes. In the kretprobe struct, the nmissed field is set to zero when the return probe is registered, and is incremented every time the probed function is entered but there is no kretprobe_instance object available for establishing the return probe.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjXhhubeh}(h]how-does-a-return-probe-workah ]h"]how does a return probe work?ah$]h&]uh1hhjGhhhhhKlubh)}(hhh](h)}(hKretprobe entry-handlerh]hKretprobe entry-handler}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXRKretprobes also provides an optional user-specified handler which runs on function entry. This handler is specified by setting the entry_handler field of the kretprobe struct. Whenever the kprobe placed by kretprobe at the function entry is hit, the user-defined entry_handler, if any, is invoked. If the entry_handler returns 0 (success) then a corresponding return handler is guaranteed to be called upon function return. If the entry_handler returns a non-zero error then Kprobes leaves the return address as is, and the kretprobe has no further effect for that particular function instance.h]hXRKretprobes also provides an optional user-specified handler which runs on function entry. This handler is specified by setting the entry_handler field of the kretprobe struct. Whenever the kprobe placed by kretprobe at the function entry is hit, the user-defined entry_handler, if any, is invoked. If the entry_handler returns 0 (success) then a corresponding return handler is guaranteed to be called upon function return. If the entry_handler returns a non-zero error then Kprobes leaves the return address as is, and the kretprobe has no further effect for that particular function instance.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hX:Multiple entry and return handler invocations are matched using the unique kretprobe_instance object associated with them. Additionally, a user may also specify per return-instance private data to be part of each kretprobe_instance object. This is especially useful when sharing private data between corresponding user entry and return handlers. The size of each private data object can be specified at kretprobe registration time by setting the data_size field of the kretprobe struct. This data can be accessed through the data field of each kretprobe_instance object.h]hX:Multiple entry and return handler invocations are matched using the unique kretprobe_instance object associated with them. Additionally, a user may also specify per return-instance private data to be part of each kretprobe_instance object. This is especially useful when sharing private data between corresponding user entry and return handlers. The size of each private data object can be specified at kretprobe registration time by setting the data_size field of the kretprobe struct. This data can be accessed through the data field of each kretprobe_instance object.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hIn case probed function is entered but there is no kretprobe_instance object available, then in addition to incrementing the nmissed count, the user entry_handler invocation is also skipped.h]hIn case probed function is entered but there is no kretprobe_instance object available, then in addition to incrementing the nmissed count, the user entry_handler invocation is also skipped.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubhtarget)}(h.. _kprobes_jump_optimization:h]h}(h]h ]h"]h$]h&]jkprobes-jump-optimizationuh1jhKhjhhhhubeh}(h]kretprobe-entry-handlerah ]h"]kretprobe entry-handlerah$]h&]uh1hhjGhhhhhKubeh}(h] return-probesah ]h"] return probesah$]h&]uh1hhjhhhhhKiubh)}(hhh](h)}(h How Does Jump Optimization Work?h]h How Does Jump Optimization Work?}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXUIf your kernel is built with CONFIG_OPTPROBES=y (currently this flag is automatically set 'y' on x86/x86-64, non-preemptive kernel) and the "debug.kprobes_optimization" kernel parameter is set to 1 (see sysctl(8)), Kprobes tries to reduce probe-hit overhead by using a jump instruction instead of a breakpoint instruction at each probepoint.h]hX]If your kernel is built with CONFIG_OPTPROBES=y (currently this flag is automatically set ‘y’ on x86/x86-64, non-preemptive kernel) and the “debug.kprobes_optimization” kernel parameter is set to 1 (see sysctl(8)), Kprobes tries to reduce probe-hit overhead by using a jump instruction instead of a breakpoint instruction at each probepoint.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhh](h)}(h Init a Kprobeh]h Init a Kprobe}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj.hhhhhKubh)}(hWhen a probe is registered, before attempting this optimization, Kprobes inserts an ordinary, breakpoint-based kprobe at the specified address. So, even if it's not possible to optimize this particular probepoint, there'll be a probe there.h]hWhen a probe is registered, before attempting this optimization, Kprobes inserts an ordinary, breakpoint-based kprobe at the specified address. So, even if it’s not possible to optimize this particular probepoint, there’ll be a probe there.}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj.hhubeh}(h] init-a-kprobeah ]h"] init a kprobeah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(h Safety Checkh]h Safety Check}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjUhhhhhKubh)}(hHBefore optimizing a probe, Kprobes performs the following safety checks:h]hHBefore optimizing a probe, Kprobes performs the following safety checks:}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjUhhubh bullet_list)}(hhh](h list_item)}(hKprobes verifies that the region that will be replaced by the jump instruction (the "optimized region") lies entirely within one function. (A jump instruction is multiple bytes, and so may overlay multiple instructions.) h]h)}(hKprobes verifies that the region that will be replaced by the jump instruction (the "optimized region") lies entirely within one function. (A jump instruction is multiple bytes, and so may overlay multiple instructions.)h]hKprobes verifies that the region that will be replaced by the jump instruction (the “optimized region”) lies entirely within one function. (A jump instruction is multiple bytes, and so may overlay multiple instructions.)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj{ubah}(h]h ]h"]h$]h&]uh1jyhjvhhhhhNubjz)}(hXKprobes analyzes the entire function and verifies that there is no jump into the optimized region. Specifically: - the function contains no indirect jump; - the function contains no instruction that causes an exception (since the fixup code triggered by the exception could jump back into the optimized region -- Kprobes checks the exception tables to verify this); - there is no near jump to the optimized region (other than to the first byte). h](h)}(hqKprobes analyzes the entire function and verifies that there is no jump into the optimized region. Specifically:h]hqKprobes analyzes the entire function and verifies that there is no jump into the optimized region. Specifically:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubju)}(hhh](jz)}(h'the function contains no indirect jump;h]h)}(hjh]h'the function contains no indirect jump;}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jyhjubjz)}(hthe function contains no instruction that causes an exception (since the fixup code triggered by the exception could jump back into the optimized region -- Kprobes checks the exception tables to verify this);h]h)}(hthe function contains no instruction that causes an exception (since the fixup code triggered by the exception could jump back into the optimized region -- Kprobes checks the exception tables to verify this);h]hthe function contains no instruction that causes an exception (since the fixup code triggered by the exception could jump back into the optimized region -- Kprobes checks the exception tables to verify this);}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jyhjubjz)}(hNthere is no near jump to the optimized region (other than to the first byte). h]h)}(hMthere is no near jump to the optimized region (other than to the first byte).h]hMthere is no near jump to the optimized region (other than to the first byte).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jyhjubeh}(h]h ]h"]h$]h&]bullet-uh1jthhhKhjubeh}(h]h ]h"]h$]h&]uh1jyhjvhhhNhNubjz)}(hqFor each instruction in the optimized region, Kprobes verifies that the instruction can be executed out of line. h]h)}(hpFor each instruction in the optimized region, Kprobes verifies that the instruction can be executed out of line.h]hpFor each instruction in the optimized region, Kprobes verifies that the instruction can be executed out of line.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jyhjvhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jthhhKhjUhhubeh}(h] safety-checkah ]h"] safety checkah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hPreparing Detour Bufferh]hPreparing Detour Buffer}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj#hhhhhKubh)}(h\Next, Kprobes prepares a "detour" buffer, which contains the following instruction sequence:h]h`Next, Kprobes prepares a “detour” buffer, which contains the following instruction sequence:}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj#hhubju)}(hhh](jz)}(h>code to push the CPU's registers (emulating a breakpoint trap)h]h)}(hjGh]h@code to push the CPU’s registers (emulating a breakpoint trap)}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjEubah}(h]h ]h"]h$]h&]uh1jyhjBhhhhhNubjz)}(h@a call to the trampoline code which calls user's probe handlers.h]h)}(hj^h]hBa call to the trampoline code which calls user’s probe handlers.}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj\ubah}(h]h ]h"]h$]h&]uh1jyhjBhhhhhNubjz)}(hcode to restore registersh]h)}(hjuh]hcode to restore registers}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjsubah}(h]h ]h"]h$]h&]uh1jyhjBhhhhhNubjz)}(h*the instructions from the optimized regionh]h)}(hjh]h*the instructions from the optimized region}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jyhjBhhhhhNubjz)}(h,a jump back to the original execution path. h]h)}(h+a jump back to the original execution path.h]h+a jump back to the original execution path.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jyhjBhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jthhhKhj#hhubeh}(h]preparing-detour-bufferah ]h"]preparing detour bufferah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hPre-optimizationh]hPre-optimization}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(h`After preparing the detour buffer, Kprobes verifies that none of the following situations exist:h]h`After preparing the detour buffer, Kprobes verifies that none of the following situations exist:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubju)}(hhh](jz)}(hThe probe has a post_handler.h]h)}(hjh]hThe probe has a post_handler.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(h6Other instructions in the optimized region are probed.h]h)}(hjh]h6Other instructions in the optimized region are probed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(hThe probe is disabled. h]h)}(hThe probe is disabled.h]hThe probe is disabled.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jthhhKhjhhubh)}(hIn any of the above cases, Kprobes won't start optimizing the probe. Since these are temporary situations, Kprobes tries to start optimizing it again if the situation is changed.h]hIn any of the above cases, Kprobes won’t start optimizing the probe. Since these are temporary situations, Kprobes tries to start optimizing it again if the situation is changed.}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXIf the kprobe can be optimized, Kprobes enqueues the kprobe to an optimizing list, and kicks the kprobe-optimizer workqueue to optimize it. If the to-be-optimized probepoint is hit before being optimized, Kprobes returns control to the original instruction path by setting the CPU's instruction pointer to the copied code in the detour buffer -- thus at least avoiding the single-step.h]hXIf the kprobe can be optimized, Kprobes enqueues the kprobe to an optimizing list, and kicks the kprobe-optimizer workqueue to optimize it. If the to-be-optimized probepoint is hit before being optimized, Kprobes returns control to the original instruction path by setting the CPU’s instruction pointer to the copied code in the detour buffer -- thus at least avoiding the single-step.}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]pre-optimizationah ]h"]pre-optimizationah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(h Optimizationh]h Optimization}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjYhhhhhKubh)}(hXThe Kprobe-optimizer doesn't insert the jump instruction immediately; rather, it calls synchronize_rcu() for safety first, because it's possible for a CPU to be interrupted in the middle of executing the optimized region [3]_. As you know, synchronize_rcu() can ensure that all interruptions that were active when synchronize_rcu() was called are done, but only if CONFIG_PREEMPT=n. So, this version of kprobe optimization supports only kernels with CONFIG_PREEMPT=n [4]_.h](hThe Kprobe-optimizer doesn’t insert the jump instruction immediately; rather, it calls synchronize_rcu() for safety first, because it’s possible for a CPU to be interrupted in the middle of executing the optimized region }(hjjhhhNhNubj)}(h[3]_h]h3}(hjrhhhNhNubah}(h]id3ah ]h"]h$]h&]jid5jjuh1jhjjjKubh. As you know, synchronize_rcu() can ensure that all interruptions that were active when synchronize_rcu() was called are done, but only if CONFIG_PREEMPT=n. So, this version of kprobe optimization supports only kernels with CONFIG_PREEMPT=n }(hjjhhhNhNubj)}(h[4]_h]h4}(hjhhhNhNubah}(h]id4ah ]h"]h$]h&]jid6jjuh1jhjjjKubh.}(hjjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjYhhubh)}(hAfter that, the Kprobe-optimizer calls stop_machine() to replace the optimized region with a jump instruction to the detour buffer, using text_poke_smp().h]hAfter that, the Kprobe-optimizer calls stop_machine() to replace the optimized region with a jump instruction to the detour buffer, using text_poke_smp().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjYhhubeh}(h] optimizationah ]h"] optimizationah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hUnoptimizationh]hUnoptimization}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hXpWhen an optimized kprobe is unregistered, disabled, or blocked by another kprobe, it will be unoptimized. If this happens before the optimization is complete, the kprobe is just dequeued from the optimized list. If the optimization has been done, the jump is replaced with the original code (except for an int3 breakpoint in the first byte) by using text_poke_smp().h]hXpWhen an optimized kprobe is unregistered, disabled, or blocked by another kprobe, it will be unoptimized. If this happens before the optimization is complete, the kprobe is just dequeued from the optimized list. If the optimization has been done, the jump is replaced with the original code (except for an int3 breakpoint in the first byte) by using text_poke_smp().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(hXPlease imagine that the 2nd instruction is interrupted and then the optimizer replaces the 2nd instruction with the jump *address* while the interrupt handler is running. When the interrupt returns to original address, there is no valid instruction, and it causes an unexpected result. h](j)}(h3h]h3}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh)}(hXPlease imagine that the 2nd instruction is interrupted and then the optimizer replaces the 2nd instruction with the jump *address* while the interrupt handler is running. When the interrupt returns to original address, there is no valid instruction, and it causes an unexpected result.h](hyPlease imagine that the 2nd instruction is interrupted and then the optimizer replaces the 2nd instruction with the jump }(hjhhhNhNubhemphasis)}(h *address*h]haddress}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh while the interrupt handler is running. When the interrupt returns to original address, there is no valid instruction, and it causes an unexpected result.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hjubeh}(h]jah ]h"]3ah$]h&]j|ajjuh1jhhhM hjhhjKubj)}(hThis optimization-safety checking may be replaced with the stop-machine method that ksplice uses for supporting a CONFIG_PREEMPT=y kernel. h](j)}(h4h]h4}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh)}(hThis optimization-safety checking may be replaced with the stop-machine method that ksplice uses for supporting a CONFIG_PREEMPT=y kernel.h]hThis optimization-safety checking may be replaced with the stop-machine method that ksplice uses for supporting a CONFIG_PREEMPT=y kernel.}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]jah ]h"]4ah$]h&]jajjuh1jhhhMhjhhjKubh)}(hXNOTE for geeks: The jump optimization changes the kprobe's pre_handler behavior. Without optimization, the pre_handler can change the kernel's execution path by changing regs->ip and returning 1. However, when the probe is optimized, that modification is ignored. Thus, if you want to tweak the kernel's execution path, you need to suppress optimization, using one of the following techniques:h]hXNOTE for geeks: The jump optimization changes the kprobe’s pre_handler behavior. Without optimization, the pre_handler can change the kernel’s execution path by changing regs->ip and returning 1. However, when the probe is optimized, that modification is ignored. Thus, if you want to tweak the kernel’s execution path, you need to suppress optimization, using one of the following techniques:}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubju)}(hhh]jz)}(h9Specify an empty function for the kprobe's post_handler. h]h)}(h8Specify an empty function for the kprobe's post_handler.h]h:Specify an empty function for the kprobe’s post_handler.}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjHubah}(h]h ]h"]h$]h&]uh1jyhjEhhhhhNubah}(h]h ]h"]h$]h&]jjuh1jthhhMhjhhubh)}(horh]hor}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubju)}(hhh]jz)}(h1Execute 'sysctl -w debug.kprobes_optimization=n' h]h)}(h0Execute 'sysctl -w debug.kprobes_optimization=n'h]h4Execute ‘sysctl -w debug.kprobes_optimization=n’}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM!hjwubah}(h]h ]h"]h$]h&]uh1jyhjthhhhhNubah}(h]h ]h"]h$]h&]jjuh1jthhhM!hjhhubj)}(h.. _kprobes_blacklist:h]h}(h]h ]h"]h$]h&]jkprobes-blacklistuh1jhM#hjhhhhubeh}(h]unoptimizationah ]h"]unoptimizationah$]h&]uh1hhjhhhhhMubeh}(h](how-does-jump-optimization-workjeh ]h"]( how does jump optimization work?kprobes_jump_optimizationeh$]h&]uh1hhjhhhhhKexpect_referenced_by_name}jjsexpect_referenced_by_id}jjsubh)}(hhh](h)}(h Blacklisth]h Blacklist}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM&ubh)}(hXRKprobes can probe most of the kernel except itself. This means that there are some functions where kprobes cannot probe. Probing (trapping) such functions can cause a recursive trap (e.g. double fault) or the nested probe handler may never be called. Kprobes manages such functions as a blacklist. If you want to add a function into the blacklist, you just need to (1) include linux/kprobes.h and (2) use NOKPROBE_SYMBOL() macro to specify a blacklisted function. Kprobes checks the given probe address against the blacklist and rejects registering it, if the given address is in the blacklist.h]hXRKprobes can probe most of the kernel except itself. This means that there are some functions where kprobes cannot probe. Probing (trapping) such functions can cause a recursive trap (e.g. double fault) or the nested probe handler may never be called. Kprobes manages such functions as a blacklist. If you want to add a function into the blacklist, you just need to (1) include linux/kprobes.h and (2) use NOKPROBE_SYMBOL() macro to specify a blacklisted function. Kprobes checks the given probe address against the blacklist and rejects registering it, if the given address is in the blacklist.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM(hjhhubj)}(h.. _kprobes_archs_supported:h]h}(h]h ]h"]h$]h&]jkprobes-archs-supporteduh1jhM3hjhhhhubeh}(h]( blacklistjeh ]h"]( blacklistkprobes_blacklisteh$]h&]uh1hhjhhhhhM&j}jjsj}jjsubeh}(h]"concepts-kprobes-and-return-probesah ]h"]#concepts: kprobes and return probesah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hArchitectures Supportedh]hArchitectures Supported}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM6ubh)}(hIKprobes and return probes are implemented on the following architectures:h]hIKprobes and return probes are implemented on the following architectures:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM8hjhhubju)}(hhh](jz)}(h!i386 (Supports jump optimization)h]h)}(hjh]h!i386 (Supports jump optimization)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM;hjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(h3x86_64 (AMD-64, EM64T) (Supports jump optimization)h]h)}(hj-h]h3x86_64 (AMD-64, EM64T) (Supports jump optimization)}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM<hj+ubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(hppc64h]h)}(hjDh]hppc64}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM=hjBubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(h,sparc64 (Return probes not yet implemented.)h]h)}(hj[h]h,sparc64 (Return probes not yet implemented.)}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM>hjYubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(harmh]h)}(hjrh]harm}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM?hjpubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(hppch]h)}(hjh]hppc}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM@hjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(hmipsh]h)}(hjh]hmips}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(hs390h]h)}(hjh]hs390}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMBhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(hparisch]h)}(hjh]hparisc}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMChjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(h loongarchh]h)}(hjh]h loongarch}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMDhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(hriscv h]h)}(hriscvh]hriscv}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMEhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jthhhM;hjhhubeh}(h](architectures-supportedjeh ]h"](architectures supportedkprobes_archs_supportedeh$]h&]uh1hhhhhhhhM6j}j jsj}jjsubh)}(hhh](h)}(hConfiguring Kprobesh]hConfiguring Kprobes}(hj& hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj# hhhhhMHubh)}(hWhen configuring the kernel using make menuconfig/xconfig/oldconfig, ensure that CONFIG_KPROBES is set to "y", look for "Kprobes" under "General architecture-dependent options".h]hWhen configuring the kernel using make menuconfig/xconfig/oldconfig, ensure that CONFIG_KPROBES is set to “y”, look for “Kprobes” under “General architecture-dependent options”.}(hj4 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMJhj# hhubh)}(hSo that you can load and unload Kprobes-based instrumentation modules, make sure "Loadable module support" (CONFIG_MODULES) and "Module unloading" (CONFIG_MODULE_UNLOAD) are set to "y".h]hSo that you can load and unload Kprobes-based instrumentation modules, make sure “Loadable module support” (CONFIG_MODULES) and “Module unloading” (CONFIG_MODULE_UNLOAD) are set to “y”.}(hjB hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMNhj# hhubh)}(hAlso make sure that CONFIG_KALLSYMS and perhaps even CONFIG_KALLSYMS_ALL are set to "y", since kallsyms_lookup_name() is used by the in-kernel kprobe address resolution code.h]hAlso make sure that CONFIG_KALLSYMS and perhaps even CONFIG_KALLSYMS_ALL are set to “y”, since kallsyms_lookup_name() is used by the in-kernel kprobe address resolution code.}(hjP hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMRhj# hhubh)}(hIf you need to insert a probe in the middle of a function, you may find it useful to "Compile the kernel with debug info" (CONFIG_DEBUG_INFO), so you can use "objdump -d -l vmlinux" to see the source-to-object code mapping.h]hIf you need to insert a probe in the middle of a function, you may find it useful to “Compile the kernel with debug info” (CONFIG_DEBUG_INFO), so you can use “objdump -d -l vmlinux” to see the source-to-object code mapping.}(hj^ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMVhj# hhubeh}(h]configuring-kprobesah ]h"]configuring kprobesah$]h&]uh1hhhhhhhhMHubh)}(hhh](h)}(h API Referenceh]h API Reference}(hjw hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjt hhhhhM\ubh)}(hXThe Kprobes API includes a "register" function and an "unregister" function for each type of probe. The API also includes "register_*probes" and "unregister_*probes" functions for (un)registering arrays of probes. Here are terse, mini-man-page specifications for these functions and the associated probe handlers that you'll write. See the files in the samples/kprobes/ sub-directory for examples.h]hXThe Kprobes API includes a “register” function and an “unregister” function for each type of probe. The API also includes “register_*probes” and “unregister_*probes” functions for (un)registering arrays of probes. Here are terse, mini-man-page specifications for these functions and the associated probe handlers that you’ll write. See the files in the samples/kprobes/ sub-directory for examples.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM^hjt hhubh)}(hhh](h)}(hregister_kprobeh]hregister_kprobe}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMfubh literal_block)}(hB#include int register_kprobe(struct kprobe *kp);h]hB#include int register_kprobe(struct kprobe *kp);}hj sbah}(h]h ]h"]h$]h&]jjuh1j hhhMjhj hhubh)}(hXhSets a breakpoint at the address kp->addr. When the breakpoint is hit, Kprobes calls kp->pre_handler. After the probed instruction is single-stepped, Kprobe calls kp->post_handler. Any or all handlers can be NULL. If kp->flags is set KPROBE_FLAG_DISABLED, that kp will be registered but disabled, so, its handlers aren't hit until calling enable_kprobe(kp).h]hXjSets a breakpoint at the address kp->addr. When the breakpoint is hit, Kprobes calls kp->pre_handler. After the probed instruction is single-stepped, Kprobe calls kp->post_handler. Any or all handlers can be NULL. If kp->flags is set KPROBE_FLAG_DISABLED, that kp will be registered but disabled, so, its handlers aren’t hit until calling enable_kprobe(kp).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMmhj hhubhnote)}(hX1. With the introduction of the "symbol_name" field to struct kprobe, the probepoint address resolution will now be taken care of by the kernel. The following will now work:: kp.symbol_name = "symbol_name"; (64-bit powerpc intricacies such as function descriptors are handled transparently) 2. Use the "offset" field of struct kprobe if the offset into the symbol to install a probepoint is known. This field is used to calculate the probepoint. 3. Specify either the kprobe "symbol_name" OR the "addr". If both are specified, kprobe registration will fail with -EINVAL. 4. With CISC architectures (such as i386 and x86_64), the kprobes code does not validate if the kprobe.addr is at an instruction boundary. Use "offset" with caution.h]henumerated_list)}(hhh](jz)}(hX$With the introduction of the "symbol_name" field to struct kprobe, the probepoint address resolution will now be taken care of by the kernel. The following will now work:: kp.symbol_name = "symbol_name"; (64-bit powerpc intricacies such as function descriptors are handled transparently) h](h)}(hWith the introduction of the "symbol_name" field to struct kprobe, the probepoint address resolution will now be taken care of by the kernel. The following will now work::h]hWith the introduction of the “symbol_name” field to struct kprobe, the probepoint address resolution will now be taken care of by the kernel. The following will now work:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMuhj ubj )}(hkp.symbol_name = "symbol_name";h]hkp.symbol_name = "symbol_name";}hj sbah}(h]h ]h"]h$]h&]jjuh1j hhhMyhj ubh)}(hS(64-bit powerpc intricacies such as function descriptors are handled transparently)h]hS(64-bit powerpc intricacies such as function descriptors are handled transparently)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM{hj ubeh}(h]h ]h"]h$]h&]uh1jyhj ubjz)}(hUse the "offset" field of struct kprobe if the offset into the symbol to install a probepoint is known. This field is used to calculate the probepoint. h]h)}(hUse the "offset" field of struct kprobe if the offset into the symbol to install a probepoint is known. This field is used to calculate the probepoint.h]hUse the “offset” field of struct kprobe if the offset into the symbol to install a probepoint is known. This field is used to calculate the probepoint.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM~hj ubah}(h]h ]h"]h$]h&]uh1jyhj ubjz)}(hzSpecify either the kprobe "symbol_name" OR the "addr". If both are specified, kprobe registration will fail with -EINVAL. h]h)}(hySpecify either the kprobe "symbol_name" OR the "addr". If both are specified, kprobe registration will fail with -EINVAL.h]hSpecify either the kprobe “symbol_name” OR the “addr”. If both are specified, kprobe registration will fail with -EINVAL.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jyhj ubjz)}(hWith CISC architectures (such as i386 and x86_64), the kprobes code does not validate if the kprobe.addr is at an instruction boundary. Use "offset" with caution.h]h)}(hWith CISC architectures (such as i386 and x86_64), the kprobes code does not validate if the kprobe.addr is at an instruction boundary. Use "offset" with caution.h]hWith CISC architectures (such as i386 and x86_64), the kprobes code does not validate if the kprobe.addr is at an instruction boundary. Use “offset” with caution.}(hj5 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj1 ubah}(h]h ]h"]h$]h&]uh1jyhj ubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.uh1j hj ubah}(h]h ]h"]h$]h&]uh1j hj hhhNhNubh)}(hFregister_kprobe() returns 0 on success, or a negative errno otherwise.h]hFregister_kprobe() returns 0 on success, or a negative errno otherwise.}(hjZ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(h&User's pre-handler (kp->pre_handler)::h]h'User’s pre-handler (kp->pre_handler):}(hjh hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj )}(hm#include #include int pre_handler(struct kprobe *p, struct pt_regs *regs);h]hm#include #include int pre_handler(struct kprobe *p, struct pt_regs *regs);}hjv sbah}(h]h ]h"]h$]h&]jjuh1j hhhMhj hhubh)}(hCalled with p pointing to the kprobe associated with the breakpoint, and regs pointing to the struct containing the registers saved when the breakpoint was hit. Return 0 here unless you're a Kprobes geek.h]hCalled with p pointing to the kprobe associated with the breakpoint, and regs pointing to the struct containing the registers saved when the breakpoint was hit. Return 0 here unless you’re a Kprobes geek.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(h(User's post-handler (kp->post_handler)::h]h)User’s post-handler (kp->post_handler):}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj )}(h#include #include void post_handler(struct kprobe *p, struct pt_regs *regs, unsigned long flags);h]h#include #include void post_handler(struct kprobe *p, struct pt_regs *regs, unsigned long flags);}hj sbah}(h]h ]h"]h$]h&]jjuh1j hhhMhj hhubh)}(hPp and regs are as described for the pre_handler. flags always seems to be zero.h]hPp and regs are as described for the pre_handler. flags always seems to be zero.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubeh}(h]register-kprobeah ]h"]register_kprobeah$]h&]uh1hhjt hhhhhMfubh)}(hhh](h)}(hregister_kretprobeh]hregister_kretprobe}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubj )}(hH#include int register_kretprobe(struct kretprobe *rp);h]hH#include int register_kretprobe(struct kretprobe *rp);}hj sbah}(h]h ]h"]h$]h&]jjuh1j hhhMhj hhubh)}(hXEstablishes a return probe for the function whose address is rp->kp.addr. When that function returns, Kprobes calls rp->handler. You must set rp->maxactive appropriately before you call register_kretprobe(); see "How Does a Return Probe Work?" for details.h]hXEstablishes a return probe for the function whose address is rp->kp.addr. When that function returns, Kprobes calls rp->handler. You must set rp->maxactive appropriately before you call register_kretprobe(); see “How Does a Return Probe Work?” for details.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hIregister_kretprobe() returns 0 on success, or a negative errno otherwise.h]hIregister_kretprobe() returns 0 on success, or a negative errno otherwise.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(h+User's return-probe handler (rp->handler)::h]h,User’s return-probe handler (rp->handler):}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj )}(h#include #include int kretprobe_handler(struct kretprobe_instance *ri, struct pt_regs *regs);h]h#include #include int kretprobe_handler(struct kretprobe_instance *ri, struct pt_regs *regs);}hj sbah}(h]h ]h"]h$]h&]jjuh1j hhhMhj hhubh)}(hregs is as described for kprobe.pre_handler. ri points to the kretprobe_instance object, of which the following fields may be of interest:h]hregs is as described for kprobe.pre_handler. ri points to the kretprobe_instance object, of which the following fields may be of interest:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubju)}(hhh](jz)}(hret_addr: the return addressh]h)}(hj. h]hret_addr: the return address}(hj0 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj, ubah}(h]h ]h"]h$]h&]uh1jyhj) hhhhhNubjz)}(h0rp: points to the corresponding kretprobe objecth]h)}(hjE h]h0rp: points to the corresponding kretprobe object}(hjG hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjC ubah}(h]h ]h"]h$]h&]uh1jyhj) hhhhhNubjz)}(h-task: points to the corresponding task structh]h)}(hj\ h]h-task: points to the corresponding task struct}(hj^ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjZ ubah}(h]h ]h"]h$]h&]uh1jyhj) hhhhhNubjz)}(hcdata: points to per return-instance private data; see "Kretprobe entry-handler" for details. h]hdefinition_list)}(hhh]hdefinition_list_item)}(h]data: points to per return-instance private data; see "Kretprobe entry-handler" for details. h](hterm)}(h@data: points to per return-instance private data; see "Kretprobeh]hBdata: points to per return-instance private data; see “Kretprobe}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j hhhMhj| ubh definition)}(hhh]h)}(hentry-handler" for details.h]hentry-handler” for details.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j hj| ubeh}(h]h ]h"]h$]h&]uh1jz hhhMhjw ubah}(h]h ]h"]h$]h&]uh1ju hjq ubah}(h]h ]h"]h$]h&]uh1jyhj) hhhNhNubeh}(h]h ]h"]h$]h&]jjuh1jthhhMhj hhubh)}(hThe regs_return_value(regs) macro provides a simple abstraction to extract the return value from the appropriate register as defined by the architecture's ABI.h]hThe regs_return_value(regs) macro provides a simple abstraction to extract the return value from the appropriate register as defined by the architecture’s ABI.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(h0The handler's return value is currently ignored.h]h2The handler’s return value is currently ignored.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubeh}(h]register-kretprobeah ]h"]register_kretprobeah$]h&]uh1hhjt hhhhhMubh)}(hhh](h)}(hunregister_*probeh]hunregister_*probe}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubj )}(hv#include void unregister_kprobe(struct kprobe *kp); void unregister_kretprobe(struct kretprobe *rp);h]hv#include void unregister_kprobe(struct kprobe *kp); void unregister_kretprobe(struct kretprobe *rp);}hj sbah}(h]h ]h"]h$]h&]jjuh1j hhhMhj hhubh)}(htRemoves the specified probe. The unregister function can be called at any time after the probe has been registered.h]htRemoves the specified probe. The unregister function can be called at any time after the probe has been registered.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj )}(hmIf the functions find an incorrect probe (ex. an unregistered probe), they clear the addr field of the probe.h]h)}(hmIf the functions find an incorrect probe (ex. an unregistered probe), they clear the addr field of the probe.h]hmIf the functions find an incorrect probe (ex. an unregistered probe), they clear the addr field of the probe.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j hj hhhhhNubeh}(h]unregister-probeah ]h"]unregister_*probeah$]h&]uh1hhjt hhhhhMubh)}(hhh](h)}(hregister_*probesh]hregister_*probes}(hj5 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj2 hhhhhMubj )}(h#include int register_kprobes(struct kprobe **kps, int num); int register_kretprobes(struct kretprobe **rps, int num);h]h#include int register_kprobes(struct kprobe **kps, int num); int register_kretprobes(struct kretprobe **rps, int num);}hjC sbah}(h]h ]h"]h$]h&]jjuh1j hhhMhj2 hhubh)}(hRegisters each of the num probes in the specified array. If any error occurs during registration, all probes in the array, up to the bad probe, are safely unregistered before the register_*probes function returns.h]hRegisters each of the num probes in the specified array. If any error occurs during registration, all probes in the array, up to the bad probe, are safely unregistered before the register_*probes function returns.}(hjQ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj2 hhubju)}(hhh](jz)}(h;kps/rps: an array of pointers to ``*probe`` data structuresh]h)}(hjd h](h!kps/rps: an array of pointers to }(hjf hhhNhNubjV)}(h ``*probe``h]h*probe}(hjm hhhNhNubah}(h]h ]h"]h$]h&]uh1jUhjf ubh data structures}(hjf hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjb ubah}(h]h ]h"]h$]h&]uh1jyhj_ hhhhhNubjz)}(h&num: the number of the array entries. h]h)}(h%num: the number of the array entries.h]h%num: the number of the array entries.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jyhj_ hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jthhhMhj2 hhubj )}(hsYou have to allocate(or define) an array of pointers and set all of the array entries before using these functions.h]h)}(hsYou have to allocate(or define) an array of pointers and set all of the array entries before using these functions.h]hsYou have to allocate(or define) an array of pointers and set all of the array entries before using these functions.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j hj2 hhhhhNubeh}(h]register-probesah ]h"]register_*probesah$]h&]uh1hhjt hhhhhMubh)}(hhh](h)}(hunregister_*probesh]hunregister_*probes}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubj )}(h#include void unregister_kprobes(struct kprobe **kps, int num); void unregister_kretprobes(struct kretprobe **rps, int num);h]h#include void unregister_kprobes(struct kprobe **kps, int num); void unregister_kretprobes(struct kretprobe **rps, int num);}hj sbah}(hn]h ]h"]h$]h&]jjuh1j hhhMhj hhubh)}(h>Removes each of the num probes in the specified array at once.h]h>Removes each of the num probes in the specified array at once.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj )}(hIf the functions find some incorrect probes (ex. unregistered probes) in the specified array, they clear the addr field of those incorrect probes. However, other probes in the array are unregistered correctly.h]h)}(hIf the functions find some incorrect probes (ex. unregistered probes) in the specified array, they clear the addr field of those incorrect probes. However, other probes in the array are unregistered correctly.h]hIf the functions find some incorrect probes (ex. unregistered probes) in the specified array, they clear the addr field of those incorrect probes. However, other probes in the array are unregistered correctly.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j hj hhhhhNubeh}(h]unregister-probesah ]h"]unregister_*probesah$]h&]uh1hhjt hhhhhMubh)}(hhh](h)}(hdisable_*probeh]hdisable_*probe}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubj )}(hn#include int disable_kprobe(struct kprobe *kp); int disable_kretprobe(struct kretprobe *rp);h]hn#include int disable_kprobe(struct kprobe *kp); int disable_kretprobe(struct kretprobe *rp);}hj' sbah}(h]h ]h"]h$]h&]jjuh1j hhhMhj hhubh)}(hTemporarily disables the specified ``*probe``. You can enable it again by using enable_*probe(). You must specify the probe which has been registered.h](h#Temporarily disables the specified }(hj5 hhhNhNubjV)}(h ``*probe``h]h*probe}(hj= hhhNhNubah}(h]h ]h"]h$]h&]uh1jUhj5 ubhi. You can enable it again by using enable_*probe(). You must specify the probe which has been registered.}(hj5 hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubeh}(h] disable-probeah ]h"]disable_*probeah$]h&]uh1hhjt hhhhhMubh)}(hhh](h)}(h enable_*probeh]h enable_*probe}(hj` hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj] hhhhhM ubj )}(hl#include int enable_kprobe(struct kprobe *kp); int enable_kretprobe(struct kretprobe *rp);h]hl#include int enable_kprobe(struct kprobe *kp); int enable_kretprobe(struct kretprobe *rp);}hjn sbah}(h]h ]h"]h$]h&]jjuh1j hhhMhj] hhubh)}(huEnables ``*probe`` which has been disabled by disable_*probe(). You must specify the probe which has been registered.h](hEnables }(hj| hhhNhNubjV)}(h ``*probe``h]h*probe}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jUhj| ubhc which has been disabled by disable_*probe(). You must specify the probe which has been registered.}(hj| hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj] hhubeh}(h] enable-probeah ]h"] enable_*probeah$]h&]uh1hhjt hhhhhM ubeh}(h] api-referenceah ]h"] api referenceah$]h&]uh1hhhhhhhhM\ubh)}(hhh](h)}(h Kprobes Features and Limitationsh]h Kprobes Features and Limitations}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(hKprobes allows multiple probes at the same address. Also, a probepoint for which there is a post_handler cannot be optimized. So if you install a kprobe with a post_handler, at an optimized probepoint, the probepoint will be unoptimized automatically.h]hKprobes allows multiple probes at the same address. Also, a probepoint for which there is a post_handler cannot be optimized. So if you install a kprobe with a post_handler, at an optimized probepoint, the probepoint will be unoptimized automatically.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hIn general, you can install a probe anywhere in the kernel. In particular, you can probe interrupt handlers. Known exceptions are discussed in this section.h]hIn general, you can install a probe anywhere in the kernel. In particular, you can probe interrupt handlers. Known exceptions are discussed in this section.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hThe register_*probe functions will return -EINVAL if you attempt to install a probe in the code that implements Kprobes (mostly kernel/kprobes.c and ``arch/*/kernel/kprobes.c``, but also functions such as do_page_fault and notifier_call_chain).h](hThe register_*probe functions will return -EINVAL if you attempt to install a probe in the code that implements Kprobes (mostly kernel/kprobes.c and }(hj hhhNhNubjV)}(h``arch/*/kernel/kprobes.c``h]harch/*/kernel/kprobes.c}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jUhj ubhD, but also functions such as do_page_fault and notifier_call_chain).}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM#hj hhubh)}(hX If you install a probe in an inline-able function, Kprobes makes no attempt to chase down all inline instances of the function and install probes there. gcc may inline a function without being asked, so keep this in mind if you're not seeing the probe hits you expect.h]hXIf you install a probe in an inline-able function, Kprobes makes no attempt to chase down all inline instances of the function and install probes there. gcc may inline a function without being asked, so keep this in mind if you’re not seeing the probe hits you expect.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM(hj hhubh)}(hXA probe handler can modify the environment of the probed function -- e.g., by modifying kernel data structures, or by modifying the contents of the pt_regs struct (which are restored to the registers upon return from the breakpoint). So Kprobes can be used, for example, to install a bug fix or to inject faults for testing. Kprobes, of course, has no way to distinguish the deliberately injected faults from the accidental ones. Don't drink and probe.h]hXA probe handler can modify the environment of the probed function -- e.g., by modifying kernel data structures, or by modifying the contents of the pt_regs struct (which are restored to the registers upon return from the breakpoint). So Kprobes can be used, for example, to install a bug fix or to inject faults for testing. Kprobes, of course, has no way to distinguish the deliberately injected faults from the accidental ones. Don’t drink and probe.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM-hj hhubh)}(hX=Kprobes makes no attempt to prevent probe handlers from stepping on each other -- e.g., probing printk() and then calling printk() from a probe handler. If a probe handler hits a probe, that second probe's handlers won't be run in that instance, and the kprobe.nmissed member of the second probe will be incremented.h]hXAKprobes makes no attempt to prevent probe handlers from stepping on each other -- e.g., probing printk() and then calling printk() from a probe handler. If a probe handler hits a probe, that second probe’s handlers won’t be run in that instance, and the kprobe.nmissed member of the second probe will be incremented.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM5hj hhubh)}(h~As of Linux v2.6.15-rc1, multiple handlers (or multiple instances of the same handler) may run concurrently on different CPUs.h]h~As of Linux v2.6.15-rc1, multiple handlers (or multiple instances of the same handler) may run concurrently on different CPUs.}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM;hj hhubh)}(h^Kprobes does not use mutexes or allocate memory except during registration and unregistration.h]h^Kprobes does not use mutexes or allocate memory except during registration and unregistration.}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM>hj hhubh)}(hXZProbe handlers are run with preemption disabled or interrupt disabled, which depends on the architecture and optimization state. (e.g., kretprobe handlers and optimized kprobe handlers run without interrupt disabled on x86/x86-64). In any case, your handler should not yield the CPU (e.g., by attempting to acquire a semaphore, or waiting I/O).h]hXZProbe handlers are run with preemption disabled or interrupt disabled, which depends on the architecture and optimization state. (e.g., kretprobe handlers and optimized kprobe handlers run without interrupt disabled on x86/x86-64). In any case, your handler should not yield the CPU (e.g., by attempting to acquire a semaphore, or waiting I/O).}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhj hhubh)}(hXpSince a return probe is implemented by replacing the return address with the trampoline's address, stack backtraces and calls to __builtin_return_address() will typically yield the trampoline's address instead of the real return address for kretprobed functions. (As far as we can tell, __builtin_return_address() is used only for instrumentation and error reporting.)h]hXtSince a return probe is implemented by replacing the return address with the trampoline’s address, stack backtraces and calls to __builtin_return_address() will typically yield the trampoline’s address instead of the real return address for kretprobed functions. (As far as we can tell, __builtin_return_address() is used only for instrumentation and error reporting.)}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMGhj hhubh)}(hXIf the number of times a function is called does not match the number of times it returns, registering a return probe on that function may produce undesirable results. In such a case, a line: kretprobe BUG!: Processing kretprobe d000000000041aa8 @ c00000000004f48c gets printed. With this information, one will be able to correlate the exact instance of the kretprobe that caused the problem. We have the do_exit() case covered. do_execve() and do_fork() are not an issue. We're unaware of other specific cases where this could be a problem.h]hXIf the number of times a function is called does not match the number of times it returns, registering a return probe on that function may produce undesirable results. In such a case, a line: kretprobe BUG!: Processing kretprobe d000000000041aa8 @ c00000000004f48c gets printed. With this information, one will be able to correlate the exact instance of the kretprobe that caused the problem. We have the do_exit() case covered. do_execve() and do_fork() are not an issue. We’re unaware of other specific cases where this could be a problem.}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMNhj hhubh)}(hXRIf, upon entry to or exit from a function, the CPU is running on a stack other than that of the current task, registering a return probe on that function may produce undesirable results. For this reason, Kprobes doesn't support return probes (or kprobes) on the x86_64 version of __switch_to(); the registration functions return -EINVAL.h]hXTIf, upon entry to or exit from a function, the CPU is running on a stack other than that of the current task, registering a return probe on that function may produce undesirable results. For this reason, Kprobes doesn’t support return probes (or kprobes) on the x86_64 version of __switch_to(); the registration functions return -EINVAL.}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMWhj hhubh)}(hXOn x86/x86-64, since the Jump Optimization of Kprobes modifies instructions widely, there are some limitations to optimization. To explain it, we introduce some terminology. Imagine a 3-instruction sequence consisting of a two 2-byte instructions and one 3-byte instruction.h]hXOn x86/x86-64, since the Jump Optimization of Kprobes modifies instructions widely, there are some limitations to optimization. To explain it, we introduce some terminology. Imagine a 3-instruction sequence consisting of a two 2-byte instructions and one 3-byte instruction.}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM^hj hhubj )}(hX IA | [-2][-1][0][1][2][3][4][5][6][7] [ins1][ins2][ ins3 ] [<- DCR ->] [<- JTPR ->] ins1: 1st Instruction ins2: 2nd Instruction ins3: 3rd Instruction IA: Insertion Address JTPR: Jump Target Prohibition Region DCR: Detoured Code Regionh]hX IA | [-2][-1][0][1][2][3][4][5][6][7] [ins1][ins2][ ins3 ] [<- DCR ->] [<- JTPR ->] ins1: 1st Instruction ins2: 2nd Instruction ins3: 3rd Instruction IA: Insertion Address JTPR: Jump Target Prohibition Region DCR: Detoured Code Region}hjsbah}(h]h ]h"]h$]h&]jjuh1j hhhMfhj hhubh)}(hThe instructions in DCR are copied to the out-of-line buffer of the kprobe, because the bytes in DCR are replaced by a 5-byte jump instruction. So there are several limitations.h]hThe instructions in DCR are copied to the out-of-line buffer of the kprobe, because the bytes in DCR are replaced by a 5-byte jump instruction. So there are several limitations.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMthj hhubj )}(hhh](jz)}(h,The instructions in DCR must be relocatable.h]h)}(hjh]h,The instructions in DCR must be relocatable.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMxhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(hhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj )}(hXgk = kprobe; r = return probe; kr = kprobe + return probe on same function i386: Intel Pentium M, 1495 MHz, 2957.31 bogomips k = 0.57 usec; r = 0.92; kr = 0.99 x86_64: AMD Opteron 246, 1994 MHz, 3971.48 bogomips k = 0.49 usec; r = 0.80; kr = 0.82 ppc64: POWER5 (gr), 1656 MHz (SMT disabled, 1 virtual CPU per physical CPU) k = 0.77 usec; r = 1.26; kr = 1.45h]hXgk = kprobe; r = return probe; kr = kprobe + return probe on same function i386: Intel Pentium M, 1495 MHz, 2957.31 bogomips k = 0.57 usec; r = 0.92; kr = 0.99 x86_64: AMD Opteron 246, 1994 MHz, 3971.48 bogomips k = 0.49 usec; r = 0.80; kr = 0.82 ppc64: POWER5 (gr), 1656 MHz (SMT disabled, 1 virtual CPU per physical CPU) k = 0.77 usec; r = 1.26; kr = 1.45}hjLsbah}(h]h ]h"]h$]h&]jjuh1j hhhMhjhhubh)}(hhh](h)}(hOptimized Probe Overheadh]hOptimized Probe Overhead}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjZhhhhhMubh)}(hTypically, an optimized kprobe hit takes 0.07 to 0.1 microseconds to process. Here are sample overhead figures (in usec) for x86 architectures::h]hTypically, an optimized kprobe hit takes 0.07 to 0.1 microseconds to process. Here are sample overhead figures (in usec) for x86 architectures:}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjZhhubj )}(hXk = unoptimized kprobe, b = boosted (single-step skipped), o = optimized kprobe, r = unoptimized kretprobe, rb = boosted kretprobe, ro = optimized kretprobe. i386: Intel(R) Xeon(R) E5410, 2.33GHz, 4656.90 bogomips k = 0.80 usec; b = 0.33; o = 0.05; r = 1.10; rb = 0.61; ro = 0.33 x86-64: Intel(R) Xeon(R) E5410, 2.33GHz, 4656.90 bogomips k = 0.99 usec; b = 0.43; o = 0.06; r = 1.24; rb = 0.68; ro = 0.30h]hXk = unoptimized kprobe, b = boosted (single-step skipped), o = optimized kprobe, r = unoptimized kretprobe, rb = boosted kretprobe, ro = optimized kretprobe. i386: Intel(R) Xeon(R) E5410, 2.33GHz, 4656.90 bogomips k = 0.80 usec; b = 0.33; o = 0.05; r = 1.10; rb = 0.61; ro = 0.33 x86-64: Intel(R) Xeon(R) E5410, 2.33GHz, 4656.90 bogomips k = 0.99 usec; b = 0.43; o = 0.06; r = 1.24; rb = 0.68; ro = 0.30}hjysbah}(h]h ]h"]h$]h&]jjuh1j hhhMhjZhhubeh}(h]optimized-probe-overheadah ]h"]optimized probe overheadah$]h&]uh1hhjhhhhhMubeh}(h]probe-overheadah ]h"]probe overheadah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hTODOh]hTODO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubj )}(hhh](jz)}(hSystemTap (http://sourceware.org/systemtap): Provides a simplified programming interface for probe-based instrumentation. Try it out.h]h)}(hSystemTap (http://sourceware.org/systemtap): Provides a simplified programming interface for probe-based instrumentation. Try it out.h](h SystemTap (}(hjhhhNhNubh)}(hhttp://sourceware.org/systemtaph]hhttp://sourceware.org/systemtap}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1hhjubh\): Provides a simplified programming interface for probe-based instrumentation. Try it out.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(h!Kernel return probes for sparc64.h]h)}(hjh]h!Kernel return probes for sparc64.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(h Support for other architectures.h]h)}(hjh]h Support for other architectures.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(hUser-space probes.h]h)}(hjh]hUser-space probes.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(h3Watchpoint probes (which fire on data references). h]h)}(h2Watchpoint probes (which fire on data references).h]h2Watchpoint probes (which fire on data references).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubeh}(h]h ]h"]h$]h&]jO jjQ hjR jS uh1j hjhhhhhMubeh}(h]todoah ]h"]todoah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hKprobes Exampleh]hKprobes Example}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjAhhhhhMubh)}(h$See samples/kprobes/kprobe_example.ch]h$See samples/kprobes/kprobe_example.c}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjAhhubeh}(h]kprobes-exampleah ]h"]kprobes exampleah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hKretprobes Exampleh]hKretprobes Example}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhhMubh)}(h'See samples/kprobes/kretprobe_example.ch]h'See samples/kprobes/kretprobe_example.c}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhhubeh}(h]kretprobes-exampleah ]h"]kretprobes exampleah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hDeprecated Featuresh]hDeprecated Features}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hJprobes is now a deprecated feature. People who are depending on it should migrate to other tracing features or use older kernels. Please consider to migrate your tool to one of the following options:h]hJprobes is now a deprecated feature. People who are depending on it should migrate to other tracing features or use older kernels. Please consider to migrate your tool to one of the following options:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubju)}(hhh](jz)}(hXUse trace-event to trace target function with arguments. trace-event is a low-overhead (and almost no visible overhead if it is off) statically defined event interface. You can define new events and trace it via ftrace or any other tracing tools. See the following urls: - https://lwn.net/Articles/379903/ - https://lwn.net/Articles/381064/ - https://lwn.net/Articles/383362/ h](h)}(h8Use trace-event to trace target function with arguments.h]h8Use trace-event to trace target function with arguments.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(htrace-event is a low-overhead (and almost no visible overhead if it is off) statically defined event interface. You can define new events and trace it via ftrace or any other tracing tools.h]htrace-event is a low-overhead (and almost no visible overhead if it is off) statically defined event interface. You can define new events and trace it via ftrace or any other tracing tools.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hSee the following urls:h]hSee the following urls:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh block_quote)}(hi- https://lwn.net/Articles/379903/ - https://lwn.net/Articles/381064/ - https://lwn.net/Articles/383362/ h]ju)}(hhh](jz)}(h https://lwn.net/Articles/379903/h]h)}(hjh]h)}(hjh]h https://lwn.net/Articles/379903/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1hhjubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jyhjubjz)}(h https://lwn.net/Articles/381064/h]h)}(hj h]h)}(hj h]h https://lwn.net/Articles/381064/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurij uh1hhj ubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jyhjubjz)}(h!https://lwn.net/Articles/383362/ h]h)}(h https://lwn.net/Articles/383362/h]h)}(hj0h]h https://lwn.net/Articles/383362/}(hj2hhhNhNubah}(h]h ]h"]h$]h&]refurij0uh1hhj.ubah}(h]h ]h"]h$]h&]uh1hhhhMhj*ubah}(h]h ]h"]h$]h&]uh1jyhjubeh}(h]h ]h"]h$]h&]jjuh1jthhhMhjubah}(h]h ]h"]h$]h&]uh1jhhhMhjubeh}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(hXUse ftrace dynamic events (kprobe event) with perf-probe. If you build your kernel with debug info (CONFIG_DEBUG_INFO=y), you can find which register/stack is assigned to which local variable or arguments by using perf-probe and set up new event to trace it. See following documents: - Documentation/trace/kprobetrace.rst - Documentation/trace/events.rst - tools/perf/Documentation/perf-probe.txt h](h)}(h9Use ftrace dynamic events (kprobe event) with perf-probe.h]h9Use ftrace dynamic events (kprobe event) with perf-probe.}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj^ubh)}(hIf you build your kernel with debug info (CONFIG_DEBUG_INFO=y), you can find which register/stack is assigned to which local variable or arguments by using perf-probe and set up new event to trace it.h]hIf you build your kernel with debug info (CONFIG_DEBUG_INFO=y), you can find which register/stack is assigned to which local variable or arguments by using perf-probe and set up new event to trace it.}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj^ubh)}(hSee following documents:h]hSee following documents:}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj^ubju)}(hhh](jz)}(h#Documentation/trace/kprobetrace.rsth]h)}(hjh]h#Documentation/trace/kprobetrace.rst}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jyhjubjz)}(hDocumentation/trace/events.rsth]h)}(hjh]hDocumentation/trace/events.rst}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jyhjubjz)}(h)tools/perf/Documentation/perf-probe.txt h]h)}(h'tools/perf/Documentation/perf-probe.txth]h'tools/perf/Documentation/perf-probe.txt}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jyhjubeh}(h]h ]h"]h$]h&]jjuh1jthhhMhj^ubeh}(h]h ]h"]h$]h&]uh1jyhjhhhNhNubeh}(h]h ]h"]h$]h&]jjuh1jthhhMhjhhubeh}(h]deprecated-featuresah ]h"]deprecated featuresah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hThe kprobes debugfs interfaceh]hThe kprobes debugfs interface}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hWith recent kernels (> 2.6.20) the list of registered kprobes is visible under the /sys/kernel/debug/kprobes/ directory (assuming debugfs is mounted at //sys/kernel/debug).h]hWith recent kernels (> 2.6.20) the list of registered kprobes is visible under the /sys/kernel/debug/kprobes/ directory (assuming debugfs is mounted at //sys/kernel/debug).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hK/sys/kernel/debug/kprobes/list: Lists all registered probes on the system::h]hJ/sys/kernel/debug/kprobes/list: Lists all registered probes on the system:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj )}(h5c015d71a k vfs_read+0x0 c03dedc5 r tcp_v4_rcv+0x0h]h5c015d71a k vfs_read+0x0 c03dedc5 r tcp_v4_rcv+0x0}hjsbah}(h]h ]h"]h$]h&]jjuh1j hhhMhjhhubh)}(hXThe first column provides the kernel address where the probe is inserted. The second column identifies the type of probe (k - kprobe and r - kretprobe) while the third column specifies the symbol+offset of the probe. If the probed function belongs to a module, the module name is also specified. Following columns show probe status. If the probe is on a virtual address that is no longer valid (module init sections, module virtual addresses that correspond to modules that've been unloaded), such probes are marked with [GONE]. If the probe is temporarily disabled, such probes are marked with [DISABLED]. If the probe is optimized, it is marked with [OPTIMIZED]. If the probe is ftrace-based, it is marked with [FTRACE].h]hXThe first column provides the kernel address where the probe is inserted. The second column identifies the type of probe (k - kprobe and r - kretprobe) while the third column specifies the symbol+offset of the probe. If the probed function belongs to a module, the module name is also specified. Following columns show probe status. If the probe is on a virtual address that is no longer valid (module init sections, module virtual addresses that correspond to modules that’ve been unloaded), such probes are marked with [GONE]. If the probe is temporarily disabled, such probes are marked with [DISABLED]. If the probe is optimized, it is marked with [OPTIMIZED]. If the probe is ftrace-based, it is marked with [FTRACE].}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h@/sys/kernel/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly.h]h@/sys/kernel/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly.}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXProvides a knob to globally and forcibly turn registered kprobes ON or OFF. By default, all kprobes are enabled. By echoing "0" to this file, all registered probes will be disarmed, till such time a "1" is echoed to this file. Note that this knob just disarms and arms all kprobes and doesn't change each probe's disabling state. This means that disabled kprobes (marked [DISABLED]) will be not enabled if you turn ON all kprobes by this knob.h]hXProvides a knob to globally and forcibly turn registered kprobes ON or OFF. By default, all kprobes are enabled. By echoing “0” to this file, all registered probes will be disarmed, till such time a “1” is echoed to this file. Note that this knob just disarms and arms all kprobes and doesn’t change each probe’s disabling state. This means that disabled kprobes (marked [DISABLED]) will be not enabled if you turn ON all kprobes by this knob.}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]the-kprobes-debugfs-interfaceah ]h"]the kprobes debugfs interfaceah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hThe kprobes sysctl interfaceh]hThe kprobes sysctl interface}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj\hhhhhMubh)}(hG/proc/sys/debug/kprobes-optimization: Turn kprobes optimization ON/OFF.h]hG/proc/sys/debug/kprobes-optimization: Turn kprobes optimization ON/OFF.}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj\hhubh)}(hXWhen CONFIG_OPTPROBES=y, this sysctl interface appears and it provides a knob to globally and forcibly turn jump optimization (see section :ref:`kprobes_jump_optimization`) ON or OFF. By default, jump optimization is allowed (ON). If you echo "0" to this file or set "debug.kprobes_optimization" to 0 via sysctl, all optimized probes will be unoptimized, and any new probes registered after that will not be optimized.h](hWhen CONFIG_OPTPROBES=y, this sysctl interface appears and it provides a knob to globally and forcibly turn jump optimization (see section }(hj{hhhNhNubh)}(h :ref:`kprobes_jump_optimization`h]j)}(hjh]hkprobes_jump_optimization}(hjhhhNhNubah}(h]h ](j stdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjkprobes_jump_optimizationuh1hhhhMhj{ubh) ON or OFF. By default, jump optimization is allowed (ON). If you echo “0” to this file or set “debug.kprobes_optimization” to 0 via sysctl, all optimized probes will be unoptimized, and any new probes registered after that will not be optimized.}(hj{hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj\hhubh)}(hNote that this knob *changes* the optimized state. This means that optimized probes (marked [OPTIMIZED]) will be unoptimized ([OPTIMIZED] tag will be removed). If the knob is turned on, they will be optimized again.h](hNote that this knob }(hjhhhNhNubj)}(h *changes*h]hchanges}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh the optimized state. This means that optimized probes (marked [OPTIMIZED]) will be unoptimized ([OPTIMIZED] tag will be removed). If the knob is turned on, they will be optimized again.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hj\hhubeh}(h]the-kprobes-sysctl-interfaceah ]h"]the kprobes sysctl interfaceah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h Referencesh]h References}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hCFor additional information on Kprobes, refer to the following URLs:h]hCFor additional information on Kprobes, refer to the following URLs:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubju)}(hhh](jz)}(h https://lwn.net/Articles/132196/h]h)}(hjh]h)}(hjh]h https://lwn.net/Articles/132196/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1hhjubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubjz)}(h@https://www.kernel.org/doc/ols/2006/ols2006v2-pages-109-124.pdf h]h)}(h?https://www.kernel.org/doc/ols/2006/ols2006v2-pages-109-124.pdfh]h)}(hjh]h?https://www.kernel.org/doc/ols/2006/ols2006v2-pages-109-124.pdf}(hj hhhNhNubah}(h]h ]h"]h$]h&]refurijuh1hhjubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jyhjhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jthhhMhjhhubeh}(h] referencesah ]h"] referencesah$]h&]uh1hhhhhhhhMubeh}(h]kernel-probes-kprobesah ]h"]kernel probes (kprobes)ah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjserror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}(1]ja3]jra4]jaurefids}(j]jaj]jaj]jaunameids}(jMjJjjj.jjjjDjAj j jjjjjjjjjRjOj jjjjVjSjjjjj jj4jjjjjj jj j jq jn j j j j j j j/ j, j j j j jZ jW j j jjjjjjj>j;jejbjjjjjYjVjjjEjBu nametypes}(jMjj.jjDj jjjjjRj jjVjjj j4jjj j jq j j j j/ j j jZ j jjjj>jejjjYjjEuh}(jJhjjjjjjjjjAjj jGjjXjjjjjjjOj.jjUjj#jSjjjYj|jrjjjjjjjjjjjjjjj jjn j# j jt j j j j j, j j j2 j j jW j j j] jj jjjjZj;jjbjAjjhjjjVjjj\jBju footnote_refs}(j]jaj]jraj]jau citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes](jjje citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}jKsRparse_messages]transform_messages](hsystem_message)}(hhh]h)}(hhh]h?Hyperlink target "kprobes-jump-optimization" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1jubj)}(hhh]h)}(hhh]h7Hyperlink target "kprobes-blacklist" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineM#uh1jubj)}(hhh]h)}(hhh]h=Hyperlink target "kprobes-archs-supported" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineM3uh1jube transformerN include_log] decorationNhhub.