]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
[SPARC64]: Fix several kprobes bugs.
authorDavid S. Miller <davem@sunset.davemloft.net>
Sun, 10 Dec 2006 10:42:03 +0000 (02:42 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 10 Dec 2006 10:42:03 +0000 (02:42 -0800)
commitf0882589666440d573f657cb3a1d5f66f3caa157
treeb2c7d133a0c6140950e928e592cf1f3cf867d4d2
parent2f149228bb30ea08bfde740178f832d5c9081005
[SPARC64]: Fix several kprobes bugs.

- relbranch_fixup(), for non-branches, would end up setting
  regs->tnpc incorrectly, in fact it would set it equal to
  regs->tpc which would cause that instruction to execute twice

  Also, if this is not a PC-relative branch, we should just
  leave regs->tnpc as-is.  This covers cases like 'jmpl' which
  branch to absolute values.

- To be absolutely %100 safe, we need to flush the instruction
  cache for all assignments to kprobe->ainsn.insn[], including
  cases like add_aggr_kprobe()

- prev_kprobe's status field needs to be 'unsigned long' to match
  the type of the value it is saving

- jprobes were totally broken:
  = jprobe_return() can run in the stack frame of the jprobe handler,
    or in an even deeper stack frame, thus we'll be in the wrong
    register window than the one from the original probe state.

    So unwind using 'restore' instructions, if necessary, right
    before we do the jprobe_return() breakpoint trap.

  = There is no reason to save/restore the register window saved
    at %sp at jprobe trigger time.  Those registers cannot be
    modified by the jprobe handler.  Also, this code was saving
    and restoring "sizeof (struct sparc_stackf)" bytes.  Depending
    upon the caller, this could clobber unrelated stack frame
    pieces if there is only a basic 128-byte register window
    stored on the stack, without the argument save area.

    So just saving and restoring struct pt_regs is sufficient.

  = Kill the "jprobe_saved_esp", totally unused.

    Also, delete "jprobe_saved_regs_location", with the stack frame
    unwind now done explicitly by jprobe_return(), this check is
    superfluous.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/kprobes.c
include/asm-sparc64/kprobes.h