Commit efab4134 authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: limit xmon dump length

A number of people (myself included) have pasted bad input into xmon that
it parsed as a request to dump gigabytes of memory.

Place a limit of 128kB on the dump commands.  Also remove a stale function
prototype thats been lying around.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5d4e5137
......@@ -50,6 +50,7 @@ static unsigned long in_xmon = 0;
static unsigned long adrs;
static int size = 1;
#define MAX_DUMP (128 * 1024)
static unsigned long ndump = 64;
static unsigned long nidump = 16;
static unsigned long ncsum = 4096;
......@@ -146,8 +147,6 @@ extern int setjmp(long *);
extern void longjmp(long *, int);
extern unsigned long _ASR;
pte_t *find_linux_pte(pgd_t *pgdir, unsigned long va); /* from htab.c */
#define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
#define isxdigit(c) (('0' <= (c) && (c) <= '9') \
......@@ -1884,18 +1883,22 @@ dump(void)
if ((isxdigit(c) && c != 'f' && c != 'd') || c == '\n')
termch = c;
scanhex((void *)&adrs);
if( termch != '\n')
if (termch != '\n')
termch = 0;
if( c == 'i' ){
if (c == 'i') {
scanhex(&nidump);
if( nidump == 0 )
if (nidump == 0)
nidump = 16;
else if (nidump > MAX_DUMP)
nidump = MAX_DUMP;
adrs += ppc_inst_dump(adrs, nidump, 1);
last_cmd = "di\n";
} else {
scanhex(&ndump);
if( ndump == 0 )
if (ndump == 0)
ndump = 64;
else if (ndump > MAX_DUMP)
ndump = MAX_DUMP;
prdump(adrs, ndump);
adrs += ndump;
last_cmd = "d\n";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment