15 May, 2009

1 commit

  • Commit 79e539453b34e35f39299a899d263b0a1f1670bd introduced a
    regression where you cannot use sysrq 'g' to enter kgdb. The solution
    is to move the intel fb sysrq over to V for video instead of G for
    graphics. The SMP VOYAGER code to register for the sysrq-v is not
    anywhere to be found in the mainline kernel, so the comments in the
    code were cleaned up as well.

    This patch also cleans up the sysrq definitions for kgdb to make it
    generic for the kernel debugger, such that the sysrq 'g' can be used
    in the future to enter a gdbstub or another kernel debugger.

    Signed-off-by: Jason Wessel
    Acked-by: Jesse Barnes
    Acked-by: Randy Dunlap
    Signed-off-by: Andrew Morton

    Jason Wessel
     

07 Oct, 2008

1 commit


26 Sep, 2008

2 commits

  • On the x86 arch, user space single step exceptions should be ignored
    if they occur in the kernel space, such as ptrace stepping through a
    system call.

    First check if it is kgdb that is executing a single step, then ensure
    it is not an accidental traversal into the user space, while in kgdb,
    any other time the TIF_SINGLESTEP is set, kgdb should ignore the
    exception.

    On x86, arm, mips and powerpc, the kgdb_contthread usage was
    inconsistent with the way single stepping is implemented in the kgdb
    core. The arch specific stub should always set the
    kgdb_cpu_doing_single_step correctly if it is single stepping. This
    allows kgdb to correctly process an instruction steps if ptrace
    happens to be requesting an instruction step over a system call.

    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • On the ARM architecture, kgdb will crash the kernel if the last byte
    of valid memory is written due to a flush_icache_range flushing
    beyond the memory boundary.

    Signed-off-by: Atsuo Igarashi
    Signed-off-by: Jason Wessel

    Atsuo Igarashi
     

01 Aug, 2008

2 commits

  • The command "info threads" did not work correctly with kgdb. It would
    result in a silent kernel hang if used.

    This patach addresses several problems.
    - Fix use of deprecated NR_CPUS
    - Fix kgdb to not walk linearly through the pid space
    - Correctly implement shadow pids
    - Change the threads per query to a #define
    - Fix kgdb_hex2long to work with negated values

    The threads 0 and -1 are reserved to represent the current task. That
    means that CPU 0 will start with a shadow thread id of -2, and CPU 1
    will have a shadow thread id of -3, etc...

    From the debugger you can switch to a shadow thread to see what one of
    the other cpus was doing, however it is not possible to execute run
    control operations on any other cpu execept the cpu executing the
    kgdb_handle_exception().

    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • A regression to the kgdb core was found in the case of using the
    CONFIG_DEBUG_RODATA kernel option. When this option is on, a breakpoint
    cannot be written into any readonly memory page. When an external
    debugger requests a breakpoint to get set, the
    kgdb_validate_break_address() was only checking to see if the address
    to place the breakpoint was readable and lacked a write check.

    This patch changes the validate routine to try reading (via the
    breakpoint set request) and also to try immediately writing the break
    point. If either fails, an error is correctly returned and the
    debugger behaves correctly. Then an end user can make the
    descision to use hardware breakpoints.

    Also update the documentation to reflect that using
    CONFIG_DEBUG_RODATA will inhibit the use of software breakpoints.

    Signed-off-by: Jason Wessel

    Jason Wessel
     

24 Jun, 2008

1 commit

  • - Fix warning reported by sparse
    kernel/kgdb.c:1502:6: warning: symbol 'kgdb_console_write' was not declared.
    Should it be static?

    Signed-off-by: Jason Wessel

    Jason Wessel
     

29 May, 2008

1 commit


15 May, 2008

1 commit

  • Add a common hex array in hexdump.c so everyone can use it.

    Add a common hi/lo helper to avoid the shifting masking that is
    done to get the upper and lower nibbles of a byte value.

    Pull the pack_hex_byte helper from kgdb as it is opencoded many
    places in the tree that will be consolidated.

    Signed-off-by: Harvey Harrison
    Acked-by: Paul Mundt
    Cc: Jason Wessel
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Harvey Harrison
     

05 May, 2008

1 commit

  • Noticed by sparse:
    arch/x86/kernel/kgdb.c:556:15: warning: symbol 'kgdb_arch_pc' was not declared. Should it be static?
    kernel/kgdb.c:149:8: warning: symbol 'kgdb_do_roundup' was not declared. Should it be static?
    kernel/kgdb.c:193:22: warning: symbol 'kgdb_arch_pc' was not declared. Should it be static?
    kernel/kgdb.c:712:5: warning: symbol 'remove_all_break' was not declared. Should it be static?

    Related to kgdb_hex2long:
    arch/x86/kernel/kgdb.c:371:28: warning: incorrect type in argument 2 (different signedness)
    arch/x86/kernel/kgdb.c:371:28: expected long *long_val
    arch/x86/kernel/kgdb.c:371:28: got unsigned long *
    kernel/kgdb.c:469:27: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:469:27: expected long *long_val
    kernel/kgdb.c:469:27: got unsigned long *
    kernel/kgdb.c:470:27: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:470:27: expected long *long_val
    kernel/kgdb.c:470:27: got unsigned long *
    kernel/kgdb.c:894:27: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:894:27: expected long *long_val
    kernel/kgdb.c:894:27: got unsigned long *
    kernel/kgdb.c:895:27: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:895:27: expected long *long_val
    kernel/kgdb.c:895:27: got unsigned long *
    kernel/kgdb.c:1127:28: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:1127:28: expected long *long_val
    kernel/kgdb.c:1127:28: got unsigned long *
    kernel/kgdb.c:1132:25: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:1132:25: expected long *long_val
    kernel/kgdb.c:1132:25: got unsigned long *

    Signed-off-by: Harvey Harrison
    Signed-off-by: Jason Wessel

    Harvey Harrison
     

18 Apr, 2008

8 commits

  • On the ppc 4xx architecture the instruction cache must be flushed as
    well as the data cache. This patch just makes it generic for all
    architectures where CACHE_FLUSH_IS_SAFE is set to 1.

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar

    Jason Wessel
     
  • Fix the problem of protecting the kgdb handle_exception exit
    which had an NMI race condition, while trying to restore
    normal system operation.

    There was a small window after the master processor sets cpu_in_debug
    to zero but before it has set kgdb_active to zero where a
    non-master processor in an SMP system could receive an NMI and
    re-enter the kgdb_wait() loop.

    As long as the master processor sets the cpu_in_debug before sending
    the cpu roundup the cpu_in_debug variable can also be used to guard
    against the race condition.

    The kgdb_wait() function no longer needs to check
    kgdb_active because it is done in the arch specific code
    and handled along with the nmi traps at the low level.
    This also allows kgdb_wait() to exit correctly if it was
    entered for some unknown reason due to a spurious NMI that
    could not be handled by the arch specific code.

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar

    Jason Wessel
     
  • kgdb core fixes:
    - Check to see that mm->mmap_cache is not null before calling
    flush_cache_range(), else on arch=ARM it will cause a fatal
    fault.

    - Breakpoints should only be restored if they are in the BP_ACTIVE
    state.

    - Fix a typo in comments to "kgdb_register_io_module"

    x86 kgdb fixes:
    - Fix the x86 arch handler such that on a kill or detach that the
    appropriate cleanup on the single stepping flags gets run.

    - Add in the DIE_NMIWATCHDOG call for x86_64

    - Touch the nmi watchdog before returning the system to normal
    operation after performing any kind of kgdb operation, else
    the possibility exists to trigger the watchdog.

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar

    Jason Wessel
     
  • Fix two regressions dealing with the kgdb core.

    1) kgdb_skipexception and kgdb_post_primary_code are optional
    functions that are only required on archs that need special exception
    fixups.

    2) The kernel address space scope must be set on any probe_kernel_*
    function or archs such as ARCH=arm will not allow access to the kernel
    memory space. As an example, it is required to allow the full kernel
    address space is when you the kernel debugger to inspect a system
    call.

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar

    Jason Wessel
     
  • Add HW breakpoints into the arch specific portion of x86 kgdb. In the
    current x86 kernel.org kernels HW breakpoints are changed out in lazy
    fashion because there is no infrastructure around changing them when
    changing to a kernel task or entering the kernel mode via a system
    call. This lazy approach means that if a user process uses HW
    breakpoints the kgdb will loose out. This is an acceptable trade off
    because the developer debugging the kernel is assumed to know what is
    going on system wide and would be aware of this trade off.

    There is a minor bug fix to the kgdb core so as to correctly call the
    hw breakpoint functions with a valid value from the enum.

    There is also a minor change to the x86_64 startup code when using
    early HW breakpoints. When the debugger is connected, the cpu startup
    code must not zero out the HW breakpoint registers or you cannot hit
    the breakpoints you are interested in, in the first place.

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar

    Jason Wessel
     
  • If kgdb does remove a breakpoint that had a problem on the recursion
    check, it should also print the address of the breakpoint.

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar

    Jason Wessel
     
  • In order to not trip the clocksource watchdog, kgdb must touch the
    clocksource watchdog on the return to normal system run state.

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar

    Jason Wessel
     
  • kgdb core code. Handles the protocol and the arch details.

    [ mingo@elte.hu: heavily modified, simplified and cleaned up. ]
    [ xemul@openvz.org: use find_task_by_pid_ns ]

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar
    Signed-off-by: Jan Kiszka
    Reviewed-by: Thomas Gleixner

    Jason Wessel