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

(cherry picked from commit c96772227b7dfcaf4eec4d07acb5c916643aca3a)

Details

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