summaryrefslogtreecommitdiffstats
path: root/share/examples/kld
Commit message (Collapse)AuthorAgeFilesLines
* MFC r264400,r265836:ngie2014-12-312-2/+2
| | | | | | | | | | | | | | r264400: NO_MAN= has been deprecated in favor of MAN= for some time, go ahead and finish the job. ncurses is now the only Makefile in the tree that uses it since it wasn't a simple mechanical change, and will be addressed in a future commit. r265836: Remove last two NO_MAN= in the tree. In both of these cases, MAN= is what is needed.
* Merge from project branch via main. Uninteresting commits are trimmed.markm2013-10-121-17/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor of /dev/random device. Main points include: * Userland seeding is no longer used. This auto-seeds at boot time on PC/Desktop setups; this may need some tweeking and intelligence from those folks setting up embedded boxes, but the work is believed to be minimal. * An entropy cache is written to /entropy (even during installation) and the kernel uses this at next boot. * An entropy file written to /boot/entropy can be loaded by loader(8) * Hardware sources such as rdrand are fed into Yarrow, and are no longer available raw. ------------------------------------------------------------------------ r256240 | des | 2013-10-09 21:14:16 +0100 (Wed, 09 Oct 2013) | 4 lines Add a RANDOM_RWFILE option and hide the entropy cache code behind it. Rename YARROW_RNG and FORTUNA_RNG to RANDOM_YARROW and RANDOM_FORTUNA. Add the RANDOM_* options to LINT. ------------------------------------------------------------------------ r256239 | des | 2013-10-09 21:12:59 +0100 (Wed, 09 Oct 2013) | 2 lines Define RANDOM_PURE_RNDTEST for rndtest(4). ------------------------------------------------------------------------ r256204 | des | 2013-10-09 18:51:38 +0100 (Wed, 09 Oct 2013) | 2 lines staticize struct random_hardware_source ------------------------------------------------------------------------ r256203 | markm | 2013-10-09 18:50:36 +0100 (Wed, 09 Oct 2013) | 2 lines Wrap some policy-rich code in 'if NOTYET' until we can thresh out what it really needs to do. ------------------------------------------------------------------------ r256184 | des | 2013-10-09 10:13:12 +0100 (Wed, 09 Oct 2013) | 2 lines Re-add /dev/urandom for compatibility purposes. ------------------------------------------------------------------------ r256182 | des | 2013-10-09 10:11:14 +0100 (Wed, 09 Oct 2013) | 3 lines Add missing include guards and move the existing ones out of the implementation namespace. ------------------------------------------------------------------------ r256168 | markm | 2013-10-08 23:14:07 +0100 (Tue, 08 Oct 2013) | 10 lines Fix some just-noticed problems: o Allow this to work with "nodevice random" by fixing where the MALLOC pool is defined. o Fix the explicit reseed code. This was correct as submitted, but in the project branch doesn't need to set the "seeded" bit as this is done correctly in the "unblock" function. o Remove some debug ifdeffing. o Adjust comments. ------------------------------------------------------------------------ r256159 | markm | 2013-10-08 19:48:11 +0100 (Tue, 08 Oct 2013) | 6 lines Time to eat crow for me. I replaced the sx_* locks that Arthur used with regular mutexes; this turned out the be the wrong thing to do as the locks need to be sleepable. Revert this folly. # Submitted by: Arthur Mesh <arthurmesh@gmail.com> (In original diff) ------------------------------------------------------------------------ r256138 | des | 2013-10-08 12:05:26 +0100 (Tue, 08 Oct 2013) | 10 lines Add YARROW_RNG and FORTUNA_RNG to sys/conf/options. Add a SYSINIT that forces a reseed during proc0 setup, which happens fairly late in the boot process. Add a RANDOM_DEBUG option which enables some debugging printf()s. Add a new RANDOM_ATTACH entropy source which harvests entropy from the get_cyclecount() delta across each call to a device attach method. ------------------------------------------------------------------------ r256135 | markm | 2013-10-08 07:54:52 +0100 (Tue, 08 Oct 2013) | 8 lines Debugging. My attempt at EVENTHANDLER(multiuser) was a failure; use EVENTHANDLER(mountroot) instead. This means we can't count on /var being present, so something will need to be done about harvesting /var/db/entropy/... . Some policy now needs to be sorted out, and a pre-sync cache needs to be written, but apart from that we are now ready to go. Over to review. ------------------------------------------------------------------------ r256094 | markm | 2013-10-06 23:45:02 +0100 (Sun, 06 Oct 2013) | 8 lines Snapshot. Looking pretty good; this mostly works now. New code includes: * Read cached entropy at startup, both from files and from loader(8) preloaded entropy. Failures are soft, but announced. Untested. * Use EVENTHANDLER to do above just before we go multiuser. Untested. ------------------------------------------------------------------------ r256088 | markm | 2013-10-06 14:01:42 +0100 (Sun, 06 Oct 2013) | 2 lines Fix up the man page for random(4). This mainly removes no-longer-relevant details about HW RNGs, reseeding explicitly and user-supplied entropy. ------------------------------------------------------------------------ r256087 | markm | 2013-10-06 13:43:42 +0100 (Sun, 06 Oct 2013) | 6 lines As userland writing to /dev/random is no more, remove the "better than nothing" bootstrap mode. Add SWI harvesting to the mix. My box seeds Yarrow by itself in a few seconds! YMMV; more to follow. ------------------------------------------------------------------------ r256086 | markm | 2013-10-06 13:40:32 +0100 (Sun, 06 Oct 2013) | 11 lines Debug run. This now works, except that the "live" sources haven't been tested. With all sources turned on, this unlocks itself in a couple of seconds! That is no my box, and there is no guarantee that this will be the case everywhere. * Cut debug prints. * Use the same locks/mutexes all the way through. * Be a tad more conservative about entropy estimates. ------------------------------------------------------------------------ r256084 | markm | 2013-10-06 13:35:29 +0100 (Sun, 06 Oct 2013) | 5 lines Don't use the "real" assembler mnemonics; older compilers may not understand them (like when building CURRENT on 9.x). # Submitted by: Konstantin Belousov <kostikbel@gmail.com> ------------------------------------------------------------------------ r256081 | markm | 2013-10-06 10:55:28 +0100 (Sun, 06 Oct 2013) | 12 lines SNAPSHOT. Simplify the malloc pools; We only need one for this device. Simplify the harvest queue. Marginally improve the entropy pool hashing, making it a bit faster in the process. Connect up the hardware "live" source harvesting. This is simplistic for now, and will need to be made rate-adaptive. All of the above passes a compile test but needs to be debugged. ------------------------------------------------------------------------ r256042 | markm | 2013-10-04 07:55:06 +0100 (Fri, 04 Oct 2013) | 25 lines Snapshot. This passes the build test, but has not yet been finished or debugged. Contains: * Refactor the hardware RNG CPU instruction sources to feed into the software mixer. This is unfinished. The actual harvesting needs to be sorted out. Modified by me (see below). * Remove 'frac' parameter from random_harvest(). This was never used and adds extra code for no good reason. * Remove device write entropy harvesting. This provided a weak attack vector, was not very good at bootstrapping the device. To follow will be a replacement explicit reseed knob. * Separate out all the RANDOM_PURE sources into separate harvest entities. This adds some secuity in the case where more than one is present. * Review all the code and fix anything obviously messy or inconsistent. Address som review concerns while I'm here, like rename the pseudo-rng to 'dummy'. # Submitted by: Arthur Mesh <arthurmesh@gmail.com> (the first item) ------------------------------------------------------------------------ r255319 | markm | 2013-09-06 18:51:52 +0100 (Fri, 06 Sep 2013) | 4 lines Yarrow wants entropy estimations to be conservative; the usual idea is that if you are certain you have N bits of entropy, you declare N/2. ------------------------------------------------------------------------ r255075 | markm | 2013-08-30 18:47:53 +0100 (Fri, 30 Aug 2013) | 4 lines Remove short-lived idea; thread to harvest (eg) RDRAND enropy into the usual harvest queues. It was a nifty idea, but too heavyweight. # Submitted by: Arthur Mesh <arthurmesh@gmail.com> ------------------------------------------------------------------------ r255071 | markm | 2013-08-30 12:42:57 +0100 (Fri, 30 Aug 2013) | 4 lines Separate out the Software RNG entropy harvesting queue and thread into its own files. # Submitted by: Arthur Mesh <arthurmesh@gmail.com> ------------------------------------------------------------------------ r254934 | markm | 2013-08-26 20:07:03 +0100 (Mon, 26 Aug 2013) | 2 lines Remove the short-lived namei experiment. ------------------------------------------------------------------------ r254928 | markm | 2013-08-26 19:35:21 +0100 (Mon, 26 Aug 2013) | 2 lines Snapshot; Do some running repairs on entropy harvesting. More needs to follow. ------------------------------------------------------------------------ r254927 | markm | 2013-08-26 19:29:51 +0100 (Mon, 26 Aug 2013) | 15 lines Snapshot of current work; 1) Clean up namespace; only use "Yarrow" where it is Yarrow-specific or close enough to the Yarrow algorithm. For the rest use a neutral name. 2) Tidy up headers; put private stuff in private places. More could be done here. 3) Streamline the hashing/encryption; no need for a 256-bit counter; 128 bits will last for long enough. There are bits of debug code lying around; these will be removed at a later stage. ------------------------------------------------------------------------ r254784 | markm | 2013-08-24 14:54:56 +0100 (Sat, 24 Aug 2013) | 39 lines 1) example (partially humorous random_adaptor, that I call "EXAMPLE") * It's not meant to be used in a real system, it's there to show how the basics of how to create interfaces for random_adaptors. Perhaps it should belong in a manual page 2) Move probe.c's functionality in to random_adaptors.c * rename random_ident_hardware() to random_adaptor_choose() 3) Introduce a new way to choose (or select) random_adaptors via tunable "rngs_want" It's a list of comma separated names of adaptors, ordered by preferences. I.e.: rngs_want="yarrow,rdrand" Such setting would cause yarrow to be preferred to rdrand. If neither of them are available (or registered), then system will default to something reasonable (currently yarrow). If yarrow is not present, then we fall back to the adaptor that's first on the list of registered adaptors. 4) Introduce a way where RNGs can play a role of entropy source. This is mostly useful for HW rngs. The way I envision this is that every HW RNG will use this functionality by default. Functionality to disable this is also present. I have an example of how to use this in random_adaptor_example.c (see modload event, and init function) 5) fix kern.random.adaptors from kern.random.adaptors: yarrowpanicblock to kern.random.adaptors: yarrow,panic,block 6) add kern.random.active_adaptor to indicate currently selected adaptor: root@freebsd04:~ # sysctl kern.random.active_adaptor kern.random.active_adaptor: yarrow # Submitted by: Arthur Mesh <arthurmesh@gmail.com> Submitted by: Dag-Erling Smørgrav <des@FreeBSD.org>, Arthur Mesh <arthurmesh@gmail.com> Reviewed by: des@FreeBSD.org Approved by: re (delphij) Approved by: secteam (des,delphij)
* Remove short-lived idea; thread to harvest (eg) RDRAND enropy into the usual ↵markm2013-08-301-19/+1
| | | | | | harvest queues. It was a nifty idea, but too heavyweight. Submitted by: Arthur Mesh <arthurmesh@gmail.com>
* 1) example (partially humorous random_adaptor, that I call "EXAMPLE")markm2013-08-243-1/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * It's not meant to be used in a real system, it's there to show how the basics of how to create interfaces for random_adaptors. Perhaps it should belong in a manual page 2) Move probe.c's functionality in to random_adaptors.c * rename random_ident_hardware() to random_adaptor_choose() 3) Introduce a new way to choose (or select) random_adaptors via tunable "rngs_want" It's a list of comma separated names of adaptors, ordered by preferences. I.e.: rngs_want="yarrow,rdrand" Such setting would cause yarrow to be preferred to rdrand. If neither of them are available (or registered), then system will default to something reasonable (currently yarrow). If yarrow is not present, then we fall back to the adaptor that's first on the list of registered adaptors. 4) Introduce a way where RNGs can play a role of entropy source. This is mostly useful for HW rngs. The way I envision this is that every HW RNG will use this functionality by default. Functionality to disable this is also present. I have an example of how to use this in random_adaptor_example.c (see modload event, and init function) 5) fix kern.random.adaptors from kern.random.adaptors: yarrowpanicblock to kern.random.adaptors: yarrow,panic,block 6) add kern.random.active_adaptor to indicate currently selected adaptor: root@freebsd04:~ # sysctl kern.random.active_adaptor kern.random.active_adaptor: yarrow Submitted by: Arthur Mesh <arthurmesh@gmail.com>
* Fix typo.glebius2013-07-171-1/+1
| | | | Submitted by: ae
* Improve example, so that it doesn't dump core when example moduleglebius2013-07-171-2/+6
| | | | isn't loaded.
* Revert previous commit...kevlo2012-10-102-2/+2
| | | | Pointyhat to: kevlo (myself)
* Prefer NULL over 0 for pointerskevlo2012-10-092-2/+2
|
* Minor style(9) improvementemaste2012-08-071-3/+3
|
* Uuencode the sample "binary" firmware image file (instead of explicitlyemaste2011-04-013-23/+20
| | | | | | | adding \0 bytes). This is a technique that would be used in an actual driver and is more suitable as an example. Reviewed by: mlaier
* Avoid having a binary file in our source tree and instead create it atemaste2011-03-312-0/+4
| | | | | build time, to avoid possible grief maintaining FreeBSD source in alternative version control tools.
* Add an example Khelp module, which will be referenced in the forthcoming Khelplstewart2011-02-114-1/+172
| | | | | | | | | documentation. Sponsored by: FreeBSD Foundation Discussed with: David Hayes <dahayes at swin edu au> MFC after: 5 weeks X-MFC with: r216615
* Fix a few more SYSCTL_PROC() that were missing a CTLFLAG type specifier.mdf2011-01-191-2/+3
|
* Fix the syscall module name after r205320.kib2010-06-151-1/+1
| | | | | Submitted by: Vladislav Movchan <vladislav.movchan gmail com> MFC after: 1 week
* Conform style.Makefile(5) and replace = and += with ?=, which lets you towkoszek2010-02-012-2/+2
| | | | | | override WARNS. Reported by: <marius@nuenneri.ch> and uqs@
* Include unistd.h for read(), write() and stdlib.h for exit().wkoszek2010-01-182-3/+6
| | | | Bump WARNS to 5 while being here.
* Small cleanup while being here:wkoszek2010-01-182-14/+6
| | | | | | | | | | - sort includes - remove usage(), since it seems to come from older version of the KLD - remove unnecessary variable - mark argc/argv as unused Bring WARNS = 5 to the Makefile.
* Include stdlib.h for exit(3) and unistd.h for syscall(2). This makeswkoszek2010-01-181-0/+2
| | | | this program to compile cleanly.
* Small fix for making this KLD to compile.wkoszek2010-01-181-1/+1
|
* Where if not in examples we should follow style(9)?pjd2009-06-032-34/+30
|
* Include the <sys/sysproto.h> header which includes the prerequisite headerkevlo2007-07-221-0/+1
| | | | | | for AUE_NULL. Approved by: re (kensmith)
* We don't have d_maj field in cdevsw structure anymore.sobomax2006-05-191-8/+1
|
* Style.ru2006-03-151-2/+2
|
* firmware(9) is a subsystem to load binary data into the kernel via amlaier2006-01-297-1/+114
| | | | | | | | | | specially crafted module. There are several handrolled sollutions to this problem in the tree already which will be replaced with this. They include iwi(4), ipw(4), ispfw(4) and digi(4). No objection from: arch MFC after: 2 weeks X-MFC after: some drivers have been converted
* Start the dreaded NOFOO -> NO_FOO conversion.ru2004-12-212-2/+2
| | | | OK'ed by: core
* For variables that are only checked with defined(), don't provideru2004-10-241-1/+2
| | | | any fake value.
* According to module(9), when command is unrecognized, the module shouldpjd2004-08-303-3/+3
| | | | return EOPNOTSUPP.
* Update for struct cdevsw and dev_t -> struct cdev * changes, plus onetjr2004-07-162-7/+9
| | | | 64-bit portability fix.
* Style.maxim2004-06-091-5/+4
|
* Remove duplicate #include.le2004-06-091-1/+0
| | | | | PR: misc/67748 Submitted by: bugghy <bugghy@phenix.rootshell.be>
* Fix the cdev kld example.mbr2003-08-034-23/+14
| | | | | | PR: 52954 Submitted by: Priit Piipuu <priit.piipuu@mail.ee> Reviewed by: phk
* Update the SUBDIR hacks to work with the current bsd.subdir.mk.ru2002-07-112-73/+4
|
* Update the KLD examples so they will work with current.arr2001-11-132-4/+10
| | | | Reviewed: jhb
* Style.ru2001-09-181-83/+8
|
* Style.ru2001-09-181-13/+3
|
* Removed unneeded stuff.ru2001-05-181-12/+0
|
* Unbreak by syncing with changes in <sys/sysctl.h> macros.abial2001-02-101-12/+12
|
* Add `_PATH_DEVZERO'.obrien2000-12-091-1/+3
| | | | Use _PATH_* where where possible.
* Fix cdev kld example after it has been broken for year or so. Also extend listsobomax2000-10-027-15/+114
| | | | | | | | of supported operations by example read() and write() operations. Inspired by: http://www.daemonnews.org/200010/blueprints.html PR: 16173 Submitted by: sobomax
* These patches implement dynamic sysctls. It's possible now to addabial2000-07-154-1/+197
| | | | | | | | | | | | | | | | | | | | | | and remove sysctl oids at will during runtime - they don't rely on linker sets. Also, the node oids can be referenced by more than one kernel user, which means that it's possible to create partially overlapping trees. Add sysctl contexts to help programmers manage multiple dynamic oids in convenient way. Please see the manpages for detailed discussion, and example module for typical use. This work is based on ideas and code snippets coming from many people, among them: Arun Sharma, Jonathan Lemon, Doug Rabson, Brian Feldman, Kelly Yancey, Poul-Henning Kamp and others. I'd like to specially thank Brian Feldman for detailed review and style fixes. PR: kern/16928 Reviewed by: dfr, green, phk
* $Id$ -> $FreeBSD$peter1999-08-284-4/+4
|
* * Tidy up a few things and fix some more warnings.dfr1999-06-275-31/+34
| | | | | * Change the devsw declaration to standard form and add missing fields * Change the filename from cdev_mod.ko to cdev.ko
* Make this sample build again.dfr1999-06-253-4/+4
|
* Use modstat(2) to get the syscall number.dfr1999-01-091-6/+7
|
* Replace the misc example with a simpler syscall example using the newdfr1999-01-0914-832/+172
| | | | | | module registration hooks for syscalls. Submitted by: Assar Westerlund <assar@sics.se>
* Sample modules for KLD.dfr1998-12-1117-0/+1713
PR: misc/8621 Submitted by: Rajesh Vaidheeswarran <rv@fore.com>
OpenPOWER on IntegriCloud