Skip to content

Commit

Permalink
Really zero the zero page
Browse files Browse the repository at this point in the history
While switching abd_zero_buf allocation KPI I've missed the fact
that kmem_zalloc() zeroed the allocation, while kmem_cache_alloc()
does not.  Add explicit bzero() after it.

I don't think it should have caused real problems, but leaking one
memory page content all over the pool is not good.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes openzfs#12569
  • Loading branch information
amotin authored and tonyhutter committed Mar 4, 2022
1 parent 037434e commit 0e2bb1a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions module/os/freebsd/zfs/abd_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ abd_alloc_zero_scatter(void)

n = abd_chunkcnt_for_bytes(SPA_MAXBLOCKSIZE);
abd_zero_buf = kmem_cache_alloc(abd_chunk_cache, KM_PUSHPAGE);
bzero(abd_zero_buf, PAGE_SIZE);
abd_zero_scatter = abd_alloc_struct(SPA_MAXBLOCKSIZE);

abd_zero_scatter->abd_flags |= ABD_FLAG_OWNER | ABD_FLAG_ZEROS;
Expand Down

0 comments on commit 0e2bb1a

Please sign in to comment.