Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Mar 2025 13:29:26 +0000
From:      bugzilla-noreply@freebsd.org
To:        emulation@FreeBSD.org
Subject:   [Bug 285408] linux: jid 1 pid 88998 (server): sysctl {1,40,6} is not implemented
Message-ID:  <bug-285408-4077-5QLtxaUgIk@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-285408-4077@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285408

--- Comment #6 from Jason Mader <jasonmader@gmail.com> ---
Found that the message may come from libressl crypto/compat/getentropy_linux.c

#ifdef SYS__sysctl
        /*
         * Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID.
         * sysctl is a failsafe API, so it guarantees a result.  This
         * should work inside a chroot, or when file descriptors are
         * exhausted.
         *
         * However this can fail if the Linux kernel removes support
         * for sysctl.  Starting in 2007, there have been efforts to
         * deprecate the sysctl API/ABI, and push callers towards use
         * of the chroot-unavailable fd-using /proc mechanism --
         * essentially the same problems as /dev/urandom.
         *
         * Numerous setbacks have been encountered in their deprecation
         * schedule, so as of June 2014 the kernel ABI still exists on
         * most Linux architectures. The sysctl() stub in libc is missing
         * on some systems.  There are also reports that some kernels
         * spew messages to the console.
         */
        ret = getentropy_sysctl(buf, len);
        if (ret != -1)
                return (ret);
#endif /* SYS__sysctl */

#ifdef SYS__sysctl
static int
getentropy_sysctl(void *buf, size_t len)
{
        static int mib[] = { CTL_KERN, KERN_RANDOM, RANDOM_UUID };
        size_t i;
        int save_errno = errno;

        for (i = 0; i < len; ) {
                size_t chunk = MINIMUM(len - i, 16);

                /* SYS__sysctl because some systems already removed sysctl() */
                struct __sysctl_args args = {
                        .name = mib,
                        .nlen = 3,
                        .oldval = (char *)buf + i,
                        .oldlenp = &chunk,
                };
                if (syscall(SYS__sysctl, &args) != 0)
                        goto sysctlfailed;
                i += chunk;
        }
        errno = save_errno;
        return (0);                     /* satisfied */
sysctlfailed:
        errno = EIO;
        return (-1);
}
#endif /* SYS__sysctl */

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-285408-4077-5QLtxaUgIk>