mirror_zfs/cmd/zstream
Rob Norris 92fca1c2d0 zstream: build with debug to fix stack overruns
abd_t differs in size depending on whether or not ZFS_DEBUG is set. It
turns out that libzpool is built with FORCEDEBUG_CPPFLAGS, which sets
-DZFS_DEBUG, and so it always has a larger abd_t with extra debug
fields, regardless of whether or not --enable-debug is set.

zdb, ztest and zhack are also all built with FORCEDEBUG_CPPFLAGS, so had
the same idea of the size of abd_t, but zstream was not, and used the
"smaller" abd_t. In practice this didn't matter because it never used
abd_t directly.

This changed in b4d81b1a6, zstream was switched to use stack ABDs for
compression. When built with --enable-debug, zstream implicitly gets
ZFS_DEBUG, and everything was fine. Productions builds without that flag
ends up with the smaller abd_t, which is now mismatched with libzpool,
and causes stack overruns in zstream recompress.

The simplest fix for now is to compile zstream with FORCEDEBUG_CPPFLAGS
like the other binaries. This commit does that.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Issue #16476
Closes #16477
2024-08-27 12:52:23 -07:00
..
Makefile.am zstream: build with debug to fix stack overruns 2024-08-27 12:52:23 -07:00
zstream_decompress.c zstream decompress: fix decompress size and output 2024-08-22 16:22:24 -07:00
zstream_dump.c Fix declarations of non-global variables 2022-10-18 11:05:32 -07:00
zstream_recompress.c zstream recompress: fix zero recompressed buffer and output 2024-08-22 16:22:24 -07:00
zstream_redup.c zstream: remove duplicate highbit64 definition 2024-08-09 14:31:41 -07:00
zstream_token.c Fix userland dereference NULL return value bugs 2022-09-30 17:02:57 -07:00
zstream.c Add ability to recompress send streams with new compression algorithm 2022-11-10 15:23:46 -08:00
zstream.h Add ability to recompress send streams with new compression algorithm 2022-11-10 15:23:46 -08:00