]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r343911, r344238-r344241, r344247, r344254-r344255, r344260, r344268,
kevans [Sun, 21 Apr 2019 04:35:49 +0000 (04:35 +0000)]
MFC r343911, r344238-r344241, r344247, r344254-r344255, r344260, r344268,
r344335, r344839, r345066, r345330

r343911:
Allow reading the UEFI variable size

When loading bigger variables form UEFI it is necessary to know their
size beforehand, so that an appropriate amount of memory can be
allocated. The easiest way to do this is to try to read the variable
with buffer size equal 0, expecting EFI_BUFFER_TOO_SMALL error to be
returned. Allow such possible approach in efi_getenv routine.

Extracted from a bigger patch as suggested by imp.

r344238:
Restore loader(8)'s ability for lsdev to show partitions within a bsd slice.

I'm pretty sure this used to work at one time, perhaps long ago.  It has
been failing recently because if you call disk_open() with dev->d_partition
set to -1 when d_slice refers to a bsd slice, it assumes you want it to
open the first partition within that slice.  When you then pass that open
dev instance to ptable_open(), it tries to read the start of the 'a'
partition and decides there is no recognizable partition type there.

This restores the old functionality by resetting d_offset to the start
of the raw slice after disk_open() returns.  For good measure, d_partition
is also set back to -1, although that doesn't currently affect anything.

I would have preferred to make disk_open() avoid such rude assumptions and
if you ask for partition -1 you get the raw slice.  But the commit history
shows that someone already did that once (r239058), and had to revert it
(r239232), so I didn't even try to go down that road.

r344239:
Use a couple local variables to avoid repetitive long expressions that
cause line-wrapping.

r344240:
Make lsdev -v output line up in neat columns by using a fixed width for
the size field and a tab between the partition type and the size.

Changes this

  disk devices:
        disk0 (MMC)
        disk0s1: DOS/Windows            49MB
        disk0s2: FreeBSD                14GB
        disk0s2a: FreeBSD UFS         14GB
        disk0s2b: Unknown             2048KB
        disk0s2d: FreeBSD UFS         2040KB

to this

  disk devices:
        disk0 (MMC)
        disk0s1: DOS/Windows      49MB
        disk0s2: FreeBSD          14GB
        disk0s2a: FreeBSD UFS     14GB
        disk0s2b: Unknown       2048KB
        disk0s2d: FreeBSD UFS   2040KB

r344241:
Garbage collection no-longer-used constant.

r344247:
Make uboot_devdesc properly alias disk_devdesc, so that parsing the u-boot
loaderdev variable works correctly.

The uboot_devdesc struct is variously cast back and forth between
uboot_devdesc and disk_devdesc as pointers are handed off through various
opaque interfaces.  uboot_devdesc attempted to mimic the layout of
disk_devdesc by having a devdesc struct, followed by a union of some
device-specific stuff that included a struct that contains the same fields
as a disk_devdesc.  However, one of those fields inside the struct is 64-bit
which causes the entire union to be 64-bit aligned -- 32 bits of padding
is added between the struct devdesc and the union, so the whole mess ends
up NOT properly mimicking a disk_devdesc after all.  (In disk_devdesc there
is also 32 bits of padding, but it shows up immediately before the d_offset
field, rather than before the whole collection of d_* fields.)

This fixes the problem by using an anonymous union to overlay the devdesc
field uboot network devices need with the disk_devdesc that uboot storage
devices need.  This is a different solution than the one contributed with
the PR (so if anything goes wrong, the blame goes to me), but 95% of the
credit for this fix goes to Pawel Worach and Manuel Stuhn who analyzed the
problem and proposed a fix.

r344254:
Use DEV_TYP_NONE instead of -1 to indicate no device was specified.

DEV_TYP_NONE has a value of zero, which makes more sense since the device
type is a bunch of bits describing the device, crammed into an int.

r344255:
Fix more places to use DEV_TYP_NONE instead of -1 to indicate 'no device'.

r344260:
Allow the u-boot loaderdev env var to be formatted in the "usual" loader(8)
way: device<unit>[s|p]<slice><partition>.  E.g., disk0s2a or disk3p12.
The code first tries to parse the variable in this format using the
standard disk_parsedev().  If that fails, it falls back to parsing the
legacy format that has been supported by ubldr for years.

In addition to 'disk', all the valid uboot device names can also be used:
mmc, sata, usb, ide, scsi. The 'disk' device serves as an alias for all
those types and will match the Nth storage-type device found (where N is
the unit number).

r344268:
loader: ptable_close() should check its argument

If the passed in table is NULL, just return.

r344335:
Fix the handling of legacy-format devices in the u-boot loaderdev variable.
When I added support for the standard loader(8) disk0s2a: type formats,
the parsing of legacy format was broken because it also contains a colon,
but it comes before the slice and partition. That would cause disk_parsedev()
to return success with the slice and partition set to wildcard values.

This change examines the string first, and if it contains spaces, dots, or
a colon at any position other than the end, it must be a legacy-format
string and we don't even try to use disk_parsedev() on it.

r344839:
Add retry loop around GetMemoryMap call to fix fragmentation bug

The call to BS->AllocatePages can cause the memory map to become framented,
causing BS->GetMemoryMap to return EFI_BUFFER_TOO_SMALL more than once. For
example this can happen on the MinnowBoard Turbot, causing the boot to stop
with an error. Avoid this by calling GetMemoryMap in a loop.

r345066:
stand: Improve some debugging experience

Some of these files using <FOO>_DEBUG defined a DEBUG() macro to serve as a
debug-printf. -DDEBUG is useful to enable some debugging output across
multiple ELF/common parts, so switch the DEBUG-as-printf macros over to
something more like DPRINTF that is more commonly used for this kind of
thing and less likely to conflict.

userboot/elf64_freebsd debugging also assumed %llx for uint64; use PRIx64
instead.

r345330:
loader: fix loading of kernels with . in path

The loader indended to search the kernel file name (only) for . but
instead searched the entire path, so paths like
"boot/test.elfv2/kernel" would not work.

PR: 233097

5 years agoMFC r341101, r341231, r341276, r341329, r341433, r341780, r342054-r342055,
kevans [Sun, 21 Apr 2019 04:26:02 +0000 (04:26 +0000)]
MFC r341101, r341231, r341276, r341329, r341433, r341780, r342054-r342055,
r342721, r342742, r342840, r343008, r343225

r341101:
powerpcspe: Don't crash the loader on ubldr with SPE instructions.

-msoft-float seems to be insufficient for disabling the SPE on powerpcspe.
Force it off with -mno-spe as well.  This prevents a crash in ubldr on
powerpcspe.

r341231:
loader: command_bcache() should print unsigned values

All bcache counters are unsigned.

r341276:
When handling CMD_CRIT error set command_errmsg to NULL after we dump it out,
so that it does not result in error message printed twice.

OK load doodoo
can't find 'doodoo'
can't find 'doodoo'
OK

r341329:
loader.efi: fix EFI getchar() for multiple consoles

This fix is ported from illumos (issue #9970), the analysis and initial
implementation was done by John Levon.

See also: https://www.illumos.org/issues/9970

Currently, efi_cons_getchar() will wait for a key. While this seems to make
sense, the implementation of getchar() in common/console.c will loop across
getchar() for all consoles without doing ischar() first.

This means that if we've configured multiple consoles, we can't input into
the serial, as getchar() will be sat waiting for input only from efi_console.c

This patch does implement a bit more generic key buffer to support
translation of input keys, and we use generic efi_readkey() to reduce
duplication from calls from getchar() and poll().

r341433:
Move inclusion of src.opts.mk later.

src.opts.mk includes bsd.own.mk. This in turn defines CTFCONVERT_CMD
depending on the MK_CTF value. We then set MK_CTF to no, which has no
real effect. The solution is to set all the MK_foo values before
including src.opts.mk.

This should stop the cdboot binary from exploding in size for releases
built WITH_CTF=yes in src.conf.

r341780:
powerpc/ubldr: Teach powerpc's ubldr to boot 64-bit kernels

This is just a copy of powerpc/ofw's ppc64_elf_freebsd.c modified to fit
ubldr's boot format.

r342054:
Print an error message in efi_main.c if we can't allocate memory for the heap

With the default Qemu parameters, only 128MB RAM gets given to a VM. This causes
the loader to be unable to allocate the 64MB it needs for the heap. This change
makes the cause of the error more obvious.

r342055:
Cast error message in efi_main.c to CHAR16* to avoid build error

r342721:
loader.efi: update memmap command to recognize new attributes

Also move memory type to string translation to libefi for later use.

r342742:
loader.efi: efi variable rework and lsefi command added

This update does add diag and debug capabilities to interpret the efi
variables, configuration and protocols (lsefi).

The side effect is that we add/update bunch of related headers.

r342840:
Create MK_LOADER_VERBOSE and connect it to ELF_VERBOSE in the loader
code.

r343008:
Add Dell Chromebook to the list of devices with E820 extmem quirk enabled

Just like for Acer C270 chromebook the E820 extmem workaround is required for
FreeBSD to boot on Dell chromebook.

r343225:
Unbreak mip64 build after r328437

Add exit and getchar functions to beri/boot2 code. They are required by
panic_action functin introduced in r328437

PR: 18498, 204916

5 years agoMFC r337534-r337535
kevans [Sun, 21 Apr 2019 04:18:57 +0000 (04:18 +0000)]
MFC r337534-r337535

r337534:
Refactor common code into execute_script().

r337535:
Use NULLs instead of casted zeroes, for consistency.

5 years agoMFC r338262, r339334, r339796, r340240, r340857, r340917, r341007
kevans [Sun, 21 Apr 2019 04:15:57 +0000 (04:15 +0000)]
MFC r338262, r339334, r339796, r340240, r340857, r340917, r341007

r338262:
stand: fdt: Drop some write-only assignments/variables and leaked bits

Generally straightforward enough; a copy of argv[1] was being made in
command_fdt_internal, solely used for a comparison within the
handler-search, then promptly leaked.

r339334:
loader.efi: add poweroff command

Add poweroff command to make life a bit easier.

r339796:
Simplify the EFI delay() function by calling BS->Stall()

r340240:
loader: ptable_open() check for ptable_cd9660read result is wrong

The ptable_*read() functions return NULL on read errors (and partition table
closed as an side effect). The ptable_open must check the return value and
act properly.

r340857:
Nuke out buffer overflow safety marker code, it duplicates similar code in
the malloc()/free() as well as having potential of softening the handling
in case error is detected down to a mere warning as compared to hard panic
in free().

r340917:
Update pxeboot(8) manual page to reflect the next-server change in the ISC DHCP v3 server.

r341007:
Bump the date of pxeboot(8) manual page for r340917.

PR: 123484, 232483

5 years agoMFC r337321, r337435, r337707, r337740, r337834, r337836, r337968
kevans [Sun, 21 Apr 2019 04:00:19 +0000 (04:00 +0000)]
MFC r337321, r337435, r337707, r337740, r337834, r337836, r337968

r337321:
Make it possible for init to execute any executable, not just sh(1)
scripts. This means one should be able to eg rewrite their /etc/rc
in Python.

r337435:
Move description of init_shell, init_script, and init_chroot kenv
tunables from loader(8) to init(8), since it's init that actually
uses them.  Add .Xrs at their old place.

r337707:
Move around text in loader(8), in particular stuff related to ZFS,
to restore the usual section order.

r337740:
Add init_exec kenv(1) variable, to make init(8) execute a file
after opening the console, replacing init as PID 1.

From the user point of view, it makes it possible to run eg the
shell as PID 1, using 'set init_exec=/bin/sh' at the loader(8)
prompt.

r337834:
Add SECURITY section to loader(8).

r337836:
Improve formatting.

r337968:
Consistently use NULL to terminate the argv; no functional changes.

Relnotes: yes (init_exec kenv(1) variable)

5 years agoMFC r339292: Fix a minor typo in loader.conf(5).
kevans [Sun, 21 Apr 2019 03:54:49 +0000 (03:54 +0000)]
MFC r339292: Fix a minor typo in loader.conf(5).

5 years agoMFC r337871, r339970, r342151, r342161, r343123-r343124, r344226, r344234,
kevans [Sun, 21 Apr 2019 03:43:27 +0000 (03:43 +0000)]
MFC r337871, r339970, r342151, r342161, r343123-r343124, r344226, r344234,
r344248, r344387

r337871:
pkgfs_init: Initialize pkg

new_package may not set *pp if it errors out, leaving pkg uninitialized.

r339970:
Remove unnecessary include from libstand.

r342151:
loader: zfs reader should not probe partitionless disks

First of all, normal setups can not boot such pools as the tools
do not support installing boot programs.

Secondly, for proper pool configuration detection, we need to checks all
four label copies on disk, 2 from front and 2 from the end of the disk,
but zfs label does not contain the size of the disk - so we depend on
firmware to report the correct disk size or use information from the
partition table.

Without partition table, we only can rely on firmware to report and support
disk IO properly.

There is a specific case: 8TB disks are reported by BIOS to have 4294967295
sectors (0x00000000ffffffff), the sectors reported by OS is 15628053168
(0x00000003a3812ab0), so the reported size is less than actual but is hitting
32-bit max. Unfortuantely the real limit must be even lower because probing
this disk in this system will wnd up with hung system.

UEFI boot of this system seems not to be affected.

r342161:
loader: zfs reader should not probe partitionless disks (UEFI case)

With r342151 I did fix the BIOS version of zfs_probe_dev() from accessing
the whole disk, but the fix was not complete - we actually did not check
if the device name was really for whole disk. Since UEFI version
is only calling the zfs_probe_dev() with partitions and not with whole
disk, the UEFI loader was not able to find the zfs pools.

This update does correct the issue by calling archsw.arch_getdev() to
translate the device name back to dev_desc, and we have whole disk when both
partition and slice values are -1.

r343123:
loader should ignore active multi_vdev_crash_dump feature on zpool

Since the loader zfs reader does not need to read the dump zvol, we can
just enable the feature.

illumos issue #9051 https://www.illumos.org/issues/9051

r343124:
libsa: add asprintf()

asprintf() is a nice tool for string processing.

r344226:
Fix memory corruption bug introduced in r325310

The bug occurred when a bounce buffer was used and the requested read
size was greater than the size of the bounce buffer.  This commit also
rewrites the read logic so that it is easier to systematically verify
all alignment and size cases.

r344234:
It turns out r344226 narrowed the overrun bug but did not eliminate it entirely

This commit fixes a remaining output buffer overrun in the
single-sector case when there is a non-zero tail.

r344248:
cd9660: dirmatch fails to unmatch when name is prefix for directory record

Loader does fail to properly match the file name in directory record and
does open file based on prefix match.

For fix, we check the name lengths first.

r344387:
loader: really fix cd9660 dirmatch

The cd9660_open() does pass whole path to dirmatch() and we need to
compare only the current path component, not full path.

Additinally, skip over duplicate / (if any) and check if the last component
in the path was meant to be directory (having trailing /). If it is in fact
a file, error out.

5 years agoMFC r341253, r341328, r342619, r342626, r342707, r342785, r342865
kevans [Sun, 21 Apr 2019 03:36:05 +0000 (03:36 +0000)]
MFC r341253, r341328, r342619, r342626, r342707, r342785, r342865

r341253:
The libstand's panic() appends its own '\n' to the message, so that users of the API
don't need to supply one.

r341328:
loader: create separate lists for fd, cd and hd, merge bioscd with biosdisk

Create unified block IO implementation in BIOS version, like it is done in UEFI
side. Implement fd, disk and cd device lists, this will split floppy devices
from disks and will allow us to have consistent, predictable device naming
(modulo BIOS issues).

r342619:
loader: create bio_alloc and bio_free for bios bounce buffer

We do have 16KB buffer space defined in pxe.c, move it to bio.c and implement
bio_alloc()/bio_free() interface to make it possible to use this space for
other BIOS calls (notably, from biosdisk.c).

r342626:
Add Copyright.

r342707:
i386_parsedev() needs to support fd devices

r342785:
With buggy int13 ah=15, we can mis-identify the floppy devices.

We have no option than trust INT13 ah=08 return code during the init phase.

r342865:
biospci_write_config args were backwards

biospci_write_config args swapped length and value to write. Some
hardware coped just fine, while other hardware had issues.

PR: 155441, 234460

5 years agoMFC r339658, r339959, r340047, r340049, r340215
kevans [Sun, 21 Apr 2019 03:30:47 +0000 (03:30 +0000)]
MFC r339658, r339959, r340047, r340049, r340215

r339658:
loader: biosdisk interface should be able to cope with 4k sectors

The 4kn support in current bios specific biosdisk.c is broken, as the code
is only implementing the support for the 512B sector size.

This work is building the support for custom size sectors, we still do assume
the requested data to be multiple of 512B blocks and we only do address the
biosdisk.c interface here.

For reference, see also:
https://www.illumos.org/issues/8303
https://www.illumos.org/rb/r/547

As the GELI is moved above biosdisk "layer", the GELI should just work

r339959:
loader: issue edd probe before legacy ah=08 and detect no media

while probing for drives, use int13 extended info before standard one and
provide workaround for case we are not getting needed information in case
of floppy drive.

In case of INT13 errors, there are (at least) 3 error codes appearing in case
of missin media - 20h, 31h and 80h. Flag the no media and do not print an
error.

r340047:
loader: do not probe floppy devices for zfs

The subject is telling it all.

r340049:
loader: biosdisk should check if the media is present

The bd_print/bd_open/bd_strategy need to make sure the device does have
media, before getting into performing IO operations. Some systems can
hung if the device without a media is accessed.

r340215:
loader: always set media size from partition.

The disk access is validated by using partition table definitions, therefore
we have no need for if statements, just set the disk size.

Of course the partition table itself may be incorrect/inconsistent, but if
so, we are in trouble anyhow.

5 years agoMFC i386 stand cleanup: r337353-r337354, r337356, r337872, r337878, r337881,
kevans [Sun, 21 Apr 2019 03:27:12 +0000 (03:27 +0000)]
MFC i386 stand cleanup: r337353-r337354, r337356, r337872, r337878, r337881,
r337890-r337891, r338188

r337353:
loader: cstyle cleanup for biosdisk.c

Also switch u_int to uint32_t. Also replace "write" by "dowrite".
No functional changes intended.

r337354:
loader: 337353 did miss to rename 2 write instances

2 write instances got somehow missed.

r337356:
loader: bd_open() should cleanup from disk_open() error

Since bd_open() does early increment for reference counter and bcache
allocation, it also should undo those in case of the error.

Also remove unused variables rdev, g_err.

r337872:
libi386: remove BD_SUPPORT_FRAGS

BD_SUPPORT_FRAGS is preprocessor knob to allow partial reads in bioscd/biosdisk
level. However, we already have support for partial reads in bcache, and there
is no need to have duplication via preprocessor controls.

Note that bioscd/biosdisk interface is assumed to perform IO in 512B blocks,
so the only translation we have to do is 512 <-> native block size.

r337878:
libi386: remove bd_read() and bd_write() wrappers

Those wroappers are nice, but do not really add much value.

r337881:
libi386: use BD_RD and BR_WR constants

Use BD_RD and BD_WR instead of 0 and 1.

r337890:
libi386: small style updates in biosdisk

Use break instead of return in for loop, as done earlier. Insert and remove
some blank lines. No functional changes intended.

r337891:
libi386: bd_io_workaround() is to be called for reads only

bd_io() can perform either reads or writes, we only need bd_io_workaround()
for reads.

r338188:
loader: bios loader should allow to chain load a file

The current chain command does accept only device, allow also a file to be used,
such as /boot/pmbr or /boot/mbr (or stored third party MBR/VBR block).

Also fix file descriptor leak.

5 years agoMFC r337271, r337317: stand: i386: sector calculation fixes
kevans [Sun, 21 Apr 2019 03:22:57 +0000 (03:22 +0000)]
MFC r337271, r337317: stand: i386: sector calculation fixes

r337271:
Some drives report a geometry that is inconsisetent with the total
number of sectors reported through the BIOS. Cylinders * heads *
sectors may not necessarily be equal to the total number of sectors
reported through int13h function 48h.

An example of this is when a Mediasonic HD3-U2B PATA to USB enclosure
with a 80 GB disk is attached. Loader hangs at line 506 of
stand/i386/libi386/biosdisk.c while attempting to read sectors beyond
the end of the disk, sector 156906855. I discovered that the Mediasonic
enclosure was reporting the disk with 9767 cylinders, 255 heads, 63
sectors/track. That's 156906855 sectors. However camcontrol and
Windows 10 both report report the disk having 156301488 sectors, not
the calculated value. At line 280 biosdisk.c sets the sectors to the
higher of either bd->bd_sectors or the total calculated at line 276
(156906855) instead of the lower and correct value of 156301488 reported
by int 13h 48h.

This was tested on all three of my Mediasonic HD3-U2B PATA to USB
enclosures.

Instead of using the higher of bd_sectors (returned by int13h) or the
calculated value, this patch uses the lower and safer of the values.

r337317:
In r337271, we limited the sector number to the lower of calculated
number and CHS based number.  However, on some systems, BIOS would
report 0 in CHS fields, making the system to think there is 0 sectors.

Add a check before comparing the calculated total with bd_sectors.

5 years agoMFC r336424-r336425: loader command typos
kevans [Sun, 21 Apr 2019 03:16:09 +0000 (03:16 +0000)]
MFC r336424-r336425: loader command typos

r336424:
Fix typo in the command summary.

Of course, I can't get the command to work, but it's a start...

r336425:
More typos

5 years agoMFC r333662: Clarify that boot_mute / boot -m mutes kernel console only
kevans [Sun, 21 Apr 2019 03:15:11 +0000 (03:15 +0000)]
MFC r333662: Clarify that boot_mute / boot -m mutes kernel console only

Perhaps RB_MUTE could mute user startup (rc) output as well, but right
now it mutes only kernel console output, so make the documentation match
reality.

PR: 228193

5 years agoMFC: r345995
rmacklem [Sun, 21 Apr 2019 00:59:21 +0000 (00:59 +0000)]
MFC: r345995
Delete the BUGS entry related to failing when jails are enabled.

r345994 has finally fixed the bug that caused the nfsuserd(8) daemon to
fail when jails were enabled, so delete the BUGS entry from the man page.

5 years agoMFC: r345994
rmacklem [Sun, 21 Apr 2019 00:51:43 +0000 (00:51 +0000)]
MFC: r345994
Fix nfsuserd so that it handles the mapped localhost address when jails
are enabled.

The nfsuserd(8) daemon does not function correctly when jails are enabled,
since localhost gets mapped to another IP address and, as such, the upcall
RPC fails.
This patch fixes the problem by doing a getsockname(2) of a socket mapped
to localhost to find out what the correct address is for the comparison
test with the upcall's from IP address.
This patch also adds INET6 support and the required #ifdef's for INET and
INET6. It now uses INET6 by default for the upcalls, if the kernel has
INET6 support and the daemon is also built with INET6 support.

5 years agoMFC: r345992, r346087
rmacklem [Sun, 21 Apr 2019 00:41:06 +0000 (00:41 +0000)]
MFC: r345992, r346087
Add INET6 support for the upcalls to the nfsuserd daemon.

The kernel code uses UDP to do upcalls to the nfsuserd(8) daemon to get
updates to the username<->uid and groupname<->gid mappings.
A change to AF_LOCAL last year had to be reverted, since it could result
in vnode locking issues on the AF_LOCAL socket.
This patch adds INET6 support and the required #ifdef INET and INET6
to the code.

5 years agoMFC r345996:
cy [Sat, 20 Apr 2019 15:06:58 +0000 (15:06 +0000)]
MFC r345996:

Update sqlite3-3.26.0 (3260000) --> sqlite3-3.27.1 (3270100)

5 years agoMFC r346010:
markj [Sat, 20 Apr 2019 11:03:46 +0000 (11:03 +0000)]
MFC r346010:
Fix indentation.

5 years agoMFC r346011:
markj [Sat, 20 Apr 2019 11:03:16 +0000 (11:03 +0000)]
MFC r346011:
Stop compiling bhyve(8) with -O0.

5 years agoMFC bectl(8)/libbe(3): r337663-337664,337667,337697-337699,337800,337805,
kevans [Sat, 20 Apr 2019 04:16:51 +0000 (04:16 +0000)]
MFC bectl(8)/libbe(3): r337663-337664,337667,337697-337699,337800,337805,
337915-337918,337921,337924,337947,337993-337995,338221-338222,338303,
338417,339047,339972,339994,340334,340507-340508,340592-340594,
340635-340636,340722-340723,340974,342466,342849,342903,342911,343335,
343543,343977,343993-343994,344034,344067,344084,345302,345769,
345845-345846,345848,346082

There are simply too many small changes to enumerate; in summary:

bectl(8)/libbe(3) has been introduced from current state in -CURRENT and
added to the stable/11 rescue build. bectl(8) is a tool for managing ZFS
boot environments, largely inspired by beadm. It includes features such as
being able to jail a boot environment or easily mount it for modification.

Relnotes: probably

5 years agoMFC: 342657, 345025
imp [Fri, 19 Apr 2019 20:23:39 +0000 (20:23 +0000)]
MFC: 342657, 345025

Quirks for Chipfancier chips. Their READ CAPACITY 10 and READ CAPACITY
16 values differ, and the default of using RC16 gets the improper one.

PR: 234503

5 years agoFix minor mismerge in r346296, where one file for the LLVM BPF target
dim [Fri, 19 Apr 2019 20:09:13 +0000 (20:09 +0000)]
Fix minor mismerge in r346296, where one file for the LLVM BPF target
was missing.  This would lead to link errors when attempting to build
clang and llvm executables.

Direct commit to stable/11, since head and stable/12 have correct
libllvm Makefiles.

5 years agoMFC 344740:
bz [Fri, 19 Apr 2019 17:29:20 +0000 (17:29 +0000)]
MFC 344740:

  Fix compilation of world with WITHOUT_{INET,INET6}_SUPPORT or both set.

  Buildworld failed when both WITHOUT_INET6_SUPPORT and INET equivalent were set.
  Fix netstat and syslogd by applying appropriate #ifdef INET/INET6 to make world
  compile again.

5 years agoMFC r345757:
bz [Fri, 19 Apr 2019 15:54:32 +0000 (15:54 +0000)]
MFC r345757:

  Improve debugging options in bcm2835_sdhci.c

  Similar to bcm2835_sdhost.c add a TUNABLE and SYSCTL to selectively
  turn on debugging printfs if debugging is turned on at compile time.

5 years agoMFC r344700:
bz [Fri, 19 Apr 2019 15:46:08 +0000 (15:46 +0000)]
MFC r344700:

  Add ushort and ulong to linux/types.h.

  When porting code once written for Linux we find not only uints but also ushort and ulong.
  Provide central typedefs as part of the linuxkpi for those as well.

5 years agoMFC r340494:
bz [Fri, 19 Apr 2019 15:34:21 +0000 (15:34 +0000)]
MFC r340494:

  Improve the comment for arpresolve_full() in if_ether.c.
  No functional changes.

5 years agoMFC r346275:
gjb [Fri, 19 Apr 2019 13:23:41 +0000 (13:23 +0000)]
MFC r346275:
 Remove INDEX-10 reference, as 10.x is now EoL.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r345966, r345968:
kib [Fri, 19 Apr 2019 13:18:54 +0000 (13:18 +0000)]
MFC r345966, r345968:
Implement devctl(8) command 'reset', using DEV_RESET /dev/devctl2 ioctl.

5 years agoMFC r345965:
kib [Fri, 19 Apr 2019 13:09:16 +0000 (13:09 +0000)]
MFC r345965:
Add DEV_RESET /dev/devctl2 ioctl.

5 years agoMFC r345963, r345997:
kib [Fri, 19 Apr 2019 13:04:48 +0000 (13:04 +0000)]
MFC r345963, r345997:
Implement resets for PCI buses and PCIe bridges.

5 years agoMFC r345960:
kib [Fri, 19 Apr 2019 12:57:37 +0000 (12:57 +0000)]
MFC r345960:
Provide newbus infrastructure for initiating device reset.

5 years agoMFC r345964:
kib [Fri, 19 Apr 2019 12:40:21 +0000 (12:40 +0000)]
MFC r345964:
Remove single-use DEV_RESET() macro.

5 years agoMFC r345959:
kib [Fri, 19 Apr 2019 12:33:58 +0000 (12:33 +0000)]
MFC r345959:
Add __BEGIN_DECLS/__END_DECLS braces to libdevctl header.

5 years agoMFC r346158:
kib [Fri, 19 Apr 2019 12:31:16 +0000 (12:31 +0000)]
MFC r346158:
Do not access mutex memory after unlock.

PR: 237195

5 years agoMFC r346161: Fix SCSI sense data pass through.
mav [Fri, 19 Apr 2019 03:47:59 +0000 (03:47 +0000)]
MFC r346161: Fix SCSI sense data pass through.

5 years agoMFC: r345866
rmacklem [Thu, 18 Apr 2019 02:47:59 +0000 (02:47 +0000)]
MFC: r345866
Fix malloc stats for the RPCSEC_GSS server code when DEBUG is enabled.

The code enabled when "DEBUG" is defined uses mem_alloc(), which is a
malloc(.., M_RPC, M_WAITOK | M_ZERO), but then calls gss_release_buffer()
which does a free(.., M_GSSAPI) to free the memory.
This patch fixes the problem by replacing mem_alloc() with a
malloc(.., M_GSSAPI, M_WAITOK | M_ZERO).
This bug affects almost no one, since the sources are not normally built
with "DEBUG" defined.

5 years agoFix cross-building VMs with a non-/usr/src source directory.
cperciva [Thu, 18 Apr 2019 00:38:54 +0000 (00:38 +0000)]
Fix cross-building VMs with a non-/usr/src source directory.

The path /usr/src was hard-coded here, resulting in mkimg not being able
to find the bootfiles.

Direct commit to stable/11 because the code in HEAD and stable/12 is
completely different due to changes in OBJDIR layout.

5 years agoAfter r346168, also merge build infrastructure for LLVM libomp.
dim [Wed, 17 Apr 2019 20:16:48 +0000 (20:16 +0000)]
After r346168, also merge build infrastructure for LLVM libomp.

MFC r345235:

Add lib/libomp, with a Makefile, and generated configuration headers.
Not connected to the main build yet, as there is still the issue of the
GNU omp.h header conflicting with the LLVM one.  (That is, if MK_GCC is
enabled.)

PR: 236062

MFC r345236:

Connect lib/libomp to the build.

* Set MK_OPENMP to yes by default only on amd64, for now.
* Bump __FreeBSD_version to signal this addition.
* Ensure gcc's conflicting omp.h is not installed if MK_OPENMP is yes.
* Update OptionalObsoleteFiles.inc to cope with the conflicting omp.h.
* Regenerate src.conf(5) with new WITH/WITHOUT fragments.

Relnotes: yes
PR: 236062

MFC r345242:

Explicitly link libomp.so against -lpthread, as it depends on pthread
functionality.  This should make example OpenMP programs work out of the
box.

Reported by: jbeich
PR: 236062, 236581

MFC r345278:

Also explicitly link libomp.so against -lm, as it transitively depends
on scalbn and a few other math functions, via libcompiler-rt.  This
should allow OpenMP programs to link with BFD linkers too.

Reported by: jbeich
PR: 236062, 236581

MFC r345282:

Remove --as-needed from the linker flags for libomp.so, as these
actually prevent the transitive dependency on libm.

Reported by: jbeich
PR: 236062, 236581

MFC r345291:

Turn on MK_OPENMP for i386 by default, now that it can build.

Noticed by: jbeich
PR: 236062, 236582

5 years agoMFC r345316, r345317, r345858:
cperciva [Wed, 17 Apr 2019 12:34:37 +0000 (12:34 +0000)]
MFC r345316, r345317, r345858:

r345316: Register ARM64 EC2 AMIs as being for the ARM64 architecture.

r345317: Don't install amazon-ssm-agent package into ARM64 AMIs.

r345858: Add support for cross-building cloudware images.

With these changes it is possible to build ARM64 EC2 AMIs on stable/12 --
said images do not *work* yet, however.

5 years agoFix a typo.
gjb [Tue, 16 Apr 2019 23:08:54 +0000 (23:08 +0000)]
Fix a typo.

Submitted by: adamw
Sponsored by: The FreeBSD Foundation

5 years agoMFC r345192-r345194: if_bridge(4): Drop pointless rtflush
kevans [Tue, 16 Apr 2019 21:02:41 +0000 (21:02 +0000)]
MFC r345192-r345194: if_bridge(4): Drop pointless rtflush

r345192:
if_bridge(4): Drop pointless rtflush

At this point, all routes should've already been dropped by removing all
members from the bridge. This condition is in-fact KASSERT'd in the line
immediately above where this nop flush was added.

r345193:
Revert r345192: Too many trees in play for bridge(4) bits

An accidental appendage was committed that has not undergone review yet.

r345194:
if_bridge(4): Drop pointless rtflush

At this point, all routes should've already been dropped by removing all
members from the bridge. This condition is in-fact KASSERT'd in the line
immediately above where this nop flush was added.

5 years agoMFC r346132: stand: refactor overlay loading a little bit
kevans [Tue, 16 Apr 2019 21:01:07 +0000 (21:01 +0000)]
MFC r346132: stand: refactor overlay loading a little bit

It was pointed out that manually loading a .dtb to be used rather than
relying on platform-specific method for loading .dtb will result in overlays
not being applied. This was true because overlay loading was hacked into
fdt_platform_load_dtb, rather than done in a way more independent from how
the .dtb is loaded.

Instead, push overlay loading (for now) out into an
fdt_platform_load_overlays. This method easily allows ubldr to pull in any
fdt_overlays specified in the ub env, and omits overlay-checking on
platforms where they're not tested and/or not desired (e.g. powerpc). If we
eventually stop caring about fdt_overlays from ubenv (if we ever cared),
this method should get chopped out in favor of just calling
fdt_load_dtb_overlays() directly.

5 years agoMFC r345180, r345187: if_bridge(4): Fix module teardown
kevans [Tue, 16 Apr 2019 20:56:51 +0000 (20:56 +0000)]
MFC r345180, r345187: if_bridge(4): Fix module teardown

r345180: if_bridge(4): Fix module teardown

bridge_rtnode_zone still has outstanding allocations at the time of
destruction in the current model because all of the interface teardown
happens in a VNET_SYSUNINIT, -after- the MOD_UNLOAD has already been
processed.  The SYSUNINIT triggers destruction of the interfaces, which then
attempts to free the memory from the zone that's already been destroyed, and
we hit a panic.

Solve this by virtualizing the uma_zone we allocate the rtnodes from to fix
the ordering. bridge_rtable_fini should also take care to flush any
remaining routes that weren't taken care of when dynamic routes were flushed
in bridge_stop.

r345187: bridge: Fix STP-related panic

After r345180 we need to have the appropriate vnet context set to delete an
rtnode in bridge_rtnode_destroy().
That's usually the case, but not when it's called by the STP code (through
bstp_notify_rtage()).

We have to set the vnet context in bridge_rtable_expire() just as we do in the
other STP callback bridge_state_change().

5 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
dim [Tue, 16 Apr 2019 20:05:24 +0000 (20:05 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
8.0.0 final release r356365.

MFC r306265 (by emaste):

Force LLVM_LIBUNWIND off if we don't have a C++11 compiler

Tested by: bde
Differential Revision: https://reviews.freebsd.org/D7746

MFC r308100 (by emaste):

compile libunwind c source with -fexceptions

When an exception is thrown the unwinder must unwind its own C source
(starting with _Unwind_RaiseException in UnwindLevel1.c), so it needs to
be built with unwinding data.

MFC r324998 (by bdrewery):

Prefix {TARGET,BUILD}_TRIPLE with LLVM_ to avoid Makefile.inc1 collision.

The Makefile.inc1 TARGET_TRIPLE is for specifying which -target is used
during the build of world.

Reviewed by: dim, imp
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12792

MFC r329093 (by emaste):

Promote llvm-cov to a standalone option

Introduce WITH_/WITHOUT_LLVM_COV to match GCC's WITH_/WITHOUT_GCOV.
It is intended to provide a superset of the interface and functionality
of gcov.

It is enabled by default when building Clang, similarly to gcov and GCC.

This change moves one file in libllvm to be compiled unconditionally.
Previously it was included only when WITH_CLANG_EXTRAS was set, but the
complexity of a new special case for (CLANG_EXTRAS | LLVM_COV) is not
worth avoiding a tiny increase in build time.

Reviewed by: dim, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D142645

MFC r331244 (by jhb):

Add support for MIPS to LLVM's libunwind.

This is originally based on a patch from David Chisnall for soft-float
N64 but has since been updated to support O32, N32, and hard-float ABIs.
The soft-float O32, N32, and N64 support has been committed upstream.
The hard-float changes are still in review upstream.

Enable LLVM_LIBUNWIND on mips when building with a suitable (C+11-capable)
toolchain.  This has been tested with external GCC for all ABIs and
O32 and N64 with clang.

Reviewed by: emaste
Obtained from: CheriBSD (original N64 patch)
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D14701

MFC r336691 (by emaste):

llvm: remove __FreeBSD_version conditionals

All supported FreeBSD build host versions have backtrace.h, so we can
just eliminate that test.  For futimes() we can test the compiler's
built-in __FreeBSD__ major version rather than relying on including
osreldate.h.  This should reduce the frequency with which Clang gets
rebuilt when building world.

Reviewed by: dim
Sponsored by: The FreeBSD Foundation

MFC r337379 (by andrew):

Default to armv5te in LINT on arm. This should fix building LINT there.

MFC r337552:

Add optional LLVM BPF target support

BPF (eBPF) is an independent instruction set architecture which is
introduced in Linux a few years ago. Originally, eBPF execute
environment was only inside Linux kernel. However, recent years there
are some user space implementation (https://github.com/iovisor/ubpf,
https://doc.dpdk.org/guides/prog_guide/bpf_lib.html) and kernel space
implementation for FreeBSD is going on
(https://github.com/YutaroHayakawa/generic-ebpf).

The BPF target support can be enabled using WITH_LLVM_TARGET_BPF, as it
is not built by default.

Submitted by: Yutaro Hayakawa <yhayakawa3720@gmail.com>
Reviewed by: dim, bdrewery
Differential Revision: https://reviews.freebsd.org/D16033

MFC r337585:

In r308100, an explicit -fexceptions flag was added for the C sources
from LLVM's libunwind, which end up in libgcc_eh.a and libgcc_s.so.
This is because the unwinder needs the unwinder data for its own
functions.

However, for the C++ sources in libunwind, -fexceptions is already the
default, and this can have the side effect of generating a reference to
__gxx_personality_v0, the so-called personality function, which is
normally provided by the C++ ABI library (libcxxrt or libsupc++).

If the reference ends up in the eventual libgcc_s.so, linking any
non-C++ programs against it will fail with "undefined reference to
`__gxx_personality_v0'".

Note that at high optimization levels, the reference is usually
optimized away, which is why we have never noticed this problem before.

With clang 7.0.0 though, higher optimization levels don't help anymore,
since the addition of address-significance tables [1] in
<https://reviews.llvm.org/rL337339>.  Effectively, this always causes a
reference to __gxx_personality_v0.

After discussion with the upstream author of that change, it turns out
that we should compile libunwind sources with the -fno-exceptions
-funwind-tables flags instead.  This ensures unwind tables are
generated, but no references to any personality functions are emitted.

[1] https://lists.llvm.org/pipermail/llvm-dev/2018-May/123514.html

Reported by: jbeich
PR: 230399

MFC r340287 (by emaste):

Consolidate gcov entries in OptionalObsoleteFiles

Sponsored by: The FreeBSD Foundation

MFC r340289 (by emaste):

llvm-cov: also install as gcov (if GNU gcov is disabled)

llvm-cov provides a gcov-compatible interface when invoked as gcov.

Reviewed by: dim, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17923

MFC r340296 (by emaste):

Move llvm-profdata build into MK_LLVM_COV block

llvm-profdata is used with llvm-cov for code coverage (although llvm-cov
can also operate independently in a gcov-compatible mode).
Although llvm-profdata can be used independently of llvm-cov it makes
sense to group these under one option.

Also handle these in OptionalObsoleteFiles.inc while here.

Sponsored by: The FreeBSD Foundation

MFC r340300 (by emaste):

libllvm: Move SampleProfWriter to SRCS_MIN

It is required by llvm-profdata, now built by default under the
LLVM_COV knob.  The additional complexity that would come from avoiding
building it if CLANG_EXTRAS and LLVM_COV are both disabled is not worth
the small savings in build time.

Sponsored by: The FreeBSD Foundation

MFC r340972 (by emaste):

llvm-objdump: initial man page

Based on llvm-objdump's online documentation and usage information.
This serves as a starting point; additional detail and cleanup still
required.

Also being submitted upstream in LLVM review D54864.  I expect to use
this bespoke copy while we have LLVM 6.0 or 7.0 in FreeBSD; when we
update to LLVM 8.0 it should be upstream and we will switch to it.

PR: 233437
Reviewed by: bcr (man formatting)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18309

MFC r340973 (by emaste):

llvm-objdump.1: remove invalid options

Some options appear in llvm-objdump's usage information as a side effect
of its option parsing implementation and are not actually llvm-objdump
options.  Reported in LLVM review https://reviews.llvm.org/D54864.

Reported by: Fangrui Song
Sponsored by: The FreeBSD Foundation

MFC r340975 (by emaste):

llvm-objdump.1: fix igor / mandoc -Tlint warnings

Accidentally omitted from r340972.

MFC r341055 (by emaste):

llvm-objdump.1: remove more unintentional options

Some options come from static constructors in LLVM libraries and are
automatically added to llvm's usage output.  They're not really supposed
to be llvm-objdump options.

Reported by: Fangrui Song in LLVM review D54864
Sponsored by: The FreeBSD Foundation

MFC r344779:

Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
the upstream release_80 branch r355313 (effectively, 8.0.0 rc3).  The
release will follow very soon, but no more functional changes are
expected.

Release notes for llvm, clang and lld 8.0.0 will soon be available here:
<https://releases.llvm.org/8.0.0/docs/ReleaseNotes.html>
<https://releases.llvm.org/8.0.0/tools/clang/docs/ReleaseNotes.html>
<https://releases.llvm.org/8.0.0/tools/lld/docs/ReleaseNotes.html>

PR: 236062
Relnotes: yes

MFC r344798 (by emaste):

libllvm: promote WithColor and xxhash to SRCS_MIN

The armv6 build failed in CI due to missing symbols (from these two
source files) in the bootstrap Clang.

This affected only armv6 because other Clang-using archs are using LLD
as the bootstrap linker, and thus include SRCS_MIW via LLD_BOOTSTRAP.

Reported by: CI, via lwhsu
Sponsored by: The FreeBSD Foundation

MFC r344825:

Add a few missed files to the MK_LLVM_TARGET_BPF=yes case, otherwise
clang and various other executables will fail to link with undefined
symbols.

Reported by: O. Hartmann <ohartmann@walstatt.org>

MFC r344852:

Put in a temporary workaround for what is likely a gcc 6 bug (it does
not occur with gcc 7 or later).  This should prevent the following error
from breaking the head-amd64-gcc CI builds:

In file included from /workspace/src/contrib/llvm/tools/lldb/source/API/SBMemoryRegionInfo.cpp:14:0:
/workspace/src/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h:128:54: error: 'template<class _InputIterator> lldb_private::MemoryRegionInfos::MemoryRegionInfos(_InputIterator, _InputIterator, const allocator_type&)' inherited from 'std::__1::vector<lldb_private::MemoryRegionInfo>'
   using std::vector<lldb_private::MemoryRegionInfo>::vector;
                                                      ^~~~~~
/workspace/src/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h:128:54: error: conflicts with version inherited from 'std::__1::vector<lldb_private::MemoryRegionInfo>'

Reported by: CI

MFC r344896:

Pull in r354937 from upstream clang trunk (by Jörg Sonnenberger):

  Fix inline assembler constraint validation

  The current constraint logic is both too lax and too strict. It fails
  for input outside the [INT_MIN..INT_MAX] range, but it also
  implicitly accepts 0 as value when it should not. Adjust logic to
  handle both correctly.

  Differential Revision: https://reviews.llvm.org/D58649

Pull in r355491 from upstream clang trunk (by Hans Wennborg):

  Inline asm constraints: allow ICE-like pointers for the "n"
  constraint (PR40890)

  Apparently GCC allows this, and there's code relying on it (see bug).

  The idea is to allow expression that would have been allowed if they
  were cast to int. So I based the code on how such a cast would be
  done (the CK_PointerToIntegral case in
  IntExprEvaluator::VisitCastExpr()).

  Differential Revision: https://reviews.llvm.org/D58821

These should fix assertions and errors when using the inline assembly
"n" constraint in certain ways.

In case of devel/valgrind, a pointer was used as the input for the
constraint, which lead to "Assertion failed: (isInt() && "Invalid
accessor"), function getInt".

In case of math/secp256k1, a very large integer value was used as input
for the constraint, which lead to "error: value '4624529908474429119'
out of range for constraint 'n'".

PR:             236216, 236194

MFC r344951:

Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r355677 (effectively, 8.0.0 rc4), resolve conflicts, and bump version
numbers.

PR: 236062

MFC r345018:

Merge LLVM libunwind trunk r351319, from just before upstream's
release_80 branch point.  Afterwards, we will merge the rest of the
changes in the actual release_80 branch.

PR: 236062

MFC r345019:

Merge LLVM libunwind release_80 branch r355677 (effectively, 8.0.0 rc4).

PR: 236062

MFC r345021:

Pull in r355854 from upstream llvm trunk (by Jonas Paulsson):

  [RegAlloc]  Avoid compile time regression with multiple copy hints.

  As a fix for https://bugs.llvm.org/show_bug.cgi?id=40986 ("excessive
  compile time building opencollada"), this patch makes sure that no
  phys reg is hinted more than once from getRegAllocationHints().

  This handles the case were many virtual registers are assigned to the
  same physreg. The previous compile time fix (r343686) in
  weightCalcHelper() only made sure that physical/virtual registers are
  passed no more than once to addRegAllocationHint().

  Review: Dimitry Andric, Quentin Colombet
  https://reviews.llvm.org/D59201

This should fix a hang when compiling certain generated .cpp files in
the graphics/opencollada port.

PR: 236313

MFC r345068 (by jhb):

Move libunwind out of contrib/llvm/projects.

Move LLVM's libunwind to its own contrib/ directory similar to other
runtime libraries like libc++ and libcxxrt.

Reviewed by: dim, emaste
Differential Revision: https://reviews.freebsd.org/D19534

MFC r345073:

Revert r308867 (which was originally committed in the clang390-import
project branch):

  Work around LLVM PR30879, which is about a bad interaction between
  X86 Call Frame Optimization on i386 and libunwind, by disallowing the
  optimization for i386-freebsd12.

  This should fix some instances of broken exception handling when
  frame pointers are omitted, in particular some unittests run during
  the build of editors/libreoffice.

  This hack will be removed as soon as upstream has implemented a more
  permanent fix for this problem.

And indeed, after r345018 and r345019, which updated LLVM libunwind to
the most recent version, the above workaround is no longer needed.  The
upstream commit which fixed this is:

  https://llvm.org/viewvc/llvm-project?view=revision&revision=292723

Specifically, 32 bit (i386-freebsd) executables optimized with omitted
frame pointers and Call Frame Optimization should now behave correctly
when a C++ exception is thrown, and the stack is unwound.

Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=30879
PR: 236062

MFC r345152:

Merge llvm, clang, compiler-rt, libc++, libunwind, lld, and lldb
release_80 branch r356034 (effectively, 8.0.0 rc5), resolve conflicts,
and bump version numbers.

PR: 236062

MFC r345231:

Add LLVM openmp trunk r351319 (just before the release_80 branch point)
to contrib/llvm.  This is not yet connected to the build, the glue for
that will come in a follow-up commit.

PR: 236062

MFC r345232:

Bootstrap svn:mergeinfo on contrib/openmp.

PR: 236062

MFC r345233:

Merge openmp release_80 branch r356034 (effectively, 8.0.0 rc5).

PR: 236062

MFC r345234:

Add openmp __kmp_gettid() wrapper, using pthread_getthreadid_np(3).
This has also been submitted upstream.

PR:           236062

MFC r345283:

Enable building libomp.so for 32-bit x86.  This is done by selectively
enabling the functions that save and restore MXCSR, since access to this
register requires SSE support.

Note that you may run into other issues with OpenMP on i386, since this
*not* yet supported upstream, and certainly not extensively tested.

PR: 236062, 236582

MFC r345345:

Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
8.0.0 final release r356365.  There were no functional changes since the
most recent merge, of 8.0.0 rc5.

Release notes for llvm, clang, lld and libc++ 8.0.0 are now available:

https://llvm.org/releases/8.0.0/docs/ReleaseNotes.html
https://llvm.org/releases/8.0.0/tools/clang/docs/ReleaseNotes.html
https://llvm.org/releases/8.0.0/tools/lld/docs/ReleaseNotes.html
https://llvm.org/releases/8.0.0/projects/libcxx/docs/ReleaseNotes.html

PR: 236062

MFC r345349:

Pull in r352826 from upstream lld trunk (by Fangrui Song):

  [ELF] Support --{,no-}allow-shlib-undefined

  Summary:
  In ld.bfd/gold, --no-allow-shlib-undefined is the default when
  linking an executable. This patch implements a check to error on
  undefined symbols in a shared object, if all of its DT_NEEDED entries
  are seen.

  Our approach resembles the one used in gold, achieves a good balance
  to be useful but not too smart (ld.bfd traces all DSOs and emulates
  the behavior of a dynamic linker to catch more cases).

  The error is issued based on the symbol table, different from
  undefined reference errors issued for relocations. It is most
  effective when there are DSOs that were not linked with -z defs (e.g.
  when static sanitizers runtime is used).

  gold has a comment that some system libraries on GNU/Linux may have
  spurious undefined references and thus system libraries should be
  excluded (https://sourceware.org/bugzilla/show_bug.cgi?id=6811). The
  story may have changed now but we make --allow-shlib-undefined the
  default for now. Its interaction with -shared can be discussed in the
  future.

  Reviewers: ruiu, grimar, pcc, espindola

  Reviewed By: ruiu

  Subscribers: joerg, emaste, arichardson, llvm-commits

  Differential Revision: https://reviews.llvm.org/D57385

Pull in r352943 from upstream lld trunk (by Fangrui Song):

  [ELF] Default to --no-allow-shlib-undefined for executables

  Summary:
  This follows the ld.bfd/gold behavior.

  The error check is useful as it captures a common type of ld.so
  undefined symbol errors as link-time errors:

      // a.cc => a.so (not linked with -z defs)
      void f(); // f is undefined
      void g() { f(); }

      // b.cc => executable with a DT_NEEDED entry on a.so
      void g();
      int main() { g(); }

      // ld.so errors when g() is executed (lazy binding) or when the program is started (-z now)
      // symbol lookup error: ... undefined symbol: f

  Reviewers: ruiu, grimar, pcc, espindola

  Reviewed By: ruiu

  Subscribers: llvm-commits, emaste, arichardson

  Tags: #llvm

  Differential Revision: https://reviews.llvm.org/D57569

Together, these add support for --no-allow-shlib-undefined, and make it
the default for executables, so they will fail to link if any symbols
from needed shared libraries are undefined.

Reported by: jbeich
PR: 236062, 236141

MFC r345449:

Pull in r356809 from upstream llvm trunk (by Eli Friedman):

  [ARM] Don't form "ands" when it isn't scheduled correctly.

  In r322972/r323136, the iteration here was changed to catch cases at
  the beginning of a basic block... but we accidentally deleted an
  important safety check.  Restore that check to the way it was.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=41116

  Differential Revision: https://reviews.llvm.org/D59680

This should fix "Assertion failed: (LiveCPSR && "CPSR liveness tracking
is wrong!"), function UpdateCPSRUse" errors when building the devel/xwpe
port for armv7.

PR: 236062, 236568

5 years agoMFC r345805: Unify SCSI_STATUS_BUSY retry handling with other cases.
mav [Tue, 16 Apr 2019 18:32:07 +0000 (18:32 +0000)]
MFC r345805: Unify SCSI_STATUS_BUSY retry handling with other cases.

 - Do not retry if periph was invalidated.
 - Do not decrement retry_count if already zero.
 - Report action_string when applicable.

5 years agoMFC r346064:
kib [Tue, 16 Apr 2019 17:56:53 +0000 (17:56 +0000)]
MFC r346064:
Fix dirty buf exhaustion easily triggered with msdosfs.

5 years agoMFC r345425, r345514, r345799, r345800, r345803, r346157:
kib [Tue, 16 Apr 2019 17:43:14 +0000 (17:43 +0000)]
MFC r345425, r345514, r345799, r345800, r345803, r346157:
Enable tmpfs rw->ro remounts.

5 years agoRelease notes documentation:
gjb [Tue, 16 Apr 2019 17:12:27 +0000 (17:12 +0000)]
Release notes documentation:
- r336449, setproctitle_fast(3) addition.
- r337418, kqueue(2) allow EVFILT_TIMER updates.
- r338405, pthread_get_name_np(3) addition.
- r339857, ddb(4) option to print process arguments added.
- r340182, ichwd(4) support for Lewisburg PCH TCO watchdog timer.
- r341828, ZFS vnode reclaimation deadlock fixed.
- r342206, lagg(4) allow changing MTU without destroying interface.
- r342656, x86 MSI IRQs are now tunable.
- r343084, jail(8) IDs printed when logging a process exit.
- r344399, zfsloader functionality now part of loader(8).
- r344399, loader(8) GELI support extended to all architectures.
- r344403, efi guess console device/type if not defined.
- r345040, ccr(4) driver addition.
- r345981, random(4) reseeding performance improvements.

Add Klara Systems, Modirum MDPay, and Panzura to the sponsors
file, sort, and remove random blank lines.

Sponsored by: The FreeBSD Foundation

5 years agoRelease notes documentation:
gjb [Tue, 16 Apr 2019 14:29:12 +0000 (14:29 +0000)]
Release notes documentation:
- r335640, pcap(3) 1.9.0 (pre-release).
- r338452, lastlogin(8) libxo(3) support.
- r338475, traceroute(8) capsicum support.
- r338707, pthread(3) POSIX compliance improvements.
- r339446, jail(8) allow.read_msgbuf parameter addition.
- r340369, TP-Link TL-WN321G uses run(4) instead of rum(4).
- r340963, makewhatis(1) do not operate on read-only directories.
- r341790, jail(8) '-e <parameter>' flag added.
- r342254, vt(4) uk.macbook.kbd keymap addition.
- r343118, trim(8) utility added.

Keep sorted by revision number.

Sponsored by: The FreeBSD Foundation

5 years agoMFC: r345818, r345828
rmacklem [Tue, 16 Apr 2019 02:38:39 +0000 (02:38 +0000)]
MFC: r345818, r345828
Fix a race in the RPCSEC_GSS server code that caused crashes.

When a new client structure was allocated, it was added to the list
so that it was visible to other threads before the expiry time was
initialized, with only a single reference count.
The caller would increment the reference count, but it was possible
for another thread to decrement the reference count to zero and free
the structure before the caller incremented the reference count.
This could occur because the expiry time was still set to zero when
the new client structure was inserted in the list and the list was
unlocked.

This patch fixes the race by initializing the reference count to two
and initializing all fields, including the expiry time, before inserting
it in the list.

5 years agoMFC r345644,r346061:
ngie [Tue, 16 Apr 2019 01:03:32 +0000 (01:03 +0000)]
MFC r345644,r346061:

r345644 (by olivier):

Skip this test if if_tap module is not available

PR: 236842

r346061:

Polish netmap(4) testcases a bit

1. Not all kernels have netmap(4) support. Check for netmap(4) support before
   attempting to run the tests via the `PLAIN_REQUIRE_KERNEL_MODULE(..)` macro.
2. Libraries shouldn't be added to LDFLAGS; they should be added to LIBADD
   instead. This allows the build system to evaluate dependencies for sanity.
3. Sort some of the Makefile variables per bsd.README.

1., in particular, will resolve failures when running this testcase on kernels
lacking netmap(4) support, e.g., the i386 GENERIC kernels on ^/stable/11 and
^/stable/12.

PR: 237129

5 years agoMFC r330760: Add new opcodes and statuses from NVMe 1.3a.
mav [Mon, 15 Apr 2019 17:54:40 +0000 (17:54 +0000)]
MFC r330760: Add new opcodes and statuses from NVMe 1.3a.

5 years agoMFC part of r334200:
mav [Mon, 15 Apr 2019 16:57:27 +0000 (16:57 +0000)]
MFC part of r334200:
 - Add missing nvme_notify_fail_consumers() call on controller detach.

With nvd(4) driver fixes merged it should now handle detach properly.
The rest of r334200 seems too invasive and depending to be MFC'd.

5 years agoMFC r344736 (by imp): Add ABORTED_BY_REQUEST to the list of things we look
mav [Mon, 15 Apr 2019 16:29:47 +0000 (16:29 +0000)]
MFC r344736 (by imp): Add ABORTED_BY_REQUEST to the list of things we look
at DNR bit and tell why to comment (code already does this)

5 years agoMFC r344642 (by imp):
mav [Mon, 15 Apr 2019 16:28:25 +0000 (16:28 +0000)]
MFC r344642 (by imp):
Unconditionally support unmapped BIOs. This was another shim for
supporting older kernels. However, all supported versions of FreeBSD
have unmapped I/Os (as do several that have gone EOL), remove it. It's
unlikely the driver would work on the older kernels anyway at this
point.

5 years agoMFC r344640 (by imp):
mav [Mon, 15 Apr 2019 16:27:53 +0000 (16:27 +0000)]
MFC r344640 (by imp):
Remove #ifdef code to support FreeBSD versions that haven't been
supported in years. A number of changes have been made to the driver
that likely wouldn't work on those older versions that aren't properly
ifdef'd and it's project policy to GC such code once it is stale.

5 years agoMFC r342862 (by chuck): Add NVMe drive to NOIOB quirk list
mav [Mon, 15 Apr 2019 16:27:06 +0000 (16:27 +0000)]
MFC r342862 (by chuck): Add NVMe drive to NOIOB quirk list

Dell-branded Intel P4600 NVMe drives benefit from NVMe 1.3's NOIOB
feature. Unfortunately just like Intel DC P4500s, they don't advertise
themselves as benefiting from this...

This changes adds P4600s to the existing list of old drives which
benefit from striping.

5 years agoMFC r340481 (by imp): Remove do-nothing nvme_modevent.
mav [Mon, 15 Apr 2019 16:25:00 +0000 (16:25 +0000)]
MFC r340481 (by imp): Remove do-nothing nvme_modevent.

nvme_modevent no longer does anything interesting, remove it.

5 years agoMFC r340412: Use atomic_load_acq_int() here too to poll done, ala r328521
mav [Mon, 15 Apr 2019 16:24:26 +0000 (16:24 +0000)]
MFC r340412: Use atomic_load_acq_int() here too to poll done, ala r328521

5 years agoMFC r339775: Put a workaround in for command timeout malfunctioning
mav [Mon, 15 Apr 2019 16:23:57 +0000 (16:23 +0000)]
MFC r339775: Put a workaround in for command timeout malfunctioning

At least one NVMe drive has a bug that makeing the Command Time Out
PCIe feature unreliable. The workaround is to disable this
feature. The driver wouldn't deal correctly with a timeout anyway.
Only do this for drives that are known bad.

5 years agoMFC r337273 (by jhibbits):
mav [Mon, 15 Apr 2019 15:35:42 +0000 (15:35 +0000)]
MFC r337273 (by jhibbits):
nvme(4): Add bus_dmamap_sync() at the end of the request path

Summary:
Some architectures, in this case powerpc64, need explicit synchronization
barriers vs device accesses.

Prior to this change, when running 'make buildworld -j72' on a 18-core
(72-thread) POWER9, I would see controller resets often.  With this change, I
don't see these resets messages, though another tester still does, for yet to be
determined reasons, so this may not be a complete fix.  Additionally, I see a
~5-10% speed up in buildworld times, likely due to not needing to reset the
controller.

5 years agoMFC r346038:
kib [Mon, 15 Apr 2019 13:12:54 +0000 (13:12 +0000)]
MFC r346038:
Exercise some care before sending SIGHUP to mountd.

5 years agoMFC r346031:
kib [Mon, 15 Apr 2019 13:11:51 +0000 (13:11 +0000)]
MFC r346031:
Handle races when remounting UFS volume from ro to rw.

5 years agoMFC of 345758
mckusick [Mon, 15 Apr 2019 12:09:58 +0000 (12:09 +0000)]
MFC of 345758

Properly flush outstanding I/Os when forcibly deleteing a memory disk device.

Sponsored by: Netflix

5 years agoMFC r345264:
ae [Sun, 14 Apr 2019 12:39:09 +0000 (12:39 +0000)]
MFC r345264:
  Add NAT64 CLAT implementation as defined in RFC6877.

  CLAT is customer-side translator that algorithmically translates 1:1
  private IPv4 addresses to global IPv6 addresses, and vice versa.
  It is implemented as part of ipfw_nat64 kernel module. When module
  is loaded or compiled into the kernel, it registers "nat64clat" external
  action. External action named instance can be created using `create`
  command and then used in ipfw rules. The create command accepts two
  IPv6 prefixes `plat_prefix` and `clat_prefix`. If plat_prefix is ommitted,
  IPv6 NAT64 Well-Known prefix 64:ff9b::/96 will be used.

    # ipfw nat64clat CLAT create clat_prefix SRC_PFX plat_prefix DST_PFX
    # ipfw add nat64clat CLAT ip4 from IPv4_PFX to any out
    # ipfw add nat64clat CLAT ip6 from DST_PFX to SRC_PFX in

  Obtained from: Yandex LLC
  Submitted by: Boris N. Lytochkin
  Relnotes: yes
  Sponsored by: Yandex LLC

5 years agoMFC r345263:
ae [Sun, 14 Apr 2019 12:35:58 +0000 (12:35 +0000)]
MFC r345263:
  Add SPDX-License-Identifier and update year in copyright.

5 years agoMFC r345262:
ae [Sun, 14 Apr 2019 12:34:30 +0000 (12:34 +0000)]
MFC r345262:
  Modify struct nat64_config.

  Add second IPv6 prefix to generic config structure and rename another
  fields to conform to RFC6877. Now it contains two prefixes and length:
  PLAT is provider-side translator that translates N:1 global IPv6 addresses
  to global IPv4 addresses. CLAT is customer-side translator (XLAT) that
  algorithmically translates 1:1 IPv4 addresses to global IPv6 addresses.
  Use PLAT prefix in stateless (nat64stl) and stateful (nat64lsn)
  translators.

  Modify nat64_extract_ip4() and nat64_embed_ip4() functions to accept
  prefix length and use plat_plen to specify prefix length.

  Retire net.inet.ip.fw.nat64_allow_private sysctl variable.
  Add NAT64_ALLOW_PRIVATE flag and use "allow_private" config option to
  configure this ability separately for each NAT64 instance.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

5 years agoMFC r339542:
ae [Sun, 14 Apr 2019 12:28:41 +0000 (12:28 +0000)]
MFC r339542:
  Retire IPFIREWALL_NAT64_DIRECT_OUTPUT kernel option. And add ability
  to switch the output method in run-time. Also document some sysctl
  variables that can by changed for NAT64 module.

  NAT64 had compile time option IPFIREWALL_NAT64_DIRECT_OUTPUT to use
  if_output directly from nat64 module. By default is used netisr based
  output method. Now both methods can be used, but they require different
  handling by rules.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D16647

5 years agoMFC r344709 (by ygy):
ae [Sun, 14 Apr 2019 12:14:25 +0000 (12:14 +0000)]
MFC r344709 (by ygy):
  Fix typos and caps for ipfw(8) man page.

  PR: 236030
  Submitted by: olgeni

5 years agoMFC r344665 (by trhodes):
ae [Sun, 14 Apr 2019 12:10:23 +0000 (12:10 +0000)]
MFC r344665 (by trhodes):
  Grammar tweaks in ipfw manual page.

5 years agoMFC r341471:
ae [Sun, 14 Apr 2019 12:05:08 +0000 (12:05 +0000)]
MFC r341471:
  Reimplement how net.inet.ip.fw.dyn_keep_states works.

  Turning on of this feature allows to keep dynamic states when parent
  rule is deleted. But it works only when the default rule is
  "allow from any to any".

  Now when rule with dynamic opcode is going to be deleted, and
  net.inet.ip.fw.dyn_keep_states is enabled, existing states will reference
  named objects corresponding to this rule, and also reference the rule.
  And when ipfw_dyn_lookup_state() will find state for deleted parent rule,
  it will return the pointer to the deleted rule, that is still valid.
  This implementation doesn't support O_LIMIT_PARENT rules.

  The refcnt field was added to struct ip_fw to keep reference, also
  next pointer added to be able iterate rules and not damage the content
  when deleted rules are chained.

  Named objects are referenced only when states are going to be deleted to
  be able reuse kidx of named objects when new parent rules will be
  installed.

  ipfw_dyn_get_count() function was modified and now it also looks into
  dynamic states and constructs maps of existing named objects. This is
  needed to correctly export orphaned states into userland.

  ipfw_free_rule() was changed to be global, since now dynamic state can
  free rule, when it is expired and references counters becomes 1.

  External actions subsystem also modified, since external actions can be
  deregisterd and instances can be destroyed. In these cases deleted rules,
  that are referenced by orphaned states, must be modified to prevent access
  to freed memory. ipfw_dyn_reset_eaction(), ipfw_reset_eaction_instance()
  functions added for these purposes.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D17532

MFC r341472:
  Add ability to request listing and deleting only for dynamic states.

  This can be useful, when net.inet.ip.fw.dyn_keep_states is enabled, but
  after rules reloading some state must be deleted. Added new flag '-D'
  for such purpose.

  Retire '-e' flag, since there can not be expired states in the meaning
  that this flag historically had.

  Also add "verbose" mode for listing of dynamic states, it can be enabled
  with '-v' flag and adds additional information to states list. This can
  be useful for debugging.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

MFC r344018:
  Remove `set' field from state structure and use set from parent rule.

  Initially it was introduced because parent rule pointer could be freed,
  and rule's information could become inaccessible. In r341471 this was
  changed. And now we don't need this information, and also it can become
  stale. E.g. rule can be moved from one set to another. This can lead
  to parent's set and state's set will not match. In this case it is
  possible that static rule will be freed, but dynamic state will not.
  This can happen when `ipfw delete set N` command is used to delete
  rules, that were moved to another set.
  To fix the problem we will use the set number from parent rule.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

MFC r344870:
  Fix the problem with O_LIMIT states introduced in r344018.

  dyn_install_state() uses `rule` pointer when it creates state.
  For O_LIMIT states this pointer actually is not struct ip_fw,
  it is pointer to O_LIMIT_PARENT state, that keeps actual pointer
  to ip_fw parent rule. Thus we need to cache rule id and number
  before calling dyn_get_parent_state(), so we can use them later
  when the `rule` pointer is overrided.

  PR: 236292

5 years agoMFC r340792 (by ygy):
ae [Sun, 14 Apr 2019 11:52:00 +0000 (11:52 +0000)]
MFC r340792 (by ygy):
  Fix a minor typo in ipfw(8) manual page.

  PR: 230747
  Submitted by: f.toscan@hotmail.it

5 years agoMFC r340717 (by ygy):
ae [Sun, 14 Apr 2019 11:50:07 +0000 (11:50 +0000)]
MFC r340717 (by ygy):
  Fix incorrect DSCP value range from 0..64 to 0..63.

  PR: 232786
  Submitted by: Sergey Akhmatov <sergey@akhmatov.ru>

5 years agoMFC r342908:
ae [Sun, 14 Apr 2019 11:06:42 +0000 (11:06 +0000)]
MFC r342908:
  Reduce the size of struct ip_fw_args from 240 to 128 bytes on amd64.
  And refactor the code to avoid unneeded initialization to reduce overhead
  of per-packet processing.

  ipfw(4) can be invoked by pfil(9) framework for each packet several times.
  Each call uses on-stack variable of type struct ip_fw_args to keep the
  state of ipfw(4) processing. Currently this variable has 240 bytes size
  on amd64.  Each time ipfw(4) does bzero() on it, and then it initializes
  some fields.

  glebius@ has reported that they at Netflix discovered, that initialization
  of this variable produces significant overhead on packet processing.
  After patching I managed to increase performance of packet processing on
  simple routing with ipfw(4) firewalling to about 11% from 9.8Mpps up to
  11Mpps (Xeon E5-2660 v4@ + Mellanox 100G card).

  Introduced new field flags, it is used to keep track of what fields was
  initialized. Some fields were moved into the anonymous union, to reduce
  the size. They all are mutually exclusive. dummypar field was unused, and
  therefore it is removed.  The hopstore6 field type was changed from
  sockaddr_in6 to a bit smaller struct ip_fw_nh6. And now the size of struct
  ip_fw_args is 128 bytes.

  ipfw_chk() was modified to properly handle ip_fw_args.flags instead of
  rely on checking for NULL pointers.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D18690

MFC r342909:
  Fix the build with INVARIANTS.

MFC r343551:
  Fix the bug introduced in r342908, that causes problems with dynamic
  handling for protocols without ports numbers.

  Since port numbers were uninitialized for protocols like ICMP/ICMPv6,
  ipfw_chk() used some non-zero values to create dynamic states, and due
  this it failed to match replies with created states.

  Reported by: Oliver Hartmann, Boris Lytochkin
  Obtained from: Yandex LLC

5 years agoMFC r344755 (by fsu@)
pfg [Sat, 13 Apr 2019 20:49:16 +0000 (20:49 +0000)]
MFC r344755 (by fsu@)
Fix integer overflow possibility.

Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert
of Fraunhofer FKIE
Reported as:    FS-2-EXT2-1: Out-of-Bounds Write in nmount (ext2_vget)
Reviewed by:    pfg
MFC after:      1 week

Differential Revision:    https://reviews.freebsd.org/D19326

5 years agoMFC r345450:
ae [Sat, 13 Apr 2019 09:06:36 +0000 (09:06 +0000)]
MFC r345450:
  Add ability to automatically load ipfw_nat64, ipfw_nptv6 and ipfw_pmod

  modules by declaring corresponding variables in rc.conf. Also document
  them in rc.conf(5).

  Submitted by: Dries Michiels
  Differential Revision: https://reviews.freebsd.org/D19673

MFC r345985:
  Add firewall_[nat64|nptv6|pmod]_enable variables to /etc/defaults/rc.conf

5 years agoFix some grammar nits.
gjb [Sat, 13 Apr 2019 00:54:56 +0000 (00:54 +0000)]
Fix some grammar nits.

Submitted by: adamw
Sponsored by: The FreeBSD Foundation

5 years agoRelease notes documentation:
gjb [Fri, 12 Apr 2019 19:05:47 +0000 (19:05 +0000)]
Release notes documentation:
- r336040, jail(8) name support for cpuset(1), sockstat(1), ipfw(8),
           and ugidfw(8).
- r336328, newfs_msdos(8) '-T' (timestamp) option added.
- r337461, ipfw(8) new rule options added.
- r338364, dd(1) status=progress support.
- r338451, last(1) libxo(3) support.
- r339160, diff(1) '-B' and '--ignore-blank-lines' support.
- r341758, bhyve(8) support for NumLock, ScrollLock and keypad keys.
- r342706, ktrdump(8) '-l' (live) support.
- r343538, newfs(8) and tunefs(8) support for '_' in label names.
- r343251, gzip(1) '-l' xz(1) support.
- r344020, pfctl(8) reference to net.pf.request_maxcount if a table
           definition fails.
- r344490, fdisk(8) support for sectors larger than 2048 bytes.
- r344052, newfs(8) and tunefs(8) support for '-' in label names.
- r345561, sh(1) '-o pipefail'.
- r345878, patch(1) exit successfully if fed a 0-length patch.

Remove a stray entry leftover from 11.2-RELEASE.

Sponsored by: The FreeBSD Foundation

5 years agoRelease notes documentation:
gjb [Fri, 12 Apr 2019 19:05:46 +0000 (19:05 +0000)]
Release notes documentation:
- r340611, rc.initdiskless support for auxiliary RAM.
- r340966, rcorder(8) rc.resume support.
- r341792, jail.conf(5) definition moved in rc.d/jail script.
- r341794, 340.noid periodic(8) no longer decends to jail(8)s.
- r342103, PATH now set in system crontab(5).
- r343046, rc_service addition to rc.subr(8).
- r343469, devd.conf(5) update to prevent duplicate hostapd(8)
           and wpa_supplicant(8) startup.

Sponsored by: The FreeBSD Foundation

5 years agoRelease notes documentation:
gjb [Fri, 12 Apr 2019 19:05:44 +0000 (19:05 +0000)]
Release notes documentation:
- r334607, xz(1) 5.2.4.
- r337817, WPA 2.6.
- r337827, file(1) 5.34.
- r338414, ELF Tool Chain r3614.
- r338795, libarchive(3) 3.3.3.
- r339100, lld '-z interpose' support added.
- r343079, file(1) dumpdate reporting fix.
- r344213, clang (and related) 7.0.1.
- r344220, lualoader merged.
- r344604, OpenSSL 1.0.2r.
- r344884, ntpd 4.2.8p13.
- r345670, tzdata 2019a.

Sponsored by: The FreeBSD Foundation

5 years agoBump copyright year.
gjb [Fri, 12 Apr 2019 19:05:43 +0000 (19:05 +0000)]
Bump copyright year.

Sponsored by: The FreeBSD Foundation

5 years agoPrune release notes entries from 11.2-RELEASE.
gjb [Fri, 12 Apr 2019 19:05:42 +0000 (19:05 +0000)]
Prune release notes entries from 11.2-RELEASE.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r345703:
kib [Fri, 12 Apr 2019 15:15:27 +0000 (15:15 +0000)]
MFC r345703:
Fix initial exec TLS mode for dynamically loaded shared objects.

5 years agoMFC r345955:
kib [Fri, 12 Apr 2019 15:02:30 +0000 (15:02 +0000)]
MFC r345955:
vn_vmap_seekhole(): align running offset to the block boundary.

5 years agoMFC r345647:
delphij [Fri, 12 Apr 2019 02:27:03 +0000 (02:27 +0000)]
MFC r345647:

Distinguish between lseek errors and read errores.

5 years agoMFC r344936: MFV/ZoL: Disable LBA weighting on files and SSDs
mav [Thu, 11 Apr 2019 13:21:10 +0000 (13:21 +0000)]
MFC r344936: MFV/ZoL: Disable LBA weighting on files and SSDs

The LBA weighting makes sense on rotational media where the outer tracks
have twice the bandwidth of the inner tracks. However, it is detrimental
on nonrotational media such as solid state disks, where the only effect
is to ensure that metaslabs enter the best-fit allocation behavior
sooner, which is detrimental to performance. It also makes no sense on
files where the underlying filesystem can arrange things however it
wants.

Author: Richard Yao <ryao@gentoo.org>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3712
zfsonlinux/zfs@fb40095f5f0853946f8150481ca22602d1334dfe

To reduce code divergence this merge replaces equivalent but different
FreeBSD code detecting non-rotating medium vdevs.

5 years agoMFC r344934, r345014: Add separate aggregation limit for non-rotating media.
mav [Thu, 11 Apr 2019 13:19:46 +0000 (13:19 +0000)]
MFC r344934, r345014: Add separate aggregation limit for non-rotating media.

Before sequential scrub patches ZFS never aggregated I/Os above 128KB.
Sequential scrub bumped that to 1MB, which motivation I understand for
spinning disks, since it should reduce number of head seeks.  But for
SSDs it makes much less sense to me, especially on FreeBSD, where due
to MAXPHYS limitation device will likely still see bunch of 128KB I/Os
instead of one large.  Having more strict aggregation limit allows to
avoid allocation of large memory buffer and memcpy to/from it, that is
a serious problem when bandwidth reaches few GB/s.

Sponsored by:   iXsystems, Inc.

5 years agoMFC r344926:
mav [Thu, 11 Apr 2019 13:18:09 +0000 (13:18 +0000)]
MFC r344926:
MFV/ZoL: Fix zfs_vdev_aggregation_limit bounds checking

Update the bounds checking for zfs_vdev_aggregation_limit so that
it has a floor of zero and a maximum value of the supported block
size for the pool.

Additionally add an early return when zfs_vdev_aggregation_limit
equals zero to disable aggregation.  For very fast solid state or
memory devices it may be more expensive to perform the aggregation
than to issue the IO immediately.

Author: Brian Behlendorf <behlendorf1@llnl.gov>
zfsonlinux/zfs@a58df6f53687ac6d1dee21f60de41b2552a43201

MFV/ZoL: Cap maximum aggregate IO size

Commit 8542ef8 allowed optional IOs to be aggregated beyond
the specified aggregation limit.  Since the aggregation limit
was also used to enforce the maximum block size, setting
`zfs_vdev_aggregation_limit=16777216` could result in an
attempt to allocate an ABD larger than 16M.

Author: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #6259
Closes #6270
zfsonlinux/zfs@2d678f779aba26a93314c8ee1142c3985fa25cb6

5 years agoMFC r345850: Fix typos in r345849.
mav [Thu, 11 Apr 2019 13:12:43 +0000 (13:12 +0000)]
MFC r345850: Fix typos in r345849.

5 years agoMFC r345849: List few more ATA commands.
mav [Thu, 11 Apr 2019 13:11:45 +0000 (13:11 +0000)]
MFC r345849: List few more ATA commands.

5 years agoMFC r345497:
mm [Wed, 10 Apr 2019 21:46:06 +0000 (21:46 +0000)]
MFC r345497:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1153: fixed 2 bugs in ZIP reader [1]
  PR #1143: ensure archive_read_disk_entry_from_file() uses ARCHIVE_READ_DISK
  Changes to file flags code, support more file flags on FreeBSD:
    UF_OFFLINE, UF_READONLY, UF_SPARSE, UF_REPARSE, UF_SYSTEM
    UF_ARCHIVE is not supported by intention (yet)

PR: 236300 [1]

5 years agoMFC r345847:
kib [Wed, 10 Apr 2019 10:50:48 +0000 (10:50 +0000)]
MFC r345847:
msdosfs: zero tail of the last block on truncation for VREG vnodes as well.

5 years agoMFC r345512: Correct contradictory information on default syslog logging
grembo [Tue, 9 Apr 2019 12:28:12 +0000 (12:28 +0000)]
MFC r345512: Correct contradictory information on default syslog logging
priority.

5 years agoMFC r344161: stand: dev_net: correct net_open's interpretation of params
kevans [Mon, 8 Apr 2019 18:38:18 +0000 (18:38 +0000)]
MFC r344161: stand: dev_net: correct net_open's interpretation of params

net_open previously casted the first vararg to a char * and this was
half-OK: at first, it is passed to netif_open, which would cast it back to
the struct devdesc * that it really is and use it properly. It is then
strdup()d and used as the netdev_name, which is objectively wrong.

Correct it so that the first vararg is properly casted to a struct devdesc *
and the netdev_name gets set properly to make it more clear at a glance that
it's not doing something horribly wrong.

5 years agoMFC r345680: NOTES: Use non-default value for BOOT_TAG
kevans [Mon, 8 Apr 2019 18:36:47 +0000 (18:36 +0000)]
MFC r345680: NOTES: Use non-default value for BOOT_TAG

5 years agoMFC r343240: iwm(4): Fix possible null pointer indirection
kevans [Mon, 8 Apr 2019 17:55:04 +0000 (17:55 +0000)]
MFC r343240: iwm(4): Fix possible null pointer indirection

5 years agoAdd _PC_ACL_* to vop_stdpathconf
sjg [Mon, 8 Apr 2019 15:52:13 +0000 (15:52 +0000)]
Add _PC_ACL_* to vop_stdpathconf

This avoid EINVAL from tmpfs etc.

Merge of r345024

Reviewed by:    kib
Differential Revision:  https://reviews.freebsd.org/D19512

5 years agoMFC r345763:
ae [Mon, 8 Apr 2019 11:54:45 +0000 (11:54 +0000)]
MFC r345763:
  Correct a port number assignment.

  PR: 236930

5 years agoMFC r345741:
jah [Sun, 7 Apr 2019 19:08:07 +0000 (19:08 +0000)]
MFC r345741:

freebsd32: fix padding of computed control message length for recvmsg()

Each control message region must be aligned on a 4-byte boundary on 32-bit
architectures. The 32-bit compat shim for recvmsg() gets the actual layout
right, but doesn't pad the payload length when computing msg_controllen for
the output message header. If a control message contains an unaligned
payload, such as the 1-byte TTL field in the example attached to PR 236737,
this can produce control message payload boundaries that extend beyond
the boundary reported by msg_controllen.

PR: 236737

5 years agoMFC r345754:
avos [Sun, 7 Apr 2019 13:26:45 +0000 (13:26 +0000)]
MFC r345754:
run(4): properly set F_DATAPAD radiotap flag if frame has padding between
frame header and data.

This will fix 'Mysterious OLPC stuff' for received frames and wrong
CCMP / TKIP / data decoding for transmitted frames in net/wireshark
dissector.

While here, drop unneeded comment - net80211 handles padding requirements
for Tx & Rx without driver adjustment.

Was tested with D-Link DWA-140 rev B3, STA mode.