mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: torvalds@linux-foundation.org
Cc: linux-kernel@vger.kernel.org,
	kgdb-bugreport@lists.sourceforge.net,
	Dongdong Deng <dongdong.deng@windriver.com>,
	Jason Wessel <jason.wessel@windriver.com>
Subject: [PATCH 6/7] kgdbts: prevent re-entry to kgdbts before it unregisters
Date: Fri, 29 Oct 2010 13:43:40 -0500	[thread overview]
Message-ID: <1288377821-24520-7-git-send-email-jason.wessel@windriver.com> (raw)
In-Reply-To: <1288377821-24520-1-git-send-email-jason.wessel@windriver.com>

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

The "kgdb_connected" variable of debug_core just indicates whether or
not kgdbts is connected to the debug_core.  It does not completely
prevent a script from trying invoke kgdbts again and possibly crashing
the system (see Call Trace below).

The configured variable in kgtbts can be used instead of
kgdb_connected instead of kgdb_connected. The cleanup_kgdbts() can
also be removed because there is no possible way to build kgdbts as a
kernel module that you could unload with rmmod.

Call Trace:
-----------------------------------------------------------------
root:/$ echo kgdbts=V1S1000 > /sys/module/kgdbts/parameters/kgdbts
kgdb: Unregistered I/O driver kgdbts, debugger disabled.
------------[ cut here ]------------
WARNING: at kernel/debug/debug_core.c:1002
kgdb_unregister_io_module+0xec/0x100()
Hardware name: Moon Creek platform
Modules linked in:
Pid: 664, comm: sh Not tainted 2.6.34.1-WR4.0.0.0_standard #58
Call Trace:
 [<c103b1ed>] warn_slowpath_common+0x6d/0xa0
 [<c1079fdc>] ? kgdb_unregister_io_module+0xec/0x100
 [<c1079fdc>] ? kgdb_unregister_io_module+0xec/0x100
 [<c10544e0>] ? param_attr_store+0x0/0x20
 [<c103b235>] warn_slowpath_null+0x15/0x20
 [<c1079fdc>] kgdb_unregister_io_module+0xec/0x100
 [<c124e4ea>] cleanup_kgdbts+0x1a/0x20
 [<c124eced>] param_set_kgdbts_var+0x6d/0xb0
 [<c124ec80>] ? param_set_kgdbts_var+0x0/0xb0
 [<c10544f7>] param_attr_store+0x17/0x20
 [<c105457c>] module_attr_store+0x2c/0x40
 [<c111fe84>] sysfs_write_file+0x94/0xf0
 [<c10d42f6>] vfs_write+0x96/0x130
 [<c111fdf0>] ? sysfs_write_file+0x0/0xf0
 [<c10d44d6>] sys_write+0x46/0xd0
 [<c13bf329>] system_call_done+0x0/0x4
---[ end trace 4eb028c6ee43154c ]---
kgdb: Unregistered I/O driver kgdbts, debugger disabled.
-----------------------------------------------------------------

[jason.wessel@windriver.com: remove cleanup_kgdbts() ]
Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 drivers/misc/kgdbts.c |   16 ++--------------
 1 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c
index 7245023..59c118c 100644
--- a/drivers/misc/kgdbts.c
+++ b/drivers/misc/kgdbts.c
@@ -1044,12 +1044,6 @@ static int __init init_kgdbts(void)
 	return configure_kgdbts();
 }
 
-static void cleanup_kgdbts(void)
-{
-	if (configured == 1)
-		kgdb_unregister_io_module(&kgdbts_io_ops);
-}
-
 static int kgdbts_get_char(void)
 {
 	int val = 0;
@@ -1081,10 +1075,8 @@ static int param_set_kgdbts_var(const char *kmessage, struct kernel_param *kp)
 		return 0;
 	}
 
-	if (kgdb_connected) {
-		printk(KERN_ERR
-	       "kgdbts: Cannot reconfigure while KGDB is connected.\n");
-
+	if (configured == 1) {
+		printk(KERN_ERR "kgdbts: ERROR: Already configured and running.\n");
 		return -EBUSY;
 	}
 
@@ -1093,9 +1085,6 @@ static int param_set_kgdbts_var(const char *kmessage, struct kernel_param *kp)
 	if (config[len - 1] == '\n')
 		config[len - 1] = '\0';
 
-	if (configured == 1)
-		cleanup_kgdbts();
-
 	/* Go and configure with the new params. */
 	return configure_kgdbts();
 }
@@ -1123,7 +1112,6 @@ static struct kgdb_io kgdbts_io_ops = {
 };
 
 module_init(init_kgdbts);
-module_exit(cleanup_kgdbts);
 module_param_call(kgdbts, param_set_kgdbts_var, param_get_string, &kps, 0644);
 MODULE_PARM_DESC(kgdbts, "<A|V1|V2>[F#|S#][N#]");
 MODULE_DESCRIPTION("KGDB Test Suite");
-- 
1.6.3.3


  parent reply	other threads:[~2010-10-29 18:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-29 18:43 [GIT PULL] kgdb/kdb tree for 2.6.37 Jason Wessel
2010-10-29 18:43 ` [PATCH 1/7] kdb: Add kdb kernel module sample Jason Wessel
2010-10-29 18:43 ` [PATCH 2/7] kdb: fix per_cpu command to remove supress mask Jason Wessel
2010-10-29 18:43 ` [PATCH 3/7] kgdb,arm: fix register dump Jason Wessel
2010-10-29 18:43 ` [PATCH 4/7] kdb: Fix early debugging crash regression Jason Wessel
2010-10-29 18:43 ` [PATCH 5/7] debug_core,x86,blackfin: Clean up hw debug disable API Jason Wessel
2010-10-29 18:43 ` Jason Wessel [this message]
2010-10-29 18:43 ` [PATCH 7/7] kgdb,ppc: Individual register get/set for ppc Jason Wessel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1288377821-24520-7-git-send-email-jason.wessel@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=dongdong.deng@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®