From bde3b1e1a5969fa937f08ce8c325b581113740e7 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Thu, 8 Mar 2018 17:04:36 +0000 Subject: [PATCH] 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. --- sys/kern/kern_shutdown.c | 6 ++++++ 1 file changed, 6 insertions(+) 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,