Commit Graph

1150 Commits

Author SHA1 Message Date
Alexander Motin
6d2a1fbf23 Add API to obtain primary enclosure name and ID for /dev/sesX devices.
sesX device number may change between reboots, so to properly identify
the instance we need more data.  Name and ID reported here may mach ones
reported by SCSI device, but that is not really required by specs.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2015-11-21 10:22:01 +00:00
Warner Losh
1f66462968 NO_CPU_OPTFLAGS doesn't exist, so don't document it. 2015-11-12 17:23:31 +00:00
Bryan Drewery
7d8f797b72 Use more appropriate ${SHAREDIR} rather than /usr/share.
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-27 23:35:02 +00:00
Bryan Drewery
aa92269e46 Add more SUBDIR_PARALLEL.
MFC after:	3 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-15 22:55:08 +00:00
Glen Barber
324fd1ce05 MFH to r289370
Sponsored by:	The FreeBSD Foundation
2015-10-15 17:36:56 +00:00
Enji Cooper
b2d48be1bc Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Divison
2015-10-12 08:16:03 +00:00
Baptiste Daroussin
9be27fdc00 Merge from head 2015-10-09 22:45:54 +00:00
Baptiste Daroussin
855ff27c8c Move all the dma(8) components into one single directory
Simplifying maintainance and options (only one place to deal with MK_DMAGENT)

This also makes packaging base less intrusive by getting a single point where
to add tags.
2015-10-09 22:09:44 +00:00
Marcel Moolenaar
8c96dcc166 Add option -l for specifying which OS loader to dlopen(3). By default
this is /boot/userboot.so. This option allows for the development and
use of other OS loaders.
2015-10-08 02:28:22 +00:00
Baptiste Daroussin
5a2b666ce5 Merge from head 2015-10-01 09:36:43 +00:00
Christian Brueffer
2aea45f0d5 Join excessive split lines.
MFC after:	1 week
2015-09-30 12:40:51 +00:00
Bryan Drewery
ec766071e3 META_MODE: Remove DEP_MACHINE from Makefile.depend files.
This has not been needed since r246865 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:44:01 +00:00
Bryan Drewery
54c7d75a06 META_MODE: Remove DEP_RELDIR from Makefile.depend files.
This has not been needed since r284171 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:26:08 +00:00
Baptiste Daroussin
b5ff185e19 Merge from head 2015-09-12 11:41:31 +00:00
Julio Merino
18bafc4da9 Add missing shebang
Plain test programs are not preprocessed by the build system (as opposed to
ATF test cases, which automatically gain a shebang pointing at atf-sh), so
we must take care of providing the shebang ourselves.

I'm not sure why this was not causing problems with Kyua 0.11, but the
upcoming 0.12 release chokes on this particular issue.

MFC after:	1 week
2015-07-04 02:24:47 +00:00
Christian Brueffer
d14a50d95a Fix issues that kept some of the examples from actually working.
PR:		144534
Submitted by:	Nicolas Edel
MFC after:	1 week
2015-06-29 14:41:19 +00:00
Baptiste Daroussin
2fbd60ec47 Merge from head @274131 2015-06-20 00:58:46 +00:00
Neel Natu
9b1aa8d622 Restructure memory allocation in bhyve to support "devmem".
devmem is used to represent MMIO devices like the boot ROM or a VESA framebuffer
where doing a trap-and-emulate for every access is impractical. devmem is a
hybrid of system memory (sysmem) and emulated device models.

devmem is mapped in the guest address space via nested page tables similar
to sysmem. However the address range where devmem is mapped may be changed
by the guest at runtime (e.g. by reprogramming a PCI BAR). Also devmem is
usually mapped RO or RW as compared to RWX mappings for sysmem.

Each devmem segment is named (e.g. "bootrom") and this name is used to
create a device node for the devmem segment (e.g. /dev/vmm/testvm.bootrom).
The device node supports mmap(2) and this decouples the host mapping of
devmem from its mapping in the guest address space (which can change).

Reviewed by:	tychon
Discussed with:	grehan
Differential Revision:	https://reviews.freebsd.org/D2762
MFC after:	4 weeks
2015-06-18 06:00:17 +00:00
Baptiste Daroussin
dad2fb7ece Merge from head 2015-06-15 10:56:01 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
5b381db8cc Remove NO_OBJ
For meta mode we will want objdirs.

Differential Revision:	D2748
Reviewed by:	brooks imp
2015-06-11 04:22:17 +00:00
Simon J. Gerraty
b589e6297b Remove extra blank lines 2015-06-10 14:08:36 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Andriy Gapon
2764d3bcdb bhyve/vmrun.sh: pass all existing readable disks to bhyveload(8)
This is done if the installation mode is not requested or auto-detected.
This is useful when a kernel has to be loaded from multiple disks.
For example from a RAID-Z pool or a ZFS pool with multiple top level
vdevs.

Differential Revision:	https://reviews.freebsd.org/D2723
Reviewed by:	neel
MFC after:	8 days
2015-06-05 15:16:26 +00:00
Andriy Gapon
2aa681ed31 bhyve/vmrun.sh: support passing disk options same as for bhyve(8)
Differential Revision:	https://reviews.freebsd.org/D2723
Reviewed by:	neel
MFC after:	8 days
2015-06-05 15:14:54 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Baptiste Daroussin
59fa1525e0 Merge from head 2015-03-17 19:10:51 +00:00
Jung-uk Kim
25fd8105c9 Catch up with Clang 3.6.0. 2015-03-17 05:48:45 +00:00
Baptiste Daroussin
7426d57242 Merge from head 2015-03-15 10:58:47 +00:00
Gleb Smirnoff
e5a31fce25 Add -p parameter to list PCI device to pass through to the guest.
Reviewed by:	neel
2015-03-12 15:58:07 +00:00
Baptiste Daroussin
72392b205d Tag examples with targetted packages 2015-03-05 09:41:49 +00:00
Edward Tomasz Napierala
984a1cbfd6 Make the uefikeys script output slightly more obvious.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-26 14:22:27 +00:00
Edward Tomasz Napierala
12fe6c356b Add key/cert generation script for uefisign(8).
(Forgot about Relnotes in the commit that added uefisign(8), so set it here.)

MFC after:	1 month
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2015-02-26 09:31:25 +00:00
Enji Cooper
b6f503dde0 Clean up more usb related files when MK_USB == no when dealing with
manpages, libraries, and binaries

MFC after: 1 week
X-MFC with: r278135
Sponsored by: EMC / Isilon Storage Division
2015-02-04 11:43:19 +00:00
Enji Cooper
02629e469f Add MK_BHYVE knob for building and installing bhyve(4), et al
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-01-26 06:44:48 +00:00
Enji Cooper
4e39505449 Add MK_HAST knob for building and installing hastd(8), et al
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-01-26 06:27:07 +00:00
Neel Natu
1bd468a4e9 Make the error message explicit instead of just printing the usage if the
virtual machine name is not specified.

Requested by:	grehan
MFC after:	1 week
2015-01-18 01:50:10 +00:00
Enji Cooper
0341ccf227 Clean up more usb related files when MK_USB == no when dealing with
manpages, libraries, and binaries
2014-11-26 21:18:52 +00:00
Enji Cooper
466046ec0d Conditionalize a number of components in the tree
- bootparamd
- bootpd
- finger/fingerd
- ftp/ftpd
- hastctl/hastd
- iscsid, et al
- rbootd
- talk/talkd
- tcpd, et al
- tftp/tftpd

Add src.conf entries for the various components and do a best effort
at adding components to tools/build/mk/OptionalObsoleteFiles.inc
2014-11-26 08:44:05 +00:00
Enji Cooper
4be1ca354c Make building/installing bhyve optional via MK_BHYVE on amd64
Disable building/installing bhyve from src.opts.mk on unsupported
architectures (!amd64)
2014-11-25 19:20:25 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Mark Murray
10cb24248a This is the much-discussed major upgrade to the random(4) device, known to you all as /dev/random.
This code has had an extensive rewrite and a good series of reviews, both by the author and other parties. This means a lot of code has been simplified. Pluggable structures for high-rate entropy generators are available, and it is most definitely not the case that /dev/random can be driven by only a hardware souce any more. This has been designed out of the device. Hardware sources are stirred into the CSPRNG (Yarrow, Fortuna) like any other entropy source. Pluggable modules may be written by third parties for additional sources.

The harvesting structures and consequently the locking have been simplified. Entropy harvesting is done in a more general way (the documentation for this will follow). There is some GREAT entropy to be had in the UMA allocator, but it is disabled for now as messing with that is likely to annoy many people.

The venerable (but effective) Yarrow algorithm, which is no longer supported by its authors now has an alternative, Fortuna. For now, Yarrow is retained as the default algorithm, but this may be changed using a kernel option. It is intended to make Fortuna the default algorithm for 11.0. Interested parties are encouraged to read ISBN 978-0-470-47424-2 "Cryptography Engineering" By Ferguson, Schneier and Kohno for Fortuna's gory details. Heck, read it anyway.

Many thanks to Arthur Mesh who did early grunt work, and who got caught in the crossfire rather more than he deserved to.

My thanks also to folks who helped me thresh this out on whiteboards and in the odd "Hallway track", or otherwise.

My Nomex pants are on. Let the feedback commence!

Reviewed by:	trasz,des(partial),imp(partial?),rwatson(partial?)
Approved by:	so(des)
2014-10-30 21:21:53 +00:00
Neel Natu
e5db20c0c8 Use '-e' to check if the virtio backing file has already been created.
The '-f' check works fine on a regular file but not if the backing file is
a device (e.g., /dev/md0). In this case it would print a misleading but
otherwise benign message about the backing file not being present.

Submitted by:	Marcus Reid (marcus@blazingdot.com)
Discussed with:	grehan
2014-10-14 18:34:15 +00:00
Craig Rodrigues
a67d73f0ed Propagate the error status of /usr/sbin/bhyve out of the vmrun.sh script.
Clean up the /dev/vmm entry for this VM when vmrun.sh exits.

Reviewed by: neel
Phabric:     D767
2014-09-13 05:08:35 +00:00
Craig Rodrigues
f0be756181 Attach the ISO to an ahci-cd emulated device. The
ISO will appear to be mounted on a /dev/cd device
instead of /dev/vtbd.  This is similar to how other
virtualization environments handle mounting ISO images.

Reviewed by: neel
2014-09-12 02:38:10 +00:00
Craig Rodrigues
2131e64e12 Use "file -s", so that we can run vmrun.sh against special devices such
as /dev/md memory file systems

Reviewed by: neel
2014-08-28 16:26:13 +00:00
Craig Rodrigues
1437f5003e If the VM was reset via "/sbin/reboot" or "shutdown -r",
then it is no longer necessary to "bhyvectl --destroy" the VM when it reboots.
Move the "bhyvectl --destroy" outside of the while loop.

Reviewed by: neel
2014-08-25 01:36:56 +00:00
Craig Rodrigues
ff5cb9fd50 Add comment which describes the exit status codes returned from
/usr/sbin/bhyve.  These are in src/usr.sbin/bhyve/bhyverun.c.

Reviewed by: neel
2014-08-25 01:04:07 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Edward Tomasz Napierala
a1577802f0 Remove vestiges of previous autofs.
Discussed with:	alfred@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-18 14:47:13 +00:00
George V. Neville-Neil
46b315b29a Various style(9) and related fixes.
Update the copyright to be more in line with the current version in
our tree.
Remove the ancient rcsid.
Add a proper return from the main function

Pointed out by: bz
2014-07-31 18:02:38 +00:00
George V. Neville-Neil
ea43014585 Add an example program to show how to use libpmc from a program.
This particular program attempts to use the TSC to measure how long
certainly libpmc operations take.  Depending on the quality of
the rdtsc() macro on a particular architecture this may work
more or less well.
2014-07-31 09:18:15 +00:00
Marcel Moolenaar
e7d939bda2 Remove ia64.
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
2014-07-07 00:27:09 +00:00
Neel Natu
874a6e051b After r267897 brought in a new version of file/libmagic, a filesystem image
is identified as "DOS/MBR boot sector" as opposed to "x86 boot sector".

This trips up vmrun.sh when using the new file(1) and makes it want to boot
into the installer instead.

Fix this by just looking for "boot sector" instead.
2014-06-27 17:18:54 +00:00
Gavin Atkinson
2be4135815 Remove example cvsup config files.
MFC after:	1 week
2014-06-25 12:32:41 +00:00
Gavin Atkinson
95c4761238 Drop example variables for updating over csup. These have not functioned
since r251084.

MFC after:	1 week
2014-06-25 12:23:16 +00:00
Baptiste Daroussin
bd0891ceb3 use .Mt to mark up email addresses consistently (part1)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:40:43 +00:00
Alfred Perlstein
3ab512ae80 Support for multiple disks and tap devices.
This allows you to give a bhyve instance multiple network devices
and disk devices easily by specifying additional "-d " and "-t "
options.

Reviewed by: neel
Sponsored by: Norse
2014-06-17 00:53:00 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
John Baldwin
9b997115fb - Format the usage so that it fits in 80 cols and follows the standard
convention for long usage lines in manpages.
- Sort the option string passed to getopts and the case statements for
  the option returned by getopts.
- Add a -C option to specify the device to be used for the console
  (defaults to 'stdio')  (This could be let vmrun be run in the background
  by using /dev/nmdm0B or the like)
- Add a -H option to specify a host path to pass to bhyveload(8) via
  -h to back the host0: filesystem in bhyveload(8) (useful for loading
  kernels from the host into the guest without having to copy them into
  the guest's disk image first)

Reviewed by:	neel
MFC after:	2 weeks
2014-04-23 20:55:07 +00:00
Warner Losh
0abe2561f6 Convert NO_MANCOMPRESSED to MK_MANCOMPRESSED. 2014-04-18 17:03:49 +00:00
Warner Losh
a0f4cb1e7b r264402 builds fine, but turns out there are problems with
install. Back it out until they can be tracked down.
2014-04-13 21:52:27 +00:00
Warner Losh
5bce97114a Convert NO_MANCOMPRESS to normal convention. 2014-04-13 05:22:26 +00:00
Warner Losh
3bdf775801 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.
2014-04-13 05:21:56 +00:00
Jung-uk Kim
6619822598 Add new CPUTYPEs supported by Clang 3.4, i.e., AMD Steamroller (bdver3) and
Intel Silvermont (slm) processors.
2014-03-20 19:17:46 +00:00
Ian Lepore
44653522f6 Add a way to apply CFLAGS only when building the given architecture. This
is useful primarily on a system used for cross-building, when you have a
set of flags to apply to the TARGET_ARCH being cross-built but don't want
those settings applied to building the cross-tools or other components that
run on the build host machine.
2014-03-19 18:54:53 +00:00
Julio Merino
9b84048643 Remove unnecessary svn:executable property from source file.
The atf cp_test.sh sample file should have never been marked executable in
the first place because this file needs to be "built" first before being
usable.
2014-03-14 12:55:06 +00:00
Julio Merino
f5fd950e35 Make bsd.test.mk the only public mk fragment for the building of tests.
Change {atf,plain,tap}.test.mk to be internal implementation details of
bsd.test.mk.  Makefiles that build tests should now only include bsd.test.mk
and declaratively specify what they want to build, without worrying about
the internal implementation of the mk files.

The reason for this change is to permit building test programs of different
interfaces from a single directory, which is something I had a need for
while porting tests over from src/tools/regression/.

Additionally, this change makes it possible to perform some other requested
changes to bsd.test.mk in an easier manner.  Coming soon.
2014-03-14 08:56:19 +00:00
Baptiste Daroussin
b1771e3dc6 Add the makefile forgotten in previous commit 2014-03-10 15:59:50 +00:00
Baptiste Daroussin
2c4c3f6750 Add a mailer.conf example to use dma 2014-03-10 14:36:27 +00:00
Julio Merino
9e684a3a79 Generate plain sh test programs from a source file.
Instead of assuming that plain sh test programs exist in the source
tree in their final form and are marked as executable, generate them
from a list of sources.

By default, just assume that the source file for a program P is P.sh
but allow the caller to customize the inputs.  Similarly, also allow
the caller to apply sed(1) replacements on the output.  These will
both be useful in hooking existing test code from tools/regression/
into the test suite.

Approved by:	rpaulo (mentor)
2013-11-25 13:30:06 +00:00
Julio Merino
21203fdd06 Add some sample test programs.
This change adds some sample test cases to share/examples/tests/
demonstrating the basic usage of the atf and plain interfaces.

These test programs are fully-functional and are installed as part
of the test suite, which guarantees that the sample code remains
correct.  However, they currently mostly serve as a placeholder for
additional examples and may be incomplete (depending on how you
look at them).  I will see what else can be useful while working on
documentation.

As a bonus, the addition of these tests exercise the *.test.mk files,
one of which (plain.test.mk) was not yet in use, and also demonstrates
that it's possible to mix different kinds of test programs into the
same test suite.

Approved by:	rpaulo (mentor)
2013-11-18 12:57:46 +00:00
Gleb Smirnoff
3135fb5e8b Finish r257779.
PR:	usb/183728
2013-11-07 14:05:49 +00:00
Hans Petter Selasky
2578c12e39 - Use libusb20_strerror() function instead of custom usb_error() one.
- Rename "aux.[ch]" to "util.[ch]" which is a more common name for
utility functions and allows checkout on some non-FreeBSD systems
where the "aux.*" namespace is reserved.
- Fix some compile warnings while at it.

PR:		usb/183728
MFC after:	2 weeks
2013-11-07 07:22:51 +00:00
Neel Natu
a1a4cbea58 Make the virtual ioapic available unconditionally in a bhyve virtual machine.
This is in preparation for moving the ioapic device model from userspace to
vmm.ko.

Reviewed by:	grehan
2013-10-31 05:44:45 +00:00
Neel Natu
ea7f1c8cd2 Add support for PCI-to-ISA LPC bridge emulation. If the LPC bus is attached
to a virtual machine then we implicitly create COM1 and COM2 ISA devices.

Prior to this change the only way of attaching a COM port to the virtual
machine was by presenting it as a PCI device that is mapped at the legacy
I/O address 0x3F8 or 0x2F8.

There were some issues with the original approach:
- It did not work at all with UEFI because UEFI will reprogram the PCI device
  BARs and remap the COM1/COM2 ports at non-legacy addresses.
- OpenBSD GENERIC kernel does not create a /dev/console because it expects
  the uart device at the legacy 0x3F8/0x2F8 address to be an ISA device.
- It was functional with a FreeBSD guest but caused the console to appear
  on /dev/ttyu2 which was not intuitive.

The uart emulation is now independent of the bus on which it resides. Thus it
is possible to have uart devices on the PCI bus in addition to the legacy
COM1/COM2 devices behind the LPC bus.

The command line option to attach ISA COM1/COM2 ports to a virtual machine is
"-s <bus>,lpc -l com1,stdio".

The command line option to create a PCI-attached uart device is:
"-s <bus>,uart[,stdio]"

The command line option to create PCI-attached COM1/COM2 device is:
"-S <bus>,uart[,stdio]". This style of creating COM ports is deprecated.

Discussed with:	grehan
Reviewed by:	grehan
Submitted by:	Tycho Nightingale (tycho.nightingale@pluribusnetworks.com)

M    share/examples/bhyve/vmrun.sh
AM   usr.sbin/bhyve/legacy_irq.c
AM   usr.sbin/bhyve/legacy_irq.h
M    usr.sbin/bhyve/Makefile
AM   usr.sbin/bhyve/uart_emul.c
M    usr.sbin/bhyve/bhyverun.c
AM   usr.sbin/bhyve/uart_emul.h
M    usr.sbin/bhyve/pci_uart.c
M    usr.sbin/bhyve/pci_emul.c
M    usr.sbin/bhyve/inout.c
M    usr.sbin/bhyve/pci_emul.h
M    usr.sbin/bhyve/inout.h
AM   usr.sbin/bhyve/pci_lpc.c
AM   usr.sbin/bhyve/pci_lpc.h
2013-10-29 00:18:11 +00:00
Neel Natu
b6afa84b8c Add an option to bhyveload(8) that allows setting a loader environment variable
from the command line.

The option syntax is "-e <name=value>". It may be used multiple times to set
multiple environment variables.

Reviewed by:	grehan
Requested by:	alfred
2013-10-17 00:28:35 +00:00
Simon J. Gerraty
3caf0790a8 Merge head@256284 2013-10-13 02:35:19 +00:00
Simon J. Gerraty
c8191bc69e We do want objdir 2013-10-13 00:27:34 +00:00
Simon J. Gerraty
34b33809b7 Updated dependencies 2013-10-13 00:24:00 +00:00
Mark Murray
cc4d059c03 Merge from project branch. Uninteresting commits are trimmed.
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)
2013-10-12 12:57:57 +00:00
Rui Paulo
ec0e2ac611 Remove most of the ATF tools and the _atf user.
This is necessary because ATF is deprecated and it will be replaced by Kyua.

Submitted by:	jmmv@netbsd.org
Reviewed by:	Garrett Cooper
Approved by:	re
2013-10-12 06:06:53 +00:00
Mark Murray
a332c3c798 MFC - tracking commit 2013-10-09 07:55:21 +00:00
Neel Natu
200758f114 Parse the memory size parameter using expand_number() to allow specifying
the memory size more intuitively (e.g. 512M, 4G etc).

Submitted by:	rodrigc
Reviewed by:	grehan
Approved by:	re (blanket)
2013-10-09 03:56:07 +00:00
Mark Murray
f02e47dc1e 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)
2013-10-04 06:55:06 +00:00
Simon J. Gerraty
d466a5b069 Merge head 2013-09-11 18:16:18 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Mark Murray
b881742f2e MFC 2013-09-01 13:33:05 +00:00
Alexander Motin
1d64933fe2 Bring legacy CAM target implementation back into API/KPI-coherent and even
functional state.  While CTL is much more superior target from all points,
there is no reason why this code should not work.

Tested with ahc(4) as target side HBA.

MFC after:	2 weeks
2013-09-01 13:01:59 +00:00
Mark Murray
7737ec4198 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>
2013-08-30 17:47:53 +00:00
Mark Murray
ddbfa6b19e 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>
2013-08-24 13:54:56 +00:00
Andriy Gapon
a29cc9a34b Revert r253748,253749
This WIP should not have been committed yet.

Pointyhat to:	avg
2013-07-28 18:44:17 +00:00
Andriy Gapon
c722ec3a51 remove needless inclusion of machine/cpu.h in userland
MFC after:	21 days
2013-07-28 18:35:43 +00:00
Gleb Smirnoff
60bd643435 Fix typo.
Submitted by:	ae
2013-07-17 13:13:44 +00:00
Gleb Smirnoff
9fd7a1b3dd Improve example, so that it doesn't dump core when example module
isn't loaded.
2013-07-17 12:28:48 +00:00
Davide Italiano
237abf0c56 - Trim an unused and bogus Makefile for mount_smbfs.
- Reconnect with some minor modifications, in particular now selsocket()
internals are adapted to use sbintime units after recent'ish calloutng
switch.
2013-06-28 21:00:08 +00:00
Jung-uk Kim
11764d8411 Add "amdfam10" to the supported CPU types for amd64. This complements
r251691 and 251692.
2013-06-27 19:47:58 +00:00
Jung-uk Kim
05923b8d7c Add a missing comma. 2013-06-13 18:33:54 +00:00