[Kgdb-bugreport] [PATCH 2/7] kdb: Rename kdb_repeat_t to kdb_cmdflags_t, cmd_repeat to cmd_flags

2012-07-31 Thread Anton Vorontsov
We're about to add more options for command behaviour, so let's expand the meaning of kdb_repeat_t. So far we just do various renames, there should be no functional changes. Signed-off-by: Anton Vorontsov --- include/linux/kdb.h|4 ++-- kernel/debug/kdb/kdb_main.c|6 +++-

Re: [Kgdb-bugreport] [PATCH 6/7] kdb: Mark safe commands as KDB_SAFE and KDB_SAFE_NO_ARGS

2012-07-31 Thread Alan Cox
> The following commands were marked as "safe": > > Clear Breakpoint > Enable Breakpoint > Disable Breakpoint > Display exception frame > Stack traceback This is sufficient to steal cryptographic keys in many environments. In fact you merely need two or three breakpo

[Kgdb-bugreport] [PATCH 05/11] tty/serial/amba-pl011: Implement clear_irqs callback

2012-07-31 Thread Anton Vorontsov
It's all pretty straightforward, except for TXIM interrupt. The interrupt has meaning "ready to transmit", so it's almost always raised, and the only way to silence it is to mask it. But that's OK, ops->start_tx will unmask it. Signed-off-by: Anton Vorontsov --- drivers/tty/serial/amba-pl011.c |

[Kgdb-bugreport] [PATCH 7/7] kdb: Add kiosk mode

2012-07-31 Thread Anton Vorontsov
By issuing 'echo 1 > /sys/module/kdb/parameters/kiosk' or booting with kdb.kiosk=1 kernel command line option, one can still have a somewhat usable debugging facility, but not fearing that the debugger can be used to easily gain root access or dump sensitive data. Without the kiosk mode, obtaining

[Kgdb-bugreport] [PATCH 6/7] kdb: Mark safe commands as KDB_SAFE and KDB_SAFE_NO_ARGS

2012-07-31 Thread Anton Vorontsov
This patch introduces two new flags: KDB_SAFE, denotes a safe command, and KDB_SAFE_NO_ARGS, denotes a safe command when used without arguments. The word "safe" here used in the sense that the commands cannot be used to leak sensitive data from the memory, and cannot be used to change program flow

[Kgdb-bugreport] [PATCH 04/11] tty/serial/kgdboc: Add and wire up clear_irqs callback

2012-07-31 Thread Anton Vorontsov
This patch implements a new callback: clear_irqs. It is used for the cases when KDB-entry (e.g. NMI) and KDB IO (e.g. serial port) shares the same interrupt. To get the idea, let's take some real example (ARM machine): we have a serial port which interrupt is routed to an NMI, and the interrupt is

Re: [Kgdb-bugreport] [PATCH 0/7] KDB: Kiosk (reduced capabilities) mode

2012-07-31 Thread Anton Vorontsov
On Fri, Jul 27, 2012 at 12:30:49PM -0700, Colin Cross wrote: > > The are two use-cases for the mode, one is evil, but another is quite > > legitimate. > > > > The evil use case is used by some (ahem) phone manufaturers that want > > to have a debuging facilities on a production device, but still do

[Kgdb-bugreport] [PATCH 06/11] ARM: Move some macros from entry-armv to entry-header

2012-07-31 Thread Anton Vorontsov
Just move the macros into header file as we would want to use them for KGDB FIQ entry code. The following macros were moved: - svc_entry - usr_entry - kuser_cmpxchg_check - vector_stub To make kuser_cmpxchg_check actually work across different files, we also have to make kuser_cmpxchg64_fixu

Re: [Kgdb-bugreport] [PATCH 03/11] kdb: Implement disable_nmi command

2012-07-31 Thread Colin Cross
On Mon, Jul 30, 2012 at 4:58 AM, Anton Vorontsov wrote: > This command disables NMI-entry. If NMI source was 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

[Kgdb-bugreport] [PATCH v2 6/7] kdb: Mark safe commands as KDB_SAFE and KDB_SAFE_NO_ARGS

2012-07-31 Thread Anton Vorontsov
This patch introduces two new flags: KDB_SAFE, denotes a safe command, and KDB_SAFE_NO_ARGS, denotes a safe command when used without arguments. The word "safe" here used in the sense that the commands cannot be used to leak sensitive data from the memory, and cannot be used to change program flow

Re: [Kgdb-bugreport] Enter KDB not possible

2012-07-31 Thread Stefan Parlitz
Hi I solved the problem by writing a small patch for the 8250 driver (solves the issue for me). However, I noticed that kdb has no disassembly support now, so it is pretty useless - you cannot use a debugger without examining the code! (a C debugger must show you C code, asm debugger must show yo

[Kgdb-bugreport] [PATCH 03/11] kdb: Implement disable_nmi command

2012-07-31 Thread Anton Vorontsov
This command disables NMI-entry. If NMI source was 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

[Kgdb-bugreport] [PATCH 4/7] kdb: Use KDB_REPEAT_* values as flags

2012-07-31 Thread Anton Vorontsov
The actual values of KDB_REPEAT_* enum values and overall logic stayed the same, but we now treat the values as flags. This makes it possible to add other flags and combine them, plus makes the code a lot simpler and shorter. But functionality-wise, there should be no changes. Signed-off-by: Anto

Re: [Kgdb-bugreport] Enter KDB not possible

2012-07-31 Thread Stefan Parlitz
On Tue, 2012-07-17 at 10:09 -0500, Stefan Parlitz wrote: > On Tue, 2012-07-17 at 09:41 -0500, Jason Wessel wrote: > > On 07/16/2012 05:12 PM, Stefan Parlitz wrote: > > > > > Hi > > > > > > I'm trying to use KDB with minicom, connected to serial port of a > > > VM. > > > Pressing ctrl-a f g does n

[Kgdb-bugreport] [PATCH 3/7] kdb: Rename kdb_register_repeat() to kdb_register_flags()

2012-07-31 Thread Anton Vorontsov
We're about to add more options for commands behaviour, so let's give a more generic name to the low-level kdb command registration function. There are just various renames, no functional changes. Signed-off-by: Anton Vorontsov --- include/linux/kdb.h |6 +-- kernel/debug/kdb/kdb_bp

[Kgdb-bugreport] [PATCH 08/11] ARM: kgdb_fiq: Implement knocking into KDB via escape command

2012-07-31 Thread Anton Vorontsov
As Colin Cross noticed, serial ports could be noisy, so occasional characters once in a while are possible. So, considering the noise possibility, entering the debugger on any received byte is unacceptable for production devices. This changes KGDB FIQ behaviour in a such way so that we have to typ

Re: [Kgdb-bugreport] [PATCH 07/11] ARM: Add KGDB/KDB FIQ debugger generic code

2012-07-31 Thread Russell King - ARM Linux
On Mon, Jul 30, 2012 at 04:58:16AM -0700, Anton Vorontsov wrote: > + .align 5 > +__fiq_svc: > + svc_entry > + fiq_handler > + svc_exit r5 @ return from exception > + UNWIND(.fnend ) > +ENDPROC(__fiq_svc) > + .ltorg > + > + .align 5

Re: [Kgdb-bugreport] [PATCH 11/11] ARM: Get rid of .LCcralign local label usage in alignment_trap macro

2012-07-31 Thread Russell King - ARM Linux
On Mon, Jul 30, 2012 at 04:58:20AM -0700, Anton Vorontsov wrote: > This makes the code more izolated. > > The downside of this is that we now have an additional branch and the > code itself is 8 bytes longer. But on the bright side, this new layout > can be more cache friendly since cr_alignment a

[Kgdb-bugreport] [PATCH 09/11] ARM: VIC: Add a couple of low-level FIQ management helpers

2012-07-31 Thread Anton Vorontsov
Just a couple of calls to manage VIC FIQ routing. We'll use them for KGDB FIQ support on ARM Versatile machines. Signed-off-by: Anton Vorontsov --- arch/arm/common/vic.c | 28 arch/arm/include/asm/hardware/vic.h |2 ++ 2 files changed, 30 insertio

Re: [Kgdb-bugreport] [PATCH 0/7] KDB: Kiosk (reduced capabilities) mode

2012-07-31 Thread Colin Cross
On Thu, Jul 26, 2012 at 7:25 AM, Anton Vorontsov wrote: > Hi all, > > Here is a patchset that implements "kiosk" mode for KDB debugger. The > mode provides reduced set of features, so that it is no longer possible > to leak sensitive data via the debugger, and not possible to change > program flow

Re: [Kgdb-bugreport] [PATCH 01/11] kernel/debug: Make use of KGDB_REASON_NMI

2012-07-31 Thread Jason Wessel
On 07/30/2012 06:58 AM, Anton Vorontsov wrote: > Currently kernel never set KGDB_REASON_NMI. We do now, when we enter > KGDB/KDB from an NMI. > > This is not to be confused with kgdb_nmicallback(), NMI callback is > an entry for the slave CPUs during CPUs roundup, but REASON_NMI is the > entry for

[Kgdb-bugreport] virtual tty for kgdboc

2012-07-31 Thread shu
Hi there, I need to debug an android phone with which using serial port is not convenient. So I consider writing a virtual tty driver which implements two connected virtual tty devices. kgdboc would be connected to tty1, tty2 would be forwarded to the PC through 'adb forward', then I c

[Kgdb-bugreport] [PATCH 10/11] ARM: versatile: Make able to use UART ports for KGDB FIQ debugger

2012-07-31 Thread Anton Vorontsov
If enabled, kernel will able to enter KGDB upon serial line activity on UART ports. Note that even with this patch and CONFIG_KGDB_FIQ is enabled, you still need to pass kgdb_fiq.enable=1 kernel command line option, otherwise UART will behave in a normal way. By default UART0 is used, but this ca

Re: [Kgdb-bugreport] [PATCH 0/7] KDB: Kiosk (reduced capabilities) mode

2012-07-31 Thread Colin Cross
On Fri, Jul 27, 2012 at 6:26 PM, Anton Vorontsov wrote: > But if you say that it wasn't the case, and no one thought about the > reducing the debugger in the "evil" way, so be it, I trust you. But I > still don't trust the phone vendors. They showed their bad attitude > in many ways towards hack

[Kgdb-bugreport] [PATCH 01/11] kernel/debug: Make use of KGDB_REASON_NMI

2012-07-31 Thread Anton Vorontsov
Currently kernel never set KGDB_REASON_NMI. We do now, when we enter KGDB/KDB from an NMI. This is not to be confused with kgdb_nmicallback(), NMI callback is an entry for the slave CPUs during CPUs roundup, but REASON_NMI is the entry for the master CPU. Signed-off-by: Anton Vorontsov --- kern

[Kgdb-bugreport] [PATCH 07/11] ARM: Add KGDB/KDB FIQ debugger generic code

2012-07-31 Thread Anton Vorontsov
The FIQ debugger may be used to debug situations when the kernel stuck in uninterruptable sections, e.g. the kernel infinitely loops or deadlocked in an interrupt or with interrupts disabled. By default KGDB FIQ is disabled in runtime, but can be enabled with kgdb_fiq.enable=1 kernel command line

Re: [Kgdb-bugreport] Enter KDB not possible

2012-07-31 Thread Stefan Parlitz
On Tue, 2012-07-17 at 09:41 -0500, Jason Wessel wrote: > On 07/16/2012 05:12 PM, Stefan Parlitz wrote: > > > Hi > > > > I'm trying to use KDB with minicom, connected to serial port of a > > VM. > > Pressing ctrl-a f g does not activate KDB (it is correctly compiled > > etc), instead only "g" appe

[Kgdb-bugreport] [PATCH 0/7] KDB: Kiosk (reduced capabilities) mode

2012-07-31 Thread Anton Vorontsov
Hi all, Here is a patchset that implements "kiosk" mode for KDB debugger. The mode provides reduced set of features, so that it is no longer possible to leak sensitive data via the debugger, and not possible to change program flow in a predefined manner. The are two use-cases for the mode, one is

Re: [Kgdb-bugreport] [PATCH 10/11] ARM: versatile: Make able to use UART ports for KGDB FIQ debugger

2012-07-31 Thread Russell King - ARM Linux
On Mon, Jul 30, 2012 at 04:58:19AM -0700, Anton Vorontsov wrote: > diff --git a/arch/arm/mach-versatile/include/mach/irqs.h > b/arch/arm/mach-versatile/include/mach/irqs.h > index bf44c61..fcd2a95 100644 > --- a/arch/arm/mach-versatile/include/mach/irqs.h > +++ b/arch/arm/mach-versatile/include/ma

Re: [Kgdb-bugreport] [PATCH 0/6] KGDB/KDB FIQ (NMI) debugger

2012-07-31 Thread Colin Cross
On Fri, Jul 13, 2012 at 2:49 AM, Anton Vorontsov wrote: > On Thu, Jul 05, 2012 at 05:02:12PM -0700, Colin Cross wrote: > [...] >> KGDB can obviously only be enabled on development >> devices, although perhaps a more limited KDB could be left enabled. > > Um, I would argue about 'obviously'. :-) It

[Kgdb-bugreport] [PATCH 02/11] kernel/debug: Mask KGDB NMI upon entry

2012-07-31 Thread 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,

Re: [Kgdb-bugreport] [PATCH 0/7] KDB: Kiosk (reduced capabilities) mode

2012-07-31 Thread John Stultz
On 07/27/2012 06:26 PM, Anton Vorontsov wrote: > On Fri, Jul 27, 2012 at 12:30:49PM -0700, Colin Cross wrote: >>> The are two use-cases for the mode, one is evil, but another is quite >>> legitimate. >>> >>> The evil use case is used by some (ahem) phone manufaturers that want >>> to have a debugin

[Kgdb-bugreport] [PATCH 1/7] kdb: Remove currently unused kdbtab_t->cmd_flags

2012-07-31 Thread Anton Vorontsov
The struct member is never used in the code, so we can remove it. We will introduce real flags soon by renaming cmd_repeat to cmd_flags. Signed-off-by: Anton Vorontsov --- kernel/debug/kdb/kdb_main.c|1 - kernel/debug/kdb/kdb_private.h |1 - 2 files changed, 2 deletions(-) diff --g

[Kgdb-bugreport] [PATCH 11/11] ARM: Get rid of .LCcralign local label usage in alignment_trap macro

2012-07-31 Thread Anton Vorontsov
This makes the code more izolated. The downside of this is that we now have an additional branch and the code itself is 8 bytes longer. But on the bright side, this new layout can be more cache friendly since cr_alignment address might be already in the cache line (not that I measured anything, it

[Kgdb-bugreport] [PATCH v3 0/11] KGDB/KDB FIQ (NMI) debugger

2012-07-31 Thread Anton Vorontsov
Hi all, I do realize that we're in the middle of the merge window. But maybe some of you will be bored enough to look into this; and no problem if you don't feel like it -- I promise to send a brand new shiny v4 after the merge window, so you won't miss a bit of this new cool stuff. :-) In v3: -

Re: [Kgdb-bugreport] [PATCH 6/7] kdb: Mark safe commands as KDB_SAFE and KDB_SAFE_NO_ARGS

2012-07-31 Thread Anton Vorontsov
On Thu, Jul 26, 2012 at 06:07:09PM +0100, Alan Cox wrote: > > The following commands were marked as "safe": > > > > Clear Breakpoint > > Enable Breakpoint > > Disable Breakpoint > > Display exception frame > > Stack traceback > > This is sufficient to steal cryptographic keys

[Kgdb-bugreport] [PATCH 5/7] kdb: Remove KDB_REPEAT_NONE flag

2012-07-31 Thread Anton Vorontsov
Since we now treat KDB_REPEAT_* as flags, there is no need to pass KDB_REPEAT_NONE. It's just the default behaviour when no flags are specified. Signed-off-by: Anton Vorontsov --- include/linux/kdb.h |1 - kernel/debug/kdb/kdb_bp.c |6 ++--- kernel/debug/kdb/kdb_main.c | 59 +

Re: [Kgdb-bugreport] [PATCH 0/6] KGDB/KDB FIQ (NMI) debugger

2012-07-31 Thread Anton Vorontsov
On Fri, Jul 13, 2012 at 09:43:45AM -0700, Colin Cross wrote: [...] > I was referring to the security implications, not size. Leaving KDB > on is effectively instant root access over the serial console. Oh, I see. Yes, for this we'd need to disable all modification commands. [...] > > The thing i