]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoAdd the ipmon.5 man page.
cy [Thu, 27 Jun 2019 02:43:26 +0000 (02:43 +0000)]
Add the ipmon.5 man page.

PR/238816 initially addressed updates to usage() however the PR has
morphed into a shopping list of updates to usage() and man pages.

PR: 238816 (I added to the list during discussion)
MFC after: 1 week

4 years agoFix a typo.
cy [Thu, 27 Jun 2019 02:42:56 +0000 (02:42 +0000)]
Fix a typo.

PR/238816 initially addressed updates to usage() however it has now
become a shopping list of fixes to ipmon man pages and usage().

PR: 238816
MFC after: 3 days

4 years agolibsecureboot: allow OpenPGP support to be dormant
sjg [Wed, 26 Jun 2019 23:33:32 +0000 (23:33 +0000)]
libsecureboot: allow OpenPGP support to be dormant

Since we can now add OpenPGP trust anchors at runtime,
ensure the latent support is available.

Ensure we do not add duplicate keys to trust store.

Also allow reporting names of trust anchors added/revoked

We only do this for loader and only after initializing trust store.
Thus only changes to initial trust store will be logged.

Reviewed by: stevek
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20700

4 years agoIn get_fpcontext32() and set_fpcontext32(), we can't just use memcpy() to
cognet [Wed, 26 Jun 2019 22:06:40 +0000 (22:06 +0000)]
In get_fpcontext32() and set_fpcontext32(), we can't just use memcpy() to
copy the VFP registers.
arvm7 VFP uses 32 64bits fp registers (but those could be used in pairs to
make 16 128bits registers), while aarch64 uses 32 128bits fp registers, so
we have to copy the value of each register.

4 years agoRevert one of the changes from r349323. Specifically, undo the change
alc [Wed, 26 Jun 2019 21:43:41 +0000 (21:43 +0000)]
Revert one of the changes from r349323.  Specifically, undo the change
that replaced a pmap_invalidate_page() with a dsb(ishst) in
pmap_enter_quick_locked().  Even though this change is in principle
correct, I am seeing occasional, spurious bus errors that are only
reproducible without this pmap_invalidate_page().  (None of adding an
isb, "upgrading" the dsb to wait on loads as well as stores, or
disabling superpage mappings eliminates the bus errors.)  Add an XXX
comment explaining why the pmap_invalidate_page() is being performed.

Discussed with:      andrew, markj

4 years agoEmulate the "TEST r/m{16,32,64}, imm{16,32,32}" instructions (opcode F7H).
rgrimes [Wed, 26 Jun 2019 21:19:43 +0000 (21:19 +0000)]
Emulate the "TEST r/m{16,32,64}, imm{16,32,32}" instructions (opcode F7H).

This adds emulation for:
test r/m16, imm16
test r/m32, imm32
test r/m64, imm32 sign-extended to 64

OpenBSD guests compiled with clang 8.0.0 use TEST directly against a
Local APIC register instead of separate read via MOV followed by a
TEST against the register.

PR: 238794
Submitted by: jhb
Reported by: Jason Tubnor jason@tubnor.net
Tested by: Jason Tubnor jason@tubnor.net
Reviewed by: markj, Patrick Mooney patrick.mooney@joyent.com
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D20755

4 years agoFree DHCP options with length zero.
markj [Wed, 26 Jun 2019 20:19:48 +0000 (20:19 +0000)]
Free DHCP options with length zero.

Otherwise they are leaked, allowing an attacker to trigger memory
exhaustion.

This is options.c rev. 1.70 from OpenBSD.

admbugs: 552
Obtained from: OpenBSD
MFC after: 3 days

4 years agoAvoid a divide-by-zero when bad checksum counters overflow.
markj [Wed, 26 Jun 2019 20:11:52 +0000 (20:11 +0000)]
Avoid a divide-by-zero when bad checksum counters overflow.

A mixture of IP or UDP packets with valid and invalid checksum could
cause {ip,udp}_packets_bad_checksum to wrap around to 0, resulting
in a division by zero.

This is packet.c rev. 1.27 from OpenBSD.

admbugs: 552
Obtained from: OpenBSD
MFC after: 3 days

4 years agofix up r349428, fix a typo made during "fdt" removal
avg [Wed, 26 Jun 2019 17:38:38 +0000 (17:38 +0000)]
fix up r349428, fix a typo made during "fdt" removal

Reported by: ian
MFC after: 11 days

4 years agoAdd a return value to vm_page_remove().
markj [Wed, 26 Jun 2019 17:37:51 +0000 (17:37 +0000)]
Add a return value to vm_page_remove().

Use it to indicate whether the page may be safely freed following
its removal from the object.  Also change vm_page_remove() to assume
that the page's object pointer is non-NULL, and have callers perform
this check instead.

This is a step towards an implementation of an atomic reference counter
for each physical page structure.

Reviewed by: alc, dougm, kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20758

4 years agoowc_gpiobus: clean / fix up the driver module things
avg [Wed, 26 Jun 2019 17:17:33 +0000 (17:17 +0000)]
owc_gpiobus: clean / fix up the driver module things

"fdt" is removed from the driver module name as the driver does not
require FDT and can work very well on hints based systems.

A module dependency is added for gpiobus.  Without that owc cannot
resolve symbols in gpiobus if both are loaded as kernel modules.

Finally, a driver module module version is added.

Reviewed by: imp
MFC after: 11 days

4 years agoamd64 pmap: Fix pkru handling in pmap_remove().
kib [Wed, 26 Jun 2019 17:16:26 +0000 (17:16 +0000)]
amd64 pmap: Fix pkru handling in pmap_remove().

When pmap_pkru_on_remove() is called, the sva argument value was
advanced.  Clear PKRU earlier when sva still specifies the start of
the region.

Noted and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 years agoFix debugging of 32bits arm binaries on arm64.
cognet [Wed, 26 Jun 2019 16:56:56 +0000 (16:56 +0000)]
Fix debugging of 32bits arm binaries on arm64.

In set_regs32()/fill_regs32(), we have to get/set SP and LR from/to
tf_x[13] and tf_x[14].
set_regs() and fill_regs() may be called for a 32bits process, if the process
is ptrace'd from a 64bits debugger. So, in set_regs() and fill_regs(), get
or set PC and SPSR from where the debugger expects it, from tf_x[15] and
tf_x[16].

4 years agolibdwarf: Use the cached strtab pointer when reading string attributes.
markj [Wed, 26 Jun 2019 16:38:30 +0000 (16:38 +0000)]
libdwarf: Use the cached strtab pointer when reading string attributes.

Previously we would perform a linear search of the DWARF section
list for ".debug_str".  However, libdwarf always caches a pointer to
the strtab image in its debug descriptor.  Using it gives a modest
performance improvement when iterating over the attributes of each
DIE.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20759

4 years agoelfcopy: Provide a size hint when creating the section string table.
markj [Wed, 26 Jun 2019 16:35:37 +0000 (16:35 +0000)]
elfcopy: Provide a size hint when creating the section string table.

Use the input file's .shstrtab size as the hint if it exists.  This
gives a small performance improvement when processing files with
many sections.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20544

4 years agolibelftc: Fix the documented prototype for elftc_string_table_destroy().
markj [Wed, 26 Jun 2019 16:32:41 +0000 (16:32 +0000)]
libelftc: Fix the documented prototype for elftc_string_table_destroy().

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agolibelftc: Consistently use size_t for string table offsets and sizes.
markj [Wed, 26 Jun 2019 16:31:50 +0000 (16:31 +0000)]
libelftc: Consistently use size_t for string table offsets and sizes.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20702

4 years agolibelftc: Micro-optimize string table insertion.
markj [Wed, 26 Jun 2019 16:30:14 +0000 (16:30 +0000)]
libelftc: Micro-optimize string table insertion.

The string's length is already known, so use memcpy() instead of
strcpy() to add it to the string table image.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20760

4 years agoRemove references to splbio in ffs_softdep.c.
markj [Wed, 26 Jun 2019 16:28:42 +0000 (16:28 +0000)]
Remove references to splbio in ffs_softdep.c.

Assert that the per-mountpoint softdep mutex is held in modified
functions that do not already have this assertion.  No functional
change intended.

Reviewed by: kib, mckusick (previous version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20741

4 years agoFix qlxgbe(4) static build.
mav [Wed, 26 Jun 2019 16:23:24 +0000 (16:23 +0000)]
Fix qlxgbe(4) static build.

MFC after: 2 weeks

4 years agoUse rtld_putstr() instead of write() for the rtld msg() macro
arichardson [Wed, 26 Jun 2019 15:43:26 +0000 (15:43 +0000)]
Use rtld_putstr() instead of write() for the rtld msg() macro

This removes an unnecessary libc dependency from rtld.
See https://reviews.freebsd.org/D20663 for more details.

4 years agoFix -Wsign-compare warnings in realpath.c
arichardson [Wed, 26 Jun 2019 15:43:20 +0000 (15:43 +0000)]
Fix -Wsign-compare warnings in realpath.c

This is needed in order to build realpath.c as part of rtld.

4 years agoo In iflib_txq_drain():
marius [Wed, 26 Jun 2019 15:28:21 +0000 (15:28 +0000)]
o In iflib_txq_drain():
  - Remove desc_used, which is only ever written to.
  - Remove a dead store to reclaimed.
  - Don't recycle avail.
  - Sort variables according to style(9).
  These changes will make a subsequent commit easier to read.
o In iflib_tx_credits_update(), don't bother checking whether the
  ift_txd_credits_update method pointer is NULL; _iflib_pre_assert()
  asserts upfront that this method has been assigned and functions
  like iflib_{fast_intr_rxtx,netmap_timer_adjust,txq_can_drain}()
  and _task_fn_tx() were already unconditionally relying on the
  method being callable.

4 years agoOnly call libusb_hotplug_enumerate() once from libusb_hotplug_register_callback().
hselasky [Wed, 26 Jun 2019 12:04:54 +0000 (12:04 +0000)]
Only call libusb_hotplug_enumerate() once from libusb_hotplug_register_callback().
Else when registering multiple filters the same USB device may appear twice in
the list.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoFix support for LIBUSB_HOTPLUG_ENUMERATE in libusb. Currently all
hselasky [Wed, 26 Jun 2019 11:28:08 +0000 (11:28 +0000)]
Fix support for LIBUSB_HOTPLUG_ENUMERATE in libusb. Currently all
devices are enumerated regardless of of the LIBUSB_HOTPLUG_ENUMERATE
flag. Make sure when the flag is not specified no arrival events are
generated for currently enumerated devices.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agogpio.4: document device hints common to all devices on gpiobus
avg [Wed, 26 Jun 2019 07:38:31 +0000 (07:38 +0000)]
gpio.4: document device hints common to all devices on gpiobus

"at" keyword is documented in device.hints(5) for all buses, but it does
hurt to add another reference to it.
"pins" keyword is specific to gpiobus.
At least these two hints should be configured for any gpiobus device on
a hints based system.

MFC after: 10 days

4 years agofix up r349406, add missing .El
avg [Wed, 26 Jun 2019 07:08:51 +0000 (07:08 +0000)]
fix up r349406, add missing .El

MFC after: 1 week

4 years agoowc.4: document how to set up the 1-wire bus on a device.hints system
avg [Wed, 26 Jun 2019 06:40:30 +0000 (06:40 +0000)]
owc.4: document how to set up the 1-wire bus on a device.hints system

MFC after: 1 week

4 years agoRevert r349393, which leads to an assertion failure on bootup, in vm_map_stack_locked.
dougm [Wed, 26 Jun 2019 03:12:57 +0000 (03:12 +0000)]
Revert r349393, which leads to an assertion failure on bootup, in vm_map_stack_locked.

Reported by: ler@lerctr.org
Approved by: kib, markj (mentors, implicit)

4 years agoRe-enable loader efi http boot and fix dv_open bug if dv_init failed
bcran [Wed, 26 Jun 2019 03:06:57 +0000 (03:06 +0000)]
Re-enable loader efi http boot and fix dv_open bug if dv_init failed

The code in efihttp.c was assuming that dv_open wouldn't be called if
dv_init failed. But the dv_init return value is currently ignored.

Add a new variable, `efihttp_init_done` and only proceed in dv_open if
it's true. This fixes the loader on systems without efi http support.

4 years agopowerpc/booke: Handle misaligned floating point loads/stores as on AIM
jhibbits [Wed, 26 Jun 2019 01:14:39 +0000 (01:14 +0000)]
powerpc/booke: Handle misaligned floating point loads/stores as on AIM

Misaligned floating point loads and stores are already handled for AIM, but
use the DSISR to obtain the necessary data.  Book-E does not have the DSISR,
so these fixups are not performed, leading to a SIGBUS on misaligned FP
loads or stores.  Obtain the necessary data on the Book-E side, similar to
how is done for SPE.

MFC after: 1 week

4 years agoWhile working on PR/238796 I discovered an unused variable in frdest,
cy [Wed, 26 Jun 2019 00:53:49 +0000 (00:53 +0000)]
While working on PR/238796 I discovered an unused variable in frdest,
the next hop structure. It is likely this contributes to PR/238796
though other factors remain to be investigated.

PR: 238796
MFC after: 1 week

4 years agoRemove a tautological compare for offset != 0.
cy [Wed, 26 Jun 2019 00:53:46 +0000 (00:53 +0000)]
Remove a tautological compare for offset != 0.

MFC after: 1 week

4 years agoPrompted by r349366, ipfilter is also does not conform to RFC 3128
cy [Wed, 26 Jun 2019 00:53:43 +0000 (00:53 +0000)]
Prompted by r349366, ipfilter is also does not conform to RFC 3128
by dropping TCP fragments with offset = 1.

In addition to dropping these fragments, add a DTrace probe to allow
for more detailed monitoring and diagnosis if required.

MFC after: 1 week

4 years agoDisconnect EFI HTTP support
bcran [Tue, 25 Jun 2019 21:26:57 +0000 (21:26 +0000)]
Disconnect EFI HTTP support

The EFI HTTP code has been causing boot failures for people, so disable it
while a fix is being worked on.

4 years agoEliminate some uses of the prev and next fields of vm_map_entry_t.
dougm [Tue, 25 Jun 2019 20:25:16 +0000 (20:25 +0000)]
Eliminate some uses of the prev and next fields of vm_map_entry_t.

Since the only caller to vm_map_splay is vm_map_lookup_entry, move the
implementation of vm_map_splay into vm_map_lookup_helper, called by
vm_map_lookup_entry.

vm_map_lookup_entry returns the greatest entry less than or equal to a
given address, but in many cases the caller wants the least entry
greater than or equal to the address and uses the next pointer to get
to it. Provide an alternative interface to lookup,
vm_map_lookup_entry_ge, to provide the latter behavior, and let
callers use one or the other rather than having them use the next
pointer after a lookup miss to get what they really want.

In vm_map_growstack, the caller wants an entry that includes a given
address, and either the preceding or next entry depending on the value
of eflags in the first entry. Incorporate that behavior into
vm_map_lookup_helper, the function that implements all of these
lookups.

Eliminate some temporary variables used with vm_map_lookup_entry, but
inessential.

Reviewed by: markj (earlier version)
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20664

4 years agoFix annoying whitespace issue.
julian [Tue, 25 Jun 2019 19:55:42 +0000 (19:55 +0000)]
Fix annoying whitespace issue.
NO real change

4 years agofcntl: style changes to r349248
asomers [Tue, 25 Jun 2019 19:44:22 +0000 (19:44 +0000)]
fcntl: style changes to r349248

Reported by: bde
MFC after: 2 weeks
MFC-With: 349248
Sponsored by: The FreeBSD Foundation

4 years agobhyve: avoid theoretical stack buffer overflow from integer overflow
emaste [Tue, 25 Jun 2019 19:06:43 +0000 (19:06 +0000)]
bhyve: avoid theoretical stack buffer overflow from integer overflow

Use the proper size_t type to match strlen's return type.  This is not
exploitable in practice as this parses command line arguments, which
are limited to well below 2^31 bytes.

This is a minimal change to address the reported issue; hda_parse_config
and the rest of this file will benefit from further review.

Reported by: Fakhri Zulkifli
Reviewed by: jhb, markj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agolibbe(3): restructure be_mount, skip canmount check for BE dataset
kevans [Tue, 25 Jun 2019 18:47:40 +0000 (18:47 +0000)]
libbe(3): restructure be_mount, skip canmount check for BE dataset

Further cleanup after r349380; loader and kernel will both ignore canmount
on the root dataset as well, so we should not be so strict about it when
mounting it. be_mount is restructured to make it more clear that depth==0 is
special, and to not try fetching these properties that we won't care about.

MFC after: 3 days

4 years agoAvoid extra taskq_dispatch() calls by DMU.
mav [Tue, 25 Jun 2019 18:35:23 +0000 (18:35 +0000)]
Avoid extra taskq_dispatch() calls by DMU.

DMU sync code calls taskq_dispatch() for each sublist of os_dirty_dnodes
and os_synced_dnodes.  Since the number of sublists by default is equal
to number of CPUs, it will dispatch equal, potentially large, number of
tasks, waking up many CPUs to handle them, even if only one or few of
sublists actually have any work to do.

This change adds check for empty sublists to avoid this.

4 years agolibbe(3): mount: the BE dataset is mounted at /
kevans [Tue, 25 Jun 2019 18:13:39 +0000 (18:13 +0000)]
libbe(3): mount: the BE dataset is mounted at /

Other parts of libbe(3) were fairly strict on the mountpoint property of the
BE dataset, and be_mount was not much better. It was improved in r347027 to
allow mountpoint=none for depth==0, but this bit was still sensitive to
mountpoint != / and mountpoint != none. Given that other parts of libbe(3)
no longer restrict the mountpoint property here, and the rest of the base
system is generally OK and will assume that a BE is mounted at /, let's do
the same.

Reported by: ler
MFC after: 3 days

4 years agoDocument the KERN_PROTECTION_FAILURE return value from vm_map_protect().
dougm [Tue, 25 Jun 2019 17:27:37 +0000 (17:27 +0000)]
Document the KERN_PROTECTION_FAILURE return value from vm_map_protect().

Reviewed by: alc (earlier version)
Approved by: kib, markj (mentors)
Differential Revision: https://reviews.freebsd.org/D20751

4 years ago[PowerPC64] Don't mark module data as static
luporl [Tue, 25 Jun 2019 17:15:44 +0000 (17:15 +0000)]
[PowerPC64] Don't mark module data as static

Fixes panic when loading ipfw.ko and if_epair.ko built with modern compiler.

Similar to arm64 and riscv, when using a modern compiler (!gcc4.2), code
generated tries to access data in the wrong location, causing kernel panic
(data storage interrupt trap) when loading if_epair and ipfw.

Issue was reproduced with kernel/module compiled using gcc8 and clang8. It
affects both ELFv1 and ELFv2 ABI environments.

PR: 232387
Submitted by: alfredo.junior_eldorado.org.br
Reported by: Mark Millard
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D20461

4 years agoFix strsep_quote() on strings without quotes.
mav [Tue, 25 Jun 2019 17:00:53 +0000 (17:00 +0000)]
Fix strsep_quote() on strings without quotes.

For strings without quotes and escapes dstptr and srcptr are equal, so
zeroing *dstptr before checking *srcptr is not a good idea.  In practice
it means that in -maproot=65534:65533 everything after the colon is lost.

The problem was there since r293305, but before r346976 it was covered by
improper strsep_quote() usage.

PR: 238725
MFC after: 3 days
Sponsored by: iXsystems, Inc.

4 years agoRemove a couple of harmless stray references to nandfs.
imp [Tue, 25 Jun 2019 16:39:25 +0000 (16:39 +0000)]
Remove a couple of harmless stray references to nandfs.

Submitted by: tsoome@

4 years agonetipsec key_register: check for M_NOWAIT alloc failure
rlibby [Tue, 25 Jun 2019 15:43:52 +0000 (15:43 +0000)]
netipsec key_register: check for M_NOWAIT alloc failure

Reviewed by: ae, cem
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20742

4 years agoInclude files containing metadata specific to the branch in the
gjb [Tue, 25 Jun 2019 14:56:13 +0000 (14:56 +0000)]
Include files containing metadata specific to the branch in the
directory where the individual distribution sets exist.

The new metadata files include the build date, svn branch, and
revision of the build.

Requested by: Mellanox Technologies (via kib)
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)

4 years agoCroatian calendar: update / fix names, dates, group national public
zec [Tue, 25 Jun 2019 14:50:03 +0000 (14:50 +0000)]
Croatian calendar: update / fix names, dates, group national public
holidays, sort by date.

MFC after: 3 days

4 years agoFix parsing of corrupt data in usbdump(8). Check that the transfer
hselasky [Tue, 25 Jun 2019 13:15:29 +0000 (13:15 +0000)]
Fix parsing of corrupt data in usbdump(8). Check that the transfer
type array lookup is within bounds to avoid segfault.

PR: 238801
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoConvert all IPv4 and IPv6 multicast memberships into using a STAILQ
hselasky [Tue, 25 Jun 2019 11:54:41 +0000 (11:54 +0000)]
Convert all IPv4 and IPv6 multicast memberships into using a STAILQ
instead of a linear array.

The multicast memberships for the inpcb structure are protected by a
non-sleepable lock, INP_WLOCK(), which needs to be dropped when
calling the underlying possibly sleeping if_ioctl() method. When using
a linear array to keep track of multicast memberships, the computed
memory location of the multicast filter may suddenly change, due to
concurrent insertion or removal of elements in the linear array. This
in turn leads to various invalid memory access issues and kernel
panics.

To avoid this problem, put all multicast memberships on a STAILQ based
list. Then the memory location of the IPv4 and IPv6 multicast filters
become fixed during their lifetime and use after free and memory leak
issues are easier to track, for example by: vmstat -m | grep multi

All list manipulation has been factored into inline functions
including some macros, to easily allow for a future hash-list
implementation, if needed.

This patch has been tested by pho@ .

Differential Revision: https://reviews.freebsd.org/D20080
Reviewed by: markj @
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFree all allocated unit IDs in cuse(3) after the client character
hselasky [Tue, 25 Jun 2019 11:46:01 +0000 (11:46 +0000)]
Free all allocated unit IDs in cuse(3) after the client character
devices have been destroyed to avoid creating character devices with
identical name.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix for deadlock situation in cuse(3)
hselasky [Tue, 25 Jun 2019 11:42:53 +0000 (11:42 +0000)]
Fix for deadlock situation in cuse(3)

The final server unref should be done by the server thread to prevent
deadlock in the client cdevpriv destructor, which cannot destroy
itself.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFollow the RFC 3128 and drop short TCP fragments with offset = 1.
ae [Tue, 25 Jun 2019 11:40:37 +0000 (11:40 +0000)]
Follow the RFC 3128 and drop short TCP fragments with offset = 1.

Reported by: emaste
MFC after: 1 week

4 years agoMark default rule with IPFW_RULE_NOOPT flag, so it can be showed in
ae [Tue, 25 Jun 2019 09:11:22 +0000 (09:11 +0000)]
Mark default rule with IPFW_RULE_NOOPT flag, so it can be showed in
compact form.

MFC after: 1 week

4 years agoRestore ipfw(8)'s compact output support broken after r331668.
ae [Tue, 25 Jun 2019 09:08:24 +0000 (09:08 +0000)]
Restore ipfw(8)'s compact output support broken after r331668.

Also modify it a bit. Now -c option omits only 'from any to any' part
and works for different protocols (not just for ip).

Reported by: Dmitry Selivanov <dseliv at gmail>
MFC after: 1 week

4 years agovm_map_protect may return an INVALID_ARGUMENT or PROTECTION_FAILURE
dougm [Tue, 25 Jun 2019 07:44:37 +0000 (07:44 +0000)]
vm_map_protect may return an INVALID_ARGUMENT or PROTECTION_FAILURE
error response after clipping the first map entry in the region to be
reserved. This creates a pair of matching entries that should have
been "simplified" back into one, or never created. This change defers
the clipping of that entry until those two vm_map_protect failure
cases have been ruled out.

Reviewed by: alc
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20711

4 years agoThe definition of icmptypes in ip_compt.h is dead code as it already
cy [Tue, 25 Jun 2019 07:04:47 +0000 (07:04 +0000)]
The definition of icmptypes in ip_compt.h is dead code as it already
use the icmptypes in ip_icmp.h.

MFC after: 1 week

4 years agoAdd SPDX tags to bhyve(8) HD Audio device.
araujo [Tue, 25 Jun 2019 06:24:56 +0000 (06:24 +0000)]
Add SPDX tags to bhyve(8) HD Audio device.

Reviewed by: bcran
Differential Revision: https://reviews.freebsd.org/D20750

4 years agoReplay r349342 by imp accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:31 +0000 (06:14 +0000)]
Replay r349342 by imp accidentally reverted by r349352

Use the cam_ed copy of ata_params rather than malloc and freeing
memory for it. This reaches into internal bits of xpt a little, and
I'll clean that up later.

4 years agoReplay r349341 by imp accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:26 +0000 (06:14 +0000)]
Replay r349341 by imp accidentally reverted by r349352

Use ata_param_fixup instead of a custom copy here

4 years agoReplay r349340 by imp accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:21 +0000 (06:14 +0000)]
Replay r349340 by imp accidentally reverted by r349352

Create ata_param_fixup

Create a common fixup routine to do the canonical fixup of the
ata_param fixup. Call it from both the ATA and the ATA over SCSI
paths.

4 years agoReplay r349339 by imp accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:16 +0000 (06:14 +0000)]
Replay r349339 by imp accidentally reverted by r349352

Go ahead and completely fix the ata_params before calling the veto
function. This breaks nothing that uses it in the tree since
ata_params is ignored in storvsc_ada_probe_veto which is the only
in-tree consumer.

4 years agoReplay r349336 by scottl accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:11 +0000 (06:14 +0000)]
Replay r349336 by scottl accidentally reverted by r349352

Add a section about the HD Audio module support

4 years agoReplay r349335 by scottl accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:05 +0000 (06:14 +0000)]
Replay r349335 by scottl accidentally reverted by r349352

Add the PCI HDAudio device model from the 2016 GSoC.  Detailed information
can be found at

https://wiki.freebsd.org/SummerOfCode2016/HDAudioEmulationForBhyve

This commit has evolved from the original work to include Capsicum
integration.  As part of that, it only opens the host audio devices once
and leaves them open, instead of opening and closing them on each guest
access.  Thanks to Peter Grehan and Marcelo Araujo for their help in
bringing the work forward and providing some of the final techncial push.

Submitted by: Alex Teaca <iateaca@freebsd.org>
Differential Revision: D7840, D12419

4 years agoReplay r349334 by markj accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:00 +0000 (06:14 +0000)]
Replay r349334 by markj accidentally reverted by r349352

Remove a lingering use of splbio().

The buffer must be locked by the caller.  No functional change
intended.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoReplay r349333 by emaste accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:13:56 +0000 (06:13 +0000)]
Replay r349333 by emaste accidentally reverted by r349352

vtfontcvt: improve .bdf validation

Previously if we had a FONTBOUNDINGBOX or DWIDTH entry that had missing
or invalid values and and failed sscanf, we would proceeded with
partially initialized bounding box / device width variables.

Reported by: afl (FONTBOUNDINGBOX)
MFC with: r349100
Sponsored by: The FreeBSD Foundation

4 years agoRemove NAND and NANDFS support
imp [Tue, 25 Jun 2019 04:50:09 +0000 (04:50 +0000)]
Remove NAND and NANDFS support

NANDFS has been broken for years. Remove it. The NAND drivers that
remain are for ancient parts that are no longer relevant. They are
polled, have terrible performance and just for ancient arm
hardware. NAND parts have evolved significantly from this early work
and little to none of it would be relevant should someone need to
update to support raw nand. This code has been off by default for
years and has violated the vnode protocol leading to panics since it
was committed.

Numerous posts to arch@ and other locations have found no actual users
for this software.

Relnotes: Yes
No Objection From: arch@
Differential Revision: https://reviews.freebsd.org/D20745

4 years agopowerpc: Transition to Secure-PLT, like most other OSs (Toolchain part)
jhibbits [Tue, 25 Jun 2019 02:35:22 +0000 (02:35 +0000)]
powerpc: Transition to Secure-PLT, like most other OSs (Toolchain part)

Summary:
Toolchain follow-up to r349350.  LLVM patches will be submitted upstream for
9.0 as well.

The bsd.cpu.mk change is required because GNU ld assumes BSS-PLT if it
cannot determine for certain that it needs Secure-PLT, and some binaries do
not compile in such a way to make it know to use Secure-PLT.

Reviewed By: nwhitehorn, bdragon, pfg
Differential Revision: https://reviews.freebsd.org/D20598

4 years agopowerpc: Transition to Secure-PLT, like most other OSs
jhibbits [Tue, 25 Jun 2019 00:40:44 +0000 (00:40 +0000)]
powerpc: Transition to Secure-PLT, like most other OSs

Summary:
PowerPC has two PLT models: BSS-PLT and Secure-PLT.  BSS-PLT uses runtime
code generation to generate the PLT stubs.  Secure-PLT was introduced with
GCC 4.1 and Binutils 2.17 (base has GCC 4.2.1 and Binutils 2.17), and is a
more secure PLT format, using a read-only linkage table, with the dynamic
linker populating a non-executable index table.

This is the libc, rtld, and kernel support only.  The toolchain and build
parts will be updated separately.

Reviewed By: nwhitehorn, bdragon, pfg
Differential Revision: https://reviews.freebsd.org/D20598
MFC after: 1 month

4 years agoloader: add HTTP support using UEFI
bcran [Mon, 24 Jun 2019 23:18:42 +0000 (23:18 +0000)]
loader: add HTTP support using UEFI

Add support for an HTTP "network filesystem" using the UEFI's HTTP
stack.

This also supports HTTPS, but TianoCore EDK2 implementations currently
crash while fetching loader files.
Only IPv4 is supported at the moment. IPv6 support is planned for a
follow-up changeset.

Note that we include some headers from the TianoCore EDK II project in
stand/efi/include/Protocol verbatim, including links to the license instead
of including the full text because that's their preferred way of
communicating it, despite not being normal FreeBSD project practice.

Submitted by: scottph
Reviewed by: imp, bcran
Differential Revision: https://reviews.freebsd.org/D20643

4 years agoarm64 acpi_iort: add some error handling
jchandra [Mon, 24 Jun 2019 21:24:55 +0000 (21:24 +0000)]
arm64 acpi_iort: add some error handling

Print warnings for some bad kernel configurations (like NUMA disabled
with multiple domains). Check and report some firmware errors (like
incorrect proximity domain entries).

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

4 years agoarm64 gicv3_its: enable all ITS blocks for a CPU
jchandra [Mon, 24 Jun 2019 21:13:45 +0000 (21:13 +0000)]
arm64 gicv3_its: enable all ITS blocks for a CPU

We now support multiple ITS blocks raising interrupts to a CPU.
Add all available CPUs to the ITS when no NUMA information is
available.

This reverts the check added in r340602, at that tim we did not
suppport multiple ITS blocks for a CPU.

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

4 years agokbdcontrol -h prints two error messages.
imp [Mon, 24 Jun 2019 21:05:14 +0000 (21:05 +0000)]
kbdcontrol -h prints two error messages.

We loop through getopt(3) twice. Once for -P args and once for the
rest. Catch '?' and print usage when that happens.

4 years agoarm64 gic: Drop unused GICV3_IVAR_REDIST_VADDR
jchandra [Mon, 24 Jun 2019 21:00:28 +0000 (21:00 +0000)]
arm64 gic: Drop unused GICV3_IVAR_REDIST_VADDR

Now that GICV3_IVAR_REDIST is available, GICV3_IVAR_REDIST_VADDR
is unused and can be removed. Drop the define and add a comment.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D20454

4 years agoAdd missing include of sys/boot.h
imp [Mon, 24 Jun 2019 20:52:21 +0000 (20:52 +0000)]
Add missing include of sys/boot.h

This change was dropped out in a rebase and I didn't catch that before
I committed.

4 years agoMove to using a common kernel path between the boot / laoder bits and
imp [Mon, 24 Jun 2019 20:34:53 +0000 (20:34 +0000)]
Move to using a common kernel path between the boot / laoder bits and
the kernel.

4 years agoUse the cam_ed copy of ata_params rather than malloc and freeing
imp [Mon, 24 Jun 2019 20:23:19 +0000 (20:23 +0000)]
Use the cam_ed copy of ata_params rather than malloc and freeing
memory for it. This reaches into internal bits of xpt a little, and
I'll clean that up later.

4 years agoUse ata_param_fixup instead of a custom copy here
imp [Mon, 24 Jun 2019 20:19:03 +0000 (20:19 +0000)]
Use ata_param_fixup instead of a custom copy here

4 years agoCreate ata_param_fixup
imp [Mon, 24 Jun 2019 20:18:58 +0000 (20:18 +0000)]
Create ata_param_fixup

Create a common fixup routine to do the canonical fixup of the
ata_param fixup. Call it from both the ATA and the ATA over SCSI
paths.

4 years agoGo ahead and completely fix the ata_params before calling the veto
imp [Mon, 24 Jun 2019 20:18:49 +0000 (20:18 +0000)]
Go ahead and completely fix the ata_params before calling the veto
function. This breaks nothing that uses it in the tree since
ata_params is ignored in storvsc_ada_probe_veto which is the only
in-tree consumer.

4 years agoAdd a section about the HD Audio module support
scottl [Mon, 24 Jun 2019 19:42:32 +0000 (19:42 +0000)]
Add a section about the HD Audio module support

4 years agoAdd the PCI HDAudio device model from the 2016 GSoC. Detailed information
scottl [Mon, 24 Jun 2019 19:31:32 +0000 (19:31 +0000)]
Add the PCI HDAudio device model from the 2016 GSoC.  Detailed information
can be found at

https://wiki.freebsd.org/SummerOfCode2016/HDAudioEmulationForBhyve

This commit has evolved from the original work to include Capsicum
integration.  As part of that, it only opens the host audio devices once
and leaves them open, instead of opening and closing them on each guest
access.  Thanks to Peter Grehan and Marcelo Araujo for their help in
bringing the work forward and providing some of the final techncial push.

Submitted by: Alex Teaca <iateaca@freebsd.org>
Differential Revision: D7840, D12419

4 years agoRemove a lingering use of splbio().
markj [Mon, 24 Jun 2019 19:19:37 +0000 (19:19 +0000)]
Remove a lingering use of splbio().

The buffer must be locked by the caller.  No functional change
intended.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agovtfontcvt: improve .bdf validation
emaste [Mon, 24 Jun 2019 17:25:14 +0000 (17:25 +0000)]
vtfontcvt: improve .bdf validation

Previously if we had a FONTBOUNDINGBOX or DWIDTH entry that had missing
or invalid values and and failed sscanf, we would proceeded with
partially initialized bounding box / device width variables.

Reported by: afl (FONTBOUNDINGBOX)
MFC with: r349100
Sponsored by: The FreeBSD Foundation

4 years agoClean out duplicate definitions of TCP macros also found in netinet/tcp.h.
cy [Mon, 24 Jun 2019 02:58:02 +0000 (02:58 +0000)]
Clean out duplicate definitions of TCP macros also found in netinet/tcp.h.

MFC after: 1 week

4 years agoAdd pwm devices to NOTES.
ian [Mon, 24 Jun 2019 02:39:56 +0000 (02:39 +0000)]
Add pwm devices to NOTES.

4 years agoAdd gpio(4) and related drivers to NOTES.
ian [Mon, 24 Jun 2019 02:30:05 +0000 (02:30 +0000)]
Add gpio(4) and related drivers to NOTES.

4 years agoThe gpiopps(4) driver currently has probe and attach code only for FDT based
ian [Mon, 24 Jun 2019 02:27:17 +0000 (02:27 +0000)]
The gpiopps(4) driver currently has probe and attach code only for FDT based
systems, so conditionalize it accordingly in conf/files.

4 years agoBuild an armv7 LINT kernel in addition to armv5 LINT. You might think this
ian [Mon, 24 Jun 2019 01:42:09 +0000 (01:42 +0000)]
Build an armv7 LINT kernel in addition to armv5 LINT.  You might think this
had been done years ago.  I did.  All this time we've only compiled a LINT
kernel for TARGET_ARCH=arm.  Now separate LINT-V5 and LINT-V7 configs are
generated and built.

There are two new files in arm/conf, NOTES.armv5 and NOTES.armv7, containing
some of what used to be in the arm NOTES file.  That file now contains only
the bits that are common to v5 and v7.

The makeLINT.mk file now creates the LINT-V5 and LINT-V7 files by concatening
sys/conf/NOTES, arm/conf/NOTES, and arm/conf/NOTES.armv{5,7} in that order.

4 years agoamd64 pmap: block on turnstile for lock-less DI.
kib [Sun, 23 Jun 2019 21:21:11 +0000 (21:21 +0000)]
amd64 pmap: block on turnstile for lock-less DI.

Port the code to block on turnstile instead of yielding, to lock-less
delayed invalidation. The yield might cause tight loop due to priority
inversion.

Since it is impossible to avoid race between block and wake-up, arm
1-tick callout to wakeup when thread blocks itself.

Reported and tested by: mjg
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 months
Differential revision: https://reviews.freebsd.org/D20636

4 years agoAllow compiling ukbdmap.h on arm, since it appears to work fine.
ian [Sun, 23 Jun 2019 21:17:41 +0000 (21:17 +0000)]
Allow compiling ukbdmap.h on arm, since it appears to work fine.

4 years agoSwitch to check for effective user id in r349320, and disable dumping
kib [Sun, 23 Jun 2019 21:15:31 +0000 (21:15 +0000)]
Switch to check for effective user id in r349320, and disable dumping
into existing files for sugid processes.

Despite using real user id pronounces the intent, it actually breaks
suid coredumps, while not making any difference for non-sugid
processes.  The reason for the breakage is that non-existent core file
is created with the effective uid (unless weird hacks like SUIDDIR are
configured).

Then, if user enabled kern.sugid_coredump, core dumping should not
overwrite core files owned by effective uid, but we cannot pretend to
use real uid for dumping.

PR: 68905
admbugs: 358
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agopmap_enter_quick_locked() never replaces a valid mapping, so it need not
alc [Sun, 23 Jun 2019 21:06:56 +0000 (21:06 +0000)]
pmap_enter_quick_locked() never replaces a valid mapping, so it need not
perform a TLB invalidation.  A barrier suffices.  (See r343876.)

Add a comment to pmap_enter_quick_locked() in order to highlight the
fact that it does not replace valid mappings.

Correct a typo in one of pmap_enter()'s comments.

MFC after: 1 week

4 years agoSkip sys.netinet.socket_afinet.socket_afinet_bind_zero temporarily because it
lwhsu [Sun, 23 Jun 2019 19:37:12 +0000 (19:37 +0000)]
Skip sys.netinet.socket_afinet.socket_afinet_bind_zero temporarily because it
doesn't work when mac_portacl(4) loaded

PR: 238781
Sponsored by: The FreeBSD Foundation

4 years agoImprove AHCI Enclosure Management and SES interoperation.
mav [Sun, 23 Jun 2019 19:05:01 +0000 (19:05 +0000)]
Improve AHCI Enclosure Management and SES interoperation.

Since SES specs do not define mechanism to map enclosure slots to SATA
disks, AHCI EM code I written many years ago appeared quite useless,
that always bugged me.  I was thinking whether it was a good idea, but
if LSI HBAs do that, why I shouldn't?

This change introduces simple non-standard mechanism for the mapping
into both AHCI EM and SES code, that makes AHCI EM on capable controllers
(most of Intel's) a first-class SES citizen, allowing it to report disk
physical path to GEOM, show devices inserted into each enclosure slot in
`sesutil map` and `getencstat`, control locate and fault LEDs for specific
devices with `sesutil locate adaX on` and `sesutil fault adaX on`, etc.

I've successfully tested this on Supermicro X10DRH-i motherboard connected
with sideband cable of its S-SATA Mini-SAS connector to SAS815TQ backplane.
It can indicate with LEDs Locate, Fault and Rebuild/Remap SES statuses for
each disk identical to real SES of Supermicro SAS2 backplanes.

MFC after: 2 weeks

4 years agocoredump: avoid writing to core files not owned by the real user.
kib [Sun, 23 Jun 2019 18:35:11 +0000 (18:35 +0000)]
coredump: avoid writing to core files not owned by the real user.

Reported by: blake frantz <trew@hick.org>
PR: 68905
admbugs: 358
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoAdd some i2c slave-device drivers that were missing from NOTES.
ian [Sun, 23 Jun 2019 17:39:13 +0000 (17:39 +0000)]
Add some i2c slave-device drivers that were missing from NOTES.

4 years agoThe sy8106a and syr827 drviers require FDT and the ext_resources subsystem.
ian [Sun, 23 Jun 2019 17:38:30 +0000 (17:38 +0000)]
The sy8106a and syr827 drviers require FDT and the ext_resources subsystem.

4 years agoAdd the rtc8583 driver to conf/files. Also, move sy8106a from
ian [Sun, 23 Jun 2019 17:23:56 +0000 (17:23 +0000)]
Add the rtc8583 driver to conf/files.  Also, move sy8106a from
file.allwinner to conf/files... it's not allwinner-specific, some day
other platforms could use the same regulator chip.