06 Mar, 2009

1 commit

  • Use the mutual exclusion provided by the text edit lock in the kprobes code. It
    allows coherent manipulation of the kernel code by other subsystems.

    Changelog:

    Move the kernel_text_lock/unlock out of the for loops.
    Use text_mutex directly instead of a function.
    Remove whitespace modifications.

    (note : kprobes_mutex is always taken outside of text_mutex)

    Signed-off-by: Mathieu Desnoyers
    Acked-by: Ananth N Mavinakayanahalli
    Acked-by: Masami Hiramatsu
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Mathieu Desnoyers
     

17 Jan, 2009

1 commit

  • Check CONFIG_FREEZER instead of CONFIG_PM because kprobe booster
    depends on freeze_processes() and thaw_processes() when CONFIG_PREEMPT=y.

    This fixes a linkage error which occurs when CONFIG_PREEMPT=y, CONFIG_PM=y
    and CONFIG_FREEZER=n.

    Reported-by: Cheng Renquan
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Ingo Molnar
    Signed-off-by: Len Brown

    Masami Hiramatsu
     

07 Jan, 2009

6 commits

  • Allow kprobes to probe module __init routines. When __init functions are
    freed, kprobes which probe those functions are set to "Gone" flag. These
    "Gone" probes are disarmed from the code and never be enabled.

    Signed-off-by: Masami Hiramatsu
    Acked-by: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     
  • Remove called_from argument from kprobes which had been used for
    preventing self-refering of kernel module. However, since we don't keep
    module's refcount after registering kprobe any more, there is no reason to
    check that.

    This patch also simplifies registering/unregistering functions because we
    don't need to use __builtin_return_address(0) which was passed to
    called_from.

    [ananth@in.ibm.com: build fix]
    Signed-off-by: Masami Hiramatsu
    Acked-by: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Ananth N Mavinakayanahalli
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     
  • Allows kprobes to probe __exit routine. This adds flags member to struct
    kprobe. When module is freed(kprobes hooks module_notifier to get this
    event), kprobes which probe the functions in that module are set to "Gone"
    flag to the flags member. These "Gone" probes are never be enabled.
    Users can check the GONE flag through debugfs.

    This also removes mod_refcounted, because we couldn't free a module if
    kprobe incremented the refcount of that module.

    [akpm@linux-foundation.org: document some locking]
    [mhiramat@redhat.com: bugfix: pass aggr_kprobe to arch_remove_kprobe]
    [mhiramat@redhat.com: bugfix: release old_p's insn_slot before error return]
    Signed-off-by: Masami Hiramatsu
    Acked-by: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     
  • Add __kprobes to kprobes internal functions for protecting from probing by
    kprobes itself.

    Signed-off-by: Masami Hiramatsu
    Acked-by: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     
  • Add kprobe_insn_mutex for protecting kprobe_insn_pages hlist, and remove
    kprobe_mutex from architecture dependent code.

    This allows us to call arch_remove_kprobe() (and free_insn_slot) while
    holding kprobe_mutex.

    Signed-off-by: Masami Hiramatsu
    Acked-by: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Cc: Russell King
    Cc: "Luck, Tony"
    Cc: Paul Mackerras
    Cc: Benjamin Herrenschmidt
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     
  • When someone called register_*probe() from kernel-core code(not from
    module) and that probes a kernel module, users can remove the probed
    module because kprobe doesn't increment reference counter of the module.
    (on the other hand, if the kernel-module calls register_*probe, kprobe
    increments refcount of the probed module.)

    Currently, we have no register_*probe() calling from kernel-core(except
    smoke-test, but the smoke-test doesn't probe module), so there is no real
    bugs. But the logic is wrong(or not fair) and it can causes a problem
    when someone might want to probe module from kernel.

    After this patch is applied, even if someone put register_*probe() call in
    the kernel-core code, it increments the reference counter of the probed
    module, and it prevents user to remove the module until stopping probing
    it.

    Signed-off-by: Masami Hiramatsu
    Cc: Lai Jiangshan
    Cc: Ananth N Mavinakayanahalli
    Cc: Hiroshi Shimamoto
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     

13 Nov, 2008

2 commits

  • We only need the cacheline padding on SMP kernels. Saves 6k:

    text data bss dec hex filename
    5713 388 8840 14941 3a5d kernel/kprobes.o
    5713 388 2632 8733 221d kernel/kprobes.o

    Acked-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • __register_kprobe() can be preempted after checking probing address but
    before module_text_address() or try_module_get(), and in this interval
    the module can be unloaded. In that case, try_module_get(probed_mod)
    will access to invalid address, or kprobe will probe invalid address.

    This patch uses preempt_disable() to protect it and uses
    __module_text_address() and __kernel_text_address().

    Signed-off-by: Lai Jiangshan
    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Hiroshi Shimamoto
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     

17 Oct, 2008

1 commit


26 Jul, 2008

2 commits

  • I noticed that there's a CONFIG_KPROBES check inside kernel/kprobes.c,
    which is redundant.

    Signed-off-by: Abhishek Sagar
    Acked-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Abhishek Sagar
     
  • Currently list of kretprobe instances are stored in kretprobe object (as
    used_instances,free_instances) and in kretprobe hash table. We have one
    global kretprobe lock to serialise the access to these lists. This causes
    only one kretprobe handler to execute at a time. Hence affects system
    performance, particularly on SMP systems and when return probe is set on
    lot of functions (like on all systemcalls).

    Solution proposed here gives fine-grain locks that performs better on SMP
    system compared to present kretprobe implementation.

    Solution:

    1) Instead of having one global lock to protect kretprobe instances
    present in kretprobe object and kretprobe hash table. We will have
    two locks, one lock for protecting kretprobe hash table and another
    lock for kretporbe object.

    2) We hold lock present in kretprobe object while we modify kretprobe
    instance in kretprobe object and we hold per-hash-list lock while
    modifying kretprobe instances present in that hash list. To prevent
    deadlock, we never grab a per-hash-list lock while holding a kretprobe
    lock.

    3) We can remove used_instances from struct kretprobe, as we can
    track used instances of kretprobe instances using kretprobe hash
    table.

    Time duration for kernel compilation ("make -j 8") on a 8-way ppc64 system
    with return probes set on all systemcalls looks like this.

    cacheline non-cacheline Un-patched kernel
    aligned patch aligned patch
    ===============================================================================
    real 9m46.784s 9m54.412s 10m2.450s
    user 40m5.715s 40m7.142s 40m4.273s
    sys 2m57.754s 2m58.583s 3m17.430s
    ===========================================================

    Time duration for kernel compilation ("make -j 8) on the same system, when
    kernel is not probed.
    =========================
    real 9m26.389s
    user 40m8.775s
    sys 2m7.283s
    =========================

    Signed-off-by: Srinivasa DS
    Signed-off-by: Jim Keniston
    Acked-by: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Cc: David S. Miller
    Cc: Masami Hiramatsu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Srinivasa D S
     

11 Jul, 2008

1 commit


13 Jun, 2008

1 commit


28 Apr, 2008

4 commits

  • Introduce unregister_/register_jprobes() for jprobe batch registration.

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Jim Keniston
    Cc: Prasanna S Panchamukhi
    Cc: Shaohua Li
    Cc: David Miller
    Cc: "Frank Ch. Eigler"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     
  • Introduce unregister_/register_kretprobes() for kretprobe batch registration.

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Jim Keniston
    Cc: Prasanna S Panchamukhi
    Cc: Shaohua Li
    Cc: David Miller
    Cc: "Frank Ch. Eigler"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     
  • Introduce unregister_/register_kprobes() for kprobe batch registration. This
    can reduce waiting time for synchronized_sched() when a lot of probes have to
    be unregistered at once.

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Jim Keniston
    Cc: Prasanna S Panchamukhi
    Cc: Shaohua Li
    Cc: David Miller
    Cc: "Frank Ch. Eigler"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     
  • Prohibit users from probing preempt_schedule(). One way of prohibiting the
    user from probing functions is by marking such functions with __kprobes. But
    this method doesn't work for those functions, which are already marked to
    different section like preempt_schedule() (belongs to __sched section). So we
    use blacklist approach to refuse user from probing these functions.

    In blacklist approach we populate the blacklisted function's starting address
    and its size in kprobe_blacklist structure. Then we verify the user specified
    address against start and end of the blacklisted function. So any attempt to
    register probe on blacklisted functions will be rejected.

    [akpm@linux-foundation.org: build fix]
    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Srinivasa DS
    Signed-off-by: Ananth N Mavinakayanahalli
    Signed-off-by: Jim Keniston
    Cc: Dave Hansen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Srinivasa Ds
     

05 Mar, 2008

2 commits

  • Fix a bug in regiseter_kretprobe() which does not check rp->kp.symbol_name ==
    NULL before calling kprobe_lookup_name.

    For maintainability, this introduces kprobe_addr helper function which
    resolves addr field. It is used by register_kprobe and register_kretprobe.

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Jim Keniston
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     
  • Add CONFIG_HAVE_KRETPROBES to the arch//Kconfig file for relevant
    architectures with kprobes support. This facilitates easy handling of
    in-kernel modules (like samples/kprobes/kretprobe_example.c) that depend on
    kretprobes being present in the kernel.

    Thanks to Sam Ravnborg for helping make the patch more lean.

    Per Mathieu's suggestion, added CONFIG_KRETPROBES and fixed up dependencies.

    Signed-off-by: Ananth N Mavinakayanahalli
    Acked-by: Mathieu Desnoyers
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ananth N Mavinakayanahalli
     

07 Feb, 2008

1 commit

  • Provide support to add an optional user defined callback to be run at
    function entry of a kretprobe'd function. Also modify the kprobe smoke
    tests to include an entry-handler during the kretprobe sanity test.

    Signed-off-by: Abhishek Sagar
    Cc: Prasanna S Panchamukhi
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Acked-by: Jim Keniston
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Abhishek Sagar
     

30 Jan, 2008

1 commit

  • Here is a quick and naive smoke test for kprobes. This is intended to
    just verify if some unrelated change broke the *probes subsystem. It is
    self contained, architecture agnostic and isn't of any great use by itself.

    This needs to be built in the kernel and runs a basic set of tests to
    verify if kprobes, jprobes and kretprobes run fine on the kernel. In case
    of an error, it'll print out a message with a "BUG" prefix.

    This is a start; we intend to add more tests to this bucket over time.

    Thanks to Jim Keniston and Masami Hiramatsu for comments and suggestions.

    Tested on x86 (32/64) and powerpc.

    Signed-off-by: Ananth N Mavinakayanahalli
    Acked-by: Masami Hiramatsu
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Ananth N Mavinakayanahalli
     

17 Oct, 2007

2 commits

  • Introduce architecture dependent kretprobe blacklists to prohibit users
    from inserting return probes on the function in which kprobes can be
    inserted but kretprobes can not.

    This patch also removes "__kprobes" mark from "__switch_to" on x86_64 and
    registers "__switch_to" to the blacklist on x86-64, because that mark is to
    prohibit user from inserting only kretprobe.

    Signed-off-by: Masami Hiramatsu
    Cc: Prasanna S Panchamukhi
    Acked-by: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     
  • x86(-64) are the last architectures still using the page fault notifier
    cruft for the kprobes page fault hook. This patch converts them to the
    proper direct calls, and removes the now unused pagefault notifier bits
    aswell as the cruft in kprobes.c that was related to this mess.

    I know Andi didn't really like this, but all other architecture maintainers
    agreed the direct calls are much better and besides the obvious cruft
    removal a common way of dealing with kprobes across architectures is
    important aswell.

    [akpm@linux-foundation.org: build fix]
    [akpm@linux-foundation.org: fix sparc64]
    Signed-off-by: Christoph Hellwig
    Cc: Andi Kleen
    Cc:
    Cc: Prasanna S Panchamukhi
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     

12 Aug, 2007

1 commit

  • gcc-4.2 is a lot more picky about its symbol handling. EXPORT_SYMBOL no
    longer works on symbols that are undefined or defined with static scope.

    For example, with CONFIG_PROFILE off, I see:

    kernel/profile.c:206: error: __ksymtab_profile_event_unregister causes a section type conflict
    kernel/profile.c:205: error: __ksymtab_profile_event_register causes a section type conflict

    This patch moves the EXPORTs inside the #ifdef CONFIG_PROFILE, so we
    only try to export symbols that are defined.

    Also, in kernel/kprobes.c there's an EXPORT_SYMBOL_GPL() for
    jprobes_return, which if CONFIG_JPROBES is undefined is a static
    inline and gives the same error.

    And in drivers/acpi/resources/rsxface.c, there's an
    ACPI_EXPORT_SYMBOPL() for a static symbol. If it's static, it's not
    accessible from outside the compilation unit, so should bot be exported.

    These three changes allow building a zx1_defconfig kernel with gcc 4.2
    on IA64.

    [akpm@linux-foundation.org: export jpobe_return properly]
    Signed-off-by: Peter Chubb
    Cc: Prasanna S Panchamukhi
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Cc: "Luck, Tony"
    Cc: Len Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Chubb
     

20 Jul, 2007

1 commit

  • I realise jprobes are a razor-blades-included type of interface, but that
    doesn't mean we can't try and make them safer to use. This guy I know once
    wrote code like this:

    struct jprobe jp = { .kp.symbol_name = "foo", .entry = "jprobe_foo" };

    And then his kernel exploded. Oops.

    This patch adds an arch hook, arch_deref_entry_point() (I don't like it
    either) which takes the void * in a struct jprobe, and gives back the text
    address that it represents.

    We can then use that in register_jprobe() to check that the entry point we're
    passed is actually in the kernel text, rather than just some random value.

    Signed-off-by: Michael Ellerman
    Cc: Prasanna S Panchamukhi
    Acked-by: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Cc: David S. Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Ellerman
     

09 May, 2007

7 commits

  • This patch provides a debugfs knob to turn kprobes on/off

    o A new file /debug/kprobes/enabled indicates if kprobes is enabled or
    not (default enabled)
    o Echoing 0 to this file will disarm all installed probes
    o Any new probe registration when disabled will register the probe but
    not arm it. A message will be printed out in such a case.
    o When a value 1 is echoed to the file, all probes (including ones
    registered in the intervening period) will be enabled
    o Unregistration will happen irrespective of whether probes are globally
    enabled or not.
    o Update Documentation/kprobes.txt to reflect these changes. While there
    also update the doc to make it current.

    We are also looking at providing sysrq key support to tie to the disabling
    feature provided by this patch.

    [akpm@linux-foundation.org: Use bool like a bool!]
    [akpm@linux-foundation.org: add printk facility levels]
    [cornelia.huck@de.ibm.com: Add the missing arch_trampoline_kprobe() for s390]
    Signed-off-by: Ananth N Mavinakayanahalli
    Signed-off-by: Srinivasa DS
    Signed-off-by: Cornelia Huck
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ananth N Mavinakayanahalli
     
  • - consolidate duplicate code in all arch_prepare_kretprobe instances
    into common code
    - replace various odd helpers that use hlist_for_each_entry to get
    the first elemenet of a list with either a hlist_for_each_entry_save
    or an opencoded access to the first element in the caller
    - inline add_rp_inst into it's only remaining caller
    - use kretprobe_inst_table_head instead of opencoding it

    Signed-off-by: Christoph Hellwig
    Cc: Prasanna S Panchamukhi
    Acked-by: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Remove superflous braces and fix indentation aswell as comments.

    Signed-off-by: Christoph Hellwig
    Cc: Prasanna S Panchamukhi
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Signed-off-by: Christoph Hellwig
    Cc: Prasanna S Panchamukhi
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Several kallsyms_lookup() pass dummy arguments but only need, say, module's
    name. Make kallsyms_lookup() accept NULLs where possible.

    Also, makes picture clearer about what interfaces are needed for all symbol
    resolving business.

    Signed-off-by: Alexey Dobriyan
    Cc: Rusty Russell
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • This patch moves the die notifier handling to common code. Previous
    various architectures had exactly the same code for it. Note that the new
    code is compiled unconditionally, this should be understood as an appel to
    the other architecture maintainer to implement support for it aswell (aka
    sprinkling a notify_die or two in the proper place)

    arm had a notifiy_die that did something totally different, I renamed it to
    arm_notify_die as part of the patch and made it static to the file it's
    declared and used at. avr32 used to pass slightly less information through
    this interface and I brought it into line with the other architectures.

    [akpm@linux-foundation.org: build fix]
    [akpm@linux-foundation.org: fix vmalloc_sync_all bustage]
    [bryan.wu@analog.com: fix vmalloc_sync_all in nommu]
    Signed-off-by: Christoph Hellwig
    Cc:
    Cc: Russell King
    Signed-off-by: Bryan Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Fix sparse NULL warnings:
    kernel/kprobes.c:915:49: warning: Using plain integer as NULL pointer

    Signed-off-by: Randy Dunlap
    Acked-by: Ananth N Mavinakayanahalli
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

21 Feb, 2007

1 commit

  • This patch lists all active probes in the system by scanning through
    kprobe_table[]. It takes care of aggregate handlers and prints the type of
    the probe. Letter "k" for kprobes, "j" for jprobes, "r" for kretprobes.
    It also lists address of the instruction,its symbolic name(function name +
    offset) and the module name. One can access this file through
    /sys/kernel/debug/kprobes/list.

    Output looks like this
    =====================
    llm40:~/a # cat /sys/kernel/debug/kprobes/list
    c0169ae3 r sys_read+0x0
    c0169ae3 k sys_read+0x0
    c01694c8 k vfs_write+0x0
    c0167d20 r sys_open+0x0
    f8e658a6 k reiserfs_delete_inode+0x0 reiserfs
    c0120f4a k do_fork+0x0
    c0120f4a j do_fork+0x0
    c0169b4a r sys_write+0x0
    c0169b4a k sys_write+0x0
    c0169622 r vfs_read+0x0
    =================================

    [akpm@linux-foundation.org: cleanup]
    [ananth@in.ibm.com: sparc build fix]
    Signed-off-by: Srinivasa DS
    Cc: Prasanna S Panchamukhi
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Ananth N Mavinakayanahalli
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Srinivasa Ds
     

31 Jan, 2007

1 commit

  • Replace the magic numbers with an enum, and gets rid of a warning on the
    specific architectures (ex. powerpc) on which the compiler considers
    'char' as 'unsigned char'.

    Signed-off-by: Masami Hiramatsu
    Cc: Prasanna S Panchamukhi
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     

08 Dec, 2006

1 commit

  • When we are unregistering a kprobe-booster, we can't release its
    instruction buffer immediately on the preemptive kernel, because some
    processes might be preempted on the buffer. The freeze_processes() and
    thaw_processes() functions can clean most of processes up from the buffer.
    There are still some non-frozen threads who have the PF_NOFREEZE flag. If
    those threads are sleeping (not preempted) at the known place outside the
    buffer, we can ensure safety of freeing.

    However, the processing of this check routine takes a long time. So, this
    patch introduces the garbage collection mechanism of insn_slot. It also
    introduces the "dirty" flag to free_insn_slot because of efficiency.

    The "clean" instruction slots (dirty flag is cleared) are released
    immediately. But the "dirty" slots which are used by boosted kprobes, are
    marked as garbages. collect_garbage_slots() will be invoked to release
    "dirty" slots if there are more than INSNS_PER_PAGE garbage slots or if
    there are no unused slots.

    Cc: "Keshavamurthy, Anil S"
    Cc: Ananth N Mavinakayanahalli
    Cc: "bibo,mao"
    Cc: Prasanna S Panchamukhi
    Cc: Yumiko Sugita
    Cc: Satoshi Oshima
    Cc: Hideo Aoki
    Signed-off-by: Masami Hiramatsu
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masami Hiramatsu
     

02 Oct, 2006

3 commits

  • kprobe_flush_task() possibly calls kfree function during holding
    kretprobe_lock spinlock, if kfree function is probed by kretprobe that will
    incur spinlock deadlock. This patch moves kfree function out scope of
    kretprobe_lock.

    Signed-off-by: bibo, mao
    Signed-off-by: Ananth N Mavinakayanahalli
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    bibo,mao
     
  • Whitespace is used to indent, this patch cleans up these sentences by
    kernel coding style.

    Signed-off-by: bibo, mao
    Signed-off-by: Ananth N Mavinakayanahalli
    Cc: "Luck, Tony"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    bibo,mao
     
  • In an effort to make kprobe modules more portable, here is a patch that:

    o Introduces the "symbol_name" field to struct kprobe.
    The symbol->address resolution now happens in the kernel in an
    architecture agnostic manner. 64-bit powerpc users no longer have
    to specify the ".symbols"
    o Introduces the "offset" field to struct kprobe to allow a user to
    specify an offset into a symbol.
    o The legacy mechanism of specifying the kprobe.addr is still supported.
    However, if both the kprobe.addr and kprobe.symbol_name are specified,
    probe registration fails with an -EINVAL.
    o The symbol resolution code uses kallsyms_lookup_name(). So
    CONFIG_KPROBES now depends on CONFIG_KALLSYMS
    o Apparantly kprobe modules were the only legitimate out-of-tree user of
    the kallsyms_lookup_name() EXPORT. Now that the symbol resolution
    happens in-kernel, remove the EXPORT as suggested by Christoph Hellwig
    o Modify tcp_probe.c that uses the kprobe interface so as to make it
    work on multiple platforms (in its earlier form, the code wouldn't
    work, say, on powerpc)

    Signed-off-by: Ananth N Mavinakayanahalli
    Signed-off-by: Prasanna S Panchamukhi
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ananth N Mavinakayanahalli