]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoRevert r340161 in stable/12, setting the default pkg(8) repository back
Glen Barber [Sat, 24 Nov 2018 17:47:53 +0000 (17:47 +0000)]
Revert r340161 in stable/12, setting the default pkg(8) repository back
to 'latest' from 'quarterly' prior to branching releng/12.0.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r340734:
Mark Johnston [Sat, 24 Nov 2018 17:09:35 +0000 (17:09 +0000)]
MFC r340734:
Avoid unsynchronized updates to kn_status.

5 years agoMFC r340485:
Mark Johnston [Sat, 24 Nov 2018 17:08:49 +0000 (17:08 +0000)]
MFC r340485:
Add regression tests for r340313 and r340483.

5 years agoMFC r340484:
Mark Johnston [Sat, 24 Nov 2018 17:08:12 +0000 (17:08 +0000)]
MFC r340484:
Rename the SO_REUSEPORT_LB test file to be consistent with other tests.

5 years agoMFC r340649:
Benedict Reuschling [Sat, 24 Nov 2018 15:10:05 +0000 (15:10 +0000)]
MFC r340649:
Add a fortune describing how to upload a machine's dmesg information to the
NYCBUG database.

We want to encourage our users to upload their dmesgs so that the project can
get a better insight into what kind of hardware is run on. This helps in making
data-driven decisions about i.e., platform and driver support.

Note that dmesgs may contain sensitive information like hardware serial numbers,
hence uploading them without review is discouraged.

Reviewed by: brooks, imp, allanjude
Approved by: allanjude
Differential Revision:    https://reviews.freebsd.org/D17705

5 years agoMFC r340663 (rmacklem):
Ed Maste [Fri, 23 Nov 2018 20:32:41 +0000 (20:32 +0000)]
MFC r340663 (rmacklem):

Improve sanity checking for the dircount hint argument to
NFSv3's ReaddirPlus and NFSv4's Readdir operations. The code
checked for a zero argument, but did not check for a very large value.
This patch clips dircount at the server's maximum data size.

5 years agoMFC r340662 (rmacklem):
Ed Maste [Fri, 23 Nov 2018 20:31:27 +0000 (20:31 +0000)]
MFC r340662 (rmacklem):

nfsm_advance() would panic() when the offs argument was negative.
The code assumed that this would indicate a corrupted mbuf chain, but
it could simply be caused by bogus RPC message data.
This patch replaces the panic() with a printf() plus error return.

5 years agoMFC r340661 (rmacklem):
Ed Maste [Fri, 23 Nov 2018 20:29:47 +0000 (20:29 +0000)]
MFC r340661 (rmacklem):

r304026 added code that started statistics gathering for an operation
before the operation number (the variable called "op") was sanity checked.
This patch moves the code down to below the range sanity check for "op".

5 years agoMFC r340285: kldxref: use appropriate Elf_Off type for offsets
Ed Maste [Fri, 23 Nov 2018 01:05:42 +0000 (01:05 +0000)]
MFC r340285: kldxref: use appropriate Elf_Off type for offsets

Submitted by: Mitchell Horne <mhorne063@gmail.com>
Sponsored by: The FreeBSD Foundation

5 years agoMFC r340699:
Mark Johnston [Fri, 23 Nov 2018 00:56:42 +0000 (00:56 +0000)]
MFC r340699:
Clear pad bytes in the struct exported by kern.ntp_pll.gettime.

5 years agoMFC r340266:
Kristof Provost [Thu, 22 Nov 2018 20:00:56 +0000 (20:00 +0000)]
MFC r340266:

pf tests: Test PR 183198

Create a table which is only used inside an anchor, ensure that the
table exists.

PR: 183198

5 years agoMFC r340264:
Kristof Provost [Thu, 22 Nov 2018 19:59:02 +0000 (19:59 +0000)]
MFC r340264:

pfctl: Populate ifname in ifa_lookup()

pfctl_adjust_skip_ifaces() relies on this name.

5 years agoMFC r340265:
Kristof Provost [Thu, 22 Nov 2018 19:56:50 +0000 (19:56 +0000)]
MFC r340265:

pf: Prevent tables referenced by rules in anchors from getting disabled.

PR: 183198
Obtained from: OpenBSD

5 years agoMFC r340639:
Mark Johnston [Thu, 22 Nov 2018 16:53:30 +0000 (16:53 +0000)]
MFC r340639:
Remove comments made obsolete by the ino64 work.

5 years agoMFC r339653:
Mark Johnston [Thu, 22 Nov 2018 16:52:30 +0000 (16:52 +0000)]
MFC r339653:
Add an IMPLEMENTATION NOTES section to ldd.1.

PR: 231926

5 years agoMFC: r340543, r340654
Marius Strobl [Thu, 22 Nov 2018 13:09:03 +0000 (13:09 +0000)]
MFC: r340543, r340654

Add a quirk handling for AMDI0040 controllers allowing them to do HS400.

Submitted by: Shreyank Amartya (original version)

5 years agoMFC: r340656
Marius Strobl [Thu, 22 Nov 2018 13:03:11 +0000 (13:03 +0000)]
MFC: r340656

Given that the idea of D15374 was to "make memmove a first class citizen",
provide a _MEMMOVE extension of _MEMCPY that deals with overlap based on
the previous bcopy(9) implementation and use the former for bcopy(9) and
memmove(9). This addresses my D15374 review comment, avoiding extra MOVs
in case of memmove(9) and trashing the stack pointer.

5 years agoMFC r340674:
Tijl Coosemans [Thu, 22 Nov 2018 09:47:42 +0000 (09:47 +0000)]
MFC r340674:

Fix another user address dereference in linux_sendmsg syscall.

This was hidden behind the LINUX_CMSG_NXTHDR macro which dereferences its
second argument.  Stop using the macro as well as LINUX_CMSG_FIRSTHDR.  Use
the size field of the kernel copy of the control message header to obtain
the next control message.

PR: 217901

5 years agoMFC r340631:
Tijl Coosemans [Thu, 22 Nov 2018 09:41:45 +0000 (09:41 +0000)]
MFC r340631:

Do proper copyin of control message data in the Linux sendmsg syscall.

Instead of calling m_append with a user address, allocate an mbuf cluster
and copy data into it using copyin.  For the SCM_CREDS case, instead of
zeroing a stack variable and appending that to the mbuf, zero part of the
mbuf cluster directly.  One mbuf cluster is also the size limit used by
the FreeBSD sendmsg syscall (uipc_syscalls.c:sockargs()).

PR: 217901
Reviewed by: kib

5 years agoMFC r339701: Update lualoader test script a little bit
Kyle Evans [Thu, 22 Nov 2018 03:04:13 +0000 (03:04 +0000)]
MFC r339701: Update lualoader test script a little bit

Use userboot.so from the test directory if possible, fall back to .OBJDIR.
This avoids a problem that we've had since userboot coexistence was added,
where userboot.so alone no longer exists in the .OBJDIR but is instead just
a link installed later.
Update lualo

5 years agoMFC r340507-r340508, r340592-r340594, r340635-r340636: bectl(8) fixes
Kyle Evans [Thu, 22 Nov 2018 01:25:44 +0000 (01:25 +0000)]
MFC r340507-r340508, r340592-r340594, r340635-r340636: bectl(8) fixes

r340507:
libbe(3): rewrite init to support chroot usage

libbe(3) currently uses zfs_be_root and locates which of its children is
currently mounted at "/". This is reasonable, but not correct in the case of
a chroot, for two reasons:

- chroot root may be of a different zpool than zfs_be_root
- chroot root will not show up as mounted at "/"

Fix both of these by rewriting libbe_init to work from the rootfs down.
zfs_path_to_zhandle on / will resolve to the dataset mounted at the new
root, rather than the real root. From there, we can derive the BE root/pool
and grab the bootfs off of the new pool. This does no harm in the average
case, and opens up bectl to operating on different pools for scenarios where
one may be, for instance, updating a pool that generally gets re-rooted into
from a separate UFS root or zfs bootpool.

While here, I've also:
- Eliminated the check for /boot and / to be on the same partition. This
  leaves one open to a setup where /boot (and consequently, kernel/modules)
  are not included in the boot environment. This may very well be an
  intentional setup done by someone that knows what they're doing, we should
  not kill BE usage because of it.

- Eliminated the validation bits of BEs and snapshots that enforced
  'mountpoint' to be "/" -- this broke when trying to operate on an imported
  pool with an altroot, but we need not be this picky.

Reported by: philip
Reviewed by: philip, allanjude (previous version)
Tested by: philip
Differential Revision: https://reviews.freebsd.org/D18012

r340508:
libbe(3): Rewrite be_unmount to stop mucking with getmntinfo(2)

Go through the ZFS layer instead; given a BE, we can derive the dataset,
zfs_open it, then zfs_unmount. ZFS takes care of the dirty details and
likely gets it more correct than we did for more interesting setups.

r340592:
bectl(3)/libbe(3): Allow BE root to be specified

Add an undocumented -r option preceding the bectl subcommand to specify a BE
root to operate out of. This will remain undocumented for now, as some
caveats apply:

- BEs cannot be activated in the pool that doesn't contain the rootfs
- bectl create cannot work out of the box without the -e option right now,
  since it defaults to the rootfs and cross-pool cloning doesn't work like
  that (IIRC)

Plumb the BE root through to libbe(3) so that some things -can- be done to
it, e.g.

bectl -r tank/ROOT create -e default upgrade
bectl -r tank/ROOT mount upgrade /mnt

this aides in some upgrade setups where rootfs is not necessarily ZFS, and
also makes it easier/possible to regression-test bectl when combined with a
file-backed zpool.

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

r340593:
libbe(3): Properly account for altroot when creating new BEs

Previously we would blindly copy the 'mountpoint' property, which includes
the altroot. The altroot needs to be snipped off prior to setting it on the
new BE, though, or you'll end up with a new BE and a mountpoint of /mnt with
altroot=/mnt

r340594:
bectl(8): Add some regression tests

These tests operate on a file-backed zpool that gets created in the kyua
temp dir. root and ZFS support are both required for these tests. Current
tests cover create, destroy, export/import, jail, list (kind of), mount,
rename, and jail.

List tests should later be extended to cover formatting and the different
list flags, but for now only covers basic "are create/destroy actually
reflected properly"

r340635:
libbe(3): Handle non-ZFS rootfs better

If rootfs isn't ZFS, current version will emit an error claiming so and fail
to initialize libbe. As a consumer, bectl -r (undocumented) can be specified
to operate on a BE independently of whether on a UFS or ZFS root.

Unbreak this for the UFS case by only erroring out the init if we can't
determine a ZFS dataset for rootfs and no BE root was specified. Consumers
of libbe should take care to ensure that rootfs is non-empty if they're
trying to use it, because this could certainly be the case.

Some check is needed before zfs_path_to_zhandle because it will
unconditionally emit to stderr if the path isn't a ZFS filesystem, which is
unhelpful for our purposes.

This should also unbreak the bectl(8) tests on a UFS root, as is the case in
Jenkins' -test runs.

r340636:
bectl(8) tests: attempt to load the ZFS module

Observed in a CI test image, bectl_create test will run and be marked as
skipped because the module is not loaded. The first zpool invocation will
automagically load the module, but bectl_create is still skipped. Subsequent
tests all pass as expected because the module is now loaded and everything
is OK.

5 years agoMFC: r340495
Marius Strobl [Wed, 21 Nov 2018 18:53:13 +0000 (18:53 +0000)]
MFC: r340495

- Restore setting the clock for devices which support the default/legacy
  transfer mode only (lost with r321385). [1]
- Similarly, don't try to set the power class on MMC devices that comply
  to version 4.0 of the system specification but are operated in default/
  legacy transfer or 1-bit bus mode as no power class is specified for
  these cases. Trying to set a power class nevertheless resulted in an -
  albeit harmless - error message.

PR: 231713 [1]

5 years agoMFC r340435:
Stephen Hurd [Wed, 21 Nov 2018 17:14:57 +0000 (17:14 +0000)]
MFC r340435:

Prevent POLA violation with TSO/CSUM offload

Ensure that any time CSUM_IP_TSO or CSUM_IP6_TSO is set that the corresponding
CSUM_IP6?_TCP / CSUM_IP flags are also set.

Rather than requireing drivers to bake-in an understanding that TSO implies
checksum offloads, make it explicit.

This change requires us to move the IFLIB_NEED_ZERO_CSUM implementation to
ensure it's zeroed for TSO.

Reported by: Jacob Keller <jacob.e.keller@intel.com>
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D17801

5 years agoMFC r340547, r340686:
Mark Johnston [Wed, 21 Nov 2018 17:07:07 +0000 (17:07 +0000)]
MFC r340547, r340686:
Change dumpon(8)'s handling of -g.

5 years agoMFC r339785 (by cem):
Mark Johnston [Wed, 21 Nov 2018 17:04:42 +0000 (17:04 +0000)]
MFC r339785 (by cem):
dumpon.8: Significantly revamp page

5 years agoMFC r340431:
Konstantin Belousov [Wed, 21 Nov 2018 06:36:15 +0000 (06:36 +0000)]
MFC r340431:
Add d_off support for multiple filesystems.

5 years agohwpmc: new counters and bug fix MFCs
Matt Macy [Wed, 21 Nov 2018 01:24:27 +0000 (01:24 +0000)]
hwpmc: new counters and bug fix MFCs
MFC r340108 and r340149

5 years agoMFC: r340713.
Jung-uk Kim [Wed, 21 Nov 2018 00:04:38 +0000 (00:04 +0000)]
MFC: r340713.

Revert r340708.  Some files became symlinks and vice versa.

5 years agoMFC: r340706
Jung-uk Kim [Tue, 20 Nov 2018 22:24:18 +0000 (22:24 +0000)]
MFC: r340706

Remove stale manual pages after OpenSSL 1.1.1a merge.

5 years agoMFC: r340703
Jung-uk Kim [Tue, 20 Nov 2018 21:35:20 +0000 (21:35 +0000)]
MFC: r340703

Merge OpenSSL 1.1.1a.

5 years agosrc.conf.5: regen after r340697
Ed Maste [Tue, 20 Nov 2018 20:40:10 +0000 (20:40 +0000)]
src.conf.5: regen after r340697

5 years agoIntroduce src.conf knob to build userland with retpoline
Ed Maste [Tue, 20 Nov 2018 20:16:03 +0000 (20:16 +0000)]
Introduce src.conf knob to build userland with retpoline

MFC r339511: Introduce src.conf knob to build userland with retpoline

WITH_RETPOLINE enables -mretpoline vulnerability mitigation in userland
for CVE-2017-5715.

MFC r340099: libcompat: disable retpoline when building build tools

These are built with the host toolchain which may not support retpoline.
While here, move the MK_ overrides to a separate line and sort them
alphabetically to support future changes.

MFC r340650: Avoid retpolineplt with static linking

Statically linked binaries linked with -zretpolineplt crash at startup
as lld produces a broken PLT.

MFC r340652: rescue: set NO_SHARED in Makefile

The rescue binary is built statically via the Makefile generated by
crunchgen, but that does not trigger other shared/static logic in
bsd.prog.mk - in particular

PR: 233336
Reported by: Peter Malcom (r339511), Charlie Li (r340652)
Approved by: re (gjb, early MFC)
Sponsored by: The FreeBSD Foundation

5 years agoMFC r340439,r340440
Renato Botelho [Tue, 20 Nov 2018 20:08:51 +0000 (20:08 +0000)]
MFC r340439,r340440

Fix /etc/ntp permissions. According to mtree it must be 0700

Approved by: imp
Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoMFC r340387: Add evdev support to amd64 and i386
Niclas Zeising [Tue, 20 Nov 2018 19:37:09 +0000 (19:37 +0000)]
MFC r340387: Add evdev support to amd64 and i386

This merge is done sans sys/i386/conf/MINIMAL, since that doesn't exist in
stable/12, only current.

Include evdev support and drivers in the amd64 GENERIC and MINIMAL, and i386
GENERIC kernels.  Evdev is used by X and wayland to handle input devices, and
this change, together with upcomming changes in ports will make us handle input
devices better in graphical UIs.

Reviewed by: wulf, bapt, imp
Approved by: imp

5 years agoMFC r339531,r339579,r340252,r340463,r340464,340472,r340587
Mateusz Guzik [Tue, 20 Nov 2018 17:10:44 +0000 (17:10 +0000)]
MFC r339531,r339579,r340252,r340463,r340464,340472,r340587

amd64: tidy up memset to have rax set earlier for small sizes
amd64: finish the tail in memset with an overlapping store
amd64: align memset buffers to 16 bytes before using rep stos
amd64: convert libc bzero to a C func to avoid future bloat
amd64: sync up libc memset with the kernel version
amd64: handle small memset buffers with overlapping stores
Fix -DNO_CLEAN amd64 build after r340463

5 years agoMFC r339449:
Mateusz Guzik [Tue, 20 Nov 2018 17:01:55 +0000 (17:01 +0000)]
MFC r339449:

    amd64: relax constraints in curthread and curpcb

    This makes the compiler less likely to reload the content from %gs.

    The 'P' modifier drops all synteax prefixes and 'n' constraint treats
    input as a known at compilation time immediate integer.

    Example reloading victim was spinlock_enter.

5 years agoMFC r340678:
Mark Johnston [Tue, 20 Nov 2018 16:35:53 +0000 (16:35 +0000)]
MFC r340678:
Handle kernel superpage mappings in pmap_remove_l2().

5 years agoMFC r339558: New sysctl: net.inet.icmp.error_keeptags
Eugene Grosbein [Tue, 20 Nov 2018 10:43:18 +0000 (10:43 +0000)]
MFC r339558: New sysctl: net.inet.icmp.error_keeptags

  Currently, icmp_error() function copies FIB number from original packet
  into generated ICMP response but not mbuf_tags(9) chain.
  This prevents us from easily matching ICMP responses corresponding
  to tagged original packets by means of packet filter such as ipfw(8).
  For example, ICMP "time-exceeded in-transit" packets usually generated
  in response to traceroute probes lose tags attached to original packets.

  This change adds new sysctl net.inet.icmp.error_keeptags
  that defaults to 0 to avoid extra overhead when this feature not needed.

  Set net.inet.icmp.error_keeptags=1 to make icmp_error() copy mbuf_tags
  from original packet to generated ICMP response.

PR: 215874

5 years agoMFC r340205:
Mark Johnston [Tue, 20 Nov 2018 00:56:54 +0000 (00:56 +0000)]
MFC r340205:
Avoid specifying VM_PROT_EXECUTE in mappings from pipe_map and exec_map.

5 years agoMFC r340192:
Mark Johnston [Tue, 20 Nov 2018 00:55:51 +0000 (00:55 +0000)]
MFC r340192:
Use plain atomic_{add,subtract} when that's sufficient.

5 years agoMFC r340392: Add dynamic_kenv assertion to init_static_kenv
Kyle Evans [Mon, 19 Nov 2018 19:04:50 +0000 (19:04 +0000)]
MFC r340392: Add dynamic_kenv assertion to init_static_kenv

Both to formally document the requirement that this not be called after the
dynamic kenv is setup, and to perhaps help static analyzers figure out
what's going on. While calling init_static_kenv this late isn't fatal, there
are some caveats that the caller should be aware of:

- Late calls are effectively a no-op, as far as default FreeBSD is
concerned, as everything will switch to searching the dynamic kenv once it's
available.

- Each of the kern_getenv calls will leak memory, as it's assumed that
these are searching static environment and allocations will not be made.

As such, this usage is not sensible and should be detected.

5 years agoMFC r340390: Fix test-dts{,o} targets
Kyle Evans [Mon, 19 Nov 2018 18:59:06 +0000 (18:59 +0000)]
MFC r340390: Fix test-dts{,o} targets

There were two main problems here:

1.) sys/dts/Makefile.inc is not included from various */overlays directories
    by default, only ../Makefile.inc
2.) When shelling out for DTS/DTSO, cwd != .CURDIR, so enumeration always
    failed

These changes allow make test-dts and make test-dtso to function in their
respective directories.

5 years agoMFC r340489-r340490
Brooks Davis [Mon, 19 Nov 2018 18:26:11 +0000 (18:26 +0000)]
MFC r340489-r340490

r340489:
Fix freebsd32 support for PCIOCGETCONF.

This fixes regresssions in pciconf -l and some ports as reported on
freebsd-current:

https://lists.freebsd.org/pipermail/freebsd-current/2018-November/072144.html

Reported by: jbeich
Reviewed by: kib (also proposed an idential patch)
Tested by: jbeich
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18011

r340490:
Fix stray tab.

Reported by: jbeich
MFC with: r340489
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18011

5 years agoRemove debugging options from amd64 MINIMAL [1] and riscv GENERIC
Glen Barber [Mon, 19 Nov 2018 15:29:40 +0000 (15:29 +0000)]
Remove debugging options from amd64 MINIMAL [1] and riscv GENERIC
kernel configuration files.  This should have been turned off when
stable/12 branched.

This is a direct commit to stable/12.

Submitted by:   Harry Schmalzbauer [1]
Sponsored by: The FreeBSD Foundation

5 years agoMFC r340434, r340445
Stephen Hurd [Mon, 19 Nov 2018 15:18:30 +0000 (15:18 +0000)]
MFC r340434, r340445

r340434:
Fix leaks caused by ifc_nhwtxqs never being initialized

r333502 removed initialization of ifc_nhwtxqs, and it's not clear
there's a need to copy it into the struct iflib_ctx at all. Use
ctx->ifc_sctx->isc_ntxqs instead.

Further, iflib_stop() did not clear the last ring in the case where
isc_nfl != isc_nrxqs (such as when IFLIB_HAS_RXCQ is set). Use
ctx->ifc_sctx->isc_nrxqs here instead of isc_nfl.

Reported by: pkelsey
Reviewed by: pkelsey
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D17979

r340445:
Clear RX completion queue state veriables in iflib_stop()

iflib_stop() was not resetting the rxq completion queue state variables.
This meant that for any driver that has receive completion queues, after a
reinit, iflib would start asking what's available on the rx side starting at
whatever the completion queue index was prior to the stop, instead of at 0.

Submitted by: pkelsey
Reported by: pkelsey
Sponsored by: Limelight Networks

5 years agoMFC r339595: nfsrvd_readdirplus: for some errors, do not fail the entire request
Andriy Gapon [Mon, 19 Nov 2018 10:01:03 +0000 (10:01 +0000)]
MFC r339595: nfsrvd_readdirplus: for some errors, do not fail the entire request

Sponsored by: Panzura

5 years agoMFC r340254:
Hans Petter Selasky [Mon, 19 Nov 2018 09:40:02 +0000 (09:40 +0000)]
MFC r340254:
Put a size limit on the opensm.log and use bzip2(1).

Discussed with: markj@
Sponsored by: Mellanox Technologies

5 years agoMFC r340475
Vincenzo Maffione [Mon, 19 Nov 2018 08:56:34 +0000 (08:56 +0000)]
MFC r340475

ifnet(9): Add description of IFCAP_NETMAP

Describe IFCAP_NETMAP adding a cross reference to netmap(4).

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

5 years agoMFC r340325
Vincenzo Maffione [Mon, 19 Nov 2018 08:55:26 +0000 (08:55 +0000)]
MFC r340325

netmap: pkt-gen: several updates from upstream

Various improvements to the netmap pkt-gen program:

 - indentation fixes
 - support for IPV6
 - fixes to checksum computation
 - support for NS_MOREFRAG
 - rate limiting in ping mode

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

5 years agoMFC r340279
Vincenzo Maffione [Mon, 19 Nov 2018 08:53:52 +0000 (08:53 +0000)]
MFC r340279

netmap: add load balancer program

Add the lb program, which is able to load-balance input traffic
received from a netmap port over M groups, with N netmap pipes in
each group. Each received packet is forwarded to one of the pipes
chosen from each group (using an L3/L4 connection-consistent hash function).
This also adds a man page for lb and some cross-references in related
man pages.

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

5 years agoMFC r339472: rc.initdiskless: fix commentary grammar after r339465
Eugene Grosbein [Mon, 19 Nov 2018 06:49:30 +0000 (06:49 +0000)]
MFC r339472: rc.initdiskless: fix commentary grammar after r339465

5 years agoMFC r339465: rc.initdiskless: add support for auxiliary NVRAM.
Eugene Grosbein [Mon, 19 Nov 2018 06:33:38 +0000 (06:33 +0000)]
MFC r339465: rc.initdiskless: add support for auxiliary NVRAM.

  Currently, rc.inidiskless assumes that local system configuration
  changes are kept in some mountable file system. For example,
  nanobsd uses dedicated partition mounted as /cfg for this.

  However, small embedded devices like MIPS routers may have no enough flash
  space to keep full-blown file system but have only one or couple
  small flash blocks to keep persistent local configuration overrides.

  This change extends rc.initdiskless and introduces ability to run auxiliary
  command /conf/T/M/extract that is supposed to extract configuration overrides
  from such local storage.

  For example, the command /conf/default/etc/extract may contain something like:

  cd "$1" && bsdcpio --quiet -idu < /dev/map/cfg

  bsdcpio command extracts compressed archive from the storage to /etc
  assuming the storage is exposed by the kernel as /dev/map/cfg to userland.

PR: 204215

5 years agoMFC r339898:
Konstantin Belousov [Mon, 19 Nov 2018 05:56:46 +0000 (05:56 +0000)]
MFC r339898:
Convert amd64_get/set_fs/gsbase to ifunc.

5 years agoMFC r340383:
Konstantin Belousov [Mon, 19 Nov 2018 05:47:31 +0000 (05:47 +0000)]
MFC r340383:
Create namespace for the symbols added during 13-CURRENT cycle.

5 years agoMFC r339895:
Konstantin Belousov [Mon, 19 Nov 2018 05:45:47 +0000 (05:45 +0000)]
MFC r339895:
amd64: Use ifuncs to select suitable implementation of set_pcb_flags().

5 years agoMFC r340487:
Konstantin Belousov [Mon, 19 Nov 2018 05:43:41 +0000 (05:43 +0000)]
MFC r340487:
Align IA32_ARCH_CAP MSR definitions and use with SDM rev. 068.

5 years agoMFC r340384:
Konstantin Belousov [Mon, 19 Nov 2018 05:42:00 +0000 (05:42 +0000)]
MFC r340384:
Apply fix to un-cripple max cpu id on BSP earlier.

5 years agoMFC r340364:
Konstantin Belousov [Mon, 19 Nov 2018 05:40:37 +0000 (05:40 +0000)]
MFC r340364:
Allow set ether/vlan PCP operation from the VNET jails.

5 years agoMFC: r339999
Rick Macklem [Mon, 19 Nov 2018 00:49:08 +0000 (00:49 +0000)]
MFC: r339999
Fix NFS client vnode locking to avoid a crash during forced dismount.

A crash was reported where the crash occurred in nfs_advlock() when the
NFS_ISV4(vp) macro was being executed. This was caused by the vnode
being VI_DOOMED due to a forced dismount in progress.
This patch fixes the problem by locking the vnode before executing the
NFS_ISV4() macro.

PR: 232673

5 years agoMFC r340171: capability.h: add comment about planned removal timeline
Ed Maste [Sun, 18 Nov 2018 14:58:01 +0000 (14:58 +0000)]
MFC r340171: capability.h: add comment about planned removal timeline

PR: 228878

5 years agoMFC r340299: Octeon SDK: avoid use of uninitialized variable
Ed Maste [Sun, 18 Nov 2018 14:56:08 +0000 (14:56 +0000)]
MFC r340299: Octeon SDK: avoid use of uninitialized variable

Reported by: Clang

5 years agoMFC r340288: nvi: remove superfluous space before ^\
Ed Maste [Sun, 18 Nov 2018 14:54:45 +0000 (14:54 +0000)]
MFC r340288: nvi: remove superfluous space before ^\

This fixes alignment in vi's 'viusage' command and has been fixed
upstream and in OpenBSD.

Submitted by: Raf Czlonka (github:rjc)

5 years agoMFC r340329: build(7): clarify buildenv target can be used for non-cross builds
Ed Maste [Sun, 18 Nov 2018 14:52:16 +0000 (14:52 +0000)]
MFC r340329: build(7): clarify buildenv target can be used for non-cross builds

make buildenv can be used for building for the same architecture as
the host (perhaps this is a degenerate case of cross-building).
TARGET and TARGET_ARCH do not need to be set in this case.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r340072:
Kristof Provost [Sun, 18 Nov 2018 13:03:49 +0000 (13:03 +0000)]
MFC r340072:

pfsync: Add missing unlock

If we fail to set up the multicast entry for pfsync and return an error
we must release the pfsync lock first.

Sponsored by: Orange Business Services

5 years agoMFC r340070:
Kristof Provost [Sun, 18 Nov 2018 12:59:09 +0000 (12:59 +0000)]
MFC r340070:

pfsync: Allow module to be unloaded

Sponsored by: Orange Business Services

5 years agoMFC r340069:
Kristof Provost [Sun, 18 Nov 2018 12:31:40 +0000 (12:31 +0000)]
MFC r340069:

pf tests: Basic pfsync test

Set up two jails, configure pfsync between them and create state in one
of them, verify that this state is copied to the other jail.

Sponsored by: Orange Business Services

5 years agoMFC r340068:
Kristof Provost [Sun, 18 Nov 2018 12:30:16 +0000 (12:30 +0000)]
MFC r340068:

pfsync: Handle syncdev going away

If the syncdev is removed we no longer need to clean up the multicast
entry we've got set up for that device.

Pass the ifnet detach event through pf to pfsync, and remove our
multicast handle, and mark us as no longer having a syncdev.

Note that this callback is always installed, even if the pfsync
interface is disabled (and thus it's not a per-vnet callback pointer).

Sponsored by: Orange Business Services

5 years agoMFC r340067:
Kristof Provost [Sun, 18 Nov 2018 12:09:26 +0000 (12:09 +0000)]
MFC r340067:

pfsync: Ensure uninit is done before pf

pfsync touches pf memory (for pf_state and the pfsync callback
pointers), not the other way around. We need to ensure that pfsync is
torn down before pf.

Sponsored by: Orange Business Services

5 years agoMFC r340066:
Kristof Provost [Sun, 18 Nov 2018 12:04:24 +0000 (12:04 +0000)]
MFC r340066:

Notify that the ifnet will go away, even on vnet shutdown

pf subscribes to ifnet_departure_event events, so it can clean up the
ifg_pf_kif and if_pf_kif pointers in the ifnet.
During vnet shutdown interfaces could go away without sending the event,
so pf ends up cleaning these up as part of its shutdown sequence, which
happens after the ifnet has already been freed.

Send the ifnet_departure_event during vnet shutdown, allowing pf to
clean up correctly.

Sponsored by: Orange Business Services

5 years agoMFC r340065:
Kristof Provost [Sun, 18 Nov 2018 11:55:56 +0000 (11:55 +0000)]
MFC r340065:

pfsync: Make pfsync callbacks per-vnet

The callbacks are installed and removed depending on the state of the
pfsync device, which is per-vnet. The callbacks must also be per-vnet.

Sponsored by: Orange Business Services

5 years agoMFC r339676:
Kristof Provost [Sun, 18 Nov 2018 10:57:31 +0000 (10:57 +0000)]
MFC r339676:

pf: Fix copy/paste error in IPv6 address rewriting

We checked the destination address, but replaced the source address. This was
fixed in OpenBSD as part of their NAT rework, which we don't want to import
right now.

CID: 1009561

5 years agoMFC r339578:
Kristof Provost [Sun, 18 Nov 2018 10:54:47 +0000 (10:54 +0000)]
MFC r339578:

pfctl: Fix line numbers when \ is used inside ""

PR: 201520
Obtained from: OpenBSD

5 years agoMFC r339470:
Kristof Provost [Sun, 18 Nov 2018 10:47:36 +0000 (10:47 +0000)]
MFC r339470:

pf synproxy will do the 3WHS on behalf of the target machine, and once
the 3WHS is completed, establish the backend connection. The trigger
for "3WHS completed" is the reception of the first ACK. However, we
should not proceed if that ACK also has RST or FIN set.

PR: 197484
Obtained from: OpenBSD

5 years agoMFC r340136:
Konstantin Belousov [Sun, 18 Nov 2018 09:57:12 +0000 (09:57 +0000)]
MFC r340136:
Move the fixed base for PIE loading on arm.

5 years agoMFC r339893:
Konstantin Belousov [Sun, 18 Nov 2018 09:55:57 +0000 (09:55 +0000)]
MFC r339893:
Style.

5 years agoMFC r339897:
Konstantin Belousov [Sun, 18 Nov 2018 09:54:03 +0000 (09:54 +0000)]
MFC r339897:
Remove rtld use of libc amd64_set_fsbase().

5 years agoMFC r339507:
Konstantin Belousov [Sun, 18 Nov 2018 09:49:24 +0000 (09:49 +0000)]
MFC r339507:
amd64: flush L1 data cache on syscall return with an error.

5 years agoMFC r339466:
Kristof Provost [Sun, 18 Nov 2018 09:48:51 +0000 (09:48 +0000)]
MFC r339466:

pfctl tests: Basic test case for PR 231323

PR: 231323

5 years agoMFC r339464:
Kristof Provost [Sun, 18 Nov 2018 09:47:30 +0000 (09:47 +0000)]
MFC r339464:

pfctl: Dup strings

When we set the ifname we have to copy the string, rather than just keep
the pointer.

PR: 231323

5 years agoMFC r340344:
Konstantin Belousov [Sun, 18 Nov 2018 09:45:52 +0000 (09:45 +0000)]
MFC r340344:
Remove single-use variable, cleanup warnings.

5 years agoMFC r339554:
Andrey V. Elsukov [Sun, 18 Nov 2018 00:22:01 +0000 (00:22 +0000)]
MFC r339554:
  Rework if_ipsec(4) to use epoch(9) instead of rmlock.

  * use CK_LIST and FNV hash to keep chains of softc;
  * read access to softc is protected by epoch();
  * write access is protected by ipsec_ioctl_sx. Changing of softc fields
    is allowed only when softc is unlinked from CK_LIST chains.
  * linking/unlinking of softc is allowed only when ipsec_ioctl_sx is
    exclusive locked.
  * the plain LIST of all softc is replaced by hash table that uses ingress
    address of tunnels as a key.
  * added support for appearing/disappearing of ingress address handling.
    Now it is allowed configure non-local ingress IP address, and thus the
    problem with if_ipsec(4) configuration that happens on boot, when
    ingress address is not yet configured, is solved.

  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D17190

MFC r339555:
  Follow the fix in r339532 (by glebius):
    Fix exiting an epoch(9) we never entered. May happen only with MAC.

MFC r339642:
  Remove softc from idhash when interface is destroyed.

MFC r339646:
  Add the check that current VNET is ready and access to srchash is
  allowed.

  ipsec_srcaddr() callback can be called during VNET teardown, since
  ingress address checking subsystem isn't VNET specific. And thus
  callback can make access to already freed memory. To prevent this,
  use V_ipsec_idhtbl pointer as indicator of VNET readiness. And make
  epoch_wait() after resetting it to NULL in vnet_ipsec_uninit() to
  be sure that ipsec_srcaddr() is finished its work.

  Reported by: kp

5 years agoMFC r339551:
Andrey V. Elsukov [Sun, 18 Nov 2018 00:17:06 +0000 (00:17 +0000)]
MFC r339551:
  Add handling for appearing/disappearing of ingress addresses to if_gif(4).

  * register handler for ingress address appearing/disappearing;
  * add new srcaddr hash table for fast softc lookup by srcaddr;
  * when srcaddr disappears, clear IFF_DRV_RUNNING flag from interface,
    and set it otherwise;
  * remove the note about ingress address from BUGS section.

  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D17134

MFC r339552:
  Add handling for appearing/disappearing of ingress addresses to if_gre(4).

  * register handler for ingress address appearing/disappearing;
  * add new srcaddr hash table for fast softc lookup by srcaddr;
  * when srcaddr disappears, clear IFF_DRV_RUNNING flag from interface,
    and set it otherwise;

  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D17214

MFC r339553:
  Add handling for appearing/disappearing of ingress addresses to if_me(4).

  * register handler for ingress address appearing/disappearing;
  * add new srcaddr hash table for fast softc lookup by srcaddr;
  * when srcaddr disappears, clear IFF_DRV_RUNNING flag from interface,
    and set it otherwise;

  Sponsored by: Yandex LLC

MFC r339649:
  Add the check that current VNET is ready and access to srchash is allowed.

  This change is similar to r339646. The callback that checks for appearing
  and disappearing of tunnel ingress address can be called during VNET
  teardown. To prevent access to already freed memory, add check to the
  callback and epoch_wait() call to be sure that callback has finished its
  work.

5 years agoMFC r339550,339556:
Andrey V. Elsukov [Sun, 18 Nov 2018 00:09:33 +0000 (00:09 +0000)]
MFC r339550,339556:
  Add KPI that can be used by tunneling interfaces to handle IP addresses
  appearing and disappearing on the host system.

  Such handling is need, because tunneling interfaces must use addresses,
  that are configured on the host as ingress addresses for tunnels.
  Otherwise the system can send spoofed packets with source address, that
  belongs to foreign host.

  The KPI uses ifaddr_event_ext event to implement addresses tracking.
  Tunneling interfaces register event handlers and then they are
  notified by the kernel, when an address disappears or appears.

  ifaddr_event_compat() handler from if.c replaced by srcaddr_change_event()
  in the ip_encap.c

  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D17134

5 years agoMFC r339537:
Andrey V. Elsukov [Sun, 18 Nov 2018 00:04:03 +0000 (00:04 +0000)]
MFC r339537:
  Add ifaddr_event_ext event. It is similar to ifaddr_event, but the
  handler receives the type of event IFADDR_EVENT_ADD/IFADDR_EVENT_DEL,
  and the pointer to ifaddr. Also ifaddr_event now is implemented using
  ifaddr_event_ext handler.

  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D17100

5 years agoMFC r339544:
Andrey V. Elsukov [Sun, 18 Nov 2018 00:00:39 +0000 (00:00 +0000)]
MFC r339544:
  Call inet_ntop() only when its result is needed.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

5 years agoMFC r339545:
Andrey V. Elsukov [Sat, 17 Nov 2018 23:58:55 +0000 (23:58 +0000)]
MFC r339545:
  Do not decrement RST life time if keep_alive is not turned on.

  This allows use differen values configured by user for sysctl variable
  net.inet.ip.fw.dyn_rst_lifetime.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

5 years agoMFC r339539:
Andrey V. Elsukov [Sat, 17 Nov 2018 23:57:46 +0000 (23:57 +0000)]
MFC r339539:
  Add IPFW_RULE_JUSTOPTS flag, that is used by ipfw(8) to mark rule,
  that was added using "new rule format". And then, when the kernel
  returns rule with this flag, ipfw(8) can correctly show it.

  Reported by: lev
  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D17373

5 years agoMFC r339535:
Andrey V. Elsukov [Sat, 17 Nov 2018 23:56:25 +0000 (23:56 +0000)]
MFC r339535:
  Do not allow use `create` keyword as hostname when ifconfig(8) is invoked
  for already existing interface.

  It appeared, that ifconfig(8) assumes `create` keyword as hostname and
  tries to resolve it, when `ifconfig ifname create` invoked for already
  existing interface. This can produce some unexpected results, when hostname
  resolving has successfully happened. This patch adds check for such case.
  When an interface is already exists, and create is only one argument,
  return error message. But when there are some other arguments, just remove
  create keyword from the arguments list.

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

MFC r339536:
  Fix grammar.

5 years agoMFC r339533:
Andrey V. Elsukov [Sat, 17 Nov 2018 23:54:19 +0000 (23:54 +0000)]
MFC r339533:
  Add sadb_x_sa2 extension to SADB_ACQUIRE requests.

  SADB_ACQUIRE requests are send by kernel, when security policy doesn't
  have corresponding security association for outbound packet. IKE daemon
  usually registers its handler for such messages and when the kernel asks
  for SA it can handle this request. Now such requests will contain
  additional fields that can help IKE daemon to create SA. And IKE now
  can create SAs using only information from SADB_ACQUIRE request, this
  is useful when many if_ipsec(4) interfaces are in use and IKE doesn track
  security policies that was installed by kernel.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

5 years agoMFC r339542:
Andrey V. Elsukov [Sat, 17 Nov 2018 23:52:56 +0000 (23:52 +0000)]
MFC r339542:
  Retire IPFIREWALL_NAT64_DIRECT_OUTPUT kernel option. And add ability
  to switch the output method in run-time. Also document some sysctl
  variables that can by changed for NAT64 module.

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

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

5 years agoMFC r339780:
Mark Johnston [Sat, 17 Nov 2018 20:59:50 +0000 (20:59 +0000)]
MFC r339780:
Avoid leaking memory in error paths.

5 years agoMFC r339781:
Mark Johnston [Sat, 17 Nov 2018 20:58:35 +0000 (20:58 +0000)]
MFC r339781:
Don't print pathconf() errors if the target file doesn't exist.

MFC r339782:
Update and re-enable ACL tests.

PR: 229930

5 years agoMFC r339490:
Mark Johnston [Sat, 17 Nov 2018 20:55:11 +0000 (20:55 +0000)]
MFC r339490:
Add an assertion to pmap_enter().

5 years agoMFC r339453, r339455, r339456, r339460, r339687, r339745, r339747:
Mark Johnston [Sat, 17 Nov 2018 20:54:24 +0000 (20:54 +0000)]
MFC r339453, r339455, r339456, r339460, r339687, r339745, r339747:
Miscellaneous cleanups of rtsol(d).

5 years agoMFC r340372: dtb.mk: Fix passing of ECHO to make_dtb{,o}.sh
Kyle Evans [Sat, 17 Nov 2018 20:27:06 +0000 (20:27 +0000)]
MFC r340372: dtb.mk: Fix passing of ECHO to make_dtb{,o}.sh

5 years agoMFC r339823:
Vladimir Kondratyev [Sat, 17 Nov 2018 20:18:15 +0000 (20:18 +0000)]
MFC r339823:

evdev: Use console lock as evdev lock for all supported keyboard drivers.

Now evdev part of keyboard drivers does not take any locks if corresponding
input/eventN device node is not opened by userland consumers.

Do not assert console lock inside evdev to handle the cases when keyboard
driver is called from some special single-threaded context like shutdown
thread.

MFC r339824:

evdev: disable evdev if it is invoked from KDB or panic context

This allow to prevent deadlock on entering KDB if one of evdev locks is
already taken by userspace process.

Also this change discards all but LED console events produced by KDB as
unrelated to userspace.

5 years agoMFC r339675:
Mark Johnston [Sat, 17 Nov 2018 20:14:02 +0000 (20:14 +0000)]
MFC r339675:
Fix comments.

5 years agoMFC r339692:
Mark Johnston [Sat, 17 Nov 2018 20:11:39 +0000 (20:11 +0000)]
MFC r339692:
Clarify slightly the interaction between wait*() and pdfork().

5 years agoMFC r339737:
Mark Johnston [Sat, 17 Nov 2018 20:07:37 +0000 (20:07 +0000)]
MFC r339737:
Remove a dead store.

5 years agoMFC r339599:
Mark Johnston [Sat, 17 Nov 2018 20:04:38 +0000 (20:04 +0000)]
MFC r339599:
Don't import 0 into vmem quantum caches.