elf_aux_info() unlike getauxval() requires passing correct size of the return buffer. As the manpage only documents the 1st argument it's not possible to use elf_aux_info() without looking and relying on libc guts.
https://reviews.freebsd.org/D22380
A commit references this bug: Author: kib Date: Sun Nov 17 14:11:08 UTC 2019 New revision: 354787 URL: https://svnweb.freebsd.org/changeset/base/354787 Log: Document required size of buffer for elf_aux_info(3). PR: 241884 Reported by: jbeich Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D22380 Changes: head/lib/libc/gen/auxv.3