Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrightsThese ones were unambiguous cases where the Foundation was the onlylisted copyright holder (in the associated license block).S
Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrightsThese ones were unambiguous cases where the Foundation was the onlylisted copyright holder (in the associated license block).Sponsored by: The FreeBSD Foundation(cherry picked from commit 9feff969a01044c3083b552f06f7eb6416bc0524)
show more ...
Switch to an ifunc in the kernel for crc32cThere is no need to read the same variable to check if the CPU supportscrc32c instructions.Reviewed by: arichardson, kib, markjSponsored by: The FreeB
Switch to an ifunc in the kernel for crc32cThere is no need to read the same variable to check if the CPU supportscrc32c instructions.Reviewed by: arichardson, kib, markjSponsored by: The FreeBSD FoundationDifferential Revision: https://reviews.freebsd.org/D31274(cherry picked from commit a93941b439fce7047dffad6bc380cc9454b967cd)
Remove incorrect __restricted labels from strcspnstrcspn should never have had the __restrict keywords. While both ofthese strings are const, it may have unindended side effects. While thisis the
Remove incorrect __restricted labels from strcspnstrcspn should never have had the __restrict keywords. While both ofthese strings are const, it may have unindended side effects. While thisis the kernel, the POSIX definition also omits restrict.Reviewed by: imp@Pull Request: https://github.com/freebsd/freebsd-src/pull/497(cherry picked from commit 56d33e86b74b197a36f42255824b56715c96a596)
Add missing libkern/strnstr.c fileApparently it wasn't picked up by git.Reviewed by: bz, hselasky, ncDifferential Revision: https://reviews.freebsd.org/D31131(cherry picked from commit 421145
Add missing libkern/strnstr.c fileApparently it wasn't picked up by git.Reviewed by: bz, hselasky, ncDifferential Revision: https://reviews.freebsd.org/D31131(cherry picked from commit 4211457e40e07f6f820c4171c7db81f028fd23af)
Use '.arch_extension crc' in the arm64 crc32 codeWe don't care about the base architecture here, just that the crcextension is enabled.Sponsored by: Innovate UK(cherry picked from commit 0ec3e
Use '.arch_extension crc' in the arm64 crc32 codeWe don't care about the base architecture here, just that the crcextension is enabled.Sponsored by: Innovate UK(cherry picked from commit 0ec3e991112d85a790ca3bbb4175652f37f4bd15)
tests/sys/kern/crc32: Check for SSE4.2 before using itThis avoids a SIGILL when running these tests on QEMU (whichdefaults to a basic amd64 CPU without SSE4.2).This commit also tests the table-b
tests/sys/kern/crc32: Check for SSE4.2 before using itThis avoids a SIGILL when running these tests on QEMU (whichdefaults to a basic amd64 CPU without SSE4.2).This commit also tests the table-based implementations in addition totesting the hw-accelerated crc32 versions.Reviewed By: cem, kib, markjDifferential Revision: https://reviews.freebsd.org/D28395(cherry picked from commit 83c20b8a2da04937cf4af127366b3dc92c855784)
random(9): Restore historical [0,2^31-1] output range and related man documention.Commit SVN r364219 / Git 8a0edc914ffd changed random(9) to be a shim aroundprng32(9) and inadvertently caused rand
random(9): Restore historical [0,2^31-1] output range and related man documention.Commit SVN r364219 / Git 8a0edc914ffd changed random(9) to be a shim aroundprng32(9) and inadvertently caused random(9) to begin returning numbers in therange [0,2^32-1] instead of [0,2^31-1], where the latter has been the documentedrange for decades.The increased output range has been identified as the source of numerous bugs incode written against the historical output range e.g. ipfw "prob" rules andstats(3) are known to be affected, and a non-exhaustive audit of the treeidentified other random(9) consumers which are also likely affected.As random(9) is deprecated and slated for eventual removal in 14.0, consumersshould gradually be audited and migrated to prng(9).Submitted by: Loic Prylli <[email protected]>Obtained from: NetflixReviewed by: cem, delphij, impMFC after: 1 dayMFC to: stable/13, releng/13.0Differential Revision: https://reviews.freebsd.org/D29385(cherry picked from commit dbbf3e3f37d67d3eae0931855f8b62b9b299b80a)
Revert "Reimplement strlen"This reverts commit 710e45c4b8539d028877769f1a4ec088c48fb5f1.It breaks for some corner cases on big endian ppc64.Given the stage of the release process it is best to r
Revert "Reimplement strlen"This reverts commit 710e45c4b8539d028877769f1a4ec088c48fb5f1.It breaks for some corner cases on big endian ppc64.Given the stage of the release process it is best to revert for now.Reported by: jhibbits(cherry picked from commit 33f0540b13d949c7cc226a79927ddc2062ff98bf)
Reimplement strlenThe previous code neglected to use primitives which can find the endof the string without having to branch on every character.While here augment the somewhat misleading comment
Reimplement strlenThe previous code neglected to use primitives which can find the endof the string without having to branch on every character.While here augment the somewhat misleading commentary -- strlen asimplemented here leaves performance on the table, especially so foruserspace. Every arch should get a dedicated variant instead.In the meantime this commit lessens the problem.Tested with glibc test suite.Naive test just calling strlen in a loop on Haswell (ops/s):$(perl -e "print 'A' x 3"):before: 211198039after: 338626619$(perl -e "print 'A' x 100"):before: 83151997after: 98285919(cherry picked from commit 710e45c4b8539d028877769f1a4ec088c48fb5f1)
libkern/strcasestr.c: Drop xlocale support and connect to build.Reviewed by: markj, hselaskyDifferential revision: https://reviews.freebsd.org/D27866
Copy strcasestr.c from libc to libkern.
arc4random(9): Integrate with RANDOM_FENESTRASX push-reseedThere is no functional change for the existing Fortuna random(4)implementation, which remains the default in GENERIC.In the FenestrasX
arc4random(9): Integrate with RANDOM_FENESTRASX push-reseedThere is no functional change for the existing Fortuna random(4)implementation, which remains the default in GENERIC.In the FenestrasX model, when the root CSPRNG is reseeded from pools due toan (infrequent) timer, child CSPRNGs can cheaply detect this condition andreseed. To do so, they just need to track an additional 64-bit value in theassociated state, and compare it against the root seed version (generation)on random reads.This revision integrates arc4random(9) into that model without substantiallychanging the design or implementation of arc4random(9). The motivation isthat arc4random(9) is immediately reseeded when the backing random(4)implementation has additional entropy. This is arguably most importantduring boot, when fenestrasX is reseeding at 1, 3, 9, 27, etc., secondintervals. Today, arc4random(9) has a hardcoded 300 second reseed window.Without this mechanism, if arc4random(9) gets weak entropy during initialseed (and arc4random(9) is used early in boot, so this is quite possible),it may continue to emit poorly seeded output for 5 minutes. The FenestrasXpush-reseed scheme corrects consumers, like arc4random(9), as soon aspossible.Reviewed by: markmApproved by: csprng (markm)Differential Revision: https://reviews.freebsd.org/D22838
arm64: check for CRC32 support via HWCAPDoing it this way eliminates the assumption about homogeneous supportfor the feature, since HWCAP values are only set if support is presenton all CPUs.Re
arm64: check for CRC32 support via HWCAPDoing it this way eliminates the assumption about homogeneous supportfor the feature, since HWCAP values are only set if support is presenton all CPUs.Reviewed by: tuexen, markjMFC after: 1 weekSponsored by: The FreeBSD FoundationDifferential Revision: https://reviews.freebsd.org/D26032
libkern: clean up empty lines in .c and .h files
Smaller crc for the boot loader.Save 7k of text space by using simpler crc32 for standalone case. wedon't need all that fancy optimization in the boot loader, so use asimplified version of the CR
Smaller crc for the boot loader.Save 7k of text space by using simpler crc32 for standalone case. wedon't need all that fancy optimization in the boot loader, so use asimplified version of the CRC function. We could save more by doing itone bit at a time rather than 32, but this is the biggest savings atthe smallest performance hit.With LUA and verfied exec, gptboot, gptzfsboot and friends are pushingthe ~530k limit and every little bit helps.Reviewed By: allanjudeDifferential Revision: https://reviews.freebsd.org/D24225
Add prng(9) APIAdd prng(9) as a replacement for random(9) in the kernel.There are two major differences from random(9) and random(3):- General prng(9) APIs (prng32(9), etc) do not guarantee an
Add prng(9) APIAdd prng(9) as a replacement for random(9) in the kernel.There are two major differences from random(9) and random(3):- General prng(9) APIs (prng32(9), etc) do not guarantee an implementation or particular sequence; they should not be used for repeatable simulations.- However, specific named API families are also exposed (for now: PCG), and those are expected to be repeatable (when so-guaranteed by the named algorithm).Some minor differences from random(3) and earlier random(9):- PRNG state for the general prng(9) APIs is per-CPU; this eliminates contention on PRNG state in SMP workloads. Each PCPU generator in an SMP system produces a unique sequence.- Better statistical properties than the Park-Miller ("minstd") PRNG (longer period, uniform distribution in all bits, passes BigCrush/PractRand analysis).- Faster than Park-Miller ("minstd") PRNG -- no division is required to step PCG-family PRNGs.For now, random(9) becomes a thin shim around prng32(). Eventually Iwould like to mechanically switch consumers over to the explicit API.Reviewed by: kib, markj (previous version both)Discussed with: markmDifferential Revision: https://reviews.freebsd.org/D25916
libkern: Add arc4random_uniformThis variant get a random number up to the limit passed as the argument.This is simply a copy of the libc version.Sponsored-by: The FreeBSD FoundationReviewed by:
libkern: Add arc4random_uniformThis variant get a random number up to the limit passed as the argument.This is simply a copy of the libc version.Sponsored-by: The FreeBSD FoundationReviewed by: cem, hselasky (previous version)Differential Revision: https://reviews.freebsd.org/D24962
Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that arestill not MPSAFE (or already are but aren’t properly mark
Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that arestill not MPSAFE (or already are but aren’t properly marked).Use it in preparation for a general review of all nodes.This is non-functional change that adds annotations to SYSCTL_NODE andSYSCTL_PROC nodes using one of the soon-to-be-required flags.Mark all obvious cases as MPSAFE. All entries that haven't been markedas MPSAFE before are by default marked as NEEDGIANTApproved by: kib (mentor, blanket)Commented by: kib, gallatin, melifaroDifferential Revision: https://reviews.freebsd.org/D23718
random(9): Deprecate random(9), remove meaningless srandom(9)srandom(9) is meaningless on SMP systems or any system with, say,interrupts. One could never rely on random(9) to produce a reproducib
random(9): Deprecate random(9), remove meaningless srandom(9)srandom(9) is meaningless on SMP systems or any system with, say,interrupts. One could never rely on random(9) to produce a reproduciblesequence of outputs on the basis of a specific srandom() seed because theglobal state was shared by all kernel contexts. As such, removing it isliterally indistinguishable to random(9) consumers (as compared withretaining it).Mark random(9) as deprecated and slated for quick removal. This is not tosay we intend to remove all fast, non-cryptographic PRNG(s) in the kernel.It/they just won't be random(9), as it exists today, in either name orimplementation.Before random(9) is removed, a replacement will be provided and in-treeconsumers will be converted.Note that despite the name, the random(9) interface does not bear anyresemblance to random(3). Instead, it is the same crummy 1988 Park-MillerLCG used in libc rand(3).
Port the NetBSD KCSAN runtime to FreeBSD.Update the NetBSD Kernel Concurrency Sanitizer (KCSAN) runtime to work inthe FreeBSD kernel. It is a useful tool for finding data races betweenthreads exe
Port the NetBSD KCSAN runtime to FreeBSD.Update the NetBSD Kernel Concurrency Sanitizer (KCSAN) runtime to work inthe FreeBSD kernel. It is a useful tool for finding data races betweenthreads executing on different CPUs.This can be enabled by enabling KCSAN in the kernel config, or by using theGENERIC-KCSAN amd64 kernel. It works on amd64 and arm64, however the laterneeds a compiler change to allow -fsanitize=thread that KCSAN uses.Sponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D22315
Rename the macros to extract a single arm64 ID field.Because of the previous naming scheme the old ID_AA64PFR0_EL1 macrocollided with a potential macro for the register of the same name. To fixth
Rename the macros to extract a single arm64 ID field.Because of the previous naming scheme the old ID_AA64PFR0_EL1 macrocollided with a potential macro for the register of the same name. To fixthis collision rename these macros.Sponsored by: DARPA, AFRL
Remove zlib 1.0.4 from kernel.PR: 229763Reviewed by: emaste, Yoshihiro Ota <ota j email ne jp>Differential Revision: https://reviews.freebsd.org/D21375
libkern: Implement strchrnul(3)
Allow Kernel to link in both legacy libkern/zlib and new sys/contrib/zlib,with an eventual goal to convert all legacl zlib callers to the new zlibversion: * Move generic zlib shims that are not s
Allow Kernel to link in both legacy libkern/zlib and new sys/contrib/zlib,with an eventual goal to convert all legacl zlib callers to the new zlibversion: * Move generic zlib shims that are not specific to zlib 1.0.4 to sys/dev/zlib. * Connect new zlib (1.2.11) to the zlib kernel module, currently built with Z_SOLO. * Prefix the legacy zlib (1.0.4) with 'zlib104_' namespace. * Convert sys/opencrypto/cryptodeflate.c to use new zlib. * Remove bundled zlib 1.2.3 from ZFS and adapt it to new zlib and make it depend on the zlib module. * Fix Z_SOLO build of new zlib.PR: 229763Submitted by: Yoshihiro Ota <ota j email ne jp>Reviewed by: markm (sys/dev/zlib/zlib_kmod.c)Relnotes: yesDifferential Revision: https://reviews.freebsd.org/D19706
Remove pre-FreeBSD 7.0 compatibility.
123