]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agocxgbe(4): Add fields to support configuration of hardware NAT and
Navdeep Parhar [Thu, 10 May 2018 20:39:04 +0000 (20:39 +0000)]
cxgbe(4): Add fields to support configuration of hardware NAT and
swapmac (SMAC/DMAC switcheroo) from userspace.

Sponsored by: Chelsio Communications

6 years agoRevert r333365
Warner Losh [Thu, 10 May 2018 20:27:12 +0000 (20:27 +0000)]
Revert r333365

Even though we don't use it, it appears something else requires it to
be != 0 to work. This breaks tftp boot in loader.efi, so revert until
that can be sorted out.

6 years agoError out on attempt to link amd64 kernel with old binutils linker
Ed Maste [Thu, 10 May 2018 20:10:02 +0000 (20:10 +0000)]
Error out on attempt to link amd64 kernel with old binutils linker

As of r333461 we require ifunc support to link a working amd64 kernel.
The default in-tree bootstrap linker is lld and it has the required
support, as does any modern out-of-tree binutils linker.  The in-tree
GNU ld is from binutils 2.17.50 and it does not have ifunc support,
so produce an error rather than a broken kernel.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D15378

6 years agoAllocate epoch for networking at startup
Matt Macy [Thu, 10 May 2018 19:13:00 +0000 (19:13 +0000)]
Allocate epoch for networking at startup

Additionally add CK to include paths for modules

Approved by: sbruno@

6 years agoRevert accidentally commited local change to bmake to prevent debilitating
Matt Macy [Thu, 10 May 2018 17:57:46 +0000 (17:57 +0000)]
Revert accidentally commited local change to bmake to prevent debilitating
excess system time from poor API usage.

Approved by: sbruno@

6 years agoAdd simple preempt safe epoch API
Matt Macy [Thu, 10 May 2018 17:55:24 +0000 (17:55 +0000)]
Add simple preempt safe epoch API

Read locking is over used in the kernel to guarantee liveness. This API makes
it easy to provide livenes guarantees without atomics.

Includes epoch_test kernel module to stress test the API.

Documentation will follow initial use case.

Test case and improvements to preemption handling in response to discussion
with mjg@

Reviewed by: imp@, shurd@
Approved by: sbruno@

6 years agoFix build for platforms using GCC:
Li-Wen Hsu [Thu, 10 May 2018 17:22:04 +0000 (17:22 +0000)]
Fix build for platforms using GCC:

- Remove unused or dead store variable
- Remove unused function ctl_copyin_alloc
- Add missing curly brackets, this seems a regression in r287720

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D15383

6 years agovt(4): Use default VGA palette
Jean-Sébastien Pédron [Thu, 10 May 2018 17:00:33 +0000 (17:00 +0000)]
vt(4): Use default VGA palette

Before this change, the VGA palette was configured to match the shell
palette (e.g. color #1 was red). There was one glitch early in boot when
the vt(4)'s VGA palette was loaded: the loader's logo would switch from
red to blue. Likewise for the "Booting..." message switching from blue
to red. That's because the loader's logo was drawed with the default VGA
palette where a few colors are swapped compared to the shell palette
(e.g. blue <-> red).

This change configures the default VGA palette during initialization and
converts input's colors from shell to VGA palette index.

There should be no visible changes, except the loader's logo which will
keep its original color.

Reviewed by: eadler

6 years agovt(4): Put for() loop outside switch() in vt_generate_cons_palette()
Jean-Sébastien Pédron [Thu, 10 May 2018 16:41:47 +0000 (16:41 +0000)]
vt(4): Put for() loop outside switch() in vt_generate_cons_palette()

This makes it more logical:
 1. It checks the requested color format
 2. It fills the palette accordingly

Also vt_palette_init() is only called when needed (i.e. when the format
is `COLOR_FORMAT_RGB`).

6 years agoFix a panic in the IPv6 multicast code.
Andrew Gallatin [Thu, 10 May 2018 16:19:41 +0000 (16:19 +0000)]
Fix a panic in the IPv6 multicast code.

Use LIST_FOREACH_SAFE in in6m_disconnect() since we're
deleting and freeing item from the membership list
while traversing the list.

Reviewed by: mmacy
Sponsored by: Netflix

6 years agoMake fpusave() and fpurestore() on amd64 ifuncs.
Konstantin Belousov [Thu, 10 May 2018 15:01:43 +0000 (15:01 +0000)]
Make fpusave() and fpurestore() on amd64 ifuncs.

From now on, linking amd64 kernel requires either lld or newer ld.bfd.

Reviewed by: jhb (as part of the large patch)
Discussed with: emaste
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D13838

6 years agoAdd the test program to examine CPU behaviour for pop ss issue
Konstantin Belousov [Thu, 10 May 2018 13:52:52 +0000 (13:52 +0000)]
Add the test program to examine CPU behaviour for pop ss issue
CVE-2018-8897.

Requested by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoFix the build after r333457
Andrew Gallatin [Thu, 10 May 2018 13:19:42 +0000 (13:19 +0000)]
Fix the build after r333457

In r333457, the arguments to kern_pwritev() were accidentally
re-ordered as part of ANSIfication, breaking the build.

6 years agoFix the printing of rule comments.
Andrey V. Elsukov [Thu, 10 May 2018 12:25:01 +0000 (12:25 +0000)]
Fix the printing of rule comments.

Change uint8_t type of opcode argument to int in the print_opcode()
function. Use negative value to print the rest of opcodes, because
zero value is O_NOP, and it can't be uses for this purpose.

Reported by: lev
MFC after: 1 week

6 years agoANSIfy sys_generic.c
Ed Maste [Thu, 10 May 2018 11:36:16 +0000 (11:36 +0000)]
ANSIfy sys_generic.c

6 years agoDo not pass header length to the ENA controller
Marcin Wojtas [Thu, 10 May 2018 09:37:54 +0000 (09:37 +0000)]
Do not pass header length to the ENA controller

Header length is optional hint for the ENA device. Because It is not
guaranteed that every packet header will be in the first mbuf
segment, it is better to skip passing any information. If the header
length will be indicating invalid value (different than 0), then the
packet will be dropped.

This kind situation can appear, when the UDP packet will be fragmented
by the stack in the ip_fragment() function.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Reported by:  Krishna Yenduri <kyenduri@brkt.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

6 years agoarm64: Add ALT_BREAK_TO_DEBUGGER to GENERIC
Emmanuel Vadot [Thu, 10 May 2018 09:37:50 +0000 (09:37 +0000)]
arm64: Add ALT_BREAK_TO_DEBUGGER to GENERIC

It is useful to enter kdb with an escape sequence.
While here move the USB_DEBUG with the others debug options and define
nooptions USB_DEBUG for GENERIC-NODEBUG

6 years agoSkip setting the MTU for ENA if it is not changing
Marcin Wojtas [Thu, 10 May 2018 09:32:59 +0000 (09:32 +0000)]
Skip setting the MTU for ENA if it is not changing

On AWS, a network interface can get reinitialized every 30 minutes due
to the MTU being (re)set when a new DHCP lease is obtained. This can
cause packet drop, along with annoying syslog messages.

Skip setting the MTU in the ena driver if the new MTU is the same as the
old MTU. Note this fix is already in the netfront driver.

Testing: Verified ena up/down messages do not appear every 30 min in
/var/log/messages with the fix in place.

Submitted by:   Krishna Yenduri <kyenduri@brkt.com>
Reviewed by: Michal Krawczyk <mk@semihalf.com>

6 years agoApply fixes in ena-com
Marcin Wojtas [Thu, 10 May 2018 09:25:51 +0000 (09:25 +0000)]
Apply fixes in ena-com

* Change ena-com BIT macro to work on unsigned value.
  To make the shifting operations safer, they should be working on
  unsigned values.

* Fix a mutex not owned ASSERT panic in ENA control path.
  A thread calling cv_broadcast()/cv_signal() must hold the mutex used for
  cv_wait(). Fix the ENA control path code that has this problem.

Submitted by:   Krishna Yenduri <kyenduri@brkt.com>
Reviewed by:    Michal Krawczyk <mk@semihalf.com>
Tested by:      Michal Krawczyk <mk@semihalf.com>

6 years agoApply fixes in ena-com
Marcin Wojtas [Thu, 10 May 2018 09:18:26 +0000 (09:18 +0000)]
Apply fixes in ena-com

* Change ena-com BIT macro to work on unsigned value.
  To make the shifting operations safer, they should be working on
  unsigned values.

* Fix a mutex not owned ASSERT panic in ENA control path.
  A thread calling cv_broadcast()/cv_signal() must hold the mutex used for
  cv_wait(). Fix the ENA control path code that has this problem.

Submitted by:   Krishna Yenduri <kyenduri@brkt.com>
Reviewed by:    Michal Krawczyk <mk@semihalf.com>
Tested by:      Michal Krawczyk <mk@semihalf.com>

6 years agoUpgrade ENA version to v0.8.1
Marcin Wojtas [Thu, 10 May 2018 09:06:21 +0000 (09:06 +0000)]
Upgrade ENA version to v0.8.1

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

6 years agoRemove "All rights reserved" from my files.
Xin LI [Thu, 10 May 2018 06:41:08 +0000 (06:41 +0000)]
Remove "All rights reserved" from my files.

See r333391 for the rationale.

MFC after: 1 week

6 years agocxgbe(4): Disable write-combined doorbells by default.
Navdeep Parhar [Thu, 10 May 2018 06:33:54 +0000 (06:33 +0000)]
cxgbe(4): Disable write-combined doorbells by default.

This had been the default behavior but was changed accidentally as part
of the recent iw_cxgbe+OFED overhaul.  Fix another bug in that change
while here: the global knob affects all the adapters in the system and
should be left alone by per-adapter code.

MFC after: 3 days
Sponsored by: Chelsio Communications

6 years agoFix PPC symbol resolution
Justin Hibbits [Thu, 10 May 2018 03:59:48 +0000 (03:59 +0000)]
Fix PPC symbol resolution

Summary:
There were 2 issues that were preventing correct symbol resolution
on PowerPC/pseries:

1- memory corruption at chrp_attach() - this caused the inital
   part of the symbol table to become zeroed, which would cause
   the kernel linker to fail to parse it.
   (this was probably zeroing out other memory parts as well)

2- DDB symbol resolution wasn't working because symtab contained
   not relocated addresses but it was given relocated offsets.
   Although relocating the symbol table fixed this, it broke the
   linker, that already handled this case.
   Thus, the fix for this consists in adding a new DDB macro:
   DB_STOFFS(offs) that converts a (potentially) relocated offset
   into one that can be compared with symbol table values.

PR: 227093
Submitted by: Leandro Lupori <leandro.lupori_gmail.com>
Differential Revision: https://reviews.freebsd.org/D15372

6 years agoRework CTL frontend & backend options to use nv(3), allow creating multiple
Marcelo Araujo [Thu, 10 May 2018 03:50:20 +0000 (03:50 +0000)]
Rework CTL frontend & backend options to use nv(3), allow creating multiple
ioctl frontend ports.

This revision introduces two changes to CTL:
- Changes the way options are passed to CTL_LUN_REQ and CTL_PORT_REQ ioctls.
  Removes ctl_be_arg structure and associated logic and replaces it with
  nv(3)-based logic for passing in and out arguments.
- Allows creating multiple ioctl frontend ports using either ctladm(8) or
  ctld(8).
  New frontend ports are represented by /dev/cam/ctl<pp>.<vp> nodes, eg /dev/cam/ctl5.3.
  Those device nodes respond only to CTL_IO ioctl.

New command-line options for ctladm:
# creates new ioctl frontend port with using free pp and vp=0
ctladm port -c
# creates new ioctl frontend port with pp=10 and vp=0
ctladm port -c -O pp=10
# creates new ioctl frontend port with pp=11 and vp=12
ctladm port -c -O pp=11 -O vp=12
# removes port with number 4 (it's a "targ_port" number, not pp number)
ctladm port -r -p 4

New syntax for ctl.conf:
target ... {
    port ioctl/<pp>
    ...
}

target ... {
    port ioctl/<pp>/<vp>
    ...

Note: Most of this work was made by jceel@, thank you.

Submitted by: jceel
Reworked by: myself
Reviewed by: mav (earlier versions and recently during the rework)
Obtained from:  FreeNAS and TrueOS
Relnotes: Yes
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D9299

6 years agoRemove unused bcopyb.
Warner Losh [Thu, 10 May 2018 02:31:54 +0000 (02:31 +0000)]
Remove unused bcopyb.

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

6 years agoSimplify things a little
Warner Losh [Thu, 10 May 2018 02:31:48 +0000 (02:31 +0000)]
Simplify things a little

Rather than include a copy for memmove to call bcopy to call memcpy
(which handles overlapping copies), make memmove a strong reference to
memcpy to save the two calls.

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

6 years agoMove MI-ish bcopy routine to libkern
Warner Losh [Thu, 10 May 2018 02:31:38 +0000 (02:31 +0000)]
Move MI-ish bcopy routine to libkern

riscv and powerpc have nearly identical bcopy.c that's
supposed to be mostly MI. Move it to the MI libkern.

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

6 years agocxgbe(4): Determine whether the firmware supports the FILTER2 work
Navdeep Parhar [Thu, 10 May 2018 00:04:14 +0000 (00:04 +0000)]
cxgbe(4): Determine whether the firmware supports the FILTER2 work
request, which can be used to configure hardware NAT and swapmac.

All firmwares released after Jan 2017 support this work request.

Sponsored by: Chelsio Communications

6 years agoRemove "All rights reserved" from my files.
Mark Johnston [Wed, 9 May 2018 20:57:18 +0000 (20:57 +0000)]
Remove "All rights reserved" from my files.

See r333391 for the rationale.

MFC after: 1 week

6 years agoIntroduce the 'n' flag for the geli attach command.
Mariusz Zaborski [Wed, 9 May 2018 20:53:38 +0000 (20:53 +0000)]
Introduce the 'n' flag for the geli attach command.

If the 'n' flag is provided the provided key number will be used to
decrypt device. This can be used combined with dryrun to verify if the key
is set correctly. This can be also used to determine which key slot we want to
change on already attached device.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D15309

6 years agoChange option dry-run from 'n' to 'C' in geli attach command.
Mariusz Zaborski [Wed, 9 May 2018 20:51:16 +0000 (20:51 +0000)]
Change option dry-run from 'n' to 'C' in geli attach command.

'n' is used in other commands to define the key index.
We should be consistent with that.
'C' option is used by patch(1) to perform dryrun so lets use that.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D15308

6 years agoFor video consoles, only launch a getty if the device exists.
Warner Losh [Wed, 9 May 2018 20:49:00 +0000 (20:49 +0000)]
For video consoles, only launch a getty if the device exists.

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

6 years agoRemove 'All Rights Reserved'
Warner Losh [Wed, 9 May 2018 20:41:03 +0000 (20:41 +0000)]
Remove 'All Rights Reserved'

Remove this from some of the iXsystems stuff I did. OK'd by kmoore
at iXsystems

6 years agoRemove the 'All Rights Reserved' clause from some of the stuff I've
Warner Losh [Wed, 9 May 2018 20:32:23 +0000 (20:32 +0000)]
Remove the 'All Rights Reserved' clause from some of the stuff I've
done for Netflix, since I'm in the neighborhood.

6 years agoUse the full year, for real this time.
Warner Losh [Wed, 9 May 2018 20:26:37 +0000 (20:26 +0000)]
Use the full year, for real this time.

6 years agoRemove 'All rights reserved' from my files
Eric van Gyzen [Wed, 9 May 2018 20:12:59 +0000 (20:12 +0000)]
Remove 'All rights reserved' from my files

See r333391 for the rationale.

Approved by: emaste (for the Foundation copyright)
Sponsored by: Dell EMC

6 years agoFix bxe(4) netdump rx polling.
Mark Johnston [Wed, 9 May 2018 19:54:34 +0000 (19:54 +0000)]
Fix bxe(4) netdump rx polling.

Reviewed by: cem, rstone
X-MFC with: r333287
Sponsored by: Dell EMC Isilon

6 years agoFix style error introduced in r333393.
Cy Schubert [Wed, 9 May 2018 19:05:27 +0000 (19:05 +0000)]
Fix style error introduced in r333393.

Reported by: jhb, imp, phk
MFC after: 6 days
X-MFC with: r333393

6 years agoAdd taskqgroup_config_gtask_deinit to support teardown after
Matt Macy [Wed, 9 May 2018 18:51:35 +0000 (18:51 +0000)]
Add taskqgroup_config_gtask_deinit to support teardown after
taskqgroup_config_gtask_init.

Approved by: sbruno

6 years agoEliminate the overhead of gratuitous repeated reinitialization of cap_rights
Matt Macy [Wed, 9 May 2018 18:47:24 +0000 (18:47 +0000)]
Eliminate the overhead of gratuitous repeated reinitialization of cap_rights

- Add macros to allow preinitialization of cap_rights_t.

- Convert most commonly used code paths to use preinitialized cap_rights_t.
  A 3.6% speedup in fstat was measured with this change.

Reported by: mjg
Reviewed by: oshogbo
Approved by: sbruno
MFC after: 1 month

6 years agonda protocol rate reporting
Warner Losh [Wed, 9 May 2018 18:41:04 +0000 (18:41 +0000)]
nda protocol rate reporting

Report the NVMe spec, number of lanes (and max) as well as the PCIe
generation we're negotiated at (and max) for the camcontrol rate
command.

Reviewed by: scottl (the output, not the code)
Sponsored by: Netflix

6 years agoRemove bogus panic
Matt Macy [Wed, 9 May 2018 17:48:52 +0000 (17:48 +0000)]
Remove bogus panic

r333345 added a panic to the default case statement on the incorrect
premise that it should "never happen" when in fact it is simply a
different adapter version.

Reported by: markj
Approved by: sbruno

6 years agoRemove "all rights reserved" on files where I have copyright.
Niclas Zeising [Wed, 9 May 2018 17:06:52 +0000 (17:06 +0000)]
Remove "all rights reserved" on files where I have copyright.

According to r333391 it is not needed any more.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D15370

6 years agoStandardize SPDX tag on files I've added
Kyle Evans [Wed, 9 May 2018 16:52:28 +0000 (16:52 +0000)]
Standardize SPDX tag on files I've added

6 years agoRemove "All Rights Reserved" on files that I hold sole copyright on
Kyle Evans [Wed, 9 May 2018 16:44:19 +0000 (16:44 +0000)]
Remove "All Rights Reserved" on files that I hold sole copyright on

See r333391 for more detail; in summary: it holds no weight and may be
removed.

6 years agoReport TRAP_BRKPT for breakpoint traps on sparc64.
John Baldwin [Wed, 9 May 2018 15:25:26 +0000 (15:25 +0000)]
Report TRAP_BRKPT for breakpoint traps on sparc64.

Reviewed by: marius
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D15190

6 years agoRecognize the base/gcc compiler as GCC.
John Baldwin [Wed, 9 May 2018 15:20:39 +0000 (15:20 +0000)]
Recognize the base/gcc compiler as GCC.

The existing patterns for 'cc --version' output do not work for GCC
built from the base/gcc port.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D15357

6 years agoamd64: depessimize bcmp for small buffers
Mateusz Guzik [Wed, 9 May 2018 15:16:25 +0000 (15:16 +0000)]
amd64: depessimize bcmp for small buffers

Adapt assembly generated by clang for memcmp and use it for <= 64 sized
compares (which are the vast majority).

Sample result of doing stats on Broadwell (% of samples):
before: 4.0 kernel     bcmp                 cache_lookup
after : 0.7 kernel     bcmp                 cache_lookup

The routine is most definitely still not optimal. Anyone interested in
spending time improving it is welcome to take over.

Reviewed by: kib

6 years agoAvoid calls to bzero() before ireloc.
Konstantin Belousov [Wed, 9 May 2018 14:39:24 +0000 (14:39 +0000)]
Avoid calls to bzero() before ireloc.

Evaluate cpu_stdext_feature early to have moved link_elf_ireloc() see
correct flags, most important is SMAP.

Tested by: mjg
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D15367

6 years agoMinor style nits
Warner Losh [Wed, 9 May 2018 14:11:35 +0000 (14:11 +0000)]
Minor style nits

Use full copyright year.
Remove 'All Rights Reserved' from new file (rights holder OK'd)
Minor #ifdef motion and #endif tagging
Remove __FBSDID macro from comments

Sponsored by: Netflix
OK'd by: rrs@

6 years agoConvert share/examples/Makefile over to using FILES and FILESDIR.
Brad Davis [Wed, 9 May 2018 13:53:10 +0000 (13:53 +0000)]
Convert share/examples/Makefile over to using FILES and FILESDIR.

The goal is to avoid using install directly so we can make changes the affect
how the entire system is installed, without having to touch many places.

This is part of the packaging base work.

Reviewed by: will
Approved by: bapt (mentor), allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D1513

6 years agoEnable directory creation with FILESDIR.
Brad Davis [Wed, 9 May 2018 13:44:54 +0000 (13:44 +0000)]
Enable directory creation with FILESDIR.

This is part of packaging base work.

Reviewed by: will
Approved by: bapt (mentor), allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D15130

6 years agoUpdate NAT64 documentation, now we support any IPv6 prefixes.
Andrey V. Elsukov [Wed, 9 May 2018 12:25:23 +0000 (12:25 +0000)]
Update NAT64 documentation, now we support any IPv6 prefixes.

MFC after: 1 month

6 years agoRemove PG_U from the rest of the kernel pmap ptes.
Konstantin Belousov [Wed, 9 May 2018 12:09:08 +0000 (12:09 +0000)]
Remove PG_U from the rest of the kernel pmap ptes.

Supposedly, they PG_U bits there were set to easier making some kernel
page accessible to userspace in-place.  Since it was not used for the
whole existence of the amd64 pmap.c and current design of the shared
pages prefers double-mapping over the in-place access, remove PG_U
both from the direct map and KVA slots.

Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoRemove PG_U from the recursive pte for kernel pmap' PML4 page.
Konstantin Belousov [Wed, 9 May 2018 12:03:40 +0000 (12:03 +0000)]
Remove PG_U from the recursive pte for kernel pmap' PML4 page.

This PML4 page is never used for the userspace process, so there is no
security implications.  But the configuration trips SMAP check, which
should be corrected.

Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoBring in some last changes in NAT64 implementation:
Andrey V. Elsukov [Wed, 9 May 2018 11:59:24 +0000 (11:59 +0000)]
Bring in some last changes in NAT64 implementation:

o Modify ipfw(8) to be able set any prefix6 not just Well-Known,
  and also show configured prefix6;
o relocate some definitions and macros into proper place;
o convert nat64_debug and nat64_allow_private variables to be
  VNET-compatible;
o add struct nat64_config that keeps generic configuration needed
  to NAT64 code;
o add nat64_check_prefix6() function to check validness of specified
  by user IPv6 prefix according to RFC6052;
o use nat64_check_private_ip4() and nat64_embed_ip4() functions
  instead of nat64_get_ip4() and nat64_set_ip4() macros. This allows
  to use any configured IPv6 prefixes that are allowed by RFC6052;
o introduce NAT64_WKPFX flag, that is set when IPv6 prefix is
  Well-Known IPv6 prefix. It is used to reduce overhead to check this;
o modify nat64lsn_cfg and nat64stl_cfg structures to use nat64_config
  structure. And respectivelly modify the rest of code;
o remove now unused ro argument from nat64_output() function;
o remove __FreeBSD_version ifdef, NAT64 was not merged to older versions;
o add commented -DIPFIREWALL_NAT64_DIRECT_OUTPUT flag to module's Makefile
  as example.

Obtained from: Yandex LLC
MFC after: 1 month
Sponsored by: Yandex LLC

6 years agolld: Omit PT_NOTE for SHT_NOTE without SHF_ALLOC
Ed Maste [Wed, 9 May 2018 11:17:01 +0000 (11:17 +0000)]
lld: Omit PT_NOTE for SHT_NOTE without SHF_ALLOC

A non-alloc note section should not have a PT_NOTE program header.

Found while linking ghc (Haskell compiler) with lld on FreeBSD.  Haskell
emits a .debug-ghc-link-info note section (as the name suggests, it
contains link info) as a SHT_NOTE section without SHF_ALLOC set.

For this case ld.bfd does not emit a PT_NOTE segment for
.debug-ghc-link-info.  lld previously emitted a PT_NOTE with p_vaddr = 0
and FreeBSD's rtld segfaulted when trying to parse a note at address 0.

LLVM PR: https://llvm.org/pr37361
LLVM review: https://reviews.llvm.org/D46623

PR: 226872
Reviewed by: dim
Sponsored by: The FreeBSD Foundation

6 years agoAdd IFCAP_LINKSTATE support to if_loop(4).
Andrey V. Elsukov [Wed, 9 May 2018 10:50:51 +0000 (10:50 +0000)]
Add IFCAP_LINKSTATE support to if_loop(4).

Reviewed by: wollman
Obtained from: Yandex LLC
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D15278

6 years agoNow that a special no-SSP libc is used for rtld, allow
Konstantin Belousov [Wed, 9 May 2018 10:33:25 +0000 (10:33 +0000)]
Now that a special no-SSP libc is used for rtld, allow
-fstack-protector-all for normal libc builds.

Submitted by: Luis Pires
Reviewed by: brooks
Differential revision: https://reviews.freebsd.org/D15340

6 years agoMake rtld use libc_nossp_pic.a. Remove SSP shims.
Konstantin Belousov [Wed, 9 May 2018 10:30:56 +0000 (10:30 +0000)]
Make rtld use libc_nossp_pic.a.  Remove SSP shims.

Submitted by: Luis Pires
Reviewed by: brooks
Differential revision: https://reviews.freebsd.org/D15341

6 years agoCreated static libc PIC/no-SSP library to be used by rtld.
Konstantin Belousov [Wed, 9 May 2018 10:28:24 +0000 (10:28 +0000)]
Created static libc PIC/no-SSP library to be used by rtld.

Rtld is not compatible with SSP, and since we link libc_pic.a to rtld
to have the basic support like memory and string copy functions, we
have to both carefully limit libc use, and to provide the ssp support
shims.  This change makes the libc use in rtld more straighforward but
still limited, and allows to remove the shims, to be done in the next
commit.

Submitted by: Luis Pires
Reviewed by: bdrewery, brooks
Differential revision: https://reviews.freebsd.org/D15283

6 years agoAdd myself to copyright in the LinuxKPI RCU support layer.
Hans Petter Selasky [Wed, 9 May 2018 08:50:42 +0000 (08:50 +0000)]
Add myself to copyright in the LinuxKPI RCU support layer.

Suggested by: mmacy@
Sponsored by: Mellanox Technologies

6 years agoenigma(1) Remove reference to PGP; modernize a bit
Eitan Adler [Wed, 9 May 2018 07:46:57 +0000 (07:46 +0000)]
enigma(1) Remove reference to PGP; modernize a bit

- the port was removed 2017-06-07 in r442847
- gnupg1 is the older version of gpg with legacy PGP support
- remove unused macro
- remove now-false statement about export restrictions

6 years agocxgbe(4): Add support for hash filters.
Navdeep Parhar [Wed, 9 May 2018 04:09:49 +0000 (04:09 +0000)]
cxgbe(4): Add support for hash filters.

These filters reside in the card's memory instead of its TCAM and can be
configured via a new "hashfilter" subcommand in cxgbetool.  Hash and
normal TCAM filters can be used together.  The hardware does an
exact-match of packet fields for hash filters, unlike the masked match
performed for TCAM filters.  Any T5/T6 card with memory can support at
least half a million hash filters.  The sample config file with the
driver configures 512K of these, it is possible to double this to 1
million+ in some cases.

The chip does an exact-match of fields of incoming datagrams with hash
filters and performs the action configured for the filter if it matches.
The fields to match are specified in a "filter mask" in the firmware
config file.  The filter mask always includes the 5-tuple (sip, dip,
sport, dport, ipproto).  It can, optionally, also include any subset of
the filter mode (see filterMode and filterMask in the firmware config
file).

For example:
filterMode = fragmentation, mpshittype, protocol, vlan, port, fcoe
filterMask = protocol, port, vlan

Exact values of the 5-tuple, the physical port, and VLAN tag would have
to be provided while setting up a hash filter with the chip
configuration above.

Hash filters support all actions supported by TCAM filters.  A packet
that hits a hash filter can be dropped, let through (with optional
steering to a specific queue or RSS region), switched out of another
port (with optional L2 rewrite of DMAC, SMAC, VLAN tag), or get NAT'ed.
(Support for some of these will show up in the driver in a follow-up
commit very shortly).

Sponsored by: Chelsio Communications

6 years agoDocument intentional fallthrough. (CID 976535)
Cy Schubert [Wed, 9 May 2018 02:07:09 +0000 (02:07 +0000)]
Document intentional fallthrough. (CID 976535)

MFC after: 1 week

6 years agoFix memory leak. (CID 1199373).
Cy Schubert [Wed, 9 May 2018 02:02:58 +0000 (02:02 +0000)]
Fix memory leak. (CID 1199373).

MFC after: 1 week

6 years agoRemove 'All Rights Reserved' from the collection copyright and templates.
Warner Losh [Wed, 9 May 2018 02:02:49 +0000 (02:02 +0000)]
Remove 'All Rights Reserved' from the collection copyright and templates.

The original Berkeley Software Distributions were made in the 1980's
and 1990's. At that time, the Buenos Ares Convention of 1910 was in
force in most of the countries in the Americas. It required an
affirmative statement of rights reservation, typically using 'All
Rights Reserved.' The Regents included this phrase in their copyright
notices to invoke this treaty to ensure maximal copyright protection.

In the 1990's, Latin America coutries ratifeid the Berne Convention on
copyrights which prohibited them from requiring an affirmative
statement to reserve the rights. When Nicaragua ratified in 2000, the
Buenos Ares Convention of 1910 was effectively repealed. This made all
the 'All Rights Reserved' phrases obsolete and legal deadweight most
of the time, and certainly in the cases removed here.

Since it's no longer required, and is in fact meaningless, core has
decided to dropped it from the project's collection copyright and
sample templates. It encourages other rights holders to do the same
after consultation with their legal department.

More see https://en.wikipedia.org/wiki/Buenos_Aires_Convention for
more information.

Approved by: core@ (emaste@, jhb@)
Differential Review:  https://reviews.freebsd.org/D15264

6 years agoReduce overhead of ktrace checks in the common case.
Matt Macy [Wed, 9 May 2018 00:00:47 +0000 (00:00 +0000)]
Reduce overhead of ktrace checks in the common case.

KTRPOINT() checks both if we are tracing _and_ if we are recursing within
ktrace. The second condition is only ever executed if ktrace is actually
enabled. This change moves the check out of the hot path in to the functions
themselves.

Discussed with mjg@

Reported by: mjg@
Approved by: sbruno@

6 years agoUpgrade to OpenSSH 7.6p1. This will be followed shortly by 7.7p1.
Dag-Erling Smørgrav [Tue, 8 May 2018 23:13:11 +0000 (23:13 +0000)]
Upgrade to OpenSSH 7.6p1.  This will be followed shortly by 7.7p1.

This completely removes client-side support for the SSH 1 protocol,
which was already disabled in 12 but is still enabled in 11.  For that
reason, we will not be able to merge 7.6p1 or newer back to 11.

6 years agonxge(4):
Sean Bruno [Tue, 8 May 2018 21:14:29 +0000 (21:14 +0000)]
nxge(4):
Remove nxge(4) and associated man page and tools in FreeBSD 12.0.

Submitted by: kbowling
Reviewed by: brooks
Relnotes: yes
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D1529

6 years agoUpdate svn_private_config.h - I misread an autoconf change.
Peter Wemm [Tue, 8 May 2018 21:01:04 +0000 (21:01 +0000)]
Update svn_private_config.h - I misread an autoconf change.
SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL -> SVN_LIBSVN_RA_LINKS_RA_LOCAL
SVN_LIBSVN_CLIENT_LINKS_RA_SERF -> SVN_LIBSVN_RA_LINKS_RA_SERF
SVN_LIBSVN_CLIENT_LINKS_RA_SVN -> SVN_LIBSVN_RA_LINKS_RA_SVN

6 years agoFix two typos reported by N. J. Mann, which were introduced in
Michael Tuexen [Tue, 8 May 2018 20:39:35 +0000 (20:39 +0000)]
Fix two typos reported by N. J. Mann, which were introduced in
https://svnweb.freebsd.org/changeset/base/333382 by me.

MFC after: 3 days

6 years agoRemove ignored command line options
Warner Losh [Tue, 8 May 2018 20:02:44 +0000 (20:02 +0000)]
Remove ignored command line options

The --device and --part command line options were planned for Linux
compatibility mode. However, that mode will never happen, so remove
them as last vestiges of a false start.

Submitted by: Vlad Movchan

6 years agoefibootmgr.8: fix example
Warner Losh [Tue, 8 May 2018 20:02:39 +0000 (20:02 +0000)]
efibootmgr.8: fix example

The example given was for the old, and now deleted, Linux
compatibility mode. Update the example for the current code.

Submitted by: Vlad Movchan

6 years agoImprove printing the boot variables.
Warner Losh [Tue, 8 May 2018 19:43:57 +0000 (19:43 +0000)]
Improve printing the boot variables.

Print the boot variables in the order in the BootOrder variable, if it
exists, and then in verbose mode print any unreferneced BootXXXX
variables. If BootOrder isn't set, fall back to printing all the
variables.

Sponsored by: Netflix

6 years agoWhen reporting ERROR or ABORT chunks, don't use more data
Michael Tuexen [Tue, 8 May 2018 18:48:51 +0000 (18:48 +0000)]
When reporting ERROR or ABORT chunks, don't use more data
that is guaranteed to be contigous.
Thanks to Felix Weinrank for finding and reporting this bug
by fuzzing the usrsctp stack.

MFC after: 3 days

6 years agoInline print_order(). It's used one palce.
Warner Losh [Tue, 8 May 2018 18:25:37 +0000 (18:25 +0000)]
Inline print_order(). It's used one palce.

6 years agoMFV: r333378
Jung-uk Kim [Tue, 8 May 2018 18:18:27 +0000 (18:18 +0000)]
MFV: r333378

Import ACPICA 20180508.

6 years agoImport ACPICA 20180508.
Jung-uk Kim [Tue, 8 May 2018 18:10:55 +0000 (18:10 +0000)]
Import ACPICA 20180508.

6 years agoUse vYYYYMMDD in the timestamp suffix for Google Compute Engine
Glen Barber [Tue, 8 May 2018 17:15:12 +0000 (17:15 +0000)]
Use vYYYYMMDD in the timestamp suffix for Google Compute Engine
snapshot images for consistency with other OSes.

MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation

6 years agoiflib: print message when iflib_tx_structures_setup fails
Stephen Hurd [Tue, 8 May 2018 17:15:10 +0000 (17:15 +0000)]
iflib: print message when iflib_tx_structures_setup fails

Print a message when iflib_tx_structures_setup fails, like we do for
iflib_rx_structures_setup.

Now that we always print a message from within
iflib_qset_structures_setup when it fails, stop printing one in
iflib_device_register() at the call site.

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: gallatin
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D15300

6 years agoPrepare DB# handler for deferred trigger of watchpoints.
Konstantin Belousov [Tue, 8 May 2018 17:00:34 +0000 (17:00 +0000)]
Prepare DB# handler for deferred trigger of watchpoints.

Since pop %ss/mov %ss instructions defer all interrupts and exceptions
for the next instruction, it is possible that the userspace watchpoint
trap executes on the first instruction of the kernel entry for
syscall/bpt.

In this case, DB# should be treated similarly to NMI: on amd64 we must
always load GSBASE even if the trap comes from kernel mode, and load
the kernel page table root into %cr3.  Moreover, the trap must
use the dedicated stack, because we are still on the user stack when
trapped on syscall entry.

For i386, we must reload %cr3.  The syscall instruction is not configured,
so there is no issue with executing on user stack when trapping.

Due to some CPU erratas it is not always possible to detect that the
userspace watchpoint triggered by inspecting %dr6.  In trap(), compare the
trap %rip with the known unsafe entry points and if matched pretend that
the watchpoint did not fire at all.

Thank you to the MSRC Incident Response Team, and in particular Greg
Lenti and Nate Warfield, for coordinating the response to this issue
across multiple vendors.

Thanks to Computer Recycling at The Working Center of Kitchener for
making hardware available to allow us to test the patch on additional
CPU families.

Reviewed by: jhb
Discussed with: Matthew Dillon
Tested by: emaste
Sponsored by: The FreeBSD Foundation
Security: CVE-2018-8897
Security: FreeBSD-SA-18:06.debugreg

6 years agoiflib: cleanup queues when iflib_device_register fail
Stephen Hurd [Tue, 8 May 2018 16:56:02 +0000 (16:56 +0000)]
iflib: cleanup queues when iflib_device_register fail

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: gallatin
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D15299

6 years agoWe don't use f_devdata, so don't set it. Should that need to change
Warner Losh [Tue, 8 May 2018 16:16:56 +0000 (16:16 +0000)]
We don't use f_devdata, so don't set it. Should that need to change
later, we can. This leaves ZFS as the only irregular f_devdata
user in the tree.

6 years agoFix wrong cpu0 identification
Justin Hibbits [Tue, 8 May 2018 13:23:39 +0000 (13:23 +0000)]
Fix wrong cpu0 identification

Summary:
chrp_cpuref_init() was relying on the boot strap processor to be
the first child of /cpus. That was not always the case, specially
on pseries with FDT.

This change uses the "reg" property of each CPU instead and also
adds several sanity checks to avoid unexpected behavior (maybe
too many panics?).

The main observed symptom was interrupts being missed by the main
processor, leading to timeouts and the kernel aborting the boot.

Submitted by: Leandro Lupori
Reviewed by: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D15174

6 years agoFix for missing network interface address event when adding the default IPv6
Hans Petter Selasky [Tue, 8 May 2018 11:39:01 +0000 (11:39 +0000)]
Fix for missing network interface address event when adding the default IPv6
based link-local address.

The default link local address for IPv6 is added as part of bringing the
network interface up. Move the call to "EVENTHANDLER_INVOKE(ifaddr_event,)"
from the SIOCAIFADDR_IN6 ioctl(2) handler to in6_notify_ifa() which should
catch all the cases of adding IPv6 based addresses to a network interface.
Add a witness warning in case the event handler is not allowed to sleep.

Reviewed by: network (ae), kib
Differential Revision: https://reviews.freebsd.org/D13407
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoRevert r333353 - FTS5 uses log(3) which currently breakes non-amd64 builds.
Peter Wemm [Tue, 8 May 2018 06:09:49 +0000 (06:09 +0000)]
Revert r333353 - FTS5 uses log(3) which currently breakes non-amd64 builds.

Reported by: lwhsu

6 years agoUpdate svn/svnlite from 1.9.7 to 1.10.0
Peter Wemm [Tue, 8 May 2018 04:54:36 +0000 (04:54 +0000)]
Update svn/svnlite from 1.9.7 to 1.10.0

6 years agoUpdate svn-1.9.7 to 1.10.0.
Peter Wemm [Tue, 8 May 2018 04:52:52 +0000 (04:52 +0000)]
Update svn-1.9.7 to 1.10.0.

6 years agoUpdate private sqlite from sqlite3-3.20.0 to sqlite3-3.23.1
Peter Wemm [Tue, 8 May 2018 04:51:47 +0000 (04:51 +0000)]
Update private sqlite from sqlite3-3.20.0 to sqlite3-3.23.1

6 years agoUpdate private sqlite from sqlite3-3.20.0 to sqlite3-3.23.1
Peter Wemm [Tue, 8 May 2018 04:51:15 +0000 (04:51 +0000)]
Update private sqlite from sqlite3-3.20.0 to sqlite3-3.23.1

6 years agobsdgrep: Allow "-" to be passed to -f to mean "standard input"
Kyle Evans [Tue, 8 May 2018 03:53:46 +0000 (03:53 +0000)]
bsdgrep: Allow "-" to be passed to -f to mean "standard input"

A version of this patch was originally sent to me by se@, matching behavior
from newer versions of GNU grep.

While there have been some differences of opinion on whether stdin should be
closed or not after depleting it in process of -f, I've opted to leave stdin
open and just let the later matching stuff fail and result in a no-match.
I'm not married to the current behavior- it was generally chosen since we
are adopting this in particular from GNU grep, and I would like to stay
consistent without a strong argument to the contrary. The current behavior
isn't technically wrong, it's just fairly unfriendly to the developer-user
of grep that may not realize their usage is trivially invalid.

Submitted by: se

6 years agoImport sqlite3-3.23.1 (3230100)
Peter Wemm [Tue, 8 May 2018 03:51:19 +0000 (03:51 +0000)]
Import sqlite3-3.23.1 (3230100)

6 years agoImport Subversion-1.10.0
Peter Wemm [Tue, 8 May 2018 03:44:38 +0000 (03:44 +0000)]
Import Subversion-1.10.0

6 years agoFix spurious retransmit recovery on low latency networks
Matt Macy [Tue, 8 May 2018 02:22:34 +0000 (02:22 +0000)]
Fix spurious retransmit recovery on low latency networks

TCP's smoothed RTT (SRTT) can be much larger than an actual observed RTT. This can be either because of hz restricting the calculable RTT to 10ms in VMs or 1ms using the default 1000hz or simply because SRTT recently incorporated a larger value.

If an ACK arrives before the calculated badrxtwin (now + SRTT):
tp->t_badrxtwin = ticks + (tp->t_srtt >> (TCP_RTT_SHIFT + 1));

We'll erroneously reset snd_una to snd_max. If multiple segments were dropped and this happens repeatedly the transmit rate will be limited to 1MSS per RTO until we've retransmitted all drops.

Reported by: rstone
Reviewed by: hiren, transport
Approved by: sbruno
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D8556

6 years agoSleep rather than spin in e1000 when doing long running config operations.
Matt Macy [Tue, 8 May 2018 01:39:45 +0000 (01:39 +0000)]
Sleep rather than spin in e1000 when doing long running config operations.

With r333218 it is now possible for drivers to use an sx lock and thus sleep while
waiting on long running operations rather than DELAY().

Reported by: gallatin
Reviewed by: sbruno
Approved by: sbruno
MFC after: 1 month
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14984

6 years agoInlined sched_userret.
Mateusz Guzik [Mon, 7 May 2018 23:36:16 +0000 (23:36 +0000)]
Inlined sched_userret.

The tested condition is rarely true and it induces a function call
on each return to userspace.

Bumps getuid rate by about 1% on Broadwell.

6 years agoChange trap_enotcap to bool and annotate with __read_frequently
Mateusz Guzik [Mon, 7 May 2018 23:10:12 +0000 (23:10 +0000)]
Change trap_enotcap to bool and annotate with __read_frequently

It is read on each return to user space.

6 years agoAvoid calls to syscall_thread_enter/exit for statically defined syscalls
Mateusz Guzik [Mon, 7 May 2018 22:29:32 +0000 (22:29 +0000)]
Avoid calls to syscall_thread_enter/exit for statically defined syscalls

The entire mechanism is rarely used and is quite not performant due to
atomci ops on the syscall table. It also has added overhead for completely
unrelated syscalls.

Reduce it by avoiding the func calls if possible (which consistutes vast
majority of cases).

Provides about 3% syscall rate speed up for getuid on Broadwell.