zfsonlinux/zfs-patches/0026-Fix-zdb-E-segfault.patch
Fabian Grünbichler 75b07eca3e update ZFS to 0.7.7
by importing the upstream release as patches. replace user namespace
patch with version which has been applied usptream.
2018-04-03 14:25:21 +02:00

51 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chunwei Chen <david.chen@nutanix.com>
Date: Thu, 1 Feb 2018 16:28:11 -0800
Subject: [PATCH] Fix zdb -E segfault
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
SPA_MAXBLOCKSIZE is too large for stack.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: loli10K <ezomori.nozomu@gmail.com>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #7099
(cherry picked from commit 31ff122aa2e20c7ed48617868085ddba7b4ad174)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
cmd/zdb/zdb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index 2d80589ca..90847d8d9 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -4139,11 +4139,12 @@ zdb_embedded_block(char *thing)
{
blkptr_t bp;
unsigned long long *words = (void *)&bp;
- char buf[SPA_MAXBLOCKSIZE];
+ char *buf;
int err;
- memset(&bp, 0, sizeof (blkptr_t));
+ buf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
+ bzero(&bp, sizeof (bp));
err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:"
"%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx",
words + 0, words + 1, words + 2, words + 3,
@@ -4161,6 +4162,7 @@ zdb_embedded_block(char *thing)
exit(1);
}
zdb_dump_block_raw(buf, BPE_GET_LSIZE(&bp), 0);
+ umem_free(buf, SPA_MAXBLOCKSIZE);
}
int
--
2.14.2