mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [GIT PULL] kgdb/kdb tree for 2.6.37-rc3
@ 2010-11-18 12:55 Jason Wessel
  2010-11-18 12:56 ` [PATCH 1/4] kdb: fix memory leak in kdb_main.c Jason Wessel
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jason Wessel @ 2010-11-18 12:55 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, kgdb-bugreport

Linus, please pull the for_linus branch to pick up several regression fixes.

git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb.git for_linus

Summary:
  * Fix perf API problem with HW breakpoints ( >= 2.6.35)
  * kdb oops fixes ( >= 2.6.35)
  * ppc evr register handling ( >= 2.6.37-rc0)

Thanks,
Jason.

---
The following changes since commit e53beacd23d9cb47590da6a7a7f6d417b941a994:
  Linus Torvalds (1):
        Linux 2.6.37-rc2

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb.git for_linus

Dongdong Deng (1):
      kgdb,ppc: Fix regression in evr register handling

Jason Wessel (1):
      kgdb,x86: fix regression in detach handling

Jovi Zhang (2):
      kdb: fix memory leak in kdb_main.c
      kdb: fix crash when KDB_BASE_CMD_MAX is exceeded

 arch/powerpc/kernel/kgdb.c  |    4 ++--
 arch/x86/kernel/kgdb.c      |   12 ++++++++----
 kernel/debug/kdb/kdb_main.c |   21 +++++++++++----------
 3 files changed, 21 insertions(+), 16 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] kdb: fix memory leak in kdb_main.c
  2010-11-18 12:55 [GIT PULL] kgdb/kdb tree for 2.6.37-rc3 Jason Wessel
@ 2010-11-18 12:56 ` Jason Wessel
  2010-11-18 12:56 ` [PATCH 2/4] kdb: fix crash when KDB_BASE_CMD_MAX is exceeded Jason Wessel
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jason Wessel @ 2010-11-18 12:56 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, kgdb-bugreport

From: Jovi Zhang <bookjovi@gmail.com>

Call kfree in the error path as well as the success path in kdb_ll().

Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 kernel/debug/kdb/kdb_main.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 37755d6..3ab3fee 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -2361,7 +2361,7 @@ static int kdb_pid(int argc, const char **argv)
  */
 static int kdb_ll(int argc, const char **argv)
 {
-	int diag;
+	int diag = 0;
 	unsigned long addr;
 	long offset = 0;
 	unsigned long va;
@@ -2400,20 +2400,21 @@ static int kdb_ll(int argc, const char **argv)
 		char buf[80];
 
 		if (KDB_FLAG(CMD_INTERRUPT))
-			return 0;
+			goto out;
 
 		sprintf(buf, "%s " kdb_machreg_fmt "\n", command, va);
 		diag = kdb_parse(buf);
 		if (diag)
-			return diag;
+			goto out;
 
 		addr = va + linkoffset;
 		if (kdb_getword(&va, addr, sizeof(va)))
-			return 0;
+			goto out;
 	}
-	kfree(command);
 
-	return 0;
+out:
+	kfree(command);
+	return diag;
 }
 
 static int kdb_kgdb(int argc, const char **argv)
-- 
1.7.0.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/4] kdb: fix crash when KDB_BASE_CMD_MAX is exceeded
  2010-11-18 12:55 [GIT PULL] kgdb/kdb tree for 2.6.37-rc3 Jason Wessel
  2010-11-18 12:56 ` [PATCH 1/4] kdb: fix memory leak in kdb_main.c Jason Wessel
@ 2010-11-18 12:56 ` Jason Wessel
  2010-11-18 12:56 ` [PATCH 3/4] kgdb,x86: fix regression in detach handling Jason Wessel
  2010-11-18 12:56 ` [PATCH 4/4] kgdb,ppc: Fix regression in evr register handling Jason Wessel
  3 siblings, 0 replies; 5+ messages in thread
From: Jason Wessel @ 2010-11-18 12:56 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, kgdb-bugreport

From: Jovi Zhang <bookjovi@gmail.com>

When the number of dyanmic kdb commands exceeds KDB_BASE_CMD_MAX, the
kernel will fault.

Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 kernel/debug/kdb/kdb_main.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 3ab3fee..a6e7297 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -82,7 +82,7 @@ static kdbtab_t kdb_base_commands[50];
 #define for_each_kdbcmd(cmd, num)					\
 	for ((cmd) = kdb_base_commands, (num) = 0;			\
 	     num < kdb_max_commands;					\
-	     num == KDB_BASE_CMD_MAX ? cmd = kdb_commands : cmd++, num++)
+	     num++, num == KDB_BASE_CMD_MAX ? cmd = kdb_commands : cmd++)
 
 typedef struct _kdbmsg {
 	int	km_diag;	/* kdb diagnostic */
@@ -646,7 +646,7 @@ static int kdb_defcmd2(const char *cmdstr, const char *argv0)
 	}
 	if (!s->usable)
 		return KDB_NOTIMP;
-	s->command = kmalloc((s->count + 1) * sizeof(*(s->command)), GFP_KDB);
+	s->command = kzalloc((s->count + 1) * sizeof(*(s->command)), GFP_KDB);
 	if (!s->command) {
 		kdb_printf("Could not allocate new kdb_defcmd table for %s\n",
 			   cmdstr);
@@ -2740,13 +2740,13 @@ int kdb_register_repeat(char *cmd,
 		}
 		if (kdb_commands) {
 			memcpy(new, kdb_commands,
-			       kdb_max_commands * sizeof(*new));
+			  (kdb_max_commands - KDB_BASE_CMD_MAX) * sizeof(*new));
 			kfree(kdb_commands);
 		}
 		memset(new + kdb_max_commands, 0,
 		       kdb_command_extend * sizeof(*new));
 		kdb_commands = new;
-		kp = kdb_commands + kdb_max_commands;
+		kp = kdb_commands + kdb_max_commands - KDB_BASE_CMD_MAX;
 		kdb_max_commands += kdb_command_extend;
 	}
 
-- 
1.7.0.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/4] kgdb,x86: fix regression in detach handling
  2010-11-18 12:55 [GIT PULL] kgdb/kdb tree for 2.6.37-rc3 Jason Wessel
  2010-11-18 12:56 ` [PATCH 1/4] kdb: fix memory leak in kdb_main.c Jason Wessel
  2010-11-18 12:56 ` [PATCH 2/4] kdb: fix crash when KDB_BASE_CMD_MAX is exceeded Jason Wessel
@ 2010-11-18 12:56 ` Jason Wessel
  2010-11-18 12:56 ` [PATCH 4/4] kgdb,ppc: Fix regression in evr register handling Jason Wessel
  3 siblings, 0 replies; 5+ messages in thread
From: Jason Wessel @ 2010-11-18 12:56 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, kgdb-bugreport

The fix from ba773f7c510c0b252145933926c636c439889207
(x86,kgdb: Fix hw breakpoint regression) was not entirely complete.

The kgdb_remove_all_hw_break() function also needs to call the
hw_break_release_slot() or else a breakpoint can get activated again
after the debugger has detached.

The kgdb test suite exposes the behavior in the form of either a hang
or repetitive failure.  The kernel config that exposes the problem
contains all of the following:

CONFIG_DEBUG_RODATA=y
CONFIG_KGDB_TESTS=y
CONFIG_KGDB_TESTS_ON_BOOT=y
CONFIG_KGDB_TESTS_BOOT_STRING="V1F100"

Reported-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Tested-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 arch/x86/kernel/kgdb.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index ec592ca..cd21b65 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -315,14 +315,18 @@ static void kgdb_remove_all_hw_break(void)
 		if (!breakinfo[i].enabled)
 			continue;
 		bp = *per_cpu_ptr(breakinfo[i].pev, cpu);
-		if (bp->attr.disabled == 1)
+		if (!bp->attr.disabled) {
+			arch_uninstall_hw_breakpoint(bp);
+			bp->attr.disabled = 1;
 			continue;
+		}
 		if (dbg_is_early)
 			early_dr7 &= ~encode_dr7(i, breakinfo[i].len,
 						 breakinfo[i].type);
-		else
-			arch_uninstall_hw_breakpoint(bp);
-		bp->attr.disabled = 1;
+		else if (hw_break_release_slot(i))
+			printk(KERN_ERR "KGDB: hw bpt remove failed %lx\n",
+			       breakinfo[i].addr);
+		breakinfo[i].enabled = 0;
 	}
 }
 
-- 
1.7.0.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/4] kgdb,ppc: Fix regression in evr register handling
  2010-11-18 12:55 [GIT PULL] kgdb/kdb tree for 2.6.37-rc3 Jason Wessel
                   ` (2 preceding siblings ...)
  2010-11-18 12:56 ` [PATCH 3/4] kgdb,x86: fix regression in detach handling Jason Wessel
@ 2010-11-18 12:56 ` Jason Wessel
  3 siblings, 0 replies; 5+ messages in thread
From: Jason Wessel @ 2010-11-18 12:56 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, kgdb-bugreport

From: Dongdong Deng <dongdong.deng@windriver.com>

Commit ff10b88b5a05c8f1646dd15fb9f6093c1384ff6d (kgdb,ppc: Individual
register get/set for ppc) introduced a problem where memcpy was used
incorrectly to read and write the evr registers with a kernel that
has:

CONFIG_FSL_BOOKE=y
CONFIG_SPE=y
CONFIG_KGDB=y

This patch also fixes the following compilation problems:

arch/powerpc/kernel/kgdb.c: In function 'dbg_get_reg':
arch/powerpc/kernel/kgdb.c:341: error: passing argument 2 of 'memcpy' makes pointer from integer without a cast
arch/powerpc/kernel/kgdb.c: In function 'dbg_set_reg':
arch/powerpc/kernel/kgdb.c:366: error: passing argument 1 of 'memcpy' makes pointer from integer without a cast

[jason.wessel@windriver.com: Remove void * casts and fix patch header]
Reported-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
CC: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/kernel/kgdb.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 7a9db64..42850ee 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -337,7 +337,7 @@ char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
 		if (current)
-			memcpy(mem, current->thread.evr[regno-32],
+			memcpy(mem, &current->thread.evr[regno-32],
 					dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */
@@ -362,7 +362,7 @@ int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
 	if (regno >= 32 && regno < 64) {
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
-		memcpy(current->thread.evr[regno-32], mem,
+		memcpy(&current->thread.evr[regno-32], mem,
 				dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */
-- 
1.7.0.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-18 12:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-18 12:55 [GIT PULL] kgdb/kdb tree for 2.6.37-rc3 Jason Wessel
2010-11-18 12:56 ` [PATCH 1/4] kdb: fix memory leak in kdb_main.c Jason Wessel
2010-11-18 12:56 ` [PATCH 2/4] kdb: fix crash when KDB_BASE_CMD_MAX is exceeded Jason Wessel
2010-11-18 12:56 ` [PATCH 3/4] kgdb,x86: fix regression in detach handling Jason Wessel
2010-11-18 12:56 ` [PATCH 4/4] kgdb,ppc: Fix regression in evr register handling Jason Wessel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®