Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Sep 2020 13:57:06 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r365300 - stable/12/sys/kern
Message-ID:  <202009031357.083Dv633035985@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Thu Sep  3 13:57:05 2020
New Revision: 365300
URL: https://svnweb.freebsd.org/changeset/base/365300

Log:
  MFC r364876:
  Fix writing of the final block of encrypted, compressed kernel dumps.

Modified:
  stable/12/sys/kern/kern_shutdown.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_shutdown.c
==============================================================================
--- stable/12/sys/kern/kern_shutdown.c	Thu Sep  3 13:56:47 2020	(r365299)
+++ stable/12/sys/kern/kern_shutdown.c	Thu Sep  3 13:57:05 2020	(r365300)
@@ -1302,6 +1302,7 @@ kerneldumpcomp_write_cb(void *base, size_t length, off
 		}
 		resid = length - rlength;
 		memmove(di->blockbuf, (uint8_t *)base + rlength, resid);
+		bzero((uint8_t *)di->blockbuf + resid, di->blocksize - resid);
 		di->kdcomp->kdc_resid = resid;
 		return (EAGAIN);
 	}
@@ -1518,9 +1519,10 @@ dump_finish(struct dumperinfo *di, struct kerneldumphe
 		error = compressor_flush(di->kdcomp->kdc_stream);
 		if (error == EAGAIN) {
 			/* We have residual data in di->blockbuf. */
-			error = dump_write(di, di->blockbuf, 0, di->dumpoff,
-			    di->blocksize);
-			di->dumpoff += di->kdcomp->kdc_resid;
+			error = _dump_append(di, di->blockbuf, 0, di->blocksize);
+			if (error == 0)
+				/* Compensate for _dump_append()'s adjustment. */
+				di->dumpoff -= di->blocksize - di->kdcomp->kdc_resid;
 			di->kdcomp->kdc_resid = 0;
 		}
 		if (error != 0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009031357.083Dv633035985>