]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r344720:
Kristof Provost [Sat, 9 Mar 2019 10:35:37 +0000 (10:35 +0000)]
MFC r344720:

pf tests: Test for nested inline anchor issue

PR: 196314

5 years agoMFC r344764
Kristof Provost [Sat, 9 Mar 2019 10:34:42 +0000 (10:34 +0000)]
MFC r344764

tests: Move common (vnet) test functions into a common file

The netipsec and pf tests have a number of common test functions. These
used to be duplicated, but it makes more sense for them to re-use the
common functions.

PR: 236223

5 years agoMFC r339836, r340286, r341358:
Kristof Provost [Sat, 9 Mar 2019 10:33:47 +0000 (10:33 +0000)]
MFC r339836, r340286, r341358:

pf tests: Test ':0' ignoring link-local addresses

Fix test: sys.netpfil.pf.pass_block.noalias

Replace hard-coded epair0b with the variable holds the real epair interface
used for testing.

pf tests: Make pass_block:noalias more robust

Send several ICMPv6 echo requests. We've seen occasional failures with a
single request.

PR: 201695

5 years agoMFC r340073, r341359:
Kristof Provost [Sat, 9 Mar 2019 10:28:36 +0000 (10:28 +0000)]
MFC r340073, r341359:

pf: Keep a reference to struct ifnets we're using

Ensure that the struct ifnet we use can't go away until we're done with
it.

pf: Fix panic on overlapping interface names

In rare situations[*] it's possible for two different interfaces to have
the same name. This confuses pf, because kifs are indexed by name (which
is assumed to be unique). As a result we can end up trying to
if_rele(NULL), which panics.

Explicitly checking the ifp pointer before if_rele() prevents the panic.
Note pf will likely behave in unexpected ways on the the overlapping
interfaces.

[*] Insert an interface in a vnet jail. Rename it to an interface which
exists on the host. Remove the jail. There are now two interfaces with
the same name in the host.

5 years agoMFC r341360:
Kristof Provost [Sat, 9 Mar 2019 10:24:39 +0000 (10:24 +0000)]
MFC r341360:

pf tests: Test name handling

Provoke a situation where two interfaces have the same name, and verify
pf's reaction to this.

5 years agoMFC r344838:
Cy Schubert [Sat, 9 Mar 2019 00:32:00 +0000 (00:32 +0000)]
MFC r344838:

Remove an empty directory emptied by r343702.

5 years agoMFC 344671: Don't assume all children of a nexus are ports.
John Baldwin [Fri, 8 Mar 2019 19:20:46 +0000 (19:20 +0000)]
MFC 344671: Don't assume all children of a nexus are ports.

Specifically, ccr(4) devices are also children of cxgbe nexus devices.
Rather than making assumptions about the child device's softc, walk
the list of ports from the nexus' softc to determine if a child is a
port in t4_child_location_str().  This fixes a panic when detaching a
ccr device.

5 years agoMFC 343620: Don't set IFCAP_TXRTLMT during lagg_clone_create().
John Baldwin [Fri, 8 Mar 2019 19:07:41 +0000 (19:07 +0000)]
MFC 343620: Don't set IFCAP_TXRTLMT during lagg_clone_create().

lagg_capabilities() will set the capability once interfaces supporting
the feature are added to the lagg.  Setting it on a lagg without any
interfaces is pointless as the if_snd_tag_alloc call will always fail
in that case.

5 years agoMFC 343456: Fix a few more places to handle ofld tx queues for RATELIMIT.
John Baldwin [Fri, 8 Mar 2019 19:03:28 +0000 (19:03 +0000)]
MFC 343456: Fix a few more places to handle ofld tx queues for RATELIMIT.

- Drain offload transmit queues when RATELIMIT is enabled but
  TCP_OFFLOAD is not.
- Expose the per-VI nofldtxq and first_ofld_txq sysctls when
  RATELIMIT is enabled but TCP_OFFLOAD is not.
- Clear offload transmit queue stats as part of a 'cxgbetool clearstats'
  request when RATELIMIT is enabled but TCP_OFFLOAD is not.

5 years agoMFC 343056: Reject new sessions if the necessary queues aren't initialized.
John Baldwin [Fri, 8 Mar 2019 18:59:37 +0000 (18:59 +0000)]
MFC 343056: Reject new sessions if the necessary queues aren't initialized.

ccr reuses the control queue and first rx queue from the first port on
each adapter.  The driver cannot send requests until those queues are
initialized.  Refuse to create sessions for now if the queues aren't
ready.  This is a workaround until cxgbe allocates one or more
dedicated queues for ccr.

5 years agoMFC 343048:
John Baldwin [Fri, 8 Mar 2019 18:53:54 +0000 (18:53 +0000)]
MFC 343048:
Update the note about the need for COMPAT_FREEBSD<n> kernel options.

Rather than mentioning the requirement for 4.x binaries but not
explaining why (it was assuming an upgrade from 4.x to 5.0-current),
explain when compat options are needed (for running existing host
binaries) in a more general way while using a more modern example
(COMPAT_FREEBSD11 for 11.x binaries).  While here, explicitly mention
that a GENERIC kernel should always work.

5 years agoMFC r343845:
Enji Cooper [Fri, 8 Mar 2019 15:48:19 +0000 (15:48 +0000)]
MFC r343845:

Clean up all directories created by `make hier`

The logic I introduced in r322511 unfortunately left chflags schg'ed
directories behind created by `make hier` (in the stock /etc/mtree
files, this is limited to /var/empty).

The proposed change calls `chflags -R 0` and `rm -Rf ...` to clean all
of the directories that could not be removed by `${MAKE} clean`.
`${MAKE} clean` in bsd.obj.mk calls `cleandir`/`cleanobj`, which handles
the first directory tree walk/removal.

Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D19174

5 years agoMFC r344696:
Vincenzo Maffione [Fri, 8 Mar 2019 08:26:06 +0000 (08:26 +0000)]
MFC r344696:

netmap: pkt-gen: fix bug in send_packets()

The send_packets() function was using ring->cur as index to scan
the transmit ring. This function may also set ring->cur ahead of
ring->head, in case no more slots are available. However, the function
also uses nm_ring_space() which looks at ring->head to check how many
slots are available. If ring->head and ring->cur are different, this
results in pkt-gen advancing ring->cur beyond ring->tail.

This patch fixes send_packets() (and similar source locations) to
use ring->head as a index, rather than using ring->cur.

5 years agoMFC 342658:
John Baldwin [Fri, 8 Mar 2019 01:04:19 +0000 (01:04 +0000)]
MFC 342658:
Correct variable name in two panic messages: num_msi_irq -> num_msi_irqs.

5 years agoMFC r344661, r344669: Limit 24xx adapters to only MSI interrupts by default.
Alexander Motin [Fri, 8 Mar 2019 00:56:07 +0000 (00:56 +0000)]
MFC r344661, r344669: Limit 24xx adapters to only MSI interrupts by default.

This was actually the known good configuration we used before.
Single MSI-X configuration doesn't even work there on my tests, just due
to lack of documentation not sure whether by design or I am doing something
wrong.

5 years agoMFC r344660: Add to isp(4) tunables to limit MSI/MSI-X usage.
Alexander Motin [Fri, 8 Mar 2019 00:54:34 +0000 (00:54 +0000)]
MFC r344660: Add to isp(4) tunables to limit MSI/MSI-X usage.

There are some problem reports possibly related to the new driver use of
multiple interrupts on older cards.  Hopefully this allow to workaround
them.

5 years agoMFC r344702: There is no `device atacard` but there is `device atapccard`.
Alexander Motin [Fri, 8 Mar 2019 00:53:11 +0000 (00:53 +0000)]
MFC r344702: There is no `device atacard` but there is `device atapccard`.

5 years agoMFC 340020: Don't enter DDB for fatal traps before panic by default.
John Baldwin [Fri, 8 Mar 2019 00:20:37 +0000 (00:20 +0000)]
MFC 340020: Don't enter DDB for fatal traps before panic by default.

Add a new 'debugger_on_trap' knob separate from 'debugger_on_panic'
and make the calls to kdb_trap() in MD fatal trap handlers prior to
calling panic() conditional on this new knob instead of
'debugger_on_panic'.  Disable the new knob by default.  Developers who
wish to recover from a fatal fault by adjusting saved register state
and retrying the faulting instruction can still do so by enabling the
new knob.  However, for the more common case this makes the user
experience for panics due to a fatal fault match the user experience
for other panics, e.g. 'c' in DDB will generate a crash dump and
reboot the system rather than being stuck in an infinite loop of fatal
fault messages and DDB prompts.

5 years agoAdd UPDATING entry for r344898 - RETPOLINE BROKEN_OPTIONS
Ed Maste [Thu, 7 Mar 2019 21:30:26 +0000 (21:30 +0000)]
Add UPDATING entry for r344898 - RETPOLINE BROKEN_OPTIONS

Sponsored by: The FreeBSD Foundation

5 years agoDisable WITH_RETPOLINE on stable/12.
Konstantin Belousov [Thu, 7 Mar 2019 20:40:39 +0000 (20:40 +0000)]
Disable WITH_RETPOLINE on stable/12.

It is known that clang 7 generates broken ifunc calls when retpoline is
enabled. Since libc uses ifuncs, mark WITH_RETPOLINE as always broken
and disabled. To be removed after clang 8 MFC.

This is a direct commit to the branch.

Reported by: many
Tested by: Nikola Mihaylov <c.source.code@gmail.com>
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation

5 years agoMFC r344449: scp: validate filenames provided by server against wildcard
Ed Maste [Thu, 7 Mar 2019 20:12:50 +0000 (20:12 +0000)]
MFC r344449: scp: validate filenames provided by server against wildcard

... in client

OpenSSH-portable commits:

check in scp client that filenames sent during remote->local directory
copies satisfy the wildcard specified by the user.

This checking provides some protection against a malicious server
sending unexpected filenames, but it comes at a risk of rejecting wanted
files due to differences between client and server wildcard expansion rules.

For this reason, this also adds a new -T flag to disable the check.

reported by Harry Sintonen
fix approach suggested by markus@;
has been in snaps for ~1wk courtesy deraadt@

OpenBSD-Commit-ID: 00f44b50d2be8e321973f3c6d014260f8f7a8eda

Minor patch conflict (getopt) resolved.

Obtained from: OpenSSH-portable 391ffc4b9d31fa1f4ad566499fef9176ff8a07dc

scp: add -T to usage();

OpenBSD-Commit-ID: a7ae14d9436c64e1bd05022329187ea3a0ce1899

Obtained from: OpenSSH-portable 2c21b75a7be6ebdcbceaebb43157c48dbb36f3d8

PR: 234965
Sponsored by: The FreeBSD Foundation

5 years agoMFC r344553:
David Bright [Thu, 7 Mar 2019 15:30:48 +0000 (15:30 +0000)]
MFC r344553:

asmc: Add support for Mac mini 2,1

PR: 235798
Submitted by: Trev <fbsdbugs4@sentry.org>
Reported by: Trev <fbsdbugs4@sentry.org>

5 years agoMFC r339941 (by mckusick):
Konstantin Belousov [Thu, 7 Mar 2019 13:51:18 +0000 (13:51 +0000)]
MFC r339941 (by mckusick):
In preparation for adding inode check-hashes, change the fsck_ffs
inodirty() function to have a pointer to the inode being dirtied.
No functional change (as for now the parameter is ununsed).

5 years agoMFC r344883:
Cy Schubert [Thu, 7 Mar 2019 13:45:36 +0000 (13:45 +0000)]
MFC r344883:

(MFV r344878:)

4.2.8p12 --> 4.2.8p13

Security:       CVE-2019-8936
                VuXML: c2576e14-36e2-11e9-9eda-206a8a720317
Obtained from:  nwtime.org

5 years agoMFC r344470:
David Bright [Thu, 7 Mar 2019 13:10:34 +0000 (13:10 +0000)]
MFC r344470:

Fix several Coverity-detected issues in newsyslog.

- CID 1394815, CID 1305673: Dereference before null check - memory was
  allocated and the allocation checked for NULL with a call to errx()
  if it failed. Code below that was guaranteed that the pointer was
  non-NULL, but there was another check for NULL at the exit of the
  function (after the memory had already been referenced). Eliminate
  the useless NULL check.

- CID 1007452: Resource leak - Storage intended to be allocated and
  returned to the caller was never freed. This was the result of a
  regression in the function signature introduced in r208648 (2010)
  (thanks for that find, @cem!). Fixed by altering the function
  signature and passing the allocated memory to the caller as
  intended. This also fixes PR158794.

- CID 1008620: Logically dead code in newsyslog.c - This was a direct
  result of CID 1007452. Since the memory allocated as described there
  was not returned to the caller, a subsequent check for the memory
  having been allocated was dead code. Returning the memory
  re-animates the code that is the subject of this CID.

- CID 1006131: Unused value - in parsing a configuration file, a
  pointer to the end of the last field was saved, but not used after
  that. Rewrite to use the pointer value. This could have been fixed
  by avoiding the assignment altogether, but this solutions more
  closely follows the pattern used in the preceding code.

PR:             158794
Reported by:    Coverity, Ken-ichi EZURA <k.ezura@gmail.com> (PR158794)

Sponsored by: Dell EMC Isilon

5 years agoMFC of 344731
Kirk McKusick [Thu, 7 Mar 2019 00:02:25 +0000 (00:02 +0000)]
MFC of 344731

Roundup tunefs -S logsize to filesystem block size

Sponsored by: Netflix

5 years agoMFC of 344552 and 344732
Kirk McKusick [Wed, 6 Mar 2019 23:54:55 +0000 (23:54 +0000)]
MFC of 344552 and 344732

Have fsck_ffs adjust size for files with hole at end

Tighten last lbn calculation

Sponsored by: Netflix

5 years agoMFC 341098: Add read-only sysctls for all tunables in the cxgbe(4) driver.
John Baldwin [Wed, 6 Mar 2019 23:09:27 +0000 (23:09 +0000)]
MFC 341098: Add read-only sysctls for all tunables in the cxgbe(4) driver.

5 years agoMFC r344355:
Konstantin Belousov [Wed, 6 Mar 2019 17:41:12 +0000 (17:41 +0000)]
MFC r344355:
pkru(3) man page.

5 years agoMFC r344354:
Konstantin Belousov [Wed, 6 Mar 2019 17:40:30 +0000 (17:40 +0000)]
MFC r344354:
Add usermode helpers for the Intel userspace protection keys feature.

5 years agoMFC r344353:
Konstantin Belousov [Wed, 6 Mar 2019 17:33:05 +0000 (17:33 +0000)]
MFC r344353:
Add kernel support for Intel userspace protection keys feature on
Skylake Xeons.

5 years agoMFC r344352:
Konstantin Belousov [Wed, 6 Mar 2019 17:26:30 +0000 (17:26 +0000)]
MFC r344352:
amd64: add defines and decode protection keys and SGX page faults reasons.

5 years agoMFC r344351:
Konstantin Belousov [Wed, 6 Mar 2019 17:25:11 +0000 (17:25 +0000)]
MFC r344351:
Implement rangesets.

5 years agoMFC r343705:
Cy Schubert [Wed, 6 Mar 2019 02:51:33 +0000 (02:51 +0000)]
MFC r343705:

new_kmem_alloc(9) is a Solaris/illumos malloc(9). FreeBSD and NetBSD
never get here, however a test for SOLARIS, as redundant as this test is,
serves to document that this is the illumos definition. This should help
those who come after me to follow the code more easily.

5 years agoMFC r343704:
Cy Schubert [Wed, 6 Mar 2019 02:46:18 +0000 (02:46 +0000)]
MFC r343704:

Kernel module shim sources have no business being in the userland
build directory, especially those for other operating systems.
The kernel module shims for other operating systems are hereby removed.
The kernel module shim for FreeBSD, mlfk_ipl.c, is already in
sys/contrib/ipfilter/netinet. The one here is never used and should
not be in the userland build directory either.

mlfk_rule.c isn't used either however we will keep it in case someone
wishes to use this shim to load rules via a kernel module, handy for
embedded. In that case it should be copied to
sys/contrib/ipfilter/netinet and a Makefile created to employ it.
(Probably a useful documentation project when time permits.)

5 years agoMFC r343703
Cy Schubert [Wed, 6 Mar 2019 02:43:31 +0000 (02:43 +0000)]
MFC r343703

Remove a reference to HP-UX in a comment.

5 years agoMFC r343702:
Cy Schubert [Wed, 6 Mar 2019 02:40:01 +0000 (02:40 +0000)]
MFC r343702:

Remove a redundant ip_compat.h, originally merged from upstream.

5 years agoMFC r343701 & r343732:
Cy Schubert [Wed, 6 Mar 2019 02:37:25 +0000 (02:37 +0000)]
MFC r343701 & r343732:

ipfilter #ifdef cleanup.

Remove #ifdefs for ancient and irrelevant operating systems from
ipfilter.

When ipfilter was written the UNIX and UNIX-like systems in use
were diverse and plentiful. IRIX, Tru64 (OSF/1) don't exist any
more. OpenBSD removed ipfilter shortly after the first time the
ipfilter license terms changed in the early 2000's. ipfilter on AIX,
HP/UX, and Linux never really caught on. Removal of code for operating
systems that ipfilter will never run on again will simplify the code
making it easier to fix bugs, complete partially implemented features,
and extend ipfilter.

Unsupported previous version FreeBSD code and some older NetBSD code
has also been removed.

What remains is supported FreeBSD, NetBSD, and illumos. FreeBSD and
NetBSD have collaborated exchanging patches, while illumos has expressed
willingness to have their ipfilter updated to 5.1.2, provided their
zone-specific updates to their ipfilter are merged (which are of interest
to FreeBSD to allow control of ipfilters in jails from the global zone).

Reviewed by: glebius@
Differential Revision: https://reviews.freebsd.org/D19006

5 years agoMFC r344628: poll.2: POLLNVAL is returned also for insufficient rights
Ed Maste [Wed, 6 Mar 2019 00:45:42 +0000 (00:45 +0000)]
MFC r344628: poll.2: POLLNVAL is returned also for insufficient rights

Reported by: Bora Ã–zarslan <borako.ozarslan@gmail.com>
Sponsored by: The FreeBSD Foundation

5 years agoMFC r344600:
Mark Johnston [Tue, 5 Mar 2019 19:41:08 +0000 (19:41 +0000)]
MFC r344600:
Add a missing return statement to g_concat_kernel_dump().

5 years agoMFC r344278:
Mark Johnston [Tue, 5 Mar 2019 19:37:06 +0000 (19:37 +0000)]
MFC r344278:
Move a racy assertion in filt_pipewrite().

PR: 235640

5 years agoMFC r343410:
Ed Maste [Tue, 5 Mar 2019 19:08:37 +0000 (19:08 +0000)]
MFC r343410:

freebsd-update: fix style from r343271 change

PR: 234771
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Sponsored by: The FreeBSD Foundation

5 years agoMFC freebsd-update: Clarify unsupported release upgrade error message
Ed Maste [Tue, 5 Mar 2019 19:01:57 +0000 (19:01 +0000)]
MFC freebsd-update: Clarify unsupported release upgrade error message

MFC r343122:

freebsd-update: Clarify unsupported release upgrade error message

Notify users that upgrading from -CURRENT or -STABLE is unsupported by
freebsd-update.

Also ensure --currently-running provides a correctly formatted release
(as done by -r).

Reported by: yuri
Reviewed by: bcran

MFC r343268:

frebsd-update: fix --currently-running after r343122

Reported by: Brandon Schneider

MFC rr343271:

freebsd-update: Allow upgrade from pre-release builds

Update r343122 to include -ALPHA, -BETA and -RC releases as
upgrade-able via freebsd-update.

Reported by: delphij, des
Reviewed by: delphij

PR: 234771
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343152: freebsd-update: Use BASEDIR when checking for src component
Ed Maste [Tue, 5 Mar 2019 18:52:13 +0000 (18:52 +0000)]
MFC r343152: freebsd-update: Use BASEDIR when checking for src component

src could potentially be installed under the based dir
and not under the root or vice versa.

PR: 224048
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: delphij
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343270: freebsd-update: Update /etc/passwd after password db changes
Ed Maste [Tue, 5 Mar 2019 18:29:25 +0000 (18:29 +0000)]
MFC r343270: freebsd-update: Update /etc/passwd after password db changes

Add -p to pwd_mkdb in order to ensure password db changes are also
included in /etc/passwd.

PR: 165954, 232921, 229487
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: jilles
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343411: freebsd-update: Clarify unsupported upgrade message
Ed Maste [Tue, 5 Mar 2019 18:26:34 +0000 (18:26 +0000)]
MFC r343411: freebsd-update: Clarify unsupported upgrade message

PR: 204115
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: delphij
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343412: Fix a typo/wordsmith a description modified in [MFC of r343407]
Ed Maste [Tue, 5 Mar 2019 18:23:31 +0000 (18:23 +0000)]
MFC r343412: Fix a typo/wordsmith a description modified in [MFC of r343407]

5 years agoMFC r343407: freebsd-update: open $PAGER only if necessary
Ed Maste [Tue, 5 Mar 2019 18:19:26 +0000 (18:19 +0000)]
MFC r343407: freebsd-update: open $PAGER only if necessary

PR: 194547, 208497
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: delphij
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343409: freebsd-update: Stop installing empty component sets
Ed Maste [Tue, 5 Mar 2019 18:15:35 +0000 (18:15 +0000)]
MFC r343409: freebsd-update: Stop installing empty component sets

Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by: rgrimes
Reviewed by: delphij
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343589: freebsd-update: regenerate man page database after update
Ed Maste [Tue, 5 Mar 2019 18:10:06 +0000 (18:10 +0000)]
MFC r343589: freebsd-update: regenerate man page database after update

These are currently not reproducible because they're built by the
makewhatis on the freebsd-update build host, not the one in the tree.
Regenerate after update, and later we can avoid including it in
freebsd-update data.

PR: 214545, 217389
Reviewed by: delphij
Sponsored by: The FreeBSD Foundation

5 years agoMFC r344692:
Kristof Provost [Tue, 5 Mar 2019 08:45:07 +0000 (08:45 +0000)]
MFC r344692:

pf tests: Test CVE-2019-5597

Generate a fragmented packet with different header chains, to provoke
the incorrect behaviour of pf.
Without the fix this will trigger a panic.

Obtained from: Corentin Bayet, Nicolas Collignon, Luca Moro at Synacktiv

5 years agoMFC r344561:
Jason A. Harmening [Tue, 5 Mar 2019 08:33:14 +0000 (08:33 +0000)]
MFC r344561:

Fix incorrect assertion in vnode_pager_generic_getpages()

5 years agoMFC r344666:
Bryan Drewery [Mon, 4 Mar 2019 21:10:40 +0000 (21:10 +0000)]
MFC r344666:

  bsd.nls.mk isn't optional.

PR: 232527

5 years agoMFC r344245:
Andriy Voskoboinyk [Mon, 4 Mar 2019 03:38:43 +0000 (03:38 +0000)]
MFC r344245:
snmp_hostres(3): fix a typo in sanity checks in handle_chunk()

PR: 204253
Submitted by: David Binderman <dcb314@hotmail.com>

5 years agoMFC r344244:
Andriy Voskoboinyk [Mon, 4 Mar 2019 03:30:39 +0000 (03:30 +0000)]
MFC r344244:
Fix memory / resource leaks in usr.sbin/rpc.ypupdated/update.c

Re-apply r343909 to this file to get the issue fixed.

PR: 204956
Reported by: David Binderman <dcb314@hotmail.com>

5 years agoMFC r344491: An IPv6 address matching should be fixed.
Hajimu UMEMOTO [Sun, 3 Mar 2019 03:40:11 +0000 (03:40 +0000)]
MFC r344491: An IPv6 address matching should be fixed.
Specifying an IPv6 address by the -a option was broken
since r309933.

5 years agoMFC r344480: Remove disabled CTL_LEGACY_STATS support.
Alexander Motin [Sat, 2 Mar 2019 03:17:23 +0000 (03:17 +0000)]
MFC r344480: Remove disabled CTL_LEGACY_STATS support.

It was not only disabled for quite a while, but also appeared to be broken
at r325517, when maximum number of ports was made configurable.

5 years agoMFC r343978:
Kristof Provost [Fri, 1 Mar 2019 22:33:24 +0000 (22:33 +0000)]
MFC r343978:

pfctl: Fix ifa_grouplookup()

Setting the length of the request got lost in r343287, which means SIOCGIFGMEMB
gives us the required length, but does not copy the names of the group members.
As a result we don't get a correct list of group members, and 'set skip on
<ifgroup>' broke.

This produced all sorts of very unexpected results, because we would end up
applying 'set skip' to unexpected interfaces.

5 years agoMFC r344691:
Kristof Provost [Fri, 1 Mar 2019 18:12:05 +0000 (18:12 +0000)]
MFC r344691:

pf: IPv6 fragments with malformed extension headers could be erroneously passed by pf or cause a panic

We mistakenly used the extoff value from the last packet to patch the
next_header field. If a malicious host sends a chain of fragmented packets
where the first packet and the final packet have different lengths or number of
extension headers we'd patch the next_header at the wrong offset.
This can potentially lead to panics or rule bypasses.

Reported by: Corentin Bayet, Nicolas Collignon, Luca Moro at Synacktiv
Approved by: so
Obtained from: OpenBSD
Security: CVE-2019-5597

5 years agoMFC r344592:
Konstantin Belousov [Fri, 1 Mar 2019 11:29:18 +0000 (11:29 +0000)]
MFC r344592:
procctl(2): fix -width parameter to .Bl.

5 years agoMFC r344477:
Hans Petter Selasky [Fri, 1 Mar 2019 08:04:17 +0000 (08:04 +0000)]
MFC r344477:
Add new USB quirk.

PR: 235897
Sponsored by: Mellanox Technologies

5 years agoMFC r343118: new small tool trim(1) to delete contents for blocks
Eugene Grosbein [Fri, 1 Mar 2019 05:02:09 +0000 (05:02 +0000)]
MFC r343118: new small tool trim(1) to delete contents for blocks
on flash based storage devices that use wear-leveling algorithms.

5 years agoMFC r344474-r344476
Ben Widawsky [Fri, 1 Mar 2019 02:16:37 +0000 (02:16 +0000)]
MFC r344474-r344476

r344474:
nvdimm: split spa dev into a separate entity

Separate code for exposing a device backed by a system physical
address range away from the NVDIMM spa code. This will allow a
future patch to add support for NVDIMM namespaces while using the
same device code.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Reviewed by: bwidawsk
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18736

r344475:
nvdimm: Read NVDIMM namespace labels

When attaching to NVDIMM devices, read and verify the namespace
labels from the special namespace label storage area. A later
change will expose NVDIMM namespaces derived from this label data.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Discussed with: kib
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18735

r344476:
nvdimm: Simple namespace support

Add support for simple NVDIMM v1.2 namespaces from the UEFI
version 2.7 specification. The combination of NVDIMM regions and
labels can lead to a wide variety of namespace layouts. Here we
support a simple subset of namespaces where each NVDIMM SPA range
is composed of a single region per member dimm.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Discussed with: kib
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18736

5 years agoMFC r344063,r344088:
Martin Matuska [Thu, 28 Feb 2019 22:55:44 +0000 (22:55 +0000)]
MFC r344063,r344088:

MFC r344063:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1085: Fix a null pointer dereference bug in zip writer
  PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2
            decopmpression
  PR #1116: Add support for 64-bit ar format
  PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2]
  PR #1125: RAR5 reader - fix an invalid read and a memory leak
  PR #1131: POSIX reader - do not fail when tree_current_lstat() fails
            due to ENOENT [3]
  PR #1134: Delete unnecessary null pointer checks before calls of free()
  OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy.
  OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader

MFC r344088:
  archive_read_disk_posix.c: initialize delayed_errno

PR: 233006 [3]
Security: CVE-2019-1000019 [1], CVE-2019-1000020 [2]

5 years agoMFC r343877,r343880:
Bryan Drewery [Thu, 28 Feb 2019 20:57:36 +0000 (20:57 +0000)]
MFC r343877,r343880:

  r343877:
    ipfw table list: Fix showing header outside of 'all'.
  r343880:
    Fix build of r343877

Relnotes: yes

5 years agoMFC r344510
Vincenzo Maffione [Thu, 28 Feb 2019 09:40:26 +0000 (09:40 +0000)]
MFC r344510

netmap: remove redundant call to nm_set_native_flags()

This redundant call was introduced by mistake in r343772.

Sponsored by:   Sunny Valley Networks

5 years agoMFC r344444:
Dimitry Andric [Thu, 28 Feb 2019 06:53:18 +0000 (06:53 +0000)]
MFC r344444:

Pull in r353299 from upstream lld trunk (by George Rimar):

  Recommit r353293 "[LLD][ELF] - Set DF_STATIC_TLS flag for i386 target."

  With the following changes:
  1) Compilation fix:
  std::atomic<bool> HasStaticTlsModel = false; ->
  std::atomic<bool> HasStaticTlsModel{false};

  2) Adjusted the comment in code.

  Initial commit message:

  DF_STATIC_TLS flag indicates that the shared object or executable
  contains code using a static thread-local storage scheme.

  Patch checks if IE/LE relocations were used to check if the code uses
  a static model. If so it sets the DF_STATIC_TLS flag.

  Differential revision: https://reviews.llvm.org/D57749

Pull in r353378 from upstream lld trunk (by George Rimar):

  [LLD][ELF] - Set DF_STATIC_TLS flag for X64 target

  This is the same as D57749, but for x64 target.

  "ELF Handling For Thread-Local Storage" p41 says
  (https://www.akkadia.org/drepper/tls.pdf):
  R_X86_64_GOTTPOFF relocation is used for IE TLS models.
  Hence if linker sees this relocation we should add DF_STATIC_TLS flag.

  Differential revision: https://reviews.llvm.org/D57821

This adds support to lld for the DF_STATIC_TLS flag in shared objects,
which signals to the dynamic linker that the shared object requires
static thread local storage.

See also: https://reviews.freebsd.org/D19072

5 years agoMFC r344437: Allow I/OAT of present Xeon E5/E7 to work thorugh PLX NTB.
Alexander Motin [Thu, 28 Feb 2019 00:30:13 +0000 (00:30 +0000)]
MFC r344437: Allow I/OAT of present Xeon E5/E7 to work thorugh PLX NTB.

Its a hack, we can't know/list all DMA engines, but this covers all
I/OAT of Xeon E5/E7 at least from Sandy Bridge till Skylake I saw.

5 years agoMFC r344441: Fix few issues in ioat(4) driver.
Alexander Motin [Thu, 28 Feb 2019 00:28:44 +0000 (00:28 +0000)]
MFC r344441: Fix few issues in ioat(4) driver.

 - Do not explicitly count active descriptors.  It allows hardware reset
to happen while device is still referenced, plus simplifies locking.
 - Do not stop/start callout each time the queue becomes empty.  Let it
run to completion and rearm if needed, that is much cheaper then to touch
it every time, plus also simplifies locking.
 - Decouple submit and cleanup locks, making driver reentrant.
 - Avoid memory mapped status register read on every interrupt.
 - Improve locking during device attach/detach.
 - Remove some no longer used variables.

Sponsored by: iXsystems, Inc.

5 years agoMFC r344473:
David Bright [Wed, 27 Feb 2019 22:29:12 +0000 (22:29 +0000)]
MFC r344473:

CID 1332000: Logically dead code in sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c

A pointer is first tested for NULL. If non-NULL, another pointer is
set equal to the first. The second pointer is then checked for NULL
and an error path taken if so. This second test and the associated
path is dead code as the pointer value, having just been checked for
NULL, cannot be NULL at this point. Remove the dead code.

Sponsored by: Dell EMC Isilon

5 years agoMFC r344381:
Dimitry Andric [Wed, 27 Feb 2019 22:12:04 +0000 (22:12 +0000)]
MFC r344381:

Fix more AddressSanitizer violations in usr.bin/top

In line_update(), set lastcol correctly after moving to any non-zero
column, so the "overwrite old stuff" part does not attempt to address
negative offsets in the current line.

Rewrite setup_buffer() to always allocate at least 80 characters,
otherwise various calls to summary_format() will overwrite the end of
the buffers, if the screen width gets small enough.

5 years agoMFC r344503:
Dimitry Andric [Wed, 27 Feb 2019 22:02:46 +0000 (22:02 +0000)]
MFC r344503:

Pull in r354756 from upstream llvm trunk (by Craig Topper):

  [X86] Fix tls variable lowering issue with large code model

  Summary:
  The problem here is the lowering for tls variable. Below is the DAG
  for the code. SelectionDAG has 11 nodes:

  t0: ch = EntryToken
t8: i64,ch = load<(load 8 from `i8 addrspace(257)* null`,
addrspace 257)> t0, Constant:i64<0>, undef:i64
  t10: i64 = X86ISD::WrapperRIP TargetGlobalTLSAddress:i64<i32*
  @x> 0 [TF=10]
t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64
      t12: i64 = add t8, t11
    t4: i32,ch = load<(dereferenceable load 4 from @x)> t0, t12,
    undef:i64
  t6: ch = CopyToReg t0, Register:i32 %0, t4

  And when mcmodel is large, below instruction can NOT be folded.

    t10: i64 = X86ISD::WrapperRIP TargetGlobalTLSAddress:i64<i32* @x> 0
    [TF=10]
  t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64

  So "t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64" is
  lowered to " Morphed node: t11: i64,ch = MOV64rm<Mem:(load 8 from
  got)> t10, TargetConstant:i8<1>, Register:i64 $noreg,
  TargetConstant:i32<0>, Register:i32 $noreg, t0"

  When llvm start to lower "t10: i64 = X86ISD::WrapperRIP
  TargetGlobalTLSAddress:i64<i32* @x> 0 [TF=10]", it fails.

  The patch is to fold the load and X86ISD::WrapperRIP.

  Fixes PR26906

  Patch by LuoYuanke

  Reviewers: craig.topper, rnk, annita.zhang, wxiao3

  Reviewed By: rnk

  Subscribers: llvm-commits

  Tags: #llvm

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

This should fix "fatal error: error in backend: Cannot select" messages
when compiling <ctype.h> functions using -mcmodel=large.

Reported by: phk
PR: 233143

5 years agoMFC r344218: mdmfs(8): use -o reserve with malloc-backed md(4)
Kyle Evans [Wed, 27 Feb 2019 17:00:14 +0000 (17:00 +0000)]
MFC r344218: mdmfs(8): use -o reserve with malloc-backed md(4)

Mentioned in mdconfig(8), malloc-backed md(4) can be unstable unless
required memory is allocated up front with -o reserve. Furthermore, panics
have been observed with md used in fstab on 12.0-RELEASE. Choose the stable
route and pass -o reserve.

5 years agoMFC: r344602
Jung-uk Kim [Tue, 26 Feb 2019 19:34:42 +0000 (19:34 +0000)]
MFC: r344602

Merge OpenSSL 1.1.1b.

5 years agoMFC r344305, r344365:
Mark Johnston [Tue, 26 Feb 2019 15:03:59 +0000 (15:03 +0000)]
MFC r344305, r344365:
Impose a limit on the number of GEOM_CTL arguments.

admbug: 854

5 years agoMFC r344307:
Mark Johnston [Tue, 26 Feb 2019 14:56:01 +0000 (14:56 +0000)]
MFC r344307:
Limit the number of entries allocated for a REPORT_ZONES command.

5 years agoMerge ENA OOO RX fixes
Marcin Wojtas [Tue, 26 Feb 2019 12:22:53 +0000 (12:22 +0000)]
Merge ENA OOO RX fixes

MFC r344150-r344151

Obtained from: Semihalf
Sponsored by: Amazon, Inc.

5 years agoMFC r344256:
Konstantin Belousov [Tue, 26 Feb 2019 09:51:53 +0000 (09:51 +0000)]
MFC r344256:
amd64: cleanup pmap_init_pat().

5 years agoMFC r344315:
Colin Percival [Tue, 26 Feb 2019 01:29:40 +0000 (01:29 +0000)]
MFC r344315:
  Fix sed script to insert Amazon NTP server into ntp.conf once rather
  than twice.

5 years agoMFC r344369:
Mark Johnston [Mon, 25 Feb 2019 15:51:31 +0000 (15:51 +0000)]
MFC r344369:
Remove an obsolete comment.

5 years agoMFC r344232:
Mark Johnston [Mon, 25 Feb 2019 15:50:59 +0000 (15:50 +0000)]
MFC r344232:
Fix refcount leaks in the SGX Linux compat ioctl handler.

5 years agoMFC r344231, r344440:
Mark Johnston [Mon, 25 Feb 2019 15:50:28 +0000 (15:50 +0000)]
MFC r344231, r344440:
Remove a redundant flag variable.

5 years agoMFC r344428:
Michael Tuexen [Mon, 25 Feb 2019 12:35:52 +0000 (12:35 +0000)]
MFC r344428:

This patch addresses an issue brought up by bz@ in D18968:
When TCP_REASS_LOGGING is defined, a NULL pointer dereference would happen,
if user data was received during the TCP handshake and BB logging is used.

A KASSERT is also added to detect tcp_reass() calls with illegal parameter
combinations.

Reported by: bz@
Reviewed by: rrs@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D19254

5 years agoMFC r343439:
Michael Tuexen [Mon, 25 Feb 2019 12:33:11 +0000 (12:33 +0000)]
MFC r343439:

Don't include two header files when not needed.

This allows the part of the rewrite of TCP reassembly in this
files to be MFCed to stable/11 with manual change.

Sponsored by: Netflix, Inc.

5 years agoMFC r343920:
Michael Tuexen [Mon, 25 Feb 2019 12:25:44 +0000 (12:25 +0000)]
MFC r343920:

Ensure that when using the TCP CDG congestion control and setting the
sysctl variable net.inet.tcp.cc.cdg.smoothing_factor to 0, the smoothing
is disabled. Without this patch, a division by zero orrurs.

PR: 193762
Reviewed by: lstewart@, rrs@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D19071

5 years agoMFC r344253
Vincenzo Maffione [Mon, 25 Feb 2019 08:50:25 +0000 (08:50 +0000)]
MFC r344253

netmap: don't schedule kqueue notify task when kqueue is not used

This change adds a counter (kqueue_users) to keep track of how many
kqueue users are referencing a given struct nm_selinfo.
In this way, nm_os_selwakeup() can schedule the kevent notification
task only when kqueue is actually being used.
This is important to avoid wasting CPU in the common case where
kqueue is not used.

Reviewed by:    Aleksandr Fedorov <aleksandr.fedorov@itglobal.com>
Differential Revision:  https://reviews.freebsd.org/D19177

5 years agoMFC r343924:
Justin Hibbits [Sun, 24 Feb 2019 20:51:47 +0000 (20:51 +0000)]
MFC r343924:

Correct the CPU target for powerpcspe

The MPC8540 is actually e500v1, which doesn't have double-precision floating
point support.  The 8548 does, so use that as the CPU target.

5 years agoMFC r343763, r343944, r343946
Justin Hibbits [Sun, 24 Feb 2019 20:49:16 +0000 (20:49 +0000)]
MFC r343763, r343944, r343946

r343763: powerpc: Don't idle with the wait instruction on booke
r343944: powerpc: Split out the e500mc idling from rest of Book-E
r343946: powerpc: Fix AIM build

5 years agoMFC r342811, r343168-r343169
Justin Hibbits [Sun, 24 Feb 2019 20:29:11 +0000 (20:29 +0000)]
MFC r342811, r343168-r343169

r342811:
dtsec: Fix formatting of addresses in translation error messages

Don't clamp addresses to 8 hex digits, particularly since this is primarily
used now on a 64-bit platform.

r343168:
powerpc/dpaa: Handle DMAP virtual addresses in DPAA

sendfile(2) appears to now use DMAP wherever possible.  These addresses are not
managed by pmap, so pmap_kextract() returns a 0 physical address, causing
failure.

This change fixes nginx running on P5020 SoC.

r343169:
dpaa: fix 32-bit build

Book-E powerpc uses 64-bit vm_paddr_t, and 32-bit powerpc has 32-bit pointers,
so gcc errors with cast to pointer from integer of different size.  As this will
not actually be used in reality anyway, simply quiet the warning by casting
through uintptr_t.

5 years agoMFC r343078:
Justin Hibbits [Sun, 24 Feb 2019 20:15:16 +0000 (20:15 +0000)]
MFC r343078:

powerpc: Fix FPU fsqrt emulation special case results

If fsqrts is emulated with +INF as its argument, the 0 return value causes a
NULL pointer dereference, panicking the system.  Follow the PowerISA and
return +INF with no FP exception.

5 years agoMFC r339707: Allow fdisk(8) to deal with sectors larger than 2048
Rodney W. Grimes [Sun, 24 Feb 2019 01:56:35 +0000 (01:56 +0000)]
MFC r339707: Allow fdisk(8) to deal with sectors larger than 2048
especially for 4Kn drives with PMBR's

Approved by: bde (mentor, implicit)

5 years agoMFC r344386:
Dimitry Andric [Sat, 23 Feb 2019 14:27:09 +0000 (14:27 +0000)]
MFC r344386:

Pull in r354515 from upstream libc++ trunk:

  Fix the build with gcc when `-Wredundant-decls` is passed

  Summary:

  gcc warns that `__throw_runtime_error` is declared both in
  `<__locale>` and `<stdexcept>`, if `-Wredundant-decls` is passed on
  the command line; this is the case with FreeBSD when ${WARNS} == 6.

  Since `<__locale>` gets its first declaration via a transitive
  include of `<stdexcept>`, and the second declaration is after the
  first invocation of `__throw_runtime_error`, delete that second
  declaration.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
  Reviewers: kristina, MaskRay, EricWF, ldionne, ngie

  Reviewed By: EricWF

  Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, libcxx-commits

  Tags: #libc

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

Submitted by: ngie

5 years agoMFC r344162:
Stephen Hurd [Fri, 22 Feb 2019 18:02:46 +0000 (18:02 +0000)]
MFC r344162:

iflib: Improve return values of interrupt handlers.

iflib was returning FILTER_HANDLED, in cases where FILTER_STRAY was more
correct. This potentially caused issues with shared legacy interrupts.

Driver filters returning FILTER_STRAY are now properly handled.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com>
Reviewed by: marius, gallatin
Obtained from: Haiku (a84bb9, 4947d1)
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D19201

5 years agoMFC r344303:
Konstantin Belousov [Fri, 22 Feb 2019 12:27:25 +0000 (12:27 +0000)]
MFC r344303:
Minor cleanup for mkuzip(8) man page.

5 years agoMFC r344296:
Konstantin Belousov [Fri, 22 Feb 2019 12:26:28 +0000 (12:26 +0000)]
MFC r344296:
Provide convenience C wrappers for RDPKRU and WRPKRU instructions.

5 years agoMFC r344293:
Konstantin Belousov [Fri, 22 Feb 2019 12:12:01 +0000 (12:12 +0000)]
MFC r344293:
Add definition for %cr4 PKRU enable bit.

5 years agoRevert r344436, which was the merge of r344120.
Konstantin Belousov [Fri, 22 Feb 2019 10:06:34 +0000 (10:06 +0000)]
Revert r344436, which was the merge of r344120.

Currently stable/12 i386 installs old ld.bfd as ld (WITHOUT_LLD_IS_LD),
which prevents ifunc relocations from working properly.  If a static
binary is linked, then it looses libc relocations needed.

The stable i386 branch uses ld.lld for the world build (WITH_LLD_BOOTSTRAP),
which is why static binaries from the base do not have the issue.

Reported and diagnosted by: antoine

5 years agoMFC r344214:
Andriy Voskoboinyk [Fri, 22 Feb 2019 08:04:50 +0000 (08:04 +0000)]
MFC r344214:
Refresh OptionalObsoleteFiles.inc for MK_PMC:

- Add missing /usr/sbin/pmc, pmcformat.h, libpmcstat.h and pmc.haswellxeon.3
to the list.
- Correct man page section for pmcstudy.8.
- Include recently added libipt and libopencsd for corresponding TARGET_ARCH

5 years agoMFC r344201:
Andriy Voskoboinyk [Thu, 21 Feb 2019 23:53:52 +0000 (23:53 +0000)]
MFC r344201:
Remove vi(1)-related files via 'make delete-old' when WITHOUT_VI=1 is set.

5 years agoMFC r344120:
Konstantin Belousov [Thu, 21 Feb 2019 12:13:27 +0000 (12:13 +0000)]
MFC r344120:
Unify i386 and amd64 getcontextx.c, and use ifuncs while there.