aboutsummaryrefslogtreecommitdiff
path: root/sys/libkern
Commit message (Collapse)AuthorAgeFilesLines
* Add the __aeabi_memclr8 symbol, clang 3.7 uses this.Andrew Turner2015-09-211-0/+2
| | | | | | | | MFC after: 1 week Sponsored by: ABT Systems Lts Notes: svn path=/head/; revision=288073
* Remove checks for __ARM_EABI__, we only build for EABI now.Andrew Turner2015-07-096-30/+0
| | | | | | | Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=285338
* Add support for __aeabi_memclr4, clang 3.7 calls it.Andrew Turner2015-07-091-0/+40
| | | | | | | Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=285337
* Huge cleanup of random(4) code.Mark Murray2015-06-302-16/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * GENERAL - Update copyright. - Make kernel options for RANDOM_YARROW and RANDOM_DUMMY. Set neither to ON, which means we want Fortuna - If there is no 'device random' in the kernel, there will be NO random(4) device in the kernel, and the KERN_ARND sysctl will return nothing. With RANDOM_DUMMY there will be a random(4) that always blocks. - Repair kern.arandom (KERN_ARND sysctl). The old version went through arc4random(9) and was a bit weird. - Adjust arc4random stirring a bit - the existing code looks a little suspect. - Fix the nasty pre- and post-read overloading by providing explictit functions to do these tasks. - Redo read_random(9) so as to duplicate random(4)'s read internals. This makes it a first-class citizen rather than a hack. - Move stuff out of locked regions when it does not need to be there. - Trim RANDOM_DEBUG printfs. Some are excess to requirement, some behind boot verbose. - Use SYSINIT to sequence the startup. - Fix init/deinit sysctl stuff. - Make relevant sysctls also tunables. - Add different harvesting "styles" to allow for different requirements (direct, queue, fast). - Add harvesting of FFS atime events. This needs to be checked for weighing down the FS code. - Add harvesting of slab allocator events. This needs to be checked for weighing down the allocator code. - Fix the random(9) manpage. - Loadable modules are not present for now. These will be re-engineered when the dust settles. - Use macros for locks. - Fix comments. * src/share/man/... - Update the man pages. * src/etc/... - The startup/shutdown work is done in D2924. * src/UPDATING - Add UPDATING announcement. * src/sys/dev/random/build.sh - Add copyright. - Add libz for unit tests. * src/sys/dev/random/dummy.c - Remove; no longer needed. Functionality incorporated into randomdev.*. * live_entropy_sources.c live_entropy_sources.h - Remove; content moved. - move content to randomdev.[ch] and optimise. * src/sys/dev/random/random_adaptors.c src/sys/dev/random/random_adaptors.h - Remove; plugability is no longer used. Compile-time algorithm selection is the way to go. * src/sys/dev/random/random_harvestq.c src/sys/dev/random/random_harvestq.h - Add early (re)boot-time randomness caching. * src/sys/dev/random/randomdev_soft.c src/sys/dev/random/randomdev_soft.h - Remove; no longer needed. * src/sys/dev/random/uint128.h - Provide a fake uint128_t; if a real one ever arrived, we can use that instead. All that is needed here is N=0, N++, N==0, and some localised trickery is used to manufacture a 128-bit 0ULLL. * src/sys/dev/random/unit_test.c src/sys/dev/random/unit_test.h - Improve unit tests; previously the testing human needed clairvoyance; now the test will do a basic check of compressibility. Clairvoyant talent is still a good idea. - This is still a long way off a proper unit test. * src/sys/dev/random/fortuna.c src/sys/dev/random/fortuna.h - Improve messy union to just uint128_t. - Remove unneeded 'static struct fortuna_start_cache'. - Tighten up up arithmetic. - Provide a method to allow eternal junk to be introduced; harden it against blatant by compress/hashing. - Assert that locks are held correctly. - Fix the nasty pre- and post-read overloading by providing explictit functions to do these tasks. - Turn into self-sufficient module (no longer requires randomdev_soft.[ch]) * src/sys/dev/random/yarrow.c src/sys/dev/random/yarrow.h - Improve messy union to just uint128_t. - Remove unneeded 'staic struct start_cache'. - Tighten up up arithmetic. - Provide a method to allow eternal junk to be introduced; harden it against blatant by compress/hashing. - Assert that locks are held correctly. - Fix the nasty pre- and post-read overloading by providing explictit functions to do these tasks. - Turn into self-sufficient module (no longer requires randomdev_soft.[ch]) - Fix some magic numbers elsewhere used as FAST and SLOW. Differential Revision: https://reviews.freebsd.org/D2025 Reviewed by: vsevolod,delphij,rwatson,trasz,jmg Approved by: so (delphij) Notes: svn path=/head/; revision=284959
* Add more __aeabi_memcpy functions, later versions of clang generate callsAndrew Turner2015-05-311-0/+4
| | | | | | | to these functions. Notes: svn path=/head/; revision=283805
* Move zlib.c from net to libkern.Craig Rodrigues2015-04-221-0/+5414
| | | | | | | | | | | | | | | It is not network-specific code and would be better as part of libkern instead. Move zlib.h and zutil.h from net/ to sys/ Update includes to use sys/zlib.h and sys/zutil.h instead of net/ Submitted by: Steve Kiernan stevek@juniper.net Obtained from: Juniper Networks, Inc. GitHub Pull Request: https://github.com/freebsd/freebsd/pull/28 Relnotes: yes Notes: svn path=/head/; revision=281855
* Implement asprintf in libkernRyan Stone2015-03-011-0/+77
| | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D1877 Reviewed by: pjd, jfv MFC After: 1 month Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=279433
* Similar to r277901, fix more -Wcast-qual warnings in libkern's strtoq(),Dimitry Andric2015-01-293-3/+3
| | | | | | | | | strtoul() and strtouq(), by using __DECONST. No functional change. MFC after: 3 days Notes: svn path=/head/; revision=277903
* Fix a -Wcast-qual warning in libkern's strtol(), by using __DECONST. NoDimitry Andric2015-01-291-1/+1
| | | | | | | | | functional change. MFC after: 3 days Notes: svn path=/head/; revision=277901
* Add some new modes to OpenCrypto. These modes are AES-ICM (can be usedJohn-Mark Gurney2014-12-121-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for counter mode), and AES-GCM. Both of these modes have been added to the aesni module. Included is a set of tests to validate that the software and aesni module calculate the correct values. These use the NIST KAT test vectors. To run the test, you will need to install a soon to be committed port, nist-kat that will install the vectors. Using a port is necessary as the test vectors are around 25MB. All the man pages were updated. I have added a new man page, crypto.7, which includes a description of how to use each mode. All the new modes and some other AES modes are present. It would be good for someone else to go through and document the other modes. A new ioctl was added to support AEAD modes which AES-GCM is one of them. Without this ioctl, it is not possible to test AEAD modes from userland. Add a timing safe bcmp for use to compare MACs. Previously we were using bcmp which could leak timing info and result in the ability to forge messages. Add a minor optimization to the aesni module so that single segment mbufs don't get copied and instead are updated in place. The aesni module needs to be updated to support blocked IO so segmented mbufs don't have to be copied. We require that the IV be specified for all calls for both GCM and ICM. This is to ensure proper use of these functions. Obtained from: p4: //depot/projects/opencrypto Relnotes: yes Sponsored by: FreeBSD Foundation Sponsored by: NetGate Notes: svn path=/head/; revision=275732
* Use the unified syntax in a few more assembly filesAndrew Turner2014-12-051-1/+2
| | | | | | | | MFC after: 1 week Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=275520
* Sync with userland variant.Xin LI2014-11-171-5/+3
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=274636
* Add a complete implementation of MurmurHash3. Tweak both implementationsDag-Erling Smørgrav2014-10-181-12/+70
| | | | | | | | | | so they match the established idiom. Document them in hash(9). MFC after: 1 month MFC with: r272906 Notes: svn path=/head/; revision=273268
* Remove duplicated code.Xin LI2014-10-161-0/+4
| | | | | | | Suggested by: jmg Notes: svn path=/head/; revision=273189
* Change the PF hash from Jenkins to Murmur3. In forwarding testsGeorge V. Neville-Neil2014-10-101-0/+74
| | | | | | | | | | | | this showed a conservative 3% incrase in PPS. Differential Revision: https://reviews.freebsd.org/D461 Submitted by: des Reviewed by: emaste MFC after: 1 month Notes: svn path=/head/; revision=272906
* Add explicit_bzero(3) and its kernel counterpart.Xin LI2014-10-071-0/+24
| | | | | | | | Obtained from: OpenBSD MFC after: 2 weeks Notes: svn path=/head/; revision=272673
* Use __DECONST to avoid compiler warnings (and thus build failures)Bjoern A. Zeeb2014-09-081-2/+2
| | | | | | | with gcc on sparc64, mips, and powerpc after r271173. Notes: svn path=/head/; revision=271251
* Add support for gdb's memory searching capabilities to our in-kernel gdbBenno Rice2014-09-051-0/+62
| | | | | | | | | | | server. Submitted by: Daniel O'Connor <daniel.oconnor@isilon.com> Reviewed by: jhb Sponsored by: EMC Isilon Storage Division Notes: svn path=/head/; revision=271173
* Bring in the new automounter, similar to what's provided in most otherEdward Tomasz Napierala2014-08-171-0/+51
| | | | | | | | | | | | | | | | UNIX systems, eg. MacOS X and Solaris. It uses Sun-compatible map format, has proper kernel support, and LDAP integration. There are still a few outstanding problems; they will be fixed shortly. Reviewed by: allanjude@, emaste@, kib@, wblock@ (earlier versions) Phabric: D523 MFC after: 2 weeks Relnotes: yes Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=270096
* Fix unwind-info errors in our hand-written arm assembler code.Ian Lepore2014-08-011-10/+10
| | | | | | | | | | | | | | | | | | | | | | We have functions nested within functions, and places where we start a function then never end it, we just jump to the middle of something else. We tried to express this with nested ENTRY()/END() macros (which result in .fnstart and .fnend directives), but it turns out there's no way to express that nesting in ARM EHABI unwind info, and newer tools treat multiple .fnstart directives without an intervening .fnend as an error. These changes introduce two new macros, EENTRY() and EEND(). EENTRY() creates a global label you can call/jump to just like ENTRY(), but it doesn't emit a .fnstart. EEND() is a no-op that just documents the conceptual endpoint that matches up with the same-named EENTRY(). This is based on patches submitted by Stepan Dyatkovskiy, but I made some changes and added the EEND() stuff, so blame any problems on me. Submitted by: Stepan Dyatkovskiy <stpworld@narod.ru> Notes: svn path=/head/; revision=269390
* Remove ia64.Marcel Moolenaar2014-07-0712-1273/+0
| | | | | | | | | | | | | | | | | | | | This includes: o All directories named *ia64* o All files named *ia64* o All ia64-specific code guarded by __ia64__ o All ia64-specific makefile logic o Mention of ia64 in comments and documentation This excludes: o Everything under contrib/ o Everything under crypto/ o sys/xen/interface o sys/sys/elf_common.h Discussed at: BSDcan Notes: svn path=/head/; revision=268351
* Use strcasecmp() instead of strcmp() when checking user-supplied encodingJohn Baldwin2014-06-092-4/+4
| | | | | | | | | | | | | names so that encoding names are treated as case-insensitive. This allows the use of 'utf-8' instead of 'UTF-8' for example and matches the behavior of iconv(1). PR: 167977 Submitted by: buganini@gmail.com MFC after: 1 week Notes: svn path=/head/; revision=267291
* Fix typoEitan Adler2013-11-291-1/+1
| | | | | | | Reported by: emaste Notes: svn path=/head/; revision=258752
* Fix typoEitan Adler2013-11-291-1/+1
| | | | | | | Reported by: swildner@DragonFlyBSD.org Notes: svn path=/head/; revision=258751
* Fix ixp425 boot2 with ARM EABI:Andrew Turner2013-09-292-0/+14
| | | | | | | | | | | - libkern is missing __aeabi_llsl, implement this by calling __ashldi3. - Because of how the asm entry macros are defined the boot2 code requires the unwind symbols to exist, include them in boot2. Approved by: re (marius) Notes: svn path=/head/; revision=255939
* Fix watchdog pretimeout.Alfred Perlstein2013-07-271-0/+47
| | | | | | | | | | | The original API calls for pow2ns, however the new APIs from Linux call for seconds. We need to be able to convert to/from 2^Nns to seconds in both userland and kernel to fix this and properly compare units. Notes: svn path=/head/; revision=253719
* Attempt to mitigate poor initialization of arc4 by one-shotAndrey A. Chernov2013-04-191-1/+4
| | | | | | | | | | reinitialization from yarrow right after good entropy is harvested. Approved by: secteam (delphij) MFC after: 1 week Notes: svn path=/head/; revision=249631
* Add __aeabi_memset to libkern, implemented using memset, as clang mayAndrew Turner2013-03-161-0/+49
| | | | | | | generate calls to it. Notes: svn path=/head/; revision=248395
* Add END to ARM libkern assembly functionsAndrew Turner2013-03-164-1/+19
| | | | Notes: svn path=/head/; revision=248367
* Move the __aeabi_unwind_cpp_pr{0,1,2} functions to libkern so they can beAndrew Turner2013-03-161-0/+58
| | | | | | | referenced in a non-debug kernel. Notes: svn path=/head/; revision=248366
* Add __aeabi_memcpy to libkern as clang may generate calls to it.Andrew Turner2013-03-101-0/+37
| | | | Notes: svn path=/head/; revision=248128
* Add __aeabi_ulcmp to allow building of the LINT kernel.Andrew Turner2013-01-232-0/+17
| | | | Notes: svn path=/head/; revision=245840
* Add the required __aeabi_* functions the kernel uses when built for ARM EABIAndrew Turner2013-01-173-0/+128
| | | | Notes: svn path=/head/; revision=245548
* Sync strlcpy with userland version.Xin LI2012-11-031-33/+17
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=242507
* Sync strlen with userland implementation.Xin LI2012-11-031-13/+98
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=242506
* s/ is is / is /gEitan Adler2012-09-141-1/+1
| | | | | | | | | | s/ a a / a /g Approved by: cperciva MFC after: 3 days Notes: svn path=/head/; revision=240521
* - Move jenkins.h to jenkins_hash.cGleb Smirnoff2012-09-042-185/+463
| | | | | | | | | | | | | - Provide missing function that can do hashing of arbitrary sized buffer. - Refetch lookup3.c and do only minimal edits to it, so that diff between our jenkins_hash.c and lookup3.c is minimal. - Add declarations for jenkins_hash(), jenkins_hash32() to sys/hash.h. - Document these functions in hash(9) Obtained from: http://burtleburtle.net/bob/c/lookup3.c Notes: svn path=/head/; revision=240086
* Fix unloading of libiconv module.Mateusz Guzik2012-06-111-2/+4
| | | | | | | | | | | Previously it would either loop infinitely or exit with error leaking a lock. Reported by: Will DeVries Approved by: trasz (mentor) MFC after: 1 week Notes: svn path=/head/; revision=236899
* Use strcmp that I replaced by accident.Kevin Lo2012-05-211-3/+3
| | | | Notes: svn path=/head/; revision=235713
* Fix broken ref countKevin Lo2012-05-211-0/+1
| | | | | | | Submitted by: gcooper Notes: svn path=/head/; revision=235712
* Fix improper handling of variadic args with ICDEBUGKevin Lo2012-05-211-3/+1
| | | | | | | | PR: kern/168095 Submitted by: gcooper Notes: svn path=/head/; revision=235711
* Remove dead codeKevin Lo2012-05-211-5/+3
| | | | Notes: svn path=/head/; revision=235710
* Remove second consts in r233288 in order to appease C++ compilers.Marius Strobl2012-03-261-10/+10
| | | | | | | | | While at it, remove some style(9) bugs in libkern.h. Submitted by: kan Notes: svn path=/head/; revision=233517
* Declare the CRC lookup-tables const as they hardly should change atMarius Strobl2012-03-211-10/+10
| | | | | | | run-time. Notes: svn path=/head/; revision=233288
* Implement extensions on top of standards instead of the other way around.Ed Schouten2012-01-032-14/+2
| | | | | | | | Now that index() and rindex() have become unused, simply turn them into wrappers around strchr() and strrchr(), respectively. Notes: svn path=/head/; revision=229366
* Use strchr() and strrchr().Ed Schouten2012-01-021-2/+2
| | | | | | | | | | | It seems strchr() and strrchr() are used more often than index() and rindex(). Therefore, simply migrate all kernel code to use it. For the XFS code, remove an empty line to make the code identical to the code in the Linux kernel. Notes: svn path=/head/; revision=229272
* Remove the now unused skpc() function.Ed Schouten2012-01-011-49/+0
| | | | | | | | | | | | It was only used by ufs and ext2 and I have really strong doubts that there are other pieces of code that also use this function. If it turns out that external drivers use this code as well, I'd be happy to migrate or revert. Bump __FreeBSD_version while there. Notes: svn path=/head/; revision=229204
* Introducing memcchr(3).Ed Schouten2012-01-011-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | It seems two of the file system drivers we have in the tree, namely ufs and ext3, use a function called `skpc()'. The meaning of this function does not seem to be documented in FreeBSD, but it turns out one needs to be a VAX programmer to understand what it does. SPKC is an instruction on the VAX that does the opposite of memchr(). It searches for the non-equal character. Add a new function called memcchr() to the tree that has the following advantages over skpc(): - It has a name that makes more sense than skpc(). Just like strcspn() matches the complement of strspn(), memcchr() is the complement of memchr(). - It is faster than skpc(). Similar to our strlen() in libc, it compares entire words, instead of single bytes. It seems that for this routine this yields a sixfold performance increase on amd64. - It has a man page. Notes: svn path=/head/; revision=229198
* retire libkern getsAndriy Gapon2011-12-171-77/+0
| | | | | | | | | Inspired by: bde MFC after: 2 months X-MFC-Note: if deemed a part of KPI, just call cngets internally Notes: svn path=/head/; revision=228642
* Add unicode support to msdosfs and smbfs; original pathes from imura,Kevin Lo2011-11-182-0/+552
| | | | | | | | | bug fixes by Kuan-Chung Chiu <buganini at gmail dot com>. Tested by me in production for several days at work. Notes: svn path=/head/; revision=227650