diff options
author | julian <julian@FreeBSD.org> | 2002-12-16 23:04:54 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2002-12-16 23:04:54 +0000 |
commit | 168664d0ec45abb96a9f3ae963ff8f67fb41d190 (patch) | |
tree | e467993483fa89a69ee0da9b2dafac7e71dfc647 /sys/amd64 | |
parent | 1f7478c2704e04f73129945a43efabc4c9a62c91 (diff) | |
download | FreeBSD-src-168664d0ec45abb96a9f3ae963ff8f67fb41d190.zip FreeBSD-src-168664d0ec45abb96a9f3ae963ff8f67fb41d190.tar.gz |
Don't dump core into a partition that is too small for it.
If we do, we usually wrote backwareds into the proceeding partititon
which is usually the root partition.
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/dump_machdep.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/amd64/amd64/dump_machdep.c b/sys/amd64/amd64/dump_machdep.c index caa5883..7d1e06f 100644 --- a/sys/amd64/amd64/dump_machdep.c +++ b/sys/amd64/amd64/dump_machdep.c @@ -75,6 +75,15 @@ dumpsys(struct dumperinfo *di) strncpy(kdh.panicstring, panicstr, sizeof kdh.panicstring); kdh.parity = kerneldump_parity(&kdh); + if (di->mediasize < + ((Maxmem * (off_t)PAGE_SIZE) + /* Memory to save */ + (sizeof kdh * 2) + /* header + trailer */ + (64*1024))) { /* Room to leave untouched */ + /* at partition head. */ + /* (an arbitrary amount). */ + 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, 0, dumplo, sizeof kdh); |