]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoFix declaration.
oshogbo [Sun, 15 Jul 2018 17:31:50 +0000 (17:31 +0000)]
Fix declaration.

5 years agoUse capsicum helpers in fstype and ctld.
oshogbo [Sun, 15 Jul 2018 17:21:19 +0000 (17:21 +0000)]
Use capsicum helpers in fstype and ctld.

Reviewed by: trasz

5 years agoExtend amount of possible coredumps from 10 to 100000 when using index format.
oshogbo [Sun, 15 Jul 2018 17:10:12 +0000 (17:10 +0000)]
Extend amount of possible coredumps from 10 to 100000 when using index format.
The amount of digits in the name of corefile is assigned dynamically.

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

5 years agosh: Don't use padvance() for MAIL/MAILPATH
jilles [Sun, 15 Jul 2018 09:14:30 +0000 (09:14 +0000)]
sh: Don't use padvance() for MAIL/MAILPATH

Using padvance() requires undoing its append of '/' and prevents adjusting
its '%' logic to allow most directories with '%' in PATH.

No functional change is intended.

5 years agoUse EF_SEG_READ_STRING instead of EF_SEG_READ when reading strings.
imp [Sun, 15 Jul 2018 05:29:39 +0000 (05:29 +0000)]
Use EF_SEG_READ_STRING instead of EF_SEG_READ when reading strings.

Normally, we can get away with just reading the 1k buffer for the
string, since the placement of the data is generally no where near the
end of the file. However, it's possible that the string is within the
last 1k of the file, in which case the read will fail, and we'll not
produce the proper records needed for devmatch to work. By reading
using EF_SEG_READ_STRING, we automatically work around these problems
while still retaining safety.

This fix a problem with devmatch where we wouldn't load certain
modules (like ums). This didn't always happen (my tree didn't exhibit
it, while nathan's did because his optimization options were more
agressive).

Reported by: nathanw@

5 years agoacquire inp lock around ip6_pcbopt to fix IPV6_TCLASS panic
mmacy [Sun, 15 Jul 2018 00:47:06 +0000 (00:47 +0000)]
acquire inp lock around ip6_pcbopt to fix IPV6_TCLASS panic

Simple fix to address panics relating to setting IPV6_TCLASS
with setsockopt(). The premise of this change is that it is
ok to call malloc with M_NOWAIT while holding a lock on the
in6p.

If it later turns out that it is not ok, then major surgery
will be required, as ip6_setpktopt() will have to be fixed
(as it also calls malloc with M_NOWAIT) which pulls in the
ip6_pcbopts(), ip6_setpktopts(), ip6_setpktopt() call chain.

Submitted by: Jason Eggnet
Reviewed by: rrs, transport, sbruno
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D16201

5 years agoepoch_test: fix compile
mmacy [Sun, 15 Jul 2018 00:31:17 +0000 (00:31 +0000)]
epoch_test: fix compile

- update to new interface

Reported by: manu

5 years agomsun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd
mmacy [Sun, 15 Jul 2018 00:23:10 +0000 (00:23 +0000)]
msun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd

This corresponds to the latest status (hasn't changed in 9+
years) from openbsd of ld80/ld128 powl, and source cpowf, cpow,
cpowl (the complex power functions for float complex, double
complex, and long double complex) which are required for C99
compliance and were missing from FreeBSD. Also required for
some numerical codes using complex numbered Hamiltonians.

Thanks to jhb for tracking down the issue with making
weak_reference compile on powerpc.

When asked to review, bde said "I don't like it" - but
provided no actionable feedback or superior implementations.

Discussed with: jhb
Submitted by: jmd
Differential Revision: https://reviews.freebsd.org/D15919

5 years agoThere was quite a bit of feedback on r336282 that has led to the
sbruno [Sat, 14 Jul 2018 23:53:51 +0000 (23:53 +0000)]
There was quite a bit of feedback on r336282 that has led to the
submitter to want to revert it.

5 years agopf tests: Basic synproxy test
kp [Sat, 14 Jul 2018 21:32:32 +0000 (21:32 +0000)]
pf tests: Basic synproxy test

A very basic syncproxy test: set up a connection via a synproxy rule.
This triggeres the panic fixed in r336273.

5 years agoInvalidate the mapping before updating its physical address.
alc [Sat, 14 Jul 2018 20:14:00 +0000 (20:14 +0000)]
Invalidate the mapping before updating its physical address.

Doing so ensures that all threads sharing the pmap have a consistent
view of the mapping.  This fixes the problem described in the commit
log message for r329254 without the overhead of an extra page fault
in the common case.  (Now that all pmap_enter() implementations are
similarly modified, the workaround added in r329254 can be removed,
reducing the overhead of COW faults.)

With this change we can reuse the PV entry from the old mapping,
potentially avoiding a call to reclaim_pv_chunk().  Otherwise, there is
nothing preventing the old PV entry from being reclaimed.  In rare
cases this could result in the PTE's page table page being freed,
leading to a use-after-free of the page when the updated PTE is written
following the allocation of the PV entry for the new mapping.

Reviewed by: br, markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D16261

5 years agoReturn the intended return code.
tuexen [Sat, 14 Jul 2018 19:53:41 +0000 (19:53 +0000)]
Return the intended return code.

This bug was spotted by markj@ in D16268 because I copied this code part
and used it there. So fix it.

Sponsored by: Netflix, Inc.

5 years agoFix the pNFS client when mirrors aren't on the same machine.
rmacklem [Sat, 14 Jul 2018 19:51:44 +0000 (19:51 +0000)]
Fix the pNFS client when mirrors aren't on the same machine.

Without this patch, the client side NFSv4.1 pNFS code erroneously did writes
and commits to both DS mirrors using the TCP connection of the first one.
For my test setup this worked, since I have both DSs running on the same
machine, but it would have failed when the DSs are on separate machines.
This patch fixes the code to use the correct TCP connection for each DS.
This patch should only affect the NFSv4.1 client when using "pnfs" mounts
to mirrored DSs.

MFC after: 2 weeks

5 years agoFix shebangs and execute bit of test scripts.
tuexen [Sat, 14 Jul 2018 19:49:14 +0000 (19:49 +0000)]
Fix shebangs and execute bit of test scripts.

Since we don't have /usr/bin/ksh, use a generic way of specifying
ksh. Some of the tests only run with ksh93, so use this shell
for these tests. Two of the tests don't have the execute bit set,
so fix this, too.

Reviewed by: markj@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16270

5 years agoCorrect some typos.
alc [Sat, 14 Jul 2018 19:35:41 +0000 (19:35 +0000)]
Correct some typos.

Reviewed by: kib

5 years agoAdd mpo_vnode_check_setmode MAC method to MAC/veriexec.
stevek [Sat, 14 Jul 2018 17:21:16 +0000 (17:21 +0000)]
Add mpo_vnode_check_setmode MAC method to MAC/veriexec.
In the method, disallow changing SUID/SGID on verified files.

Obtained from: Juniper Networks, Inc.

5 years agoAdd support for pmap_enter(..., psind=1) to the i386 pmap. In other words,
alc [Sat, 14 Jul 2018 17:20:27 +0000 (17:20 +0000)]
Add support for pmap_enter(..., psind=1) to the i386 pmap.  In other words,
add support for explicitly requesting that pmap_enter() create a 2 or 4 MB
page mapping.  (Essentially, this feature allows the machine-independent
layer to create superpage mappings preemptively, and not wait for automatic
promotion to occur.)

Export pmap_ps_enabled() to the machine-independent layer.

Add a flag to pmap_pv_insert_pde() that specifies whether it should fail or
reclaim a PV entry when one is not available.

Refactor pmap_enter_pde() into two functions, one by the same name, that is
a general-purpose function for creating PDE PG_PS mappings, and another,
pmap_enter_4mpage(), that is used to prefault 2 or 4 MB read- and/or
execute-only mappings for execve(2), mmap(2), and shmat(2).

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D16246

5 years agoAdd config(8) options that can be used to enable building MAC/veriexec
stevek [Sat, 14 Jul 2018 17:18:17 +0000 (17:18 +0000)]
Add config(8) options that can be used to enable building MAC/veriexec
and its fingerprint modules into a kernel.

Reviewed by: sjg

5 years agoFix a typo which could cause a build breakage when building with MAC/veriexec
stevek [Sat, 14 Jul 2018 17:15:28 +0000 (17:15 +0000)]
Fix a typo which could cause a build breakage when building with MAC/veriexec
enabled in the kernel config.

Remove unused mac_veriexec_print_db prototype in internal header file.

5 years agoAdd support for TCP state names used by Solaris.
tuexen [Sat, 14 Jul 2018 17:12:04 +0000 (17:12 +0000)]
Add support for TCP state names used by Solaris.

For compatibility, add the TCP state names used by Solaris
and given in the Dtrace Guide available at
https://docs.oracle.com/cd/E37838_01/html/E61035/glhgu.html#OSDTGglhmv

Reviewed by: markj@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16269

5 years agoRemove RIPEMD-160 fingerprint modules for veriexec, since it has very
stevek [Sat, 14 Jul 2018 16:59:17 +0000 (16:59 +0000)]
Remove RIPEMD-160 fingerprint modules for veriexec, since it has very
little practical use and would not be recommended for anyone to use in
a production environment.

Reviewed by: sjg

5 years agoEliminate an unused var warning-error; the var is used only when parsing
ian [Sat, 14 Jul 2018 16:33:11 +0000 (16:33 +0000)]
Eliminate an unused var warning-error; the var is used only when parsing
linux-style boot args, so wrap it in the appropriate ifdef.

5 years agoFixup memory management for fetching options in ip_ctloutput()
sbruno [Sat, 14 Jul 2018 16:19:46 +0000 (16:19 +0000)]
Fixup memory management for fetching options in ip_ctloutput()

Submitted by: Jason Eggleston <jason@eggnet.com>
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14621

5 years agoFix vnic fallback PHY name matching after r334880.
markj [Sat, 14 Jul 2018 16:06:53 +0000 (16:06 +0000)]
Fix vnic fallback PHY name matching after r334880.

In some cases it seems that the PHY mode can only be identified by
matching against the corresponding device node name in the FDT.  r334880
broke this for the case where the node name contains a unit address.
Fix the problem by allowing a match in that case.

Reviewed by: andrew, sbruno
Tested by: sbruno
Differential Revision: https://reviews.freebsd.org/D16259

5 years agoffs_syncvnode: Remove unhelpful print
cem [Sat, 14 Jul 2018 15:45:11 +0000 (15:45 +0000)]
ffs_syncvnode: Remove unhelpful print

It can occur during ordinary use of softupdates, or perhaps if writes to the
underlying media fail (causing bufs to be redirtied).  Either way, it is not
particularly actionable.

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

5 years agopf: Fix synproxy
kp [Sat, 14 Jul 2018 10:14:59 +0000 (10:14 +0000)]
pf: Fix synproxy

Synproxy was accidentally broken by r335569. The 'return (action)' must be
executed for every non-PF_PASS result, but the error packet (TCP RST or ICMP
error) should only be sent if the packet was dropped (i.e. PF_DROP) and the
return flag is set.

PR: 229477
Submitted by: Andre Albsmeier <mail AT fbsd.e4m.org>
MFC after: 1 week

5 years agoregex/engine.c: error: variable 'dp' set but not used
tsoome [Sat, 14 Jul 2018 09:29:45 +0000 (09:29 +0000)]
regex/engine.c: error: variable 'dp' set but not used

The issue found with gcc6 build (originally on illumos, confirmed on FreeBSD).
Mark it __unused.

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

5 years agopf: Fix panic on vnet jail shutdown with synproxy
kp [Sat, 14 Jul 2018 09:11:32 +0000 (09:11 +0000)]
pf: Fix panic on vnet jail shutdown with synproxy

When shutting down a vnet jail pf_shutdown() clears the remaining states, which
through pf_clear_states() calls pf_unlink_state().
For synproxy states pf_unlink_state() will send a TCP RST, which eventually
tries to schedule the pf swi in pf_send(). This means we can't remove the
software interrupt until after pf_shutdown().

MFC after: 1 week

5 years agoMinor adjustments:
imp [Sat, 14 Jul 2018 06:43:37 +0000 (06:43 +0000)]
Minor adjustments:

o Fix the parsing of the device path. a last minute change terminated
  it too soon.
o Kill setting LINES. We don't need to do it, and even if we did hard
  coding it to 24 is wrong.
o Now that the console is working again for the loader, adjust the
  printfs to be more in line with other platforms.

5 years agoAdd reporting of whether or not a keyboard is detected. In addition,
imp [Sat, 14 Jul 2018 01:46:19 +0000 (01:46 +0000)]
Add reporting of whether or not a keyboard is detected. In addition,
note that r336270's commit message was slightly incorrect. It changed
the default setting of the console to honor the ConOut
variable. Overrides via the command line are still possible, and we
use the devices in ConOut to set the proper console. If, for example,
serial cosnole is specified, we'll set console to "efi" if ConOut has
a serial port list and to either "efi comconsole" or "comconsole efi"
if not depending on whether -D or -D -h was specified.

RelNotes: Yes
Sponsored by: Netflix

5 years agouefi stand: Guess the console better
imp [Sat, 14 Jul 2018 00:40:38 +0000 (00:40 +0000)]
uefi stand: Guess the console better

For server machines, ComOut is set to the set of devices that the efi
console suppots. Parse it to see if we have serial, video or both.
Make that take precidence over the command line args. boot1.efi parses
them, but loader.efi doesn't. It's not clear where to read boot.conf
from, so we don't do that. The command line args can still be set via
efibootmgr, which is more inline with the UEFI boot manager to replace
that. These args are typically used only to set serial vs video and
the com speed line. We can infer that from ComOut, so do so.
Remember the com speed and hw.uart.console to match.

RelNotes: yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D15917

5 years agoOCF: Add a typedef for session identifiers
cem [Fri, 13 Jul 2018 23:46:07 +0000 (23:46 +0000)]
OCF: Add a typedef for session identifiers

No functional change.

This should ease the transition from an integer session identifier model to
an opaque pointer model.

5 years agoRe-unbreak smartpqi(4) GCC build
cem [Fri, 13 Jul 2018 22:49:48 +0000 (22:49 +0000)]
Re-unbreak smartpqi(4) GCC build

Like r333085, remove redundant declarations.

Redundant declarations were re-introduced in r336201.

Sponsored by: Dell EMC Isilon

5 years agolockmgr: tidy up slock/sunlock similar to other locks
mjg [Fri, 13 Jul 2018 22:40:14 +0000 (22:40 +0000)]
lockmgr: tidy up slock/sunlock similar to other locks

5 years agoDefine ADR subtype of ACPI type for a device path.
imp [Fri, 13 Jul 2018 21:03:32 +0000 (21:03 +0000)]
Define ADR subtype of ACPI type for a device path.

5 years agoUse the existing MSR_BIOS_SIGN on AMD.
markj [Fri, 13 Jul 2018 20:56:20 +0000 (20:56 +0000)]
Use the existing MSR_BIOS_SIGN on AMD.

Reported by: kib
Sponsored by: The FreeBSD Foundation

5 years agoFix machdep_boot.c
imp [Fri, 13 Jul 2018 20:33:10 +0000 (20:33 +0000)]
Fix machdep_boot.c

A last minute change made this no longer compile. Pass the right arg
and eliminate now-unused variables from the code.

5 years agoCatch up to the inflate renaming.
imp [Fri, 13 Jul 2018 20:08:18 +0000 (20:08 +0000)]
Catch up to the inflate renaming.

5 years agoClose down the TCP connection to a pNFS DS when it is disabled.
rmacklem [Fri, 13 Jul 2018 20:03:05 +0000 (20:03 +0000)]
Close down the TCP connection to a pNFS DS when it is disabled.

So long as the TCP connection to a pNFS DS isn't shared with other DSs,
it can be closed down when the DS is being disabled in the pNFS client.
This causes any RPCs in progress to fail.
This patch only affects the NFSv4.1 pNFS client when errors occur
while doing I/O on a DS.

MFC after: 2 weeks

5 years agoEnable UART support for Xilinx Ultrascale+ SoCs
mw [Fri, 13 Jul 2018 19:54:22 +0000 (19:54 +0000)]
Enable UART support for Xilinx Ultrascale+ SoCs

Xilinx Ultrascale+ are based on Cortex-A53 and use existing
UART driver (uart_dev_cdnc). Enable it in arm64 GENERIC config.

Submitted by: Michal Stanek <mst@semihalf.com>
Obtained from: Semihalf

5 years agoUse the name added in r336257.
markj [Fri, 13 Jul 2018 19:45:12 +0000 (19:45 +0000)]
Use the name added in r336257.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoDefine the MSR used to fetch the current microcode patch level on AMD.
markj [Fri, 13 Jul 2018 19:42:59 +0000 (19:42 +0000)]
Define the MSR used to fetch the current microcode patch level on AMD.

It is defined in the AMD family 17h register reference.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoFix glitched indentation (and rewrap as needed due to deeper indent).
ian [Fri, 13 Jul 2018 18:58:37 +0000 (18:58 +0000)]
Fix glitched indentation (and rewrap as needed due to deeper indent).
No functional changes.

Reported by: rpokala@

5 years agog_eli_key_cmp is used only in the kernel, so only define it in the
imp [Fri, 13 Jul 2018 18:21:38 +0000 (18:21 +0000)]
g_eli_key_cmp is used only in the kernel, so only define it in the
kernel.

5 years agoUse if rather than case for a simple boolean. gcc thinks blks is
imp [Fri, 13 Jul 2018 18:19:33 +0000 (18:19 +0000)]
Use if rather than case for a simple boolean. gcc thinks blks is
undefined sometimes with the case, but enc is always 0 or 1, so
and if / else is better anyway.

5 years agoAdd missing include of sys/boot.h
imp [Fri, 13 Jul 2018 18:00:13 +0000 (18:00 +0000)]
Add missing include of sys/boot.h

5 years agoExtend loader(8) geli support to all architectures and all disk-like devices.
ian [Fri, 13 Jul 2018 17:50:25 +0000 (17:50 +0000)]
Extend loader(8) geli support to all architectures and all disk-like devices.

This moves the bulk of the geli support from lib386/biosdisk.c into a new
geli/gelidev.c which implements a devsw-type device whose dv_strategy()
function handles geli decryption. Support for all arches comes from moving
the taste-and-attach code to the devopen() function in libsa.

After opening any DEVT_DISK device, devopen() calls the new function
geli_probe_and_attach(), which will "attach" the geli code to the open_file
struct by creating a geli_devdesc instance to replace the disk_devdesc
instance in the open_file. That routes all IO for the device through the
geli code.

A new public geli_add_key() function is added, to allow arch/vendor-specific
code to add keys obtained from custom hardware or other sources.

With these changes, geli support will be compiled into all variations of
loader(8) on all arches because the default is WITH_LOADER_GELI.

Relnotes: yes
Sponsored by: Microchip Technology Inc
Differential Revision: https://reviews.freebsd.org/D15743

5 years agoUse C99 initializers for instances of struct apic_enumerator.
markj [Fri, 13 Jul 2018 17:42:48 +0000 (17:42 +0000)]
Use C99 initializers for instances of struct apic_enumerator.

MFC after: 3 days

5 years agoThere's two files in the sys tree named inflate.c, in addition
imp [Fri, 13 Jul 2018 17:41:28 +0000 (17:41 +0000)]
There's two files in the sys tree named inflate.c, in addition
to it being a common name elsewhere. Rename the old kzip one
to subr_inflate.c.

This actually fixes the build issues on sparc64 that my inclusion of
.PATH ${SYSDIR}/kern created in r336244, so also revert the broken
workaround I committed in r336249.

This slipped passed me because apparently, I never did a clean build.

5 years agoFix sparc64 builds
imp [Fri, 13 Jul 2018 17:15:14 +0000 (17:15 +0000)]
Fix sparc64 builds

gcc is complaining about struct infate being defined in a parameter
list. It's inclear how long this has been broken, but the fix is
simple enough.

5 years agoInvalidate the mapping before updating its physical address.
alc [Fri, 13 Jul 2018 17:12:50 +0000 (17:12 +0000)]
Invalidate the mapping before updating its physical address.

Doing so ensures that all threads sharing the pmap have a consistent
view of the mapping.  This fixes the problem described in the commit
log message for r329254 without the overhead of an extra fault in the
common case.  (Once the riscv pmap_enter() implementation is similarly
modified, the workaround added in r329254 can be removed, reducing the
overhead of CoW faults.)

See also r335784 for amd64.  The mips implementation of pmap_enter()
already reused the PV entry from the old mapping.

Reviewed by: kib, markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D16199

5 years agoTransition to boot_env_to_howto and boot_howto_to_env in the boot
imp [Fri, 13 Jul 2018 16:43:29 +0000 (16:43 +0000)]
Transition to boot_env_to_howto and boot_howto_to_env in the boot
loader.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16205

5 years agoEliminate boot loader copies of boot arg parsing.
imp [Fri, 13 Jul 2018 16:43:23 +0000 (16:43 +0000)]
Eliminate boot loader copies of boot arg parsing.

Eliminate 4 of the copies of the arg parsing in /boot/laoder
by using boot_parse_cmdline.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16205

5 years agoUse boot_parse_* to parse command line args and retire cut-n-paste
imp [Fri, 13 Jul 2018 16:43:17 +0000 (16:43 +0000)]
Use boot_parse_* to parse command line args and retire cut-n-paste
code that was substantially identical.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16205

5 years agoCreate helper functions for parsing boot args.
imp [Fri, 13 Jul 2018 16:43:05 +0000 (16:43 +0000)]
Create helper functions for parsing boot args.

boot_parse_arg to parse a single arg
boot_parse_cmdline to parse a command line string
boot_parse_args to parse all the args in a vector
boot_howto_to_env Convert howto bits to env vars
boot_env_to_howto Return howto mask mased on what's set in the environment.

All these routines return an int that's the bitmask of the args
translated to RB_* flags. As a special case, the 'S' flag sets the
comconsole_speed env var. Any arg that looks like a=b will set the env
key 'a' to value 'b'. If =b is omitted, 'a' is set to '1'.  This
should help us reduce the number of redundant copies of these routines
in the tree.  It should also give a more uniform experience between
platforms.

Also, invent a new flag RB_PROBE that's set when 'P' is parsed.  On
x86 + BIOS, this means 'probe for the keyboard, and if it's not there
set both RB_MULTIPLE and RB_SERIAL (which means show the output on
both video and serial consoles, but make serial primary).  Others it
may be some similar concept of probing, but it's loader dependent
what, exactly, it means.

These routines are suitable for /boot/loader and/or the kernel,
though they may not be suitable for the tightly hand-rolled-for-space
environments like boot2.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16205

5 years agoMake generated scripts executable.
ian [Fri, 13 Jul 2018 16:37:42 +0000 (16:37 +0000)]
Make generated scripts executable.

5 years agoMore little fixes... fix a function name typo (eps vs esp), and cope with
ian [Fri, 13 Jul 2018 16:33:21 +0000 (16:33 +0000)]
More little fixes... fix a function name typo (eps vs esp), and cope with
newer versions of gpart that show mbr efi partition types with the name
'efi' rather than as '!239'.

5 years agoRevert r336240, which contained unrelated changes accidentally committed.
ian [Fri, 13 Jul 2018 16:32:31 +0000 (16:32 +0000)]
Revert r336240, which contained unrelated changes accidentally committed.

5 years agoMore little fixes... fix a function name typo (eps vs esp), and cope with
ian [Fri, 13 Jul 2018 16:30:54 +0000 (16:30 +0000)]
More little fixes... fix a function name typo (eps vs esp), and cope with
newer versions of gpart that show mbr efi partition types with the name
'efi' rather than as '!239'.

5 years agoChange the pNFS client so that it does not report an NFSERR_STALE from
rmacklem [Fri, 13 Jul 2018 12:39:27 +0000 (12:39 +0000)]
Change the pNFS client so that it does not report an NFSERR_STALE from
an I/O attempt on a DS to the server via LayoutReturn.

The current FreeBSD client can generate these errors for an operational
DS while doing a recovery of a mirror after a mirrored DS has been repaired.
I am not sure why these errors occur, but my best current guess is a race
between the Layout Recall issued by the kernel code run from pnfsdscopymr(8)
and a Read operation on the DS for the file bing copied.
The errrors are not fatal, since the client falls back on doing I/O through
the MDS, which can do the I/O successfully as a proxy. (The fact that the
MDS can do this indicates that the file does still exist on the functioning
DS.)
This patch only affects behaviour of the pNFS client and only when using
Flexible File layouts.

MFC after: 2 weeks

5 years agoRound down the location of execpathp to slightly improve copyout speed.
brooks [Fri, 13 Jul 2018 11:32:27 +0000 (11:32 +0000)]
Round down the location of execpathp to slightly improve copyout speed.

In practice, this moves the padding from below the canary to above
execpathp has no impact on stack consumption.

Submitted by: Wuyang-Chung (via github pull request #159)
MFC after: 1 week

5 years agogeom_gate: enable resize
trociny [Fri, 13 Jul 2018 07:08:06 +0000 (07:08 +0000)]
geom_gate: enable resize

Reviewed By: pjd
Approved By: pjd
Differential Revision: https://reviews.freebsd.org/D11531

5 years agoDetect and handle invalid number of FATs
delphij [Fri, 13 Jul 2018 02:02:16 +0000 (02:02 +0000)]
Detect and handle invalid number of FATs

If the number of FATs field in the boot sector is zero, give
an appropriate error code.

Obtained from: Android https://android.googlesource.com/platform/external/fsck_msdos/+/6c29bbe8d58e6fe8755935a04166ecf82ff31f47%5E%21/
MFC after: 2 weeks

5 years agofd: stop passing M_ZERO to uma_zalloc
mjg [Thu, 12 Jul 2018 22:48:18 +0000 (22:48 +0000)]
fd: stop passing M_ZERO to uma_zalloc

The optimisation seen with malloc cannot be used here as zone sizes are
now known at compilation. Thus bzero by hand to get the optimisation
instead.

5 years agouma: whack main zone counter update in the slow path, freeing side
mjg [Thu, 12 Jul 2018 22:35:52 +0000 (22:35 +0000)]
uma: whack main zone counter update in the slow path, freeing side

See r333052.

5 years agosx: remove the spurious macro value difference vs rwlocks
mjg [Thu, 12 Jul 2018 22:34:40 +0000 (22:34 +0000)]
sx: remove the spurious macro value difference vs rwlocks

No functional changes.

5 years agoModify the NFSv4.1 pNFS client to use separate TCP connections for DSs.
rmacklem [Thu, 12 Jul 2018 20:46:22 +0000 (20:46 +0000)]
Modify the NFSv4.1 pNFS client to use separate TCP connections for DSs.

Without this patch, the NFSv4.1 pNFS client shared a single TCP connection
for all DSs that resided on the same machine. This made disabling one of
the DSs impossible. Although unlikely, it is possible that the storage
subsystem has failed in such a way that the storage for one DS on a machine
is no longer functioning correctly, but the storage used by another DS on
the same machine is still ok. For this case, it would be nice if a system
can fail one of the DSs without failing them all.
This patch changes the default behaviour to use separate TCP connections
for each DS even if they reside on the same machine.
I do not believe that this will be a problem for extant pNFS servers, but
a sysctl can be set to restore the old behaviour if this change causes a
problem for an extant pNFS server.
This patch only affects the NFSv4.1 pNFS client.

MFC after: 2 weeks

5 years agoPull in r336008 from upstream clang trunk:
dim [Thu, 12 Jul 2018 19:02:59 +0000 (19:02 +0000)]
Pull in r336008 from upstream clang trunk:

  Request init/fini array on FreeBSD 12 and later

  Summary:

  It seems a bad idea to change the default in the middle of a release
  branch due to possible changes in global ctor / dtor ordering between
  .ctors and .init_array. With FreeBSD 11.0's release imminent lets
  change the default now for FreeBSD 12 (the current development
  stream) and later.

  FreeBSD rtld has supported .init_array / .fini_array for many years.
  As of Jan 1 2017 all supported FreeBSD releases and branches will
  have support.

  Reviewers: dim, brooks, arichardson

  Reviewed By: dim, brooks, arichardson

  Subscribers: bsdjhb, krytarowski, emaste, cfe-commits

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

Requested by: jhb
MFC after: 3 days

5 years agoPass the right sizes to malloc() and realloc().
markj [Thu, 12 Jul 2018 18:48:53 +0000 (18:48 +0000)]
Pass the right sizes to malloc() and realloc().

Reported by: scan-build, via Mark Millard
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D16180

5 years agoAdd PCI IDs for AMD X370 AHCI and XHCI.
markj [Thu, 12 Jul 2018 18:44:00 +0000 (18:44 +0000)]
Add PCI IDs for AMD X370 AHCI and XHCI.

Submitted by: Greg V <greg@unrelenting.technology>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D15398

5 years agopf: Fix typo in r336221
kp [Thu, 12 Jul 2018 18:07:28 +0000 (18:07 +0000)]
pf: Fix typo in r336221

Reported by: olivier@

5 years agoixl(4): Set baudrate on link up using proper link_speed variable
erj [Thu, 12 Jul 2018 17:42:36 +0000 (17:42 +0000)]
ixl(4): Set baudrate on link up using proper link_speed variable

And remove old, now-completely unused link_speed variable.

Reported by: Jacob Keller <jacob.e.keller@intel.com>
MFC after: 1 month

5 years agoWee fix: $dev is passed in to the function with the /dev prefix already in
ian [Thu, 12 Jul 2018 17:22:25 +0000 (17:22 +0000)]
Wee fix: $dev is passed in to the function with the /dev prefix already in
place, don't add it.

5 years agopf: Increate default state table size
kp [Thu, 12 Jul 2018 16:35:35 +0000 (16:35 +0000)]
pf: Increate default state table size

The typical system now has a lot more memory than when pf was new, and is also
expected to handle more connections. Increase the default size of the state
table.
Note that users can overrule this using 'set limit states' in pf.conf.

From OpenBSD:
    The year is 2018.
    Mercury, Bowie, Cash, Motorola and DEC all left us.
    Just pf still has a default state table limit of 10000.
    Had! Now it's a tiny little bit more, 100k.
    lead guitar: me
    ok chorus: phessler theo claudio benno
    background school girl laughing: bob

Obtained from: OpenBSD

5 years agoFix an obvious 'is odd' check.
imp [Thu, 12 Jul 2018 16:19:17 +0000 (16:19 +0000)]
Fix an obvious 'is odd' check.

len % 1 is always true. Fix StrHexToBytes to do a proper odd length
check. This was only called by DevPathFromTextGenericPath,
ConvertFromTextVendor and DevPathFromTextMAC, which we've not had
a need to actually use just yet.

Submitted by: David Binderman
PR: 229718

5 years agoUse correct size when we are allocating array for skipto index.
ae [Thu, 12 Jul 2018 11:38:18 +0000 (11:38 +0000)]
Use correct size when we are allocating array for skipto index.

Also, there is no need to use M_ZERO for idxmap_back. It will be
re-filled just after allocation in update_skipto_cache().

PR: 229665
MFC after: 1 week

5 years agokern_environment: Give the static environment a chance to disable MD env
kevans [Thu, 12 Jul 2018 02:51:50 +0000 (02:51 +0000)]
kern_environment: Give the static environment a chance to disable MD env

This variable has been given the name "loader_env.disabled" as it's the
primary way most people will have an MD environment. This restores the
previously-default behavior of ignoring the loader(8) environment, which may
be useful for vendor distributions or other scenarios where inheriting the
loader environment may be considered a security issue or potentially
breaking of a more locked-down environment.

As the change to config(5) indicates, disabling the loader environment
should not be a choice made lightly since it may provide ACPI hints and
other useful things that the system can rely on to boot.

An UPDATING entry has been added to mention an upgrade path for those that
may have relied on the previous behavior.

Discussed with: bde
Relnotes: yes (maybe)

5 years agoActually build and install the spigen.4 manpage.
ian [Wed, 11 Jul 2018 23:59:04 +0000 (23:59 +0000)]
Actually build and install the spigen.4 manpage.

5 years agoIgnore the cookie verifier for NFSv4.1 when the cookie is 0.
rmacklem [Wed, 11 Jul 2018 23:23:29 +0000 (23:23 +0000)]
Ignore the cookie verifier for NFSv4.1 when the cookie is 0.

RFC5661 states that the cookie verifier should be 0 when the cookie is 0.
However, the wording is somewhat unclear and a recent discussion on the
nfsv4@ietf.org mailing list indicated that the NFSv4 server should ignore
the cookie verifier's value when the dirctory offset cookie is 0.
This patch deletes the check for this that would return NFSERR_BAD_COOKIE
when the verifier was not 0.
This was found during testing of the ESXi client against the NFSv4.1 server.

Reported by: daniel@ftml.net (via packet trace)
MFC after: 2 weeks

5 years agoAdd various spi devices to NOTES. Add some required options for building
ian [Wed, 11 Jul 2018 22:23:50 +0000 (22:23 +0000)]
Add various spi devices to NOTES.  Add some required options for building
the cqspi and n25q drivers.

5 years agoSmall refactor of install-boot
imp [Wed, 11 Jul 2018 21:53:04 +0000 (21:53 +0000)]
Small refactor of install-boot

Use newfs_msdos to create the filesystem for the partition requested
and use loader.efi instead of boot1.efi.

5 years agoDon't acquire evclass_lock with a spinlock held
asomers [Wed, 11 Jul 2018 19:38:42 +0000 (19:38 +0000)]
Don't acquire evclass_lock with a spinlock held

When the "pc" audit class is enabled and auditd is running, witness will
panic during thread exit because au_event_class tries to lock an rwlock
while holding a spinlock acquired upstack by thread_exit.

To fix this, move AUDIT_SYSCALL_EXIT futher upstack, before the spinlock is
acquired. Of thread_exit's 16 callers, it's only necessary to call
AUDIT_SYSCALL_EXIT from two, exit1 (for exiting processes) and kern_thr_exit
(for exiting threads). The other callers are all kernel threads, which
needen't call AUDIT_SYSCALL_EXIT because since they can't make syscalls
there will be nothing to audit.  And exit1 already does call
AUDIT_SYSCALL_EXIT, making the second call in thread_exit redundant for that
case.

PR: 228444
Reported by: aniketp
Reviewed by: aniketp, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16210

5 years agoMFV r324714:
cy [Wed, 11 Jul 2018 18:53:18 +0000 (18:53 +0000)]
MFV r324714:

Update wpa 2.5 --> 2.6.

MFC after: 1 month

5 years agoEnhancements and fixes for the spigen(4) driver...
ian [Wed, 11 Jul 2018 17:54:41 +0000 (17:54 +0000)]
Enhancements and fixes for the spigen(4) driver...

- Resources used by spigen_mmap_single() are now tracked using
  devfs_set_cdevpriv() rather than in the softc.

- Since resources are now tracked per-open-fd, there is no need to try to
  impose any exclusive-open logic, so flags related to that are removed.

- Flags used to track open status to prevent detach() when the device is
  open are replaced with calls to device_busy()/device_unbusy().  That
  extends the protection up the hierarchy so that the spibus and hardware
  controller drivers also can't be detached while the device is open/in use.

- Arbitrary limits on the maximum size of a transfer are removed, along with
  the sysctl variables that allowed the limits to be changed.  There is just
  no reason to limit the size of a spi transfer to the machine's page size.
  Or to any other arbitrary value, really.

- Most of the locking is removed.  It was mostly protecting access to flags
  and fields in the softc that no longer exist.  The locking that remains is
  just to prevent concurrent calls to device_[un]busy().

- The code was calling malloc() with M_WAITOK while holding a mutex in
  several places.  Since most of the locking is gone, that's fixed.

5 years agosmartpqi(4):
sbruno [Wed, 11 Jul 2018 16:44:14 +0000 (16:44 +0000)]
smartpqi(4):
 - Update to release "3"

Submitted by: Deepak Ukey <deepak.ukey@microsemi.com>
Reviewed by: mav
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16060

5 years agoRemove a duplicate check.
markj [Wed, 11 Jul 2018 14:54:56 +0000 (14:54 +0000)]
Remove a duplicate check.

PR: 229663
Submitted by: David Binderman <dcb314@hotmail.com>
MFC after: 3 days

5 years agoTweak ports(7) manual page to better explain the basics.
trasz [Wed, 11 Jul 2018 13:53:44 +0000 (13:53 +0000)]
Tweak ports(7) manual page to better explain the basics.

Reviewed by: allanjude@ (earlier version)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16149

5 years agoMake dhclient(8) verify if new MTU (option 26) differs from current one and skip...
eugen [Wed, 11 Jul 2018 09:41:50 +0000 (09:41 +0000)]
Make dhclient(8) verify if new MTU (option 26) differs from current one and skip unneeded MTU change.
This check eliminates infinite loop of MTU change / link flap / lease verification / MTU change / link flap etc.
in case of some NIC drivers like em(4) or igb(4).

N.B.: obsolete u_int16_t is used in consistency with the rest of the file.

PR: 229432
Approved by: mav (mentor)
MFC after: 1 week

5 years agoImprove bhyve exit(3) error code.
araujo [Wed, 11 Jul 2018 03:23:09 +0000 (03:23 +0000)]
Improve bhyve exit(3) error code.

The bhyve(8) exit status indicates how the VM was terminated:

0 rebooted
1 powered off
2 halted
3 triple fault

The problem is when we have wrappers around bhyve that parses the exit
error code and gets an exit(1) for an error but interprets it as "powered off".
So to mitigate this issue and makes it less error prone for third part
applications, I have added a new exit code 4 that is "exited due to an error".

For now the bhyve(8) exit status are:
0 rebooted
1 powered off
2 halted
3 triple fault
4 exited due to an error

Reviewed by: @jhb
MFC after: 2 weeks.
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D16161

5 years agorun(4): Add a new USB device ID.
bwidawsk [Wed, 11 Jul 2018 02:32:06 +0000 (02:32 +0000)]
run(4): Add a new USB device ID.

Summary:
Add the device id of the Panda Wireless PAU06 which seems to be
the already-supported combination of RT5392 MAC and RF RT5372
radio.

Reviewed By: allanjude, eadler, jhb
Approved By: jhb
Differential Revision: https://reviews.freebsd.org/D16211

5 years agoAddress some (although not all) style(9) issues in event.h after r335776.
dab [Wed, 11 Jul 2018 02:09:11 +0000 (02:09 +0000)]
Address some (although not all) style(9) issues in event.h after r335776.

Reported by: bde@
MFC after: 1 day
Sponsored by: Dell EMC

5 years agoacpidump(8): Add ACPI LPIT (Low Power Idle Table)
bwidawsk [Wed, 11 Jul 2018 01:37:01 +0000 (01:37 +0000)]
acpidump(8): Add ACPI LPIT (Low Power Idle Table)

The LPIT is the part of the "standardized" way that one can enumerate
various power state information on Intel platforms.

The documentation for this change can be found here:
http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf

Reviewed By: jhb
Approved By: jhb
Differential Revision: https://reviews.freebsd.org/D15931

5 years agonet80211: Fix ifdetach w/o ifattach, small whitespace cleanup
kevans [Tue, 10 Jul 2018 23:30:19 +0000 (23:30 +0000)]
net80211: Fix ifdetach w/o ifattach, small whitespace cleanup

As the comment says, ifdetach might be called during the course of driver
detach if initialization failed. This shouldn't be a total failure, though,
we just have nothing to do there.

This has been modified slightly from Augustin's original commit to move the
bail-out slightly earlier since the ic wouldn't have been added to the
ic list in the first place, and a comment has been added describing when
this might be an issue.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com>
Obtained from: Haiku (e6f6c1b4633532a8ad37c803dc7c65601e5b24ba)

5 years agoUpdate the pnfs(4) man page.
rmacklem [Tue, 10 Jul 2018 22:53:07 +0000 (22:53 +0000)]
Update the pnfs(4) man page.

This is a content change.

5 years agoRemove bits of the old NUMA.
kib [Tue, 10 Jul 2018 22:00:20 +0000 (22:00 +0000)]
Remove bits of the old NUMA.

Remove numactl(1), edit numa(4) to bring it some closer to reality,
provide libc ABI shims for old NUMA syscalls.

Noted and reviewed by: brooks (previous version)
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D16142

5 years agoFix parsing of create-kernel-packages
bdrewery [Tue, 10 Jul 2018 21:20:49 +0000 (21:20 +0000)]
Fix parsing of create-kernel-packages

MFC after: 3 days
Reported by: rene

5 years agoFix up some missed and mis-merges from the sequential scan code
sef [Tue, 10 Jul 2018 20:11:32 +0000 (20:11 +0000)]
Fix up some missed and mis-merges from the sequential scan code
(r334844). Most of the changes involve moving some code around to
reduce conflicts with future merges.  One of the missing changes
included a notification on scrub cancellation.

Approved by: mav
Sponsored by: iXsystems Inc

5 years agoDocument the "-f" option added to pnfsdskill(8) by r336176.
rmacklem [Tue, 10 Jul 2018 18:44:44 +0000 (18:44 +0000)]
Document the "-f" option added to pnfsdskill(8) by r336176.

This is a content change.

5 years agoAdd a "-f" option to pnfsdskill(8) to force disabling of a DS.
rmacklem [Tue, 10 Jul 2018 18:41:16 +0000 (18:41 +0000)]
Add a "-f" option to pnfsdskill(8) to force disabling of a DS.

The pnfsdskill(8) command will normally fail if there is no valid mirror
for the DS to be disabled. However, a system administrator may need to
disable a DS which does not have a valid mirror so that the nfsd threads
can be terminated. This patch adds a "-f" option to pnfsdskill(8) that
uses the kernel changes made by r336141 to implement this "forced" case
of disabling a DS.
This patch only affects the pNFS server.

5 years agoEliminate unnecessary differences between i386's pmap_enter() and amd64's.
alc [Tue, 10 Jul 2018 18:00:55 +0000 (18:00 +0000)]
Eliminate unnecessary differences between i386's pmap_enter() and amd64's.
For example, fully construct the new PTE before entering the critical
section.  This change is a stepping stone to psind == 1 support on i386.

Reviewed by: kib, markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D16188