01 May, 2013

1 commit

  • Currently help message of /proc/sysrq-trigger highlight its upper-case
    characters, like below:

    SysRq : HELP : loglevel(0-9) reBoot Crash terminate-all-tasks(E)
    memory-full-oom-kill(F) kill-all-tasks(I) ...

    this would confuse user trigger sysrq by upper-case character, which is
    inconsistent with the real lower-case character registed key.

    This inconsistent help message will also lead more confused when
    26 upper-case letters put into use in future.

    This patch fix kgdb sysrq key: "debug(g)"

    Signed-off-by: zhangwei(Jovi)
    Cc: Jason Wessel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    zhangwei(Jovi)
     

03 Mar, 2013

1 commit

  • Pull KGDB/KDB fixes and cleanups from Jason Wessel:
    "For a change we removed more code than we added. If people aren't
    using it we shouldn't be carrying it. :-)

    Cleanups:
    - Remove kdb ssb command - there is no in kernel disassembler to
    support it

    - Remove kdb ll command - Always caused a kernel oops and there were
    no bug reports so no one was using this command

    - Use kernel ARRAY_SIZE macro instead of array computations

    Fixes:
    - Stop oops in kdb if user executes kdb_defcmd with args

    - kdb help command truncated text

    - ppc64 support for kgdbts

    - Add missing kconfig option from original kdb port for dealing with
    catastrophic kernel crashes such that you can reboot automatically
    on continue from kdb"

    * tag 'for_linux-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
    kdb: Remove unhandled ssb command
    kdb: Prevent kernel oops with kdb_defcmd
    kdb: Remove the ll command
    kdb_main: fix help print
    kdb: Fix overlap in buffers with strcpy
    Fixed dead ifdef block by adding missing Kconfig option.
    kdb: Setup basic kdb state before invoking commands via kgdb
    kdb: use ARRAY_SIZE where possible
    kgdb/kgdbts: support ppc64
    kdb: A fix for kdb command table expansion

    Linus Torvalds
     

02 Mar, 2013

8 commits

  • The 'ssb' command can only be handled when we have a disassembler, to check for
    branches, so remove the 'ssb' command for now.

    Signed-off-by: Vincent Stehlé
    Signed-off-by: Jason Wessel

    Vincent
     
  • The kdb_defcmd can only be used to display the available command aliases
    while using the kernel debug shell. If you try to define a new macro
    while the kernel debugger is active it will oops. The debug shell
    macros must use pre-allocated memory set aside at the time kdb_init()
    is run, and the kdb_defcmd is restricted to only working at the time
    that the kdb_init sequence is being run, which only occurs if you
    actually activate the kernel debugger.

    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • Recently some code inspection was done after fixing a problem with
    kmalloc used while in the kernel debugger context (which is not
    legal), and it turned up the fact that kdb ll command will oops the
    kernel.

    Given that there have been zero bug reports on the command combined
    with the fact it will oops the kernel it is clearly not being used.
    Instead of fixing it, it will be removed.

    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • The help command was chopping all the usage instructions such that
    they were not readable.

    Example:

    bta [D|R|S|T|C|Z|E|U|I| Backtrace all processes matching state flag
    per_cpu [] [ [] []
    Display per_cpu variables

    All that is needed is to check the how long the cmd_usage is and jump
    to the next line when appropriate.

    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • Maxime reported that strcpy(s->usage, s->usage+1) has no definitive
    guarantee that it will work on all archs the same way when you have
    overlapping memory. The fix is simple for the kdb code because we
    still have the original string memory in the function scope, so we
    just have to use that as the argument instead.

    Reported-by: Maxime Villard
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • Although invasive kdb commands are not supported via kgdb, some useful
    non-invasive commands like bt* require basic kdb state to be setup before
    calling into the kdb code. Factor out some of this code and call it before
    and after executing kdb commands via kgdb.

    Signed-off-by: Matt Klein
    Signed-off-by: Jason Wessel

    Matt Klein
     
  • Signed-off-by: Sasha Levin
    Signed-off-by: Jason Wessel

    Sasha Levin
     
  • When locally adding in some additional kdb commands, I stumbled
    across an issue with the dynamic expansion of the kdb command table.
    When the number of kdb commands exceeds the size of the statically
    allocated kdb_base_commands[] array, additional space is allocated in
    the kdb_register_repeat() routine.

    The unused portion of the newly allocated array was not being initialized
    to zero properly and this would result in segfaults when help '?' was
    executed or when a search for a non-existing command would traverse the
    command table beyond the end of valid command entries and then attempt
    to use the non-zeroed area as actual command entries.

    Signed-off-by: John Blackwood
    Signed-off-by: Jason Wessel

    John Blackwood
     

05 Feb, 2013

1 commit


12 Jan, 2013

1 commit


13 Oct, 2012

1 commit

  • Pull KGDB/KDB fixes and cleanups from Jason Wessel:
    "Cleanups
    - Clean up compile warnings in kgdboc.c and x86/kernel/kgdb.c
    - Add module event hooks for simplified debugging with gdb
    Fixes
    - Fix kdb to stop paging with 'q' on bta and dmesg
    - Fix for data that scrolls off the vga console due to line wrapping
    when using the kdb pager
    New
    - The debug core registers for kernel module events which allows a
    kernel aware gdb to automatically load symbols and break on entry
    to a kernel module
    - Allow kgdboc=kdb to setup kdb on the vga console"

    * tag 'for_linus-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
    tty/console: fix warnings in drivers/tty/serial/kgdboc.c
    kdb,vt_console: Fix missed data due to pager overruns
    kdb: Fix dmesg/bta scroll to quit with 'q'
    kgdboc: Accept either kbd or kdb to activate the vga + keyboard kdb shell
    kgdb,x86: fix warning about unused variable
    mips,kgdb: fix recursive page fault with CONFIG_KPROBES
    kgdb: Add module event hooks

    Linus Torvalds
     

12 Oct, 2012

3 commits

  • It is possible to miss data when using the kdb pager. The kdb pager
    does not pay attention to the maximum column constraint of the screen
    or serial terminal. This result is not incrementing the shown lines
    correctly and the pager will print more lines that fit on the screen.
    Obviously that is less than useful when using a VGA console where you
    cannot scroll back.

    The pager will now look at the kdb_buffer string to see how many
    characters are printed. It might not be perfect considering you can
    output ASCII that might move the cursor position, but it is a
    substantially better approximation for viewing dmesg and trace logs.

    This also means that the vt screen needs to set the kdb COLUMNS
    variable.

    Cc:
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • If you press 'q' the pager should exit instead of printing everything
    from dmesg which can really bog down a 9600 baud serial link.

    The same is true for the bta command.

    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • Allow gdb to auto load kernel modules when it is attached,
    which makes it trivially easy to debug module init functions
    or pre-set breakpoints in a kernel module that has not loaded yet.

    Signed-off-by: Jason Wessel

    Jason Wessel
     

27 Sep, 2012

2 commits

  • This command disables NMI-entry. If NMI source has been previously shared
    with a serial console ("debug port"), this effectively releases the port
    from KDB exclusive use, and makes the console available for normal use.

    Of course, NMI can be reenabled, enable_nmi modparam is used for that:

    echo 1 > /sys/module/kdb/parameters/enable_nmi

    Signed-off-by: Anton Vorontsov
    Acked-by: Jason Wessel
    Signed-off-by: Greg Kroah-Hartman

    Anton Vorontsov
     
  • The new arch callback should manage NMIs that usually cause KGDB to
    enter. That is, not all NMIs should be enabled/disabled, but only
    those that issue kgdb_handle_exception().

    We must mask it as serial-line interrupt can be used as an NMI, so
    if the original KGDB-entry cause was say a breakpoint, then every
    input to KDB console will cause KGDB to reenter, which we don't want.

    Signed-off-by: Anton Vorontsov
    Acked-by: Jason Wessel
    Signed-off-by: Greg Kroah-Hartman

    Anton Vorontsov
     

31 Jul, 2012

3 commits


22 Jul, 2012

3 commits


05 Apr, 2012

1 commit

  • Pull KGDB/KDB regression fixes from Jason Wessel:
    - Fix a Smatch warning that appeared in the 3.4 merge window
    - Fix kgdb test suite with SMP for all archs without HW single stepping
    - Fix kgdb sw breakpoints with CONFIG_DEBUG_RODATA=y limitations on x86
    - Fix oops on kgdb test suite with CONFIG_DEBUG_RODATA
    - Fix kgdb test suite with SMP for all archs with HW single stepping

    * tag 'for_linus-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
    x86,kgdb: Fix DEBUG_RODATA limitation using text_poke()
    kgdb,debug_core: pass the breakpoint struct instead of address and memory
    kgdbts: (2 of 2) fix single step awareness to work correctly with SMP
    kgdbts: (1 of 2) fix single step awareness to work correctly with SMP
    kgdbts: Fix kernel oops with CONFIG_DEBUG_RODATA
    kdb: Fix smatch warning on dbg_io_ops->is_console

    Linus Torvalds
     

30 Mar, 2012

2 commits

  • There is extra state information that needs to be exposed in the
    kgdb_bpt structure for tracking how a breakpoint was installed. The
    debug_core only uses the the probe_kernel_write() to install
    breakpoints, but this is not enough for all the archs. Some arch such
    as x86 need to use text_poke() in order to install a breakpoint into a
    read only page.

    Passing the kgdb_bpt structure to kgdb_arch_set_breakpoint() and
    kgdb_arch_remove_breakpoint() allows other archs to set the type
    variable which indicates how the breakpoint was installed.

    Cc: stable@vger.kernel.org # >= 2.6.36
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • The Smatch tool warned that the change from commit b8adde8dd
    (kdb: Avoid using dbg_io_ops until it is initialized) should
    add another null check later in the kdb_printf().

    It is worth noting that the second use of dbg_io_ops->is_console
    is protected by the KDB_PAGER state variable which would only
    get set when kdb is fully active and initialized. If we
    ever encounter changes or defects in the KDB_PAGER state
    we do not want to crash the kernel in a kdb_printf/printk.

    CC: Tim Bird
    Reported-by: Dan Carpenter
    Signed-off-by: Jason Wessel

    Jason Wessel
     

29 Mar, 2012

2 commits

  • …m/linux/kernel/git/dhowells/linux-asm_system

    Pull "Disintegrate and delete asm/system.h" from David Howells:
    "Here are a bunch of patches to disintegrate asm/system.h into a set of
    separate bits to relieve the problem of circular inclusion
    dependencies.

    I've built all the working defconfigs from all the arches that I can
    and made sure that they don't break.

    The reason for these patches is that I recently encountered a circular
    dependency problem that came about when I produced some patches to
    optimise get_order() by rewriting it to use ilog2().

    This uses bitops - and on the SH arch asm/bitops.h drags in
    asm-generic/get_order.h by a circuituous route involving asm/system.h.

    The main difficulty seems to be asm/system.h. It holds a number of
    low level bits with no/few dependencies that are commonly used (eg.
    memory barriers) and a number of bits with more dependencies that
    aren't used in many places (eg. switch_to()).

    These patches break asm/system.h up into the following core pieces:

    (1) asm/barrier.h

    Move memory barriers here. This already done for MIPS and Alpha.

    (2) asm/switch_to.h

    Move switch_to() and related stuff here.

    (3) asm/exec.h

    Move arch_align_stack() here. Other process execution related bits
    could perhaps go here from asm/processor.h.

    (4) asm/cmpxchg.h

    Move xchg() and cmpxchg() here as they're full word atomic ops and
    frequently used by atomic_xchg() and atomic_cmpxchg().

    (5) asm/bug.h

    Move die() and related bits.

    (6) asm/auxvec.h

    Move AT_VECTOR_SIZE_ARCH here.

    Other arch headers are created as needed on a per-arch basis."

    Fixed up some conflicts from other header file cleanups and moving code
    around that has happened in the meantime, so David's testing is somewhat
    weakened by that. We'll find out anything that got broken and fix it..

    * tag 'split-asm_system_h-for-linus-20120328' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-asm_system: (38 commits)
    Delete all instances of asm/system.h
    Remove all #inclusions of asm/system.h
    Add #includes needed to permit the removal of asm/system.h
    Move all declarations of free_initmem() to linux/mm.h
    Disintegrate asm/system.h for OpenRISC
    Split arch_align_stack() out from asm-generic/system.h
    Split the switch_to() wrapper out of asm-generic/system.h
    Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h
    Create asm-generic/barrier.h
    Make asm-generic/cmpxchg.h #include asm-generic/cmpxchg-local.h
    Disintegrate asm/system.h for Xtensa
    Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt]
    Disintegrate asm/system.h for Tile
    Disintegrate asm/system.h for Sparc
    Disintegrate asm/system.h for SH
    Disintegrate asm/system.h for Score
    Disintegrate asm/system.h for S390
    Disintegrate asm/system.h for PowerPC
    Disintegrate asm/system.h for PA-RISC
    Disintegrate asm/system.h for MN10300
    ...

    Linus Torvalds
     
  • Remove all #inclusions of asm/system.h preparatory to splitting and killing
    it. Performed with the following command:

    perl -p -i -e 's!^#\s*include\s*.*\n!!' `grep -Irl '^#\s*include\s*' *`

    Signed-off-by: David Howells

    David Howells
     

24 Mar, 2012

1 commit

  • Pull KGDB/KDB updates from Jason Wessel:
    "Fixes:
    - Fix KDB keyboard repeat scan codes and leaked keyboard events
    - Fix kernel crash with kdb_printf() for users who compile new
    kdb_printf()'s in early code
    - Return all segment registers to gdb on x86_64

    Features:
    - KDB/KGDB hook the reboot notifier and end user can control if it
    stops, detaches or does nothing (updated docs as well)
    - Notify users who use CONFIG_DEBUG_RODATA to use hw breakpoints"

    * tag 'for_linus-3.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
    kdb: Add message about CONFIG_DEBUG_RODATA on failure to install breakpoint
    kdb: Avoid using dbg_io_ops until it is initialized
    kgdb,debug_core: add the ability to control the reboot notifier
    KDB: Fix usability issues relating to the 'enter' key.
    kgdb,debug-core,gdbstub: Hook the reboot notifier for debugger detach
    kgdb: Respect that flush op is optional
    kgdb: x86: Return all segment registers also in 64-bit mode

    Linus Torvalds
     

23 Mar, 2012

6 commits

  • On x86, if CONFIG_DEBUG_RODATA is set, one cannot set breakpoints
    via KDB. Apparently this is a well-known problem, as at least one distribution
    now ships with both KDB enabled and CONFIG_DEBUG_RODATA=y for security reasons.

    This patch adds an printk message to the breakpoint failure case,
    in order to provide suggestions about how to use the debugger.

    Reported-by: Tim Bird
    Signed-off-by: Jason Wessel
    Acked-by: Tim Bird

    Jason Wessel
     
  • This fixes a bug with setting a breakpoint during kdb initialization
    (from kdb_cmds). Any call to kdb_printf() before the initialization
    of the kgdboc serial console driver (which happens much later during
    bootup than kdb_init), results in kernel panic due to the use of
    dbg_io_ops before it is initialized.

    Signed-off-by: Tim Bird
    Signed-off-by: Jason Wessel

    Tim Bird
     
  • Sometimes it is desirable to stop the kernel debugger before allowing
    a system to reboot either with kdb or kgdb. This patch adds the
    ability to turn the reboot notifier on and off or enter the debugger
    and stop kernel execution before rebooting.

    It is possible to change the setting after booting the kernel with the
    following:

    echo 1 > /sys/module/debug_core/parameters/kgdbreboot

    It is also possible to change this setting using kdb / kgdb to
    manipulate the variable directly.

    Using KDB:
    mm kgdbreboot 1

    Using gdb:
    set kgdbreboot=1

    Reported-by: Jan Kiszka
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • This fixes the following problems:
    1) Typematic-repeat of 'enter' gives warning message
    and leaks make/break if KDB exits. Repeats
    look something like 0x1c 0x1c .... 0x9c
    2) Use of 'keypad enter' gives warning message and
    leaks the ENTER break/make code out if KDB exits.
    KP ENTER repeats look someting like 0xe0 0x1c
    0xe0 0x1c ... 0xe0 0x9c.
    3) Lag on the order of seconds between "break" and "make" when
    expecting the enter "break" code. Seen under virtualized
    environments such as VMware ESX.

    The existing special enter handler tries to glob the enter break code,
    but this fails if the other (KP) enter was used, or if there was a key
    repeat. It also fails if you mashed some keys along with enter, and
    you ended up with a non-enter make or non-enter break code coming
    after the enter make code. So first, we modify the handler to handle
    these cases. But performing these actions on every enter is annoying
    since now you can't hold ENTER down to scroll d messages in
    KDB. Since this special behaviour is only necessary to handle the
    exiting KDB ('g' + ENTER) without leaking scancodes to the OS. This
    cleanup needs to get executed anytime the kdb_main loop exits.

    Tested on QEMU. Set a bp on atkbd.c to verify no scan code was leaked.

    Cc: Andrei Warkentin
    [jason.wessel@windriver.com: move cleanup calls to kdb_main.c]
    Signed-off-by: Andrei Warkentin
    Signed-off-by: Jason Wessel

    Andrei Warkentin
     
  • The gdbstub and kdb should get detached if the system is rebooting.
    Calling gdbstub_exit() will set the proper debug core state and send a
    message to any debugger that is connected to correctly detach.

    An attached debugger will receive the exit code from
    include/linux/reboot.h based on SYS_HALT, SYS_REBOOT, etc...

    Reported-by: Jan Kiszka
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • Not all kgdb I/O drivers implement a flush operation. Adjust
    gdbstub_exit accordingly.

    Signed-off-by: Jan Kiszka
    Signed-off-by: Jason Wessel

    Jan Kiszka
     

20 Mar, 2012

1 commit


13 Jan, 2012

1 commit

  • module_ref contains two "unsigned int" fields.

    Thats now too small, since some machines can open more than 2^32 files.

    Check commit 518de9b39e8 (fs: allow for more than 2^31 files) for
    reference.

    We can add an aligned(2 * sizeof(unsigned long)) attribute to force
    alloc_percpu() allocating module_ref areas in single cache lines.

    Signed-off-by: Eric Dumazet
    CC: Rusty Russell
    CC: Tejun Heo
    CC: Robin Holt
    CC: David Miller
    Signed-off-by: Rusty Russell

    Eric Dumazet
     

12 Dec, 2011

1 commit


07 Nov, 2011

1 commit

  • * 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
    Revert "tracing: Include module.h in define_trace.h"
    irq: don't put module.h into irq.h for tracking irqgen modules.
    bluetooth: macroize two small inlines to avoid module.h
    ip_vs.h: fix implicit use of module_get/module_put from module.h
    nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
    include: replace linux/module.h with "struct module" wherever possible
    include: convert various register fcns to macros to avoid include chaining
    crypto.h: remove unused crypto_tfm_alg_modname() inline
    uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
    pm_runtime.h: explicitly requires notifier.h
    linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
    miscdevice.h: fix up implicit use of lists and types
    stop_machine.h: fix implicit use of smp.h for smp_processor_id
    of: fix implicit use of errno.h in include/linux/of.h
    of_platform.h: delete needless include
    acpi: remove module.h include from platform/aclinux.h
    miscdevice.h: delete unnecessary inclusion of module.h
    device_cgroup.h: delete needless include
    net: sch_generic remove redundant use of
    net: inet_timewait_sock doesnt need
    ...

    Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in
    - drivers/media/dvb/frontends/dibx000_common.c
    - drivers/media/video/{mt9m111.c,ov6650.c}
    - drivers/mfd/ab3550-core.c
    - include/linux/dmaengine.h

    Linus Torvalds