libc: Purge unneeded cdefs.hThese sys/cdefs.h are not needed. Purge them. They are mostly left-overfrom the $FreeBSD$ removal. A few in libc are still required for macrosthat cdefs.h defines. Kee
libc: Purge unneeded cdefs.hThese sys/cdefs.h are not needed. Purge them. They are mostly left-overfrom the $FreeBSD$ removal. A few in libc are still required for macrosthat cdefs.h defines. Keep those.Sponsored by: NetflixDifferential Revision: https://reviews.freebsd.org/D42385(cherry picked from commit 559a218c9b257775fb249b67945fe4a05b7a6b9f)
show more ...
Remove $FreeBSD$: one-line sh patternRemove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
Remove $FreeBSD$: one-line .c patternRemove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
Remove $FreeBSD$: two-line .h patternRemove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDThe SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catchup to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDThe SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catchup to that fact and revert to their recommended match of BSD-2-Clause.Discussed with: pfgMFC After: 3 daysSponsored by: Netflix
tests: fix posix_spawnp_enoexec_fallback_null_argv0This test was written because execvp was found to improperly handle theargc == 0 case when it falls back from an ENOEXEC. We could probablymost
tests: fix posix_spawnp_enoexec_fallback_null_argv0This test was written because execvp was found to improperly handle theargc == 0 case when it falls back from an ENOEXEC. We could probablymostly revert it now, but let's just fix the test for the time being andcircle back later to decide if we want to simplify execvp. The testwill likely remain either way just to make sure execvp isn't workingaround the newly enforced restriction with the fallback.Fixes: 301cb491ea41 ("execvp: fix up the ENOEXEC fallback")Reported by: jenkins via lwhsu@
libc: tests: hook CPUSET(9) test up to the buildAdd shims to map NetBSD's API to CPUSET(9). Obviously the invalid inputparts of these tests are relatively useless since we're just testing theshim
libc: tests: hook CPUSET(9) test up to the buildAdd shims to map NetBSD's API to CPUSET(9). Obviously the invalid inputparts of these tests are relatively useless since we're just testing theshims that aren't used elsewhere, there's still some amount of value inthe parts testing valid inputs.Differential Revision: https://reviews.freebsd.org/D27307
Revert r351416 to let lib.libc.gen.getmntinfo_test.getmntinfo_test get more testThis is supposed to be fixed by r363068PR: 240049Sponsored by: The FreeBSD Foundation
Enable long double tests on RISC-VSome of the NetBSD contributed tests are gated behind the__HAVE_LONG_DOUBLE flag. This flag seems to be defined only forplatforms whose long double is larger tha
Enable long double tests on RISC-VSome of the NetBSD contributed tests are gated behind the__HAVE_LONG_DOUBLE flag. This flag seems to be defined only forplatforms whose long double is larger than their double. I could notfind this explicitly documented anywhere, but it is implied by thedefinitions in NetBSD's sys/arch/${arch}/include/math.h headers, and thefollowing assertion from the UBSAN code: #ifdef __HAVE_LONG_DOUBLE long double LD; ASSERT(sizeof(LD) > sizeof(uint64_t)); #endifRISC-V has 128-bit long doubles, so enable the tests on this platform,and update the comments to better explain the purpose of this flag.Reviewed by: ngieMFC after: 1 weekDifferential Revision: https://reviews.freebsd.org/D25419
Add missing shell script from r361995Pointy hat: kevansReported by: rpokalaX-MFC-With: r361995
execvp: fix up the ENOEXEC fallbackIf execve fails with ENOEXEC, execvp is expected to rebuild the commandwith /bin/sh instead and try again.The previous version did this, but overlooked two det
execvp: fix up the ENOEXEC fallbackIf execve fails with ENOEXEC, execvp is expected to rebuild the commandwith /bin/sh instead and try again.The previous version did this, but overlooked two details:argv[0] can conceivably be NULL, in which case memp would never getterminated. We must allocate no less than three * sizeof(char *) so we canproperly terminate at all times. For the non-NULL argv standard case, wecount all the non-NULL elements and actually skip the first argument, so weend up capturing the NULL terminator in our bcopy().The second detail is that the spec is actually worded such that we shouldhave been preserving argv[0] as passed to execvp:"[...] executed command shall be as if the process invoked the sh utilityusing execl() as follows:execl(<shell path>, arg0, file, arg1, ..., (char *)0);where <shell path> is an unspecified pathname for the sh utility, file isthe process image file, and for execvp(), where arg0, arg1, and so oncorrespond to the values passed to execvp() in argv[0], argv[1], and so on."So we make this change at this time as well, while we're already touchingit. We decidedly can't preserve a NULL argv[0] as this would be incredibly,incredibly fragile, so we retain our legacy behavior of using "sh" forargv[] in this specific instance.Some light tests are added to try and detect some components of handling theENOEXEC fallback; posix_spawnp_enoexec_fallback_null_argv0 is likely not100% reliable, but it at least won't raise false-alarms and it did result inuseful failures with pre-change libc on my machine.This is a secondary change in D25038.Reported by: Andrew Gierth <andrew_tao173.riddles.org.uk>Reviewed by: jilles, kib, Andrew GierthMFC after: 1 week
Avoid using non-portable dd status=none flagCopying the approach chosen in r309412. This fixes building the libc testson a macOS host since the macOS /bin/dd binary does not support status=none.
Avoid using non-portable dd status=none flagCopying the approach chosen in r309412. This fixes building the libc testson a macOS host since the macOS /bin/dd binary does not support status=none.As there only seem to be two uses, this commit changes the two Makefiles.If this becomes more common, we could also add a wrapper bootstrap scriptthat ignores status= and forwards the remaining args to the real dd.Another alternative would be to remove the status flag and pipe stderr to/dev/null, but them we lose error messages.Reviewed By: brooksDifferential Revision: https://reviews.freebsd.org/D24785
Add sigsetop extensions commonly found in musl libc and glibcThese functions (sigandset, sigisemptyset, sigorset) are commonly availablein at least musl libc and glibc; sigorset, at least, has pro
Add sigsetop extensions commonly found in musl libc and glibcThese functions (sigandset, sigisemptyset, sigorset) are commonly availablein at least musl libc and glibc; sigorset, at least, has proven quite usefulin qemu-bsd-user work for tracking the current process signal mask in a moreself-documenting/aesthetically pleasing manner.Reviewed by: bapt, jilles, pfgMFC after: 1 weekDifferential Revision: https://reviews.freebsd.org/D22187
lib.libc.gen.getmntinfo_test.getmntinfo_test is unstable since 8/20, skip itin CI env temporarily for more offline diagnosisPR: 240049Sponsored by: The FreeBSD Foundation
Include a mode when creating files with openat().Reviewed by: asomersObtained from: CheriBSDMFC after: 1 weekSponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D20989
Drop "All rights reserved" from my copyright statements.Reviewed by: rgrimesMFC after: 1 monthDifferential Revision: https://reviews.freebsd.org/D19485
getentropy(3): Fallback to kern.arandom sysctl on older kernelsOn older kernels, when userspace program disables SIGSYS, catch ENOSYS andemulate getrandom(2) syscall with the kern.arandom sysctl (
getentropy(3): Fallback to kern.arandom sysctl on older kernelsOn older kernels, when userspace program disables SIGSYS, catch ENOSYS andemulate getrandom(2) syscall with the kern.arandom sysctl (via existingarc4_sysctl wrapper).Special care is taken to faithfully emulate EFAULT on NULL pointers, becausesysctl(3) as used by kern.arandom ignores NULL oldp. (This was caught bygetentropy(3) ATF tests.)Reported by: kibReviewed by: kibDiscussed with: delphijSponsored by: Dell EMC IsilonDifferential Revision: https://reviews.freebsd.org/D14785
Implement getrandom(2) and getentropy(3)The general idea here is to provide userspace programs with well-definedsources of entropy, in a fashion that doesn't require opening a new filedescriptor
Implement getrandom(2) and getentropy(3)The general idea here is to provide userspace programs with well-definedsources of entropy, in a fashion that doesn't require opening a new filedescriptor (ulimits) or accessing paths (/dev/urandom may be restrictedby chroot or capsicum).getrandom(2) is the more general API, and comes from the Linux world.Since our urandom and random devices are identical, the GRND_RANDOM flagis ignored.getentropy(3) is added as a compatibility shim for the OpenBSD API.truss(1) support is included.Tests for both system calls are provided. Coverage is believed to be atleast as comprehensive as LTP getrandom(2) test coverage. Additionally,instructions for running the LTP tests directly against FreeBSD are providedin the "Test Plan" section of the Differential revision linked below. (Theypass, of course.)PR: 194204Reported by: David CARLIER <david.carlier AT hardenedbsd.org>Discussed with: cperciva, delphij, jhb, markjRelnotes: maybeDifferential Revision: https://reviews.freebsd.org/D14500
Add a new set of simple tests for makecontext().In contrast to the existing NetBSD setcontext_link test, these testsverify that passing from 1 to 6 arguments through to the callback functionwork
Add a new set of simple tests for makecontext().In contrast to the existing NetBSD setcontext_link test, these testsverify that passing from 1 to 6 arguments through to the callback functionwork correctly which can be useful for testing ABIs which split argumentsbetween registers and the stack.Sponsored by: DARPA / AFRL
Optimize telldir(3)Currently each call to telldir() requires a malloc and adds an entry to alinked list which must be traversed on future telldir(), seekdir(),closedir(), and readdir() calls. App
Optimize telldir(3)Currently each call to telldir() requires a malloc and adds an entry to alinked list which must be traversed on future telldir(), seekdir(),closedir(), and readdir() calls. Applications that call telldir() for everydirectory entry incur O(n^2) behavior in readdir() and O(n) in telldir() andclosedir().This optimization eliminates the malloc() and linked list in most cases bypacking the relevant information into a single long. On 64-bit architecturesmsdosfs, NFS, tmpfs, UFS, and ZFS can all use the packed representation. On32-bit architectures msdosfs, NFS, and UFS can use the packedrepresentation, but ZFS and tmpfs can only use it for about the first 128files per directory. Memory savings is about 50 bytes per telldir(3) call.Speedup for telldir()-heavy directory traversals is about 20-30x for onemillion files per directory.Reviewed by: kib, mav, mckusickMFC after: 3 weeksSponsored by: Spectra Logic CorpDifferential Revision: https://reviews.freebsd.org/D13385
DIRDEPS_BUILD: Update dependencies.Sponsored by: Dell EMC Isilon
getmntinfo(3): Scale faster, and return soonergetmntinfo(3) is designed around a relatively static or slow growing set ofcurrent mounts. It tried to detect a race with somewhat concurrent mounta
getmntinfo(3): Scale faster, and return soonergetmntinfo(3) is designed around a relatively static or slow growing set ofcurrent mounts. It tried to detect a race with somewhat concurrent mountand re-call getfsstat(2) in that case, looping indefinitely. It alsoallocated space for a single extra mount as slop.In the case where the user has a large number of mounts and is adding themat a rapid pace, it fell over.This patch makes two functional changes:1. Allocate even more slop. Double whatever the last getfsstat(2) returned.2. Abort and return some known results after looping a few times (arbitrarily, 3). If the list is constantly changing, we can't guarantee we return a full result to the user at any point anyways.While here, add very basic functional tests for getmntinfo(3) to the libcsuite.PR: 221743Submitted by: Peter Eriksson <peter AT ifm.liu.se> (earlier version)Sponsored by: Dell EMC Isilon
fnmatch(3): Update testcase for r322368.
Fix cleanup in lib/libc/gen/setdomainname_testATF cleanup routines run in separate processes from the tests themselves, sothey can't share global variables.Also, setdomainname_test needs to be i
Fix cleanup in lib/libc/gen/setdomainname_testATF cleanup routines run in separate processes from the tests themselves, sothey can't share global variables.Also, setdomainname_test needs to be is_exclusive because the test casesaccess a global resource.PR: 219967Reviewed by: ngieMFC after: 3 weeksSponsored by: Spectra Logic CorpDifferential Revision: https://reviews.freebsd.org/D11188
Add tests for some cases in r318298.The first test triggers the out of bounds read of the 'left' array. Itonly fails when realpath.c is compiled with '-fsanitize=address'.The other test checks f
Add tests for some cases in r318298.The first test triggers the out of bounds read of the 'left' array. Itonly fails when realpath.c is compiled with '-fsanitize=address'.The other test checks for ENOENT when running into an emptysymlink. This matches NetBSD's realpath(3) semantics. Previously,empty symlinks were treated like ".".Submitted by: Jan Kokemц╪ller <[email protected]>PR: 219154MFC after: 2 weeks
12