svn commit: r339127 - stable/11/cddl/contrib/opensolaris/cmd/zdb

Alexander Motin mav at FreeBSD.org
Wed Oct 3 14:45:49 UTC 2018


Author: mav
Date: Wed Oct  3 14:45:48 2018
New Revision: 339127
URL: https://svnweb.freebsd.org/changeset/base/339127

Log:
  MFC r337179: 9523 Large alloc in zdb can cause trouble
  
  16MB alloc in zdb_embedded_block() can cause cores in certain situations
  (clang, gcc55).
  
  OsX commit: https://github.com/openzfsonosx/zfs/commit/ced236a5da6e72ea7bf6d2919fe14e17cffe10f1
  FreeBSD commit: https://svnweb.freebsd.org/base?view=revision&revision=326150
  illumos/illumos-gate at 03a4c2f4bfaca30115963b76445279b36468a614
  
  Reviewed by: Igor Kozhukhov <igor at dilos.org>
  Reviewed by: Andriy Gapon <avg at FreeBSD.org>
  Reviewed by: Matthew Ahrens <mahrens at delphix.com>
  Approved by: Dan McDonald <danmcd at joyent.com>
  Author:     Jorgen Lundman <lundman at lundman.net>
  
  This is an update for r326150 (by avg), where this change comes from.

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==============================================================================
--- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Wed Oct  3 14:44:16 2018	(r339126)
+++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Wed Oct  3 14:45:48 2018	(r339127)
@@ -4950,19 +4950,18 @@ zdb_embedded_block(char *thing)
 	    words + 8, words + 9, words + 10, words + 11,
 	    words + 12, words + 13, words + 14, words + 15);
 	if (err != 16) {
-		(void) printf("invalid input format\n");
+		(void) fprintf(stderr, "invalid input format\n");
 		exit(1);
 	}
 	ASSERT3U(BPE_GET_LSIZE(&bp), <=, SPA_MAXBLOCKSIZE);
 	buf = malloc(SPA_MAXBLOCKSIZE);
 	if (buf == NULL) {
-		(void) fprintf(stderr, "%s: failed to allocate %llu bytes\n",
-		    __func__, SPA_MAXBLOCKSIZE);
+		(void) fprintf(stderr, "out of memory\n");
 		exit(1);
 	}
 	err = decode_embedded_bp(&bp, buf, BPE_GET_LSIZE(&bp));
 	if (err != 0) {
-		(void) printf("decode failed: %u\n", err);
+		(void) fprintf(stderr, "decode failed: %u\n", err);
 		free(buf);
 		exit(1);
 	}


More information about the svn-src-all mailing list