04 Aug, 2016

4 commits

  • The regs_return_value() returns "unsigned long" or "long" value. But the
    retval is int type now, it may cause overflow, the log may becomes:

    [ 2911.078869] do_brk returned -2003877888 and took 4620 ns to execute

    This patch converts the retval to "unsigned long" type, and fixes the
    overflow issue.

    Link: http://lkml.kernel.org/r/1464143083-3877-4-git-send-email-shijie.huang@arm.com
    Signed-off-by: Huang Shijie
    Cc: Petr Mladek
    Cc: Steve Capper
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Cc: Masami Hiramatsu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Shijie
     
  • We prefer to use the pr_* to print out the log now, this patch converts
    the printk to pr_info. In the error path, use the pr_err to replace the
    printk.

    Link: http://lkml.kernel.org/r/1464143083-3877-3-git-send-email-shijie.huang@arm.com
    Signed-off-by: Huang Shijie
    Cc: Petr Mladek
    Cc: Steve Capper
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Cc: Masami Hiramatsu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Shijie
     
  • We prefer to use the pr_* to print out the log now, this patch converts
    the printk to pr_info. In the error path, use the pr_err to replace the
    printk.

    Link: http://lkml.kernel.org/r/1464143083-3877-2-git-send-email-shijie.huang@arm.com
    Signed-off-by: Huang Shijie
    Cc: Petr Mladek
    Cc: Steve Capper
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Cc: Masami Hiramatsu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Shijie
     
  • We prefer to use the pr_* to print out the log now, this patch converts
    the printk to pr_info. In the error path, use the pr_err to replace the
    printk.

    Link: http://lkml.kernel.org/r/1464143083-3877-1-git-send-email-shijie.huang@arm.com
    Signed-off-by: Huang Shijie
    Cc: Petr Mladek
    Cc: Steve Capper
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Cc: Masami Hiramatsu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Shijie
     

19 Jul, 2016

1 commit


21 May, 2016

3 commits

  • Print out the symbol name for the hooks, it makes the logs more
    readable.

    Link: http://lkml.kernel.org/r/1463535417-29637-2-git-send-email-shijie.huang@arm.com
    Signed-off-by: Huang Shijie
    Cc: Petr Mladek
    Cc: Steve Capper
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Shijie
     
  • Add a new module parameter which can be used as the symbol name.

    Without this patch, we can only test the "_do_fork" function with this
    kernel module. With this patch, the module becomes more flexible; we
    can test any functions with this module with

    # insmod kprobe_example.ko symbol="xxx"

    Link: http://lkml.kernel.org/r/1463535417-29637-1-git-send-email-shijie.huang@arm.com
    Signed-off-by: Huang Shijie
    Cc: Petr Mladek
    Cc: Steve Capper
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Shijie
     
  • Commit 3033f14ab78c ("clone: support passing tls argument via C rather
    than pt_regs magic") added the tls argument for _do_fork(). This patch
    adds the "tls" argument for j_do_fork to make it match _do_fork().

    Signed-off-by: Huang Shijie
    Acked-by: Steve Capper
    Reviewed-by: Josh Triplett
    Cc: Masami Hiramatsu
    Cc: Andy Lutomirski
    Cc: Thiago Macieira
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Shijie
     

02 Oct, 2015

1 commit

  • Commit 3033f14ab78c ("clone: support passing tls argument via C rather
    than pt_regs magic") introduced _do_fork() that allowed to pass @tls
    parameter.

    The old do_fork() is defined only for architectures that are not ready
    to use this way and do not define HAVE_COPY_THREAD_TLS.

    Let's use _do_fork() in the kprobe examples to make them work again on
    all architectures.

    Signed-off-by: Petr Mladek
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    Cc: Andy Lutomirski
    Cc: Peter Zijlstra
    Cc: "H. Peter Anvin"
    Cc: Thomas Gleixner
    Cc: Thiago Macieira
    Cc: Jiri Kosina
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Petr Mladek
     

26 Sep, 2014

1 commit

  • In commit e80d666 "flagday: kill pt_regs argument of do_fork()", the
    arguments to do_fork() changed.

    The example code in jprobe_example.c was not updated to match, so the
    arguments inside the jprobe handler do not match reality.

    Fix it by updating the arguments to match do_fork(). While we're at it
    use pr_info() for brevity, and print stack_start as well for interest.

    Signed-off-by: Michael Ellerman
    Acked-by: Masami Hiramatsu
    Signed-off-by: Jiri Kosina

    Michael Ellerman
     

30 Aug, 2013

1 commit


05 Aug, 2010

1 commit

  • This KProbes example is a little useless if it doesn't print anything.
    For MIPS print similar messages to those produced on x86 and PPC.

    Signed-off-by: David Daney
    To: linux-mips@linux-mips.org
    To: ananth@in.ibm.com
    To: anil.s.keshavamurthy@intel.com
    To: davem@davemloft.net
    To: masami.hiramatsu.pt@hitachi.com
    Cc: linux-kernel@vger.kernel.org
    Cc: hschauhan@nulltrace.org
    Patchwork: https://patchwork.linux-mips.org/patch/1528/
    Signed-off-by: Ralf Baechle

    David Daney
     

17 Aug, 2009

1 commit


05 Mar, 2008

1 commit

  • Move kprobes examples from Documentation/kprobes.txt to under samples/.
    Patch originally by Randy Dunlap.

    o Updated the patch to apply on 2.6.25-rc3
    o Modified examples code to build on multiple architectures. Currently,
    the kprobe and jprobe examples code works for x86 and powerpc
    o Cleaned up unneeded #includes
    o Cleaned up Kconfig per Sam Ravnborg's suggestions to fix build break
    on archs that don't have kretprobes
    o Implemented suggestions by Mathieu Desnoyers on CONFIG_KRETPROBES
    o Included Andrew Morton's cleanup based on x86-git
    o Modified kretprobe_example to act as a arch-agnostic module to
    determine routine execution times:
    Use 'modprobe kretprobe_example func=' to determine
    execution time of func_name in nanoseconds.

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

    Ananth N Mavinakayanahalli