From deb1213098e2dc10e6eee5e5c57bb40584e096a6 Mon Sep 17 00:00:00 2001 From: Tino Reichardt Date: Tue, 21 Jun 2022 23:32:09 +0200 Subject: Fix memory allocation issue for BLAKE3 context The kmem_alloc(sizeof (*ctx), KM_NOSLEEP) call on FreeBSD can't be used in this code segment. Work around this by pre-allocating a percpu context array for later use. Reviewed-by: Ryan Moeller Reviewed-by: Brian Behlendorf Signed-off-by: Tino Reichardt Closes #13568 --- include/sys/blake3.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/sys/blake3.h b/include/sys/blake3.h index e6650372c..b3391c5f2 100644 --- a/include/sys/blake3.h +++ b/include/sys/blake3.h @@ -92,6 +92,11 @@ void Blake3_Final(const BLAKE3_CTX *ctx, uint8_t *out); void Blake3_FinalSeek(const BLAKE3_CTX *ctx, uint64_t seek, uint8_t *out, size_t out_len); +/* these are pre-allocated contexts */ +extern void **blake3_per_cpu_ctx; +extern void blake3_per_cpu_ctx_init(void); +extern void blake3_per_cpu_ctx_fini(void); + /* return number of supported implementations */ extern int blake3_get_impl_count(void); -- cgit v1.2.3