mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kgdb/kdb: A fix for kdb command table expansion
@ 2012-12-10 21:37 John Blackwood
  0 siblings, 0 replies; only message in thread
From: John Blackwood @ 2012-12-10 21:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jason Wessel


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 <john.blackwood@ccur.com>
Index: b/kernel/debug/kdb/kdb_main.c
===================================================================
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -3341,7 +3341,7 @@ int kdb_register_repeat(char *cmd,
  			  (kdb_max_commands - KDB_BASE_CMD_MAX) * sizeof(*new));
  			kfree(kdb_commands);
  		}
-		memset(new + kdb_max_commands, 0,
+		memset(new + kdb_max_commands - KDB_BASE_CMD_MAX, 0,
  		       kdb_command_extend * sizeof(*new));
  		kdb_commands = new;
  		kp = kdb_commands + kdb_max_commands - KDB_BASE_CMD_MAX;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-12-10 21:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-10 21:37 [PATCH] kgdb/kdb: A fix for kdb command table expansion John Blackwood

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

Powered by JetHome