aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_shutdown.c
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2018-03-08 17:04:36 +0000
committerMark Johnston <markj@FreeBSD.org>2018-03-08 17:04:36 +0000
commitbde3b1e1a5969fa937f08ce8c325b581113740e7 (patch)
tree0ee1eaae4f9f006d6874a35ad7d282bd3ff09d63 /sys/kern/kern_shutdown.c
parent50e3ba10e8f42c80612440b3e5466158aa5a2370 (diff)
downloadsrc-bde3b1e1a5969fa937f08ce8c325b581113740e7.tar.gz
src-bde3b1e1a5969fa937f08ce8c325b581113740e7.zip
Return E2BIG if we run out of space writing a compressed kernel dump.
ENOSPC causes the MD kernel dump code to retry the dump, but this is undesirable in the case where we legitimately ran out of space.
Notes
Notes: svn path=/head/; revision=330663
Diffstat (limited to 'sys/kern/kern_shutdown.c')
-rw-r--r--sys/kern/kern_shutdown.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index aa60eecc5fa1..71d4484782fe 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -1115,6 +1115,12 @@ dump_check_bounds(struct dumperinfo *di, off_t offset, size_t length)
if (length != 0 && (offset < di->mediaoffset ||
offset - di->mediaoffset + length > di->mediasize)) {
+ if (di->kdcomp != NULL && offset >= di->mediaoffset) {
+ printf(
+ "Compressed dump failed to fit in device boundaries.\n");
+ return (E2BIG);
+ }
+
printf("Attempt to write outside dump device boundaries.\n"
"offset(%jd), mediaoffset(%jd), length(%ju), mediasize(%jd).\n",
(intmax_t)offset, (intmax_t)di->mediaoffset,