Page MenuHomeFreeBSD

libc: Fix getentropy POSIX 2024 conformance issues
ClosedPublic

Authored by emaste on Nov 20 2024, 7:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 19, 4:04 PM
Unknown Object (File)
Dec 11 2025, 2:17 PM
Unknown Object (File)
Dec 7 2025, 4:50 PM
Unknown Object (File)
Dec 4 2025, 8:41 PM
Unknown Object (File)
Dec 4 2025, 6:51 AM
Unknown Object (File)
Dec 1 2025, 9:16 AM
Unknown Object (File)
Nov 30 2025, 8:23 PM
Unknown Object (File)
Nov 28 2025, 8:30 PM
Subscribers

Details

Summary
GETENTROPY_MAX should be defined in limits.h.  EINVAL is the return
value for buflen > GETENTROPY_MAX.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste created this revision.

I'm not sure how the build is intended to set __POSIX_VISIBLE for building libc's getentropy.c.

imp added inline comments.
include/limits.h
142

Why doesn't this work today? I've recently bumped __POSIX_VISIBLE to 202405 for the default BSD_VISIBLE sources

I'm not sure how the build is intended to set __POSIX_VISIBLE for building libc's getentropy.c.

By default we build with BSD_SOURCE which makes it all visible.

Oh, on ref15-amd64.freebsd.org I get:

#include <sys/cdefs.h>
#include <stdio.h>

int
main(int argc, char *argv[])
{
        printf("__POSIX_VISIBLE=%d\n", __POSIX_VISIBLE);
}

__POSIX_VISIBLE=200809

Restore POSIX_VISIBLE tests - issue was local cross-threading

This revision is now accepted and ready to land.Jan 17 2025, 6:11 PM