From 5e3bd0e684a3c32bd22647938247ac3699c5372a Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Thu, 1 Feb 2018 16:28:11 -0800 Subject: Fix zdb -E segfault SPA_MAXBLOCKSIZE is too large for stack. Reviewed-by: Brian Behlendorf Reviewed-by: loli10K Signed-off-by: Chunwei Chen Closes #7099 --- cmd/zdb/zdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 4c0a8245f..7f2cab382 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -4235,9 +4235,11 @@ zdb_embedded_block(char *thing) { blkptr_t bp; unsigned long long *words = (void *)&bp; - char buf[SPA_MAXBLOCKSIZE]; + char *buf; int err; + 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", @@ -4256,6 +4258,7 @@ zdb_embedded_block(char *thing) exit(1); } zdb_dump_block_raw(buf, BPE_GET_LSIZE(&bp), 0); + umem_free(buf, SPA_MAXBLOCKSIZE); } int -- cgit v1.2.3