diff options
author | Julian Elischer <julian@FreeBSD.org> | 2002-12-16 23:04:54 +0000 |
---|---|---|
committer | Julian Elischer <julian@FreeBSD.org> | 2002-12-16 23:04:54 +0000 |
commit | 6b8fc51d28eb59a464d0414ce6902b5005f2da1f (patch) | |
tree | e467993483fa89a69ee0da9b2dafac7e71dfc647 /sys/amd64/amd64/dump_machdep.c | |
parent | adb72768ea93971fa89b70e40cb974f4b6888c23 (diff) | |
download | src-6b8fc51d28eb59a464d0414ce6902b5005f2da1f.tar.gz src-6b8fc51d28eb59a464d0414ce6902b5005f2da1f.zip |
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.
Notes
Notes:
svn path=/head/; revision=107955
Diffstat (limited to 'sys/amd64/amd64/dump_machdep.c')
-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 caa5883d10df..7d1e06f969eb 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); |