HomeFreeBSD

memfd_create: don't allocate heap memory

Description

memfd_create: don't allocate heap memory

Rather than calling calloc() to allocate space for a page size array to
pass to getpagesizes(), just follow the getpagesizes() implementation
and allocate MAXPAGESIZES elements on the stack. This avoids the need
for the allocation.

While this does mean that a new libc is required to take advantage of a
new huge page size, that was already true due to getpagesizes() using a
static buffer of MAXPAGESIZES elements.

Reviewed by: kevans, imp, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D42710

Details

Provenance
brooksAuthored on Nov 27 2023, 5:07 PM
Reviewer
kevans
Differential Revision
D42710: memfd_create: don't allocate heap memory
Parents
rGc3207e2d2554: memfd_create: move implementation to libc/gen
Branches
Unknown
Tags
Unknown