]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
5 years agoMFC r337522:
delphij [Mon, 3 Sep 2018 06:57:25 +0000 (06:57 +0000)]
MFC r337522:

In read_zones(), check if the file name actually fit in the buffer
and make sure it would terminate with nul with strlcpy().

Reviewed by: imp (earlier revision)
Differential Revision: https://reviews.freebsd.org/D16595

git-svn-id: svn://svn.freebsd.org/base/stable/10@338441 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r338038: Extending the delay cycles to give the codec more time to pump ADC data...
avatar [Sun, 26 Aug 2018 13:03:58 +0000 (13:03 +0000)]
MFC r338038: Extending the delay cycles to give the codec more time to pump ADC data across the AC-link.

Without this patch, some CS4614 cards will need users to reload the driver manually or
the hardware won't be initialised properly. Something like:

# kldload snd_csa
# kldunload snd_csa
# kldload snd_csa

Tested with: Terratec SiXPack 5.1+

git-svn-id: svn://svn.freebsd.org/base/stable/10@338326 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336420,336433,336593,336621,336622,336624,337394,337401,338141
cperciva [Sun, 26 Aug 2018 05:28:17 +0000 (05:28 +0000)]
MFC r336420,336433,336593,336621,336622,336624,337394,337401,338141

Teach the EC2 AMI upload code to:
* Mark EBS snapshots as public,
* Announce new AMIs to an SNS topic, and
* Place the SVN branch and revision into the AMI "description".

git-svn-id: svn://svn.freebsd.org/base/stable/10@338323 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC 338013: bsnmpd(8): fix and optimize interface description processing
eugen [Sat, 25 Aug 2018 10:42:44 +0000 (10:42 +0000)]
MFC 338013: bsnmpd(8): fix and optimize interface description processing

* correctly prepare a buffer to obtain interface description from a kernel
  and truncate long description instead of dropping it altogether and
  spamming logs;
* skip calling strlen() for each description and each SNMP request
  for MIB-II/ifXTable's ifAlias.
* teach bsnmpd to allocate memory dynamically for interface descriptions
  to decrease memory usage for common case and not to break
  if long description occurs;

PR: 217763
Reviewed by: harti and others
Differential Revision: https://reviews.freebsd.org/D16459

git-svn-id: svn://svn.freebsd.org/base/stable/10@338311 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r337438
rmacklem [Fri, 24 Aug 2018 22:48:19 +0000 (22:48 +0000)]
MFC: r337438
Allow newnfs_request() to retry all callback RPCs with an NFSERR_DELAY reply.

The code in newnfs_request() retries RPCs that get a reply of NFSERR_DELAY,
but exempts certain NFSv4 operations. However, for callback RPCs, there
should not be any exemptions at this time. The code would have erroneously
exempted the CBRECALL callback, since it has the same operation number as
the CLOSE operation.
This patch fixes this by checking for a callback RPC (indicated by clp != NULL)
and not checking for exempt operations for callbacks.
This would have only affected the NFSv4 server when delegations are enabled
(they are not enabled by default) and the client replies to CBRECALL with
NFSERR_DELAY. This may never actually happen.
Spotted during code inspection.

git-svn-id: svn://svn.freebsd.org/base/stable/10@338308 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r338120: config(8): Allow escape-quoted empty strings
kevans [Thu, 23 Aug 2018 02:20:09 +0000 (02:20 +0000)]
MFC r338120: config(8): Allow escape-quoted empty strings

For use with things like BOOT_TAG=\"\" -- there are valid reasons to allow
empty strings, especially as these are usually being passed through as
options. The same argument could perhaps be made for the unquoted
variant in things like MODULES_OVERRIDE="", but it's not immediately clear
that this is an issue so I've left it untouched.

git-svn-id: svn://svn.freebsd.org/base/stable/10@338229 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337456:
pfg [Wed, 22 Aug 2018 04:21:25 +0000 (04:21 +0000)]
MFC r337456:
msdosfs: fixes for Undefined Behavior.

These were found by the Undefined Behaviour GsoC project at NetBSD:

Do not change signedness bit with left shift.
While there avoid signed integer overflow.
Address both issues with using unsigned type.

msdosfs_fat.c:512:42, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:521:44, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:14, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:24, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'
msdosfs_fat.c:840:13, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:840:36, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'

Detected with micro-UBSan in the user mode.

Hinted from: NetBSD (CVS 1.33)

git-svn-id: svn://svn.freebsd.org/base/stable/10@338180 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r338047:
cy [Wed, 22 Aug 2018 01:43:11 +0000 (01:43 +0000)]
MFC r338047:

The bucket index is subtracted by one at lines 2304 and 2314.  When 0 it
becomes -1, except these are unsigned integers, so they become very large
numbers. Thus are always larger than the maximum bucket; the hash table
insertion fails causing NAT to fail.

This commit ensures that if the index is already zero it is not reduced
prior to insertion into the hash table.

PR: 208566

git-svn-id: svn://svn.freebsd.org/base/stable/10@338171 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r338046:
cy [Wed, 22 Aug 2018 01:23:11 +0000 (01:23 +0000)]
MFC r338046:

Add handy DTrace probes useful in diagnosing NAT issues. DTrace probes
are situated next to error counters and/or in one instance prior to the
-1 return from various functions. This was useful in diagnosis of
PR/208566 and will be handy in the future diagnosing NAT failures.

PR: 208566

git-svn-id: svn://svn.freebsd.org/base/stable/10@338170 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r338045:
cy [Wed, 22 Aug 2018 01:04:52 +0000 (01:04 +0000)]
MFC r338045:

Expose np (nat_t - an entry in the nat table structure) in the DTrace
probe when nat fails (label badnat). This is useful in diagnosing
failed NAT issues and was used in PR/208566.

PR: 208566

git-svn-id: svn://svn.freebsd.org/base/stable/10@338169 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r336839
rmacklem [Tue, 21 Aug 2018 11:17:25 +0000 (11:17 +0000)]
MFC: r336839
Modify the NFSv4.1 server so that it allows ReclaimComplete as done by ESXi 6.7.

I believe that a ReclaimComplete with rca_one_fs == TRUE is only
to be used after a file system has been transferred to a different
file server.  However, RFC5661 is somewhat vague w.r.t. this and
the ESXi 6.7 client does both a ReclaimComplete with rca_one_fs == TRUE
and one with ReclaimComplete with rca_one_fs == FALSE.
Therefore, just ignore the rca_one_fs == TRUE operation and return
NFS_OK without doing anything instead of replying NFS4ERR_NOTSUPP.
This allows the ESXi 6.7 NFSv4.1 client to do a mount.
After discussion on the NFSv4 IETF working group mailing list, doing this
along with setting a flag to note that a ReclaimComplete with rca_one_fs TRUE
was an appropriate way to handle this.
The flag that indicates that a ReclaimComplete with rca_one_fs == TRUE was
done may be used to disable replies of NFS4ERR_GRACE for non-reclaim
state operations in a future commit.

This patch along with r332790, r334492 and r336357 allow ESXi 6.7 NFSv4.1 mounts
work ok. ESX 6.5 NFSv4.1 mounts do not work well, due to what I believe are
violations of RFC-5661 and should not be used.

git-svn-id: svn://svn.freebsd.org/base/stable/10@338132 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337410:
cy [Tue, 21 Aug 2018 00:37:48 +0000 (00:37 +0000)]
MFC r337410:

Remove redundant and incorrect default definition of AF_INET6. AF_INET6
is defined in sys/socket.h where it's defined as 28.

A bit of trivia: On NetBSD AF_INET6 is defined as 24. On Solaris it is
defined as 26. This is probably why Darren defaulted to 26, because
ipfilter was originally written for SunOS 4 and Solaris many moons ago.

git-svn-id: svn://svn.freebsd.org/base/stable/10@338123 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337969:
kp [Mon, 20 Aug 2018 15:43:08 +0000 (15:43 +0000)]
MFC r337969:

pf: Limit the maximum number of fragments per packet

Similar to the network stack issue fixed in r337782 pf did not limit the number
of fragments per packet, which could be exploited to generate high CPU loads
with a crafted series of packets.

Limit each packet to no more than 64 fragments. This should be sufficient on
typical networks to allow maximum-sized IP frames.

This addresses the issue for both IPv4 and IPv6.

Security: CVE-2018-5391
Sponsored by: Klara Systems

git-svn-id: svn://svn.freebsd.org/base/stable/10@338106 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337867:
jamie [Mon, 20 Aug 2018 05:32:42 +0000 (05:32 +0000)]
MFC r337867:

  Don't let clobber jailparam values when checking for modification of
  init-only parameters.

PR: 230487
Submitted by: Jason Mader

git-svn-id: svn://svn.freebsd.org/base/stable/10@338091 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFH r337745:
mm [Sat, 18 Aug 2018 23:24:53 +0000 (23:24 +0000)]
MFH r337745:
Sync libarchive with vendor..

Vendor changes:
  PR #1042: validate iso9660 directory record length

MFC after: 3 days
Security: CVE-2017-14501

git-svn-id: svn://svn.freebsd.org/base/stable/10@338034 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337322:
dim [Fri, 17 Aug 2018 06:31:30 +0000 (06:31 +0000)]
MFC r337322:

Fix build of hyperv with base gcc on i386

Summary:
Base gcc fails to compile `sys/dev/hyperv/pcib/vmbus_pcib.c` for i386,
with the following -Werror warnings:

cc1: warnings being treated as errors
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'new_pcichild_device':
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:567: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'vmbus_pcib_on_channel_callback':
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:940: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_pci_protocol_negotiation':
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1012: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_pci_enter_d0':
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1073: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_send_resources_allocated':
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1125: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'vmbus_pcib_map_msi':
/usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1730: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

This is because on i386, several casts from `uint64_t` to a pointer
reduce the value from 64 bit to 32 bit.

For gcc, this can be fixed by an intermediate cast to uintptr_t. Note
that I am assuming the incoming values will always fit into 32 bit!

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

git-svn-id: svn://svn.freebsd.org/base/stable/10@337959 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337558, r337560
cy [Fri, 17 Aug 2018 02:46:36 +0000 (02:46 +0000)]
MFC r337558, r337560

r337558:
Identify the return value (rval) that led to the IPv4 NAT failure
in ipf_nat_checkout() and report it in the frb_natv4out and frb_natv4in
dtrace probes.

This is currently being used to diagnose NAT failures in PR/208566. It's
rather handy so this commit makes it available for future diagnosis and
debugging efforts.

PR: 208566

r337560:
Correct a comment. Should have been detected by ipf_nat_in() not
ipf_nat_out().

git-svn-id: svn://svn.freebsd.org/base/stable/10@337948 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337727 (rewritten due to unmerged API change in 11+):
brooks [Thu, 16 Aug 2018 15:54:12 +0000 (15:54 +0000)]
MFC r337727 (rewritten due to unmerged API change in 11+):

Copy out from kernel to data, not the other way around.

Sponsored by: DARPA, AFRL

git-svn-id: svn://svn.freebsd.org/base/stable/10@337912 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoDocument SA-18:09 through SA-18:11.
gjb [Thu, 16 Aug 2018 15:32:17 +0000 (15:32 +0000)]
Document SA-18:09 through SA-18:11.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@337910 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337717, r337718:
gjb [Thu, 16 Aug 2018 15:17:22 +0000 (15:17 +0000)]
MFC r337717, r337718:

 r337717:
  Add lang/python2, lang/python3, and lang/python to GCE images
  to help avoid hard-coding 'python<MAJOR>.<MINOR>' in several
  scripts in the client-side scripts. [1]

 r337718:
  Add a space between a variable and escaped new line.

PR: 230248 [1]
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@337908 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoLoad filesystem modules associated with allow.mount permissions.
jamie [Wed, 15 Aug 2018 22:32:55 +0000 (22:32 +0000)]
Load filesystem modules associated with allow.mount permissions.

PR: 192092

git-svn-id: svn://svn.freebsd.org/base/stable/10@337880 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r331332:
jamie [Wed, 15 Aug 2018 21:38:44 +0000 (21:38 +0000)]
MFC r331332:

  If a jail parameter isn't found, try loading a related kernel module.

PR: 192092

git-svn-id: svn://svn.freebsd.org/base/stable/10@337876 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoFix unauthenticated EAPOL-Key decryption vulnerability. [SA-18:11.hostapd]
delphij [Wed, 15 Aug 2018 05:05:02 +0000 (05:05 +0000)]
Fix unauthenticated EAPOL-Key decryption vulnerability. [SA-18:11.hostapd]

Approved by: so

git-svn-id: svn://svn.freebsd.org/base/stable/10@337832 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337508:
brooks [Tue, 14 Aug 2018 16:25:09 +0000 (16:25 +0000)]
MFC r337508:

Terminate filter_create_ext() args with NULL, not 0.

filter_create_ext() is documented to take a NULL terminated set of
arguments.  0 is promoted to an int so this would fail on 64-bit
systems if the value was not passed in a register.  On all currently
supported 64-bit architectures it is.

Obtained from: CheriBSD
Sponsored by: DARPA, AFRL

git-svn-id: svn://svn.freebsd.org/base/stable/10@337768 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337426:
markj [Tue, 14 Aug 2018 14:19:57 +0000 (14:19 +0000)]
MFC r337426:
ifconfig: Fix use of _Noreturn.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337757 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoBump the mlx5core, mlx5en(4) and mlx5ib driver version.
hselasky [Tue, 14 Aug 2018 11:52:05 +0000 (11:52 +0000)]
Bump the mlx5core, mlx5en(4) and mlx5ib driver version.

This is a direct commit.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@337748 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330657:
hselasky [Tue, 14 Aug 2018 11:44:11 +0000 (11:44 +0000)]
MFC r330657:
Use vport rather than physical-port MTU in mlx5en(4).

Set and report vport MTU rather than physical MTU,
The driver will set both vport and physical port mtu
and will rely on the query of vport mtu.

SRIOV VFs have to report their MTU to their vport manager (PF),
and this will allow them to work with any MTU they need
without failing the request.

Also for some cases where the PF is not a port owner, PF can
work with MTU less than the physical port mtu if set physical
port mtu didn't take effect.

Based on Linux upstream commit:
cd255efff9baadd654d6160e52d17ae7c568c9d3

Submitted by: Meny Yossefi <menyy@mellanox.com>
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@337747 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r325661:
hselasky [Tue, 14 Aug 2018 11:43:02 +0000 (11:43 +0000)]
MFC r325661:
Expose the current hardware MTU in mlx5en(4) as a separate entry
in the sysctl tree.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@337746 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoEnter error state when handling bad device in mlx5core and add checks
hselasky [Tue, 14 Aug 2018 11:24:14 +0000 (11:24 +0000)]
Enter error state when handling bad device in mlx5core and add checks
for error state to mlx5en(4) to make live migration work.

This is a direct commit.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@337743 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336450:
hselasky [Tue, 14 Aug 2018 11:19:04 +0000 (11:19 +0000)]
MFC r336450:
Do not inline transmit headers and use HW VLAN tagging if supported by mlx5en(4).

Query the minimal inline mode supported by the card.
When creating a send queue, cache the queried mode and optimize the transmit
if no inlining is required.  In this case, we can avoid touching the headers
cache line and avoid dirtying several more lines by copying headers into
the send WQEs.  Also, if no inline headers are used, hardware assists in
the VLAN tag framing.

Submitted by: kib@, slavash@
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@337742 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336407:
hselasky [Tue, 14 Aug 2018 11:15:05 +0000 (11:15 +0000)]
MFC r336407:
Handle jumbo frames without requiring big clusters in mlx5en(4).

The scatter list is formed by the chunks of MCLBYTES each, and larger
than default packets are returned to the stack as the mbuf chain.

Submitted by: kib@
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@337741 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r322325: cat: fix build with -DNO_UDOM_SUPPORT
kevans [Tue, 14 Aug 2018 01:57:11 +0000 (01:57 +0000)]
MFC r322325: cat: fix build with -DNO_UDOM_SUPPORT

PR: 230489

git-svn-id: svn://svn.freebsd.org/base/stable/10@337734 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337555, r337556:
gjb [Mon, 13 Aug 2018 14:24:00 +0000 (14:24 +0000)]
MFC r337555, r337556:
 r337555:
  Update and replace old rc daemons for GCE images.

 r337556:
  Invoke the growfs rc script for each boot on GCE.

PR: 229000, 230275
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@337710 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoRemove mention of FreeBSD 9.x which is EoL'ed now.
delphij [Sun, 12 Aug 2018 21:43:59 +0000 (21:43 +0000)]
Remove mention of FreeBSD 9.x which is EoL'ed now.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337692 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC SVN r336350: Send sysrc(8) error message to stderr (not stdout)
dteske [Fri, 10 Aug 2018 20:07:59 +0000 (20:07 +0000)]
MFC SVN r336350: Send sysrc(8) error message to stderr (not stdout)

PR: bin/229806
Reported by: Andreas Sommer <andreas.sommer87@googlemail.com>
Sponsored by: Smule, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337588 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336695
davidcs [Thu, 9 Aug 2018 01:39:47 +0000 (01:39 +0000)]
MFC r336695
Remove support for QLNX_RCV_IN_TASKQ - i.e., Rx only in TaskQ.
Added support for LLDP passthru
Upgrade ECORE to version 8.33.5.0
Upgrade STORMFW to version 8.33.7.0

git-svn-id: svn://svn.freebsd.org/base/stable/10@337519 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336680
davidcs [Thu, 9 Aug 2018 01:05:25 +0000 (01:05 +0000)]
MFC r336680
Update man page with support for 41000 Series adapters

git-svn-id: svn://svn.freebsd.org/base/stable/10@337516 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336438
davidcs [Thu, 9 Aug 2018 00:48:55 +0000 (00:48 +0000)]
MFC r336438

Fixes for  the following issues:
1. Fix taskqueues drain/free to fix panic seen when interface is being
   bought down and in parallel asynchronous link events happening.

2. Fix bxe_ifmedia_status()

Submitted by:Vaishali.Kulkarni@cavium.com and Anand.Khoje@cavium.com

git-svn-id: svn://svn.freebsd.org/base/stable/10@337511 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r321333:
bdrewery [Wed, 8 Aug 2018 18:59:25 +0000 (18:59 +0000)]
MFC r321333:

  Properly set userid for truncate_test.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337491 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r323620:
bdrewery [Wed, 8 Aug 2018 18:54:05 +0000 (18:54 +0000)]
MFC r323620:

  Fix the raise tests.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337486 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335183:
bdrewery [Wed, 8 Aug 2018 17:49:35 +0000 (17:49 +0000)]
MFC r335183:

  proc0_post: Fix some locking issues

git-svn-id: svn://svn.freebsd.org/base/stable/10@337471 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoDocument SA-18:08.
gjb [Tue, 7 Aug 2018 15:03:11 +0000 (15:03 +0000)]
Document SA-18:08.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@337420 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337390: Bump date after r337384.
jtl [Mon, 6 Aug 2018 18:47:03 +0000 (18:47 +0000)]
MFC r337390: Bump date after r337384.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337392 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337384:
jtl [Mon, 6 Aug 2018 17:46:28 +0000 (17:46 +0000)]
MFC r337384:

Address concerns about CPU usage while doing TCP reassembly.

Currently, the per-queue limit is a function of the receive buffer
size and the MSS.  In certain cases (such as connections with large
receive buffers), the per-queue segment limit can be quite large.
Because we process segments as a linked list, large queues may not
perform acceptably.

The better long-term solution is to make the queue more efficient.
But, in the short-term, we can provide a way for a system
administrator to set the maximum queue size.

We set the default queue limit to 100.  This is an effort to balance
performance with a sane resource limit.  Depending on their
environment, goals, etc., an administrator may choose to modify this
limit in either direction.

Approved by: so
Security: FreeBSD-SA-18:08.tcp
Sponsored by: CVE-2018-6922

git-svn-id: svn://svn.freebsd.org/base/stable/10@337386 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336926:
pfg [Mon, 6 Aug 2018 02:10:52 +0000 (02:10 +0000)]
MFC r336926:
sed: unsign some indexes to fix sign-compare warnings.

Hinted by: OpenBSD (CVS 1.32)

git-svn-id: svn://svn.freebsd.org/base/stable/10@337367 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFH r336801,r336854:
mm [Sun, 5 Aug 2018 14:36:12 +0000 (14:36 +0000)]
MFH r336801,r336854:

MFH r336801 (cem):
Cherry-pick upstream 2c8c83b9

Relevant vendor changes:
  Fix issue #948: out-of-bounds read in lha_read_data_none()

MFH r336854:
Sync libarchive with vendor.

Important vendor changes:
  PR #993: Chdir to -C directory for metalog processing
  OSS-Fuzz #4969: Check size of the extended time field in zip archives
  PR #973: Record informational compression level in gzip header

amdbugs: 877
Security: CVE-2017-14503

git-svn-id: svn://svn.freebsd.org/base/stable/10@337352 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336319:
asomers [Fri, 3 Aug 2018 14:47:47 +0000 (14:47 +0000)]
MFC r336319:

auditon(2): fix A_SETPOLICY with 64-bit values

A_SETPOLICY is supposed to work with either 64 or 32-bit values, but due to a
typo the 64-bit version has never worked correctly.

Submitted by: aniketp
Reviewed by: asomers, cem
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16222

git-svn-id: svn://svn.freebsd.org/base/stable/10@337259 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336205:
asomers [Fri, 3 Aug 2018 14:45:53 +0000 (14:45 +0000)]
MFC r336205:

Don't acquire evclass_lock with a spinlock held

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

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

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

git-svn-id: svn://svn.freebsd.org/base/stable/10@337258 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335899:
asomers [Fri, 3 Aug 2018 14:37:23 +0000 (14:37 +0000)]
MFC r335899:

auditd(8): register signal handlers interrutibly

auditd_wait_for_events() relies on read(2) being interrupted by signals,
but it registers signal handlers with signal(3), which sets SA_RESTART.
That breaks asynchronous signal handling. It means that signals don't
actually get handled until after an audit(8) trigger is received.
Symptoms include:

* Sending SIGTERM to auditd doesn't kill it right away; you must send
  SIGTERM and then send a trigger with auditon(2).
* Same with SIGHUP
* Zombie child processes don't get reaped until auditd receives a trigger
  sent by auditon. This includes children created by expiring audit trails
  at auditd startup.

Fix by using sigaction(2) instead of signal(3).

Cherry pick https://github.com/openbsm/openbsm/commit/d060887

PR: 229381
Reviewed by: cem
Obtained from: OpenBSM
Differential Revision: https://github.com/openbsm/openbsm/pull/36

git-svn-id: svn://svn.freebsd.org/base/stable/10@337257 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335287, r335290
asomers [Fri, 3 Aug 2018 14:36:29 +0000 (14:36 +0000)]
MFC r335287, r335290

r335287:
praudit(1): return 0 on success

Cherry pick https://github.com/openbsm/openbsm/commit/ed83bb3

Submitted by: aniketp
Reviewed by: rwatson, 0mp
Obtained from: OpenBSM
Sponsored by: Google, Inc. (GSoC 2018)
Pull Request: https://github.com/openbsm/openbsm/pull/32

r335290:
praudit(1): add tests

Submitted by: aniketp
X-MFC-With: 335287
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15751

git-svn-id: svn://svn.freebsd.org/base/stable/10@337256 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334547:
asomers [Fri, 3 Aug 2018 14:25:15 +0000 (14:25 +0000)]
MFC r334547:

pty.3: Add a HISTORY section

These functions were first added in 4.3 BSD-Reno, according to
http://unix.superglobalmegacorp.com/ and the CSRG svn repository.

Reviewed by: bcr, bjk
Differential Revision: https://reviews.freebsd.org/D15652

git-svn-id: svn://svn.freebsd.org/base/stable/10@337254 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334394:
asomers [Fri, 3 Aug 2018 14:23:51 +0000 (14:23 +0000)]
MFC r334394:

auditpipe(4): fix some ioctl arguments in the man page

Fix the argument types for the AUDITPIPE_[GS]ET_PRESELECT_(NA)?FLAGS ioctls.
Also, fix some grammar.

[skip ci]

PR: 226713
Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15620

git-svn-id: svn://svn.freebsd.org/base/stable/10@337253 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334390:
asomers [Fri, 3 Aug 2018 14:23:01 +0000 (14:23 +0000)]
MFC r334390:

au_read_rec(3): correct return value in man page

Submitted by: aniketp
Reviewed by: csjp (earlier version)
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15618

git-svn-id: svn://svn.freebsd.org/base/stable/10@337252 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334296:
asomers [Fri, 3 Aug 2018 14:22:16 +0000 (14:22 +0000)]
MFC r334296:

Fix "Bad tailq" panic when auditing auditon(A_SETCLASS, ...)

Due to an oversight in r195280, auditon(A_SETCLASS, ...) would cause a tailq
element to get added to the tailq twice, resulting in a circular tailq. This
panics when INVARIANTS are on.

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

git-svn-id: svn://svn.freebsd.org/base/stable/10@337251 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330720:
asomers [Fri, 3 Aug 2018 14:19:56 +0000 (14:19 +0000)]
MFC r330720:

tftpd: reject unknown opcodes

If tftpd receives a command with an unknown opcode, it simply exits 1.  It
doesn't send an ERROR packet, and the client will hang waiting for one.  Fix
it.

PR: 226005

git-svn-id: svn://svn.freebsd.org/base/stable/10@337250 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330719:
asomers [Fri, 3 Aug 2018 14:19:09 +0000 (14:19 +0000)]
MFC r330719:

tftpd: Abort on an WRQ access violation

On a WRQ (write request) tftpd checks whether the client has access
permission for the file in question.  If not, then the write is prevented.
However, tftpd doesn't reply with an ERROR packet, nor does it abort.
Instead, it tries to receive the packet anyway.

The symptom is slightly different depending on the nature of the error.  If
the target file is nonexistent and tftpd lacks permission to create it, then
tftpd will willingly receive the file, but not write it anywhere.  If the
file exists but is not writable, then tftpd will fail to ACK to WRQ.

PR: 225996

git-svn-id: svn://svn.freebsd.org/base/stable/10@337249 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330718:
asomers [Fri, 3 Aug 2018 14:18:02 +0000 (14:18 +0000)]
MFC r330718:

tftpd: Verify world-writability for WRQ when using relative paths

tftpd(8) says that files may only be written if they already exist and are
publicly writable.  tftpd.c verifies that a file is publicly writable if it
uses an absolute pathname.  However, if the pathname is relative, that check
is skipped.  Fix it.

Note that this is not a security vulnerability, because the transfer
ultimately doesn't work unless the file already exists and is owned by user
nobody.  Also, this bug does not affect the default configuration, because
the default uses the "-s" option which makes all pathnames absolute.

PR: 226004

git-svn-id: svn://svn.freebsd.org/base/stable/10@337248 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330710:
asomers [Fri, 3 Aug 2018 14:17:11 +0000 (14:17 +0000)]
MFC r330710:

tftpd: Flush files as soon as they are fully received

On an RRQ, tftpd doesn't exit as soon as it's finished receiving a file.
Instead, it waits five seconds just in case the client didn't receive the
server's last ACK and decides to resend the final DATA packet.
Unfortunately, this created a 5 second delay from when the client thinks
it's done sending the file, and when the file is available for other
processes.

Fix this bug by closing the file as soon as receipt is finished.

PR: 157700
Reported by: Barry Mishler <barry_mishler@yahoo.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@337247 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330696, r330709, r330742, r331358
asomers [Fri, 3 Aug 2018 14:13:15 +0000 (14:13 +0000)]
MFC r330696, r330709, r330742, r331358

r330696:
Add some functional tests for tftpd(8)

tftpd(8) is difficult to test in isolation due to its relationship with
inetd.  Create a test program that mimics the behavior of tftp(1) and
inetd(8) and verifies tftpd's response in several different scenarios.

These test cases cover all of the basic TFTP protocol, but not the optional
parts.

PR: 157700
PR: 225996
PR: 226004
PR: 226005
Differential Revision: https://reviews.freebsd.org/D14310

r330709:
Commit missing file from r330696

X-MFC-With: 330696

r330742:
tftpd: fix the build of tests on i386 after 330696

It's those darn printf format specifiers again

Reported by: cy, kibab
X-MFC-With: 330696

r331358:
tftpd: misc Coverity cleanup in the tests

A bunch of unchecked return values from open(2) and read(2)

Reported by: Coverity
CID: 138690013869111386926138692813869321386942
CID: 13869611386979
X-MFC-With: 330696

git-svn-id: svn://svn.freebsd.org/base/stable/10@337246 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336683:
kib [Fri, 3 Aug 2018 14:12:37 +0000 (14:12 +0000)]
MFC r336683:
Extend ranges of the critical sections to ensure that context switch
code never sees FPU pcb flags not consistent with the hardware state.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337245 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r328266:
asomers [Fri, 3 Aug 2018 14:08:39 +0000 (14:08 +0000)]
MFC r328266:

mlock(2): correct documentation for error conditions.

The man page is years out of date regarding errors. Our implementation _does_
allow unaligned addresses, and it _does_not_ check for negative lengths,
because the length is unsigned. It checks for overflow instead.

Update the tests accordingly.

Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D13826

git-svn-id: svn://svn.freebsd.org/base/stable/10@337244 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r336357
rmacklem [Wed, 1 Aug 2018 19:25:12 +0000 (19:25 +0000)]
MFC: r336357
Modify the reasons for not issuing a delegation in the NFSv4.1 server.

The ESXi NFSv4.1 client will generate warning messages when the reason for
not issuing a delegation is two. Two refers to a resource limit and I do
not see why it would be considered invalid. However it probably was not the
best choice of reason for not issuing a delegation.
This patch changes the reasons used to ones that the ESXi client doesn't
complain about. This change does not affect the FreeBSD client and does
not appear to affect behaviour of the Linux NFSv4.1 client.
RFC5661 defines these "reasons" but does not give any guidance w.r.t. which
ones are more appropriate to return to a client.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337058 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r322596:
hselasky [Wed, 1 Aug 2018 13:13:43 +0000 (13:13 +0000)]
MFC r322596:
Add SI_SUB_TASKQ after SI_SUB_INTR and move taskqueue initialization there for EARLY_AP_STARTUP

This fixes a regression accidentally introduced in r322588, due to an
interaction with EARLY_AP_STARTUP.

Reviewed by: bdrewery@, jhb@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12053

git-svn-id: svn://svn.freebsd.org/base/stable/10@337042 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r311169, r312975, r313080, r315718 and r316031:
hselasky [Wed, 1 Aug 2018 12:49:51 +0000 (12:49 +0000)]
MFC r311169, r312975, r313080, r315718 and r316031:

Add support for atomic_(f)cmpset to x86.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337041 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r321686 and r330361:
hselasky [Wed, 1 Aug 2018 11:08:52 +0000 (11:08 +0000)]
MFC r321686 and r330361:
Add inline functions to convert between sbintime_t and decimal time units.
Use them in some existing code that is vulnerable to roundoff errors.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337036 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330344:
hselasky [Wed, 1 Aug 2018 10:35:49 +0000 (10:35 +0000)]
MFC r330344:
Correct the return code from pause() during cold startup from zero to
EWOULDBLOCK. This also matches the description in pause(9).

Discussed with: kib@
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@337035 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330349 and r330362:
hselasky [Wed, 1 Aug 2018 10:34:53 +0000 (10:34 +0000)]
MFC r330349 and r330362:

Allow pause_sbt() to catch signals during sleep by passing C_CATCH flag.
Define pause_sig() function macro helper similarly to other kernel functions
which catch signals. Update outdated function description.

Document pause_sig(9) and update prototypes for existing pause(9) and
pause_sbt(9) functions.

Discussed with: kib@
Suggested by: cem@
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@337034 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r336215
rmacklem [Tue, 31 Jul 2018 21:02:45 +0000 (21:02 +0000)]
MFC: r336215
Ignore the cookie verifier for NFSv4.1 when the cookie is 0.

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

git-svn-id: svn://svn.freebsd.org/base/stable/10@337006 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoRevert r335693, r335694, r335695 by eadler.
markj [Tue, 31 Jul 2018 00:37:25 +0000 (00:37 +0000)]
Revert r335693, r335694, r335695 by eadler.

They cause mail(1) to crash in certain scenarios.

PR: 230196
Reported by: Pete French <petefrench@ingresso.co.uk>

git-svn-id: svn://svn.freebsd.org/base/stable/10@336953 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r335866
rmacklem [Mon, 30 Jul 2018 19:29:31 +0000 (19:29 +0000)]
MFC: r335866
Fix the server side krpc so that the kernel nfsd threads terminate.

Occationally the kernel nfsd threads would not terminate when a SIGKILL
was posted for the kernel process (called nfsd (slave)). When this occurred,
the thread associated with the process (called "ismaster") had returned from
svc_run_internal() and was sleeping waiting for the other threads to terminate.
The other threads (created by kthread_start()) were still in svc_run_internal()
handling NFS RPCs.
The only way this could occur is for the "ismaster" thread to return from
svc_run_internal() without having called svc_exit().
There was only one place in the code where this could happen and this patch
stops that from happening.
Since the problem is intermittent, I cannot be sure if this has fixed the
problem, but I have not seen an occurrence of the problem with this patch
applied.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336928 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r334966
rmacklem [Mon, 30 Jul 2018 12:17:10 +0000 (12:17 +0000)]
MFC: r334966
Add a couple of safety belt checks to the NFSv4.1 client related to sessions.

There were a couple of cases in newnfs_request() that it assumed that it
was an NFSv4.1 mount with a session. This should always be the case when
a Sequence operation is in the reply or the server replies NFSERR_BADSESSION.
However, if a server was broken and sent an erroneous reply, these safety
belt checks should avoid trouble.
The one check required a small tweak to nfsmnt_mdssession() so that it
returns NULL when there is no session instead of the offset of the field
in the structure (0x8 for i386).
This patch should have no effect on normal operation of the client.
Found by inspection during pNFS server development.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336899 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336632:
hselasky [Mon, 30 Jul 2018 09:28:00 +0000 (09:28 +0000)]
MFC r336632:
Update modify counter when setting a mixer control.

PR: 229969

git-svn-id: svn://svn.freebsd.org/base/stable/10@336890 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335700:
hselasky [Mon, 30 Jul 2018 09:21:19 +0000 (09:21 +0000)]
MFC r335700:
Improve the kernel's USB descriptor reading function.
Some USB devices does not allow a partial descriptor readout.

Found by: bz@
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@336887 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335669:
hselasky [Mon, 30 Jul 2018 09:16:47 +0000 (09:16 +0000)]
MFC r335669:
Improve the userspace USB string reading function in LibUSB.
Some USB devices does not allow a partial descriptor readout.

Found by: bz @
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@336884 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r334492
rmacklem [Sat, 28 Jul 2018 20:38:08 +0000 (20:38 +0000)]
MFC: r334492
Add the BindConnectiontoSession operation to the NFSv4.1 server.

Under some fairly unusual circumstances, the Linux NFSv4.1 client is
doing a BindConnectiontoSession operation for TCP connections.
It is also used by the ESXi6.5 NFSv4.1 client.
This patch adds this operation to the NFSv4.1 server.

PR: 226493

git-svn-id: svn://svn.freebsd.org/base/stable/10@336846 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336457:
dab [Mon, 23 Jul 2018 18:47:04 +0000 (18:47 +0000)]
MFC r336457:

Make the definition of struct kevent in event.h match what the man page for kevent(2) says.

This is a trivial comment-only fix. The man page for kevent(2) gives
the definition of struct kevent, including a comment on each
field. The actual definition in sys/event.h omitted the comments on
some fields. Add the comments in. Not only does this make the man page
and include file agree, but the comments are useful in and of
themselves.

Sponsored by: Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@336647 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: 336426
dexuan [Mon, 23 Jul 2018 17:38:35 +0000 (17:38 +0000)]
MFC: 336426

    r336426
        hyperv/hn: Fix panic in hypervisor code upon device detach event

        Submitted by:       hselasky
        Reviewed by:        dexuan
        Differential Revision:      https://reviews.freebsd.org/D16139

git-svn-id: svn://svn.freebsd.org/base/stable/10@336644 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r333766
rmacklem [Thu, 19 Jul 2018 21:07:39 +0000 (21:07 +0000)]
MFC: r333766
Add a missing nfsrv_freesession() call for an unlikely failure case.

Since NFSv4.1 clients normally create a single session which supports
both fore and back channels, it is unlikely that a callback will fail
due to a lack of a back channel.
However, if this failure occurred, the session wasn't being dereferenced
and would never be free'd.
Found by inspection during pNFS server development.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336518 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoRetrospectively document SVN branch point for stable-10 and its releases.
peterj [Wed, 18 Jul 2018 09:32:43 +0000 (09:32 +0000)]
Retrospectively document SVN branch point for stable-10 and its releases.

This is a direct commit to stable/10 because the releases are taken
from the stable/10 branch.

Approved by: jhb (mentor)
Differential Revision: D16263

git-svn-id: svn://svn.freebsd.org/base/stable/10@336448 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoPull in r211155 from upstream llvm trunk (by Tim Northover):
dim [Tue, 17 Jul 2018 21:10:31 +0000 (21:10 +0000)]
Pull in r211155 from upstream llvm trunk (by Tim Northover):

  DAG: move sret demotion into most basic LowerCallTo implementation.

  It looks like there are two versions of LowerCallTo here: the
  SelectionDAGBuilder one is designed to operate on LLVM IR, and the
  TargetLowering one in the case where everything is at DAG level.

  Previously, only the SelectionDAGBuilder variant could handle
  demoting an impossible return to sret semantics (before delegating to
  the TargetLowering version), but this functionality is also useful
  for certain libcalls (e.g. 128-bit operations on 32-bit x86).  So
  this commit moves the sret handling down a level.

  rdar://problem/17242889

This should fix "Call result #3 has unhandled type i32" errors when
building devel/libslang2 for i386.  Direct commit to stable/10, since
clang 3.5 and later already have this change.

Reported by: mi
PR: 229754

git-svn-id: svn://svn.freebsd.org/base/stable/10@336429 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r333645
rmacklem [Tue, 17 Jul 2018 19:26:17 +0000 (19:26 +0000)]
MFC: r333645
End grace for the NFSv4 server if all mounts do ReclaimComplete.

The NFSv4 protocol requires that the server only allow reclaim of state
and not issue any new open/lock state for a grace period after booting.
The NFSv4.0 protocol required this grace period to be greater than the
lease duration (over 2minutes). For NFSv4.1, the client tells the server
that it has done reclaiming state by doing a ReclaimComplete operation.
If all NFSv4 clients are NFSv4.1, the grace period can end once all the
clients have done ReclaimComplete, shortening the time period considerably.
This patch does this. If there are any NFSv4.0 mounts, the grace period
will still be over 2minutes.
This change is only an optimization and does not affect correct operation.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336422 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336115;
pfg [Mon, 16 Jul 2018 00:28:33 +0000 (00:28 +0000)]
MFC r336115;
libiconv: correct undefined behavior.

Detected on NetBSD:
# nm /usr/lib/libc.so|grep sanit
    /public/src.git/lib/libc/citrus/modules/citrus_mapper_std.c:173:8:
runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Obtained from: NetBSD (CVS Rev. 1.11)

git-svn-id: svn://svn.freebsd.org/base/stable/10@336324 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r333579
rmacklem [Thu, 12 Jul 2018 22:59:02 +0000 (22:59 +0000)]
MFC: r333579
The NFSv4.1 server should return NFSERR_BACKCHANBUSY instead of NFS_OK.

When an NFSv4.1 session is busy due to a callback being in progress,
nfsrv_freesession() should return NFSERR_BACKCHANBUSY instead of NFS_OK.
The only effect this has is that the DestroySession operation will report
the failure for this case and this probably has little or no effect on a
client. Spotted by inspection and no failures related to this have been
reported.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336234 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335765, r335776, r336186:
dab [Wed, 11 Jul 2018 14:56:38 +0000 (14:56 +0000)]
MFC r335765, r335776, r336186:

Remove potential identifier conflict in the EV_SET macro.

PR43905 pointed out a problem with the EV_SET macro if the passed
struct kevent pointer were specified with an expression with side
effects (e.g., "kevp++"). This was fixed in rS110241, but by using a
local block that defined an internal variable (named "kevp") to get
the pointer value once. This worked, but could cause issues if an
existing variable named "kevp" is in scope. To avoid that issue,
jilles@ pointed out that "C99 compound literals and designated
initializers allow doing this cleanly using a macro". This change
incorporates that suggestion, essentially verbatim from jilles@
comment on PR43905, except retaining the old definition for pre-C99 or
non-STDC (e.g., C++) compilers.

PR: 43905
Submitted by: Jilles Tjoelker (jilles@)
Reported by: Lamont Granquist <lamont@scriptkiddie.org>
Sponsored by: Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@336200 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r333508
rmacklem [Tue, 10 Jul 2018 19:37:52 +0000 (19:37 +0000)]
MFC: r333508
Add support for the TestStateID operation to the NFSv4.1 server.

The Linux client now uses the TestStateID operation, so this patch adds
support for it to the NFSv4.1 server. The FreeBSD client never uses this
operation, so it should not be affected.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336179 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335921:
jamie [Fri, 6 Jul 2018 19:10:07 +0000 (19:10 +0000)]
MFC r335921:

  Allow jail names (not just IDs) to be specified for: cpuset(1), ipfw(8),
   sockstat(1), ugidfw(8)
  These are the last of the jail-aware userland utilities that didn't work
   with names.

PR: 229266
Differential Revision: D16047

git-svn-id: svn://svn.freebsd.org/base/stable/10@336039 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r306098 (br): Use kqueue(2) instead of select(2).
emaste [Wed, 4 Jul 2018 18:03:19 +0000 (18:03 +0000)]
MFC r306098 (br): Use kqueue(2) instead of select(2).

This helps to ensure we will not lose SIGINT sent by parent to child.

PR: 212562, 228492

git-svn-id: svn://svn.freebsd.org/base/stable/10@335965 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335575, r335786
ian [Wed, 4 Jul 2018 14:12:09 +0000 (14:12 +0000)]
MFC r335575, r335786

r335575:
Use 'mv -f' in rc.d/ntpd to avoid spuriously halting the boot.

The final 'mv' to install a fetched leap-list file can fail (due to a
readonly fs, or schg flags, for example), and that leads to mv(1)
prompting the user, stopping the boot process.  Instead, use mv -f
to supress the prompting, and if verbose mode is on, emit a warning
that the existing file cannot be replaced.

PR: 219255

r335786:
Rename variable ntp_tmp_leapfile to have a leading underbar, to distinguish
it from variables with similar names which are set in rc.conf.  This will
make more sense as the script grows more similar-name local variables in
some upcoming changes.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335952 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335595-r335596
ian [Wed, 4 Jul 2018 14:10:36 +0000 (14:10 +0000)]
MFC r335595-r335596

r335595:
Modernize usage of "restrict" keyword in ntp.conf

It is no longer necessary to specify a -4/-6 flag on any ntp.conf
keyword.  The address type is inferred from the address itself as
necessary.  "restrict default" statements always apply to both address
families regardless of any -4/-6 flag that may be present.

So this change just tidies up our default config by removing the redundant
restrict -6 statement and comment, and by removing the -6 flag from the
restrict keyword that allows access from localhost.

This change was inspired by the patches provided in PRs 201803 and 210245,
and included some contrib/ntp code inspection to verify that the -4/-6
keywords are basically no-ops in all contexts now.

PR: 201803 210245
Differential Revision: https://reviews.freebsd.org/D15974

r335596:
Fix a comment; the ntp leaplist file is updated periodically, but not weekly
(it's only updated when a check shows it's within 30 days of expiring).

PR: 207138

git-svn-id: svn://svn.freebsd.org/base/stable/10@335950 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC SVN r335750: Fix typo in top-level Makefile
dteske [Wed, 4 Jul 2018 03:24:11 +0000 (03:24 +0000)]
MFC SVN r335750: Fix typo in top-level Makefile

Submitted by: Ben Widawsky <ben.widawsky@intel.com>
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/P186

git-svn-id: svn://svn.freebsd.org/base/stable/10@335927 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC SVN r290340: Fix typo in error message
dteske [Tue, 3 Jul 2018 22:11:16 +0000 (22:11 +0000)]
MFC SVN r290340: Fix typo in error message

Submitted by: git_johnko.ca (John Ko)
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/D3997

git-svn-id: svn://svn.freebsd.org/base/stable/10@335914 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r327317:
robak [Tue, 3 Jul 2018 14:57:11 +0000 (14:57 +0000)]
MFC r327317:

humanize_number(3): fix math edge case in rounding large numbers

Fix for remainder overflow, when in rare cases adding remainder to divider
exceeded 1 and turned the total to 1000 in final formatting, taking up
the space for the unit character.

The fix continues the division of the original number if the above case
happens -- added the appropriate check to the for loop performing
the division. This lowers the value shown, to make it fit into the buffer
space provided (1.0M for 4+1 character buffer, as used by ls).

Add test case for the reported bug and extend test program to support
providing buffer length (ls -lh uses 5, tests hard-coded 4).

PR: 224498

git-svn-id: svn://svn.freebsd.org/base/stable/10@335891 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335641:
brooks [Thu, 28 Jun 2018 21:23:05 +0000 (21:23 +0000)]
MFC r335641:

Fix a stack overflow in mount_smbfs when hostname is too long.

The local hostname was blindly copied into the to the nn_name array.
When the hostname exceeded 16 bytes, it would overflow.  Truncate the
hostname to 15 bytes plus a 0 terminator which is the "workstation name"
suffix.

Use defensive strlcpy() when filling nn_name in all cases.

PR: 228354
Reported by: donald.buchholz@intel.com
Reviewed by: jpaetzel,  ian (prior version)
Discussed with: Security Officer (gtetlow)
Security: Stack overflow with the hostname.
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15936

git-svn-id: svn://svn.freebsd.org/base/stable/10@335781 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoAdd mergeinfo for MFC r335607
dteske [Thu, 28 Jun 2018 07:01:56 +0000 (07:01 +0000)]
Add mergeinfo for MFC r335607

This is a direct commit on stable/10 accounting for missing mergeinfo from
SVN r335744. Difficulties with dealing with 'stand' vs 'sys/boot' in MFCs.

Reported by: kevans
Sponsored by: Smule, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335758 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335607: check-password.4th(8): Fix manual [in]accuracy
dteske [Wed, 27 Jun 2018 21:22:00 +0000 (21:22 +0000)]
MFC r335607: check-password.4th(8): Fix manual [in]accuracy

SVN r280384 updated the maximum password length from 16 bytes to 255. The
manual was not updated to reflect this.

Sponsored by: Smule, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335744 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335355:
cy [Wed, 27 Jun 2018 19:42:55 +0000 (19:42 +0000)]
MFC r335355:

Fix amq -i timestamp segmentation violation.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335734 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r302776, r302799:
eadler [Wed, 27 Jun 2018 04:56:01 +0000 (04:56 +0000)]
MFC r302776, r302799:

mail(1): Bring some fixes from other BSDs.

- Use varargs properly
- Use pid_t
- Better handling of error conditions on forked jobs.
- Some prototype and warning cleanups.

Fix missing forked job changes from r302776 in wait_child().

git-svn-id: svn://svn.freebsd.org/base/stable/10@335694 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r325107, r335665:
gjb [Tue, 26 Jun 2018 16:16:08 +0000 (16:16 +0000)]
MFC r325107, r335665:
 r325107 (eadler, partial):
  Update the updating URL in UPDATING.

 r335665:
  Use the 'Updating from Source' Handbook section in UPDATING.

PR: 229345
Submitted by: Niels Bakker
Approved by: re (marius, insta-MFC)
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@335670 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334002: uchcom: extend hardware support to version 0x30
avg [Mon, 25 Jun 2018 08:57:03 +0000 (08:57 +0000)]
MFC r334002: uchcom: extend hardware support to version 0x30

git-svn-id: svn://svn.freebsd.org/base/stable/10@335627 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334001: uchcom: remove UCHCOM_REG_BREAK2 alias of UCHCOM_REG_LCR1
avg [Mon, 25 Jun 2018 08:55:19 +0000 (08:55 +0000)]
MFC r334001: uchcom: remove UCHCOM_REG_BREAK2 alias of UCHCOM_REG_LCR1

git-svn-id: svn://svn.freebsd.org/base/stable/10@335625 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f