microzap: set hard upper limit of 1M
commitc37a2ddaaabc203feaae987f62289b2cfe306818
authorRob Norris <rob.norris@klarasystems.com>
Thu, 26 Dec 2024 22:10:09 +0000 (27 09:10 +1100)
committerGitHub <noreply@github.com>
Thu, 26 Dec 2024 22:10:09 +0000 (26 17:10 -0500)
treecb5762ec80e1882e0e14018a6712a879ef8ba255
parent1acd2469643f8543f2941cdc72f977d56521c4c9
microzap: set hard upper limit of 1M

The count of chunks in a microzap block is stored as an uint16_t
(mze_chunkid). Each chunk is 64 bytes, and the first is used to store a
header, so there are 32767 usable chunks, which is just under 2M. 1M is
the largest power-2-rounded block size under 2M, so we must set the
limit there.

If it goes higher, the loop in mzap_addent can overflow and fall into
the PANIC case.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #16888
module/zfs/zap_micro.c