1. 29 4月, 2011 14 次提交
  2. 29 3月, 2011 1 次提交
    • V
      ARM: 6836/1: kprobes/fix emulation of LDR/STR instruction when Rn == PC · 0652f067
      Viktor Rosendahl 提交于
      The Rn value from the emulation is unconditionally written back;
      this is fine as long as Rn != PC because in that case, even if the
      instruction isn't a write back instruction, it will only result in the
      same value being written back.
      
      In case Rn == PC, then the emulated instruction doesn't have the
      actual PC value in Rn but an adjusted value; when this is written
      back, it will result in the PC being incorrectly updated.
      
      An altenative solution would be to check bits 24 and 22 to see whether
      the instruction actually is a write back instruction or not. I think
      it's enough to check whether Rn != PC,  because:
      - it's looks cheaper than the alternative
      - to my understaning it's not permitted to update the PC with a write
      back instruction, so we don't lose any ability to emulate legal
      instructions.
      - in case of writing back for non write back instructions where Rn != PC, it doesn't matter because the values are the same.
      
      Regarding the second point above, it would possibly be prudent to add
      some checking to prep_emulate_ldr_str(), so that instructions with
      both write back and Rn == PC would be rejected.
      Signed-off-by: NViktor Rosendahl <viktor.rosendahl@nokia.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      0652f067
  3. 22 2月, 2011 1 次提交
  4. 05 10月, 2010 1 次提交
  5. 15 7月, 2010 1 次提交
  6. 01 9月, 2008 1 次提交
  7. 29 4月, 2008 1 次提交
  8. 26 1月, 2008 1 次提交
    • Q
      ARM kprobes: instruction single-stepping support · 35aa1df4
      Quentin Barnes 提交于
      This is the code implementing instruction single-stepping for kprobes
      on ARM.
      
      To get around the limitation of no Next-PC and no hardware single-
      stepping, all kprobe'd instructions are split into three camps:
      simulation, emulation, and rejected. "Simulated" instructions are
      those instructions which behavior is reproduced by straight C code.
      "Emulated" instructions are ones that are copied, slightly altered
      and executed directly in the instruction slot to reproduce their
      behavior.  "Rejected" instructions are ones that could be simulated,
      but work hasn't been put into simulating them. These instructions
      should be very rare, if not unencountered, in the kernel. If ever
      needed, code could be added to simulate them.
      
      One might wonder why this and the ptrace singlestep facility are not
      sharing some code.  Both approaches are fundamentally different because
      the ptrace code regains control after the stepped instruction by installing
      a breakpoint after the instruction itself, and possibly at the location
      where the instruction might be branching to, instead of simulating or
      emulating the target instruction.
      
      The ptrace approach isn't suitable for kprobes because the breakpoints
      would have to be moved back, and the icache flushed, everytime the
      probe is hit to let normal code execution resume, which would have a
      significant performance impact. It is also racy on SMP since another
      CPU could, with the right timing, sail through the probe point without
      being caught.  Because ptrace single-stepping always result in a
      different process to be scheduled, the concern for performance is much
      less significant.
      
      On the other hand, the kprobes approach isn't (currently) suitable for
      ptrace because it has no provision for proper user space memory
      protection and translation, and even if that was implemented, the gain
      wouldn't be worth the added complexity in the ptrace path compared to
      the current approach.
      
      So, until kprobes does support user space, both kprobes and ptrace are
      best kept independent and separate.
      Signed-off-by: NQuentin Barnes <qbarnes@gmail.com>
      Signed-off-by: NAbhishek Sagar <sagar.abhishek@gmail.com>
      Signed-off-by: NNicolas Pitre <nico@marvell.com>
      35aa1df4