[Libguestfs] [PATCH nbdkit v2 0/4] common/allocators: Always align mlock buffer

Richard W.M. Jones
Thu, 27 Jan 2022 16:39:20 -0000

Earlier patch was reviewed here:

https://listman.redhat.com/archives/libguestfs/2022-January/msg00172.html

For this series I pulled out two smaller changes into separate commits
(patches 1 & 2).

I then decided to modify the vector library to add a new
<vector>_reserve_page_aligned function which always allocates
page-aligned memory (patch 3).  Currently this is using
posix_memalign, maybe in future using mmap since there seems to be
some dispute about whether calling mlock on anonymous memory is safe.

This makes the change to common/allocators/malloc.c quite
straightforward (patch 4), at the cost of making the change to the
vector library rather headache-inducing.  At least it is confined to a
new function and doesn't affect any existing callers!

Rich.