Commit Graph

234904 Commits

Author SHA1 Message Date
Kyle Evans
77d5a868a0 bectl(8): Add some relevant bectl list -a information
bectl list -a should show the boot environment, its relevant dataset, and
the snapshot it was created from. The header also changes to indicate the
rough order in which these things will show.

While here, start doing a little bit of spring cleaning and splitting
different bits out.
2018-08-04 06:14:54 +00:00
Kyle Evans
4146029bb3 bectl(8): Take origin snapshot into account when calculating used space
This more closely matches the behavior for beadm. The associated libbe(3)
API is still getting worked out a little bit.
2018-08-03 02:04:57 +00:00
Kyle Evans
74c55b3d38 bectl(8): Just use a single pointer for all string props 2018-08-03 01:51:44 +00:00
Kyle Evans
970fd6543a bectl(8): Move dataset printing out into its own function
This may later get reused for printing snapshot and/or origin snapshot
information.
2018-08-03 01:46:46 +00:00
Kyle Evans
513044c181 libbe(3): Fix checking of zfs_prop_get's return value
Rather than a boolean_t, it returns an int != 0 for error or 0 for OK.
2018-08-03 01:43:51 +00:00
Kyle Evans
4503a8b6c7 bectl(8): Remove sneaky comment 2018-07-26 18:57:51 +00:00
Kyle Evans
83244ec1ec bectl(8): Hack together a more proper bectl list
Note that the space is currently just the 'used' property of the dataset.
2018-07-26 18:56:50 +00:00
Kyle Evans
2e355bd3ff bectl(8): Remove the jail mount point with unjail 2018-07-26 04:12:31 +00:00
Kyle Evans
a2d93d3c98 bectl(8): Redo jail using jail(3) API
The jail is created with allow.mount, allow.mount.devfs, and
enforce_statfs=1. Upon creation, we immediately attach, chdir to "/", and
drop the user into a shell inside the jail.

The default IP for this is arbitrarily 10.20.30.40.
2018-07-26 04:07:36 +00:00
Kyle Evans
ad765da4e8 bectl(8): Support unjailing a boot environment
The given parameter may either be a jid, jail name, or a BE name.  In all
cases, the parameter will be resolved to a jid and bectl(8) will
sanity-check that there's actually a BE mounted at the requested jail root
before invoking jail_remove(2).
2018-07-26 03:14:58 +00:00
Kyle Evans
843e39ce7b libbe(3): Add be_mounted_at to check a mount point
At a bare minimum, this function will return 0 if a BE is mounted at the
given path or non-zero otherwise.  If the optional 'details' nvlist is
supplied, it is filled with an nvpair containing just the information about
the BE mounted at the path.  This nvpair is structured just as it is for
be_get_bootenv_props, except limited to just the single mount point.
2018-07-26 03:13:07 +00:00
Kyle Evans
734e362fa1 libbe(3)/bectl(8): Provide and use proper alloc/free for property lists 2018-07-25 16:00:48 +00:00
Kyle Evans
4831c931dd libbe(3): Use zfs_is_mounted to check mounted and mountpoint 2018-07-25 15:45:42 +00:00
Kyle Evans
b29bf2f84e libbe(3)/be(8): Drop WARNS overrides, fix all fallout
Based on the idea that we shouldn't have all-new library and utility going
into base that need WARNS=1...

- Decent amount of constification
- Lots of parentheses
- Minor other nits
2018-07-25 15:14:35 +00:00
Kyle Evans
ff8676cc4e libbe(3): Add nextboot flag to returned BE information 2018-07-25 14:45:00 +00:00
Kyle Evans
3682d5e902 bectl(8): Start dumping out BE information with bectl list
For the moment, this is a primitive nvlist dump of what we get back from
be_get_bootenv_props as a proof-of-concept and to make sure that we're
getting back the kind of information we want to see from list.
2018-07-25 14:30:47 +00:00
Kyle Evans
16a10da86c bectl(8): Consistent style 2018-07-25 04:06:09 +00:00
Kyle Evans
2c8489579a bectl(8): Rename error messages 2018-07-25 03:57:28 +00:00
Kyle Evans
bfe0869c7f libbe(3): make style consistent with what I'll use going forward 2018-07-25 03:50:01 +00:00
Kyle Evans
ee16b7c946 libbe(3): Find rootfs instead by enumerating child datasets of BE root
This makes us more resilient to a rename of the bootfs, but still wouldn't
withstand pool renames or guid renames. More importantly, this allows `bectl
create <foo>` work out of the box to create a boot environment based on the
currently booted one.
2018-07-25 03:30:01 +00:00
Kyle Evans
c3a34c08e0 libbe(3): Disambiguate 'active' a little bit, add 'bootfs'
- Rename 'active' to 'rootfs', which is used in other places to describe the
currently booted (or about to be booted) BE.

- Add 'bootfs', which indicates the next boot environment to be booted. This
  is pulled from the BOOTFS zpool property.

- Go ahead and keep an open handle to the active zpool. We might need to
  enumerate datasets, get properties, and set properties (e.g. bootfs)
  throughout other libbe bits, and a single handle isn't overly expensive.
2018-07-25 03:08:11 +00:00
Kyle Evans
9e004b219e bectl.c: Chase rename 2018-07-25 01:04:50 +00:00
Kyle Evans
268af06d3e Normalize bectl(8)/libbe(3) Makefiles, remove Makefile copyright/license
Approved by:	hselaskey
2018-07-24 19:55:02 +00:00
Kyle Evans
70a11a8eea libbe(3): Add to cddl build, adjust src.libnames.mk as needed 2018-07-24 15:42:23 +00:00
Kyle Evans
7b6d4f44ea src.libnames.mk: Make libbe entry consistent with others
Perhaps using libbe.a from "${DESTDIR}${LIBDIR}" might have been the
prevailing technique at one point, but nowadays it appears to be to
preferred to spell this as "${OBJTOP}/lib" -- make it so.
2018-07-24 13:31:50 +00:00
Kyle Evans
edbfe3bcb5 bectl(8): Chase rename in manpage 2018-07-24 13:24:30 +00:00
Kyle Evans
5952343e02 Rename be(1) to bectl(8); continues to live in /sbin
Discussed with:	rpokala, allanjude
2018-07-24 13:21:44 +00:00
Kyle Evans
28f16a0f19 Import libbe(3)/be(1) from socsvn/soc2017/kneitinger/libbe-head 2018-07-24 13:17:40 +00:00
Bruce Evans
2011986f09 In C remquol() and thus also in C remainderl(), don't clobber the sign bit
of NaNs before possible returning a NaN.

The remquo*() and remainder*() functions should now give bitwise identical
results across arches and implementations, and bitwise consistent results
(with lower precisions having truncated mantissas) across precisions.  x86
already had consistency across amd64 and i386 and precisions by using the
i387 consistently and normally not using the C versions.  Inconsistencies
for C reqmquol() were first detected on sparc64.

Remove double second clearing of the sign bit and extra blank lines.
2018-07-24 11:50:05 +00:00
Ed Maste
33683c3d3c lld: fix addends with partial linking
[ELF] Update addends in non-allocatable sections for REL targets when
creating a relocatable output.

LLVM PR: 37735
LLVM Differential Revision: https://reviews.llvm.org/D48929

PR:		225128
Obtained from:	LLVM r336799 by Igor Kudrin
2018-07-24 11:35:22 +00:00
Bruce Evans
daa1e39110 Fix the conversion to use nan_mix() in r336362. fmod*(x, y),
remainder*(x, y) and remquo*(x, y, quo) were broken for y = 0 by changing
multiplication by y to addition of y.  (When y is 0, the result should be
NaN but became 1 for finite x.)

Use a new macro nan_mix_op() to give more control over the mixing, and
expand comments.

Recent re-testing missed finding this bug since I only tested the macro
version on amd64 and i386 and these arches don't use the C versions (they
use either asm versions or builtins).

Reported by:	enh via freebsd-numerics
2018-07-24 10:10:16 +00:00
Ravi Pokala
f9027e3a3a Deprecate jedec_ts(4) and point users to jedec_dimm(4) instead
jedec_dimm(4) is a superset of the functionality of jedec_ts(4). Mark
jedec_ts(4) as removed in FreeBSD 12, and include a pointer to the migration
instructions in the jedec_dimm(4) manpage, in both the jedec_ts(4) code and
the jedec_ts(4) manpage. Add a note to the jedec_dimm(4) manpage about the
fact that it is a superset of jedec_ts(4).

This change will be MFCed to stable/11 and stable/10; the followup change
to actually remove jedec_ts(4) from -HEAD will not.

Reviewed by:	avg
MFC after:	1 week
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D16412
2018-07-24 08:15:02 +00:00
Allan Jude
68232f2053 ZFS: Reserve DMU_BACKUP_FEATURE flags for Native Encryption and ZSTD 2018-07-24 04:38:11 +00:00
Ben Woods
368455ec95 geli init: Allow initialization of multiple geli providers at once if
they use same passphrase and keyfiles.

Unique salt will be randomly generated for each provider to ensure the
Master Key for each is unique.

This change follows on from r335673 and r336602, which allowed multiple
providers to be attached in a single command.

Reviewed by:	asomers
Approved by:	sobomax
Differential Revision:	https://reviews.freebsd.org/D16115
2018-07-23 23:04:43 +00:00
Warner Losh
663472df5a Say a little more about the new protocol.
Requested by: emaste@
2018-07-23 22:15:36 +00:00
Ed Maste
83722abcb6 arch.7: fix whitespace from r336435
Previously armeb's Final Release rendered as 'Ta 11.x'.

Sponsored by:	The FreeBSD Foundation
2018-07-23 21:09:57 +00:00
Warner Losh
b43c6042c3 Finalize the boot manager protocol support for next-stage boot
loading.

If we are booting in a conforming UEFI Boot Manager Environment, then
use the BootCurrent variable to find the BootXXXX we're using. Once we
find that, then if it contains more than one EFI_DEVICE_PATH in its
what to boot section, try to use the last one as the kernel to
load. This will also set the default root partition as well. If
there's only one path, or if there's an error along the way, assume
that nothing specific was specified and revert to the old
algorithm. If something was specified, but not found, then fail the
boot. Otherwise you that, specific thing. On FreeBSD, this can be set
using efibootmgr -l <loader> -k <kernel>. We try a few variations of
kernel to cope with the fact that UEFI comes from a DOS world where
paths might be upper case and/or contain back-slashes.

Note: In an ideal world, we'd work out where we are in chain loading
by looking at the passed-in image handle and doing name
matching. However, that's unreliable since at least boot1.efi booted
images don't have that, hence the assumption that loader.efi needs to
load the last thing on the list, if possible.

The reason we fail for something specific is so that we can fully
participate in the UEFI Boot Manager Protocol and fail over to the
next item in the list of BootOrder choices when something goes wrong
at this stage.

This implements was was talked about in freebsd-arch@ last year
https://docs.freebsd.org/cgi/getmsg.cgi?fetch=3576+0+archive/2017/freebsd-arch/20171022.freebsd-arch
and documented in full (after changed resulting from the discussion) in
https://docs.google.com/document/d/1aK9IqF-60JPEbUeSAUAkYjF2W_8EnmczFs6RqCT90Jg/edit#
although one or two minor details may have been modified in this
implementation to make it work, and the ZFS MEDIA PATH extension isn't
implemented. This does not yet move things to ESP:\efi\freebsd\loader.efi.

RelNotes: Yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16403
2018-07-23 20:36:59 +00:00
Warner Losh
00a47597a3 Implement efiblk_get_pdinfo_by_device_path
Lookup a block device by it's device path. We use a 'loose' lookup
whereby we scan forward to the first Media Path portion of the device
path, then look at all our handles for one whose first Media Path
matches. This will also work if the device path pointed to has a
following file path (or paths) as that's ignored. It assumes that
there's only one media path node that describes the entire device,
which is true as of the latest UEFI spec (2.7 Errata A) as far as I've
been able to determine.

Sponsored by: Netflix
2018-07-23 20:36:54 +00:00
Warner Losh
c6c2a73c0c Implement efi_devpath_length
Return the total length, in bytes, of the device path (including the
terminating node at the end).

Sponsored by: Netflix
2018-07-23 20:36:50 +00:00
Warner Losh
13850b362f Implement efi_devpath_match_node
Returns true if the first node pointed to by devpath1 is identical to
the first node pointed to by devpath2, with care taken to not read
past the end of the valid parts of either devpath1 or
devpath2. Otherwise, returns false.

Sponsored by: Netflix
2018-07-23 20:36:45 +00:00
Warner Losh
3ef81aa0f5 Store the number of handles we get back in efipart_nhandles rather
than the number of bytes. Don't divide by the element size every time
we have to iterate. Eliminate now-unused variables.

Sponsored by: Netflix
2018-07-23 20:36:41 +00:00
Warner Losh
ee4e1d5807 Implement efi_devpath_to_media_path
Takes a generic device path as its input. Scans through it to find the
first media_path node in it and returns a pointer to it. If none is
found, NULL is returned.

Sponsored by: Netflix
2018-07-23 20:36:25 +00:00
Li-Wen Hsu
03154ade2a Use __riscv to determine building for RISC-V
Reviewed by:	br
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D16398
2018-07-23 19:49:54 +00:00
Ed Maste
f84d8f0ce5 arch.7: Clarify architecture-specific macro use
Compilers may define multiple variants of architecture-specific macros
(for example, both __x86_64 and __x86_64__).  Add a note that the macros
documented in arch.7 are the preferred ones for FreeBSD.

Sponsored by:	The FreeBSD Foundation
2018-07-23 19:39:20 +00:00
Warner Losh
da8e85391f Now that we set the busy_detect bit in the bas to support setting it
for the console, set our override in the bas as well.

Tested by: emaste@
2018-07-23 19:27:11 +00:00
John Baldwin
6f77212f27 Support compressed crash dumps in crashinfo(8).
Temporarily decompress a copy of a crash dump compressed with either
gzip or zstd and run various tools against the decompressed copy while
generating the crash information.  The uncompressed copy is deleted when
the script exits.

Note that crashinfo is enabled by default, so this will attempt to
decompress the most recent compressed crash dump after a crash that
generates a compressed crash dump.  Users who wish to only do offline
analysis of compressed crash dumps can disable crashinfo in rc.conf.

Tested by:	ler
Reviewed by:	markj
MFC after:	2 weeks
2018-07-23 18:08:56 +00:00
Ian Lepore
c798532ffa Revert r336619, it appears to cause problems with ssh, and probably other
things which use pw_scan().
2018-07-23 17:26:38 +00:00
Andriy Gapon
dc8240f0da fix incorrect operator in the AUDITPIPE_SET_QLIMIT bounds check
PR:		229983
Submitted by:	Aniket Pandey <aniketp@iitk.ac.in>
Reported by:	Aniket Pandey <aniketp@iitk.ac.in>
MFC after:	1 week
2018-07-23 16:56:49 +00:00
Brad Davis
a9e8c5c4b0 Add the initial DIRS infrastructure for creating directories with the
necessary owner, group, mode and flags.

Approved by:	bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D16405
2018-07-23 16:11:03 +00:00
Andriy Gapon
2559473944 follow-up to r336635, update TAILQ to CK_SLIST for ie_handlers
arm, mips and sparc64 were affected.
2018-07-23 15:36:55 +00:00