aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2022-03-10 18:04:34 +0000
committerEd Maste <emaste@FreeBSD.org>2022-04-10 23:12:30 +0000
commitfbc0c2a21b761f676050e8769ef6ea498c0ac579 (patch)
treea77adf471b53d8a31f51f909970f2eeeb41472b7
parent3caf7dd45d08a5b7b7fafe39e7aae7d7f8d1a684 (diff)
downloadsrc-fbc0c2a21b761f676050e8769ef6ea498c0ac579.tar.gz
src-fbc0c2a21b761f676050e8769ef6ea498c0ac579.zip
dumpon: proceed without compression if the kernel lacks support
PR: 252554 Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34520 (cherry picked from commit 2b20327ec9394754c0bac2d83567b972a08e3930)
-rw-r--r--sbin/dumpon/dumpon.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c
index 2b710a611af3..e7f1d06ea666 100644
--- a/sbin/dumpon/dumpon.c
+++ b/sbin/dumpon/dumpon.c
@@ -572,6 +572,15 @@ main(int argc, char *argv[])
error = ioctl(fd, DIOCSKERNELDUMP, kdap);
if (error != 0)
error = errno;
+ if (error == EINVAL && (gzip || zstd)) {
+ /* Retry without compression in case kernel lacks support. */
+ kdap->kda_compression = KERNELDUMP_COMP_NONE;
+ error = ioctl(fd, DIOCSKERNELDUMP, kdap);
+ if (error == 0)
+ warnx("Compression disabled; kernel may lack gzip or zstd support.");
+ else
+ error = errno;
+ }
explicit_bzero(kdap->kda_encryptedkey, kdap->kda_encryptedkeysize);
free(kdap->kda_encryptedkey);
explicit_bzero(kdap, sizeof(*kdap));