summaryrefslogtreecommitdiffstats
path: root/sys/alpha
diff options
context:
space:
mode:
authorticso <ticso@FreeBSD.org>2003-01-03 00:19:54 +0000
committerticso <ticso@FreeBSD.org>2003-01-03 00:19:54 +0000
commitbb0b4e12fb4d26109ca3ed9aa81724390199a38f (patch)
tree7cf70fadfb318f022ef7b8b8e91b4cd63eb51bce /sys/alpha
parent53ffe07705f6bdc395a2ddc795e9fffeb642ec8a (diff)
downloadFreeBSD-src-bb0b4e12fb4d26109ca3ed9aa81724390199a38f.zip
FreeBSD-src-bb0b4e12fb4d26109ca3ed9aa81724390199a38f.tar.gz
Approved by: gallatin (mentor)
Sync with i386. Don't write crashdumps outside partition boundaries.
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/dump_machdep.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/alpha/alpha/dump_machdep.c b/sys/alpha/alpha/dump_machdep.c
index 902cf12..63f98e2 100644
--- a/sys/alpha/alpha/dump_machdep.c
+++ b/sys/alpha/alpha/dump_machdep.c
@@ -73,6 +73,18 @@ dumpsys(struct dumperinfo *di)
strncpy(kdh.panicstring, panicstr, sizeof kdh.panicstring);
kdh.parity = kerneldump_parity(&kdh);
+ /*
+ * Check if we will have enough room to save the coredump.
+ * The partition size needed is the sum of:
+ * Memory to save + header + trailer + Room to leave untouched
+ * at partition head. (an arbitrary amount).
+ */
+ if (di->mediasize <
+ Maxmem * (off_t)PAGE_SIZE + sizeof kdh * 2 + 64*1024) {
+ printf("\nDump failed. Partition too small.\n");
+ return;
+ }
+
dumplo = di->mediaoffset + di->mediasize - Maxmem * (off_t)PAGE_SIZE;
dumplo -= sizeof kdh * 2;
i = di->dumper(di->priv, &kdh, NULL, dumplo, sizeof kdh);
OpenPOWER on IntegriCloud