]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r322854, r323995, r324568, r324991
asomers [Tue, 28 Nov 2017 00:19:04 +0000 (00:19 +0000)]
MFC r322854, r323995, r324568, r324991

r322854:
zfsd(8): Close a race condition when onlining a disk paritition

When inserting a partitioned disk, devfs and geom will announce the whole
disk before they announce the partition. If the partition containing ZFS
extends to one of the disk's extents, then zfsd will see a ZFS label on the
whole disk and attempt to online it. ZFS is smart enough to activate the
partition instead of the whole disk, but only if GEOM has already created
the partition's provider.

cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Add a zpool_read_all_labels method. It's similar to
zpool_read_label, but it will return the number of labels found.

cddl/usr.sbin/zfsd/zfsd_event.cc
When processing a DevFS CREATE event, only online a VDEV if we can
read all four ZFS labels.

Reviewed by: mav
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D11920

r323995:
Close a memory leak when using zpool_read_all_labels

X-MFC-With: 322854
Sponsored by: Spectra Logic Corp

r324568:
Optimize zpool_read_all_labels with AIO

Read all labels in parallel instead of sequentially

X-MFC-With: 322854
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12495

r324991:
Fix zpool_read_all_labels when vfs.aio.enable_unsafe=0

Previously, zpool_read_all_labels was trying to do 256KB reads, which are
greater than the default MAXPHYS and therefore must go through the slow,
unsafe AIO path.  Shrink these reads to 112KB so they can use the safe, fast
AIO path instead.

X-MFC-With: 324568
Sponsored by: Spectra Logic Corp

6 years agoMFC r326068:
gjb [Mon, 27 Nov 2017 15:12:14 +0000 (15:12 +0000)]
MFC r326068:
 Remove /etc/resolv.conf from virtual machine images, which is
 copied from the build host.  It is renamed to /etc/resolv.conf.bak
 on boot, so never used anyway.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r325755: Be more careful when doing calculation with request from
delphij [Mon, 27 Nov 2017 03:47:12 +0000 (03:47 +0000)]
MFC r325755: Be more careful when doing calculation with request from
userland.

6 years agoMFC r326028:
pfg [Mon, 27 Nov 2017 02:43:27 +0000 (02:43 +0000)]
MFC r326028:
iconv: Fix a pointer mismatch.

Catch NULL pointer earlier, check for empty string later.
Apparently this fixes a GCC8 warning.

Obtained from: NetBSD (CVS Rev. 1.21, 1.22) through DragonFlyBSD

6 years agoMFC r319824 (by sevan), r320624, r326173:
markj [Mon, 27 Nov 2017 00:26:33 +0000 (00:26 +0000)]
MFC r319824 (by sevan), r320624, r326173:
Fixups for the lockstat provider man page.

6 years agoMFC r326098:
kib [Sat, 25 Nov 2017 14:47:24 +0000 (14:47 +0000)]
MFC r326098:
Return different error code for the guard page layout violation.

PR: 223732

6 years agoMFC r325960:
ae [Fri, 24 Nov 2017 04:42:21 +0000 (04:42 +0000)]
MFC r325960:
  Unconditionally enable support for O_IPSEC opcode.

  IPsec support can be loaded as kernel module, thus do not depend from
  kernel option IPSEC and always build O_IPSEC opcode implementation as
  enabled.

MFC r325962:
  Do not invoke IPv4 NAT handler for non IPv4 packets. Libalias expects
  a packet is IPv4. And in case when it is IPv6, it just translates them
  as IPv4. This leads to corruption and in some cases to panics.
  In particular a panic can happen when value of ip6_plen modified to
  something that leads to IP fragmentation, but actual packet length does
  not match the IP length.

  Packets that are not IPv4 will be dropped by NAT rule.

6 years agoMFC r325528:
markj [Thu, 23 Nov 2017 14:03:10 +0000 (14:03 +0000)]
MFC r325528:
Correct the type of foff.

6 years agoMFC r325561:
markj [Thu, 23 Nov 2017 14:02:35 +0000 (14:02 +0000)]
MFC r325561:
Allow various page daemon parameters to be set from loader.conf.

6 years agoMFC r325887:
markj [Thu, 23 Nov 2017 14:01:52 +0000 (14:01 +0000)]
MFC r325887:
Avoid holding the process in uread() and uwrite().

6 years agoMFC r324864, r324865:
markj [Thu, 23 Nov 2017 13:59:34 +0000 (13:59 +0000)]
MFC r324864, r324865:
Cleanups for ctf.5.

6 years agoMFC r325571: Add some PCI IDs found on AMD Epyc system.
mav [Thu, 23 Nov 2017 10:09:49 +0000 (10:09 +0000)]
MFC r325571: Add some PCI IDs found on AMD Epyc system.

6 years agoMFC r325888:
bapt [Thu, 23 Nov 2017 09:35:01 +0000 (09:35 +0000)]
MFC r325888:

Add some 4k quirks for Samsung pm863a SSDs

Submitted by: Nikita Kozlov <nikita.kozlov at blade-group.com>
Sponsored by: blade
Differential Revision: https://reviews.freebsd.org/D13093

6 years agoMFC r325552: s/NgSendMsgReply/NgSendReplyMsg/ in man to match the code.
mav [Wed, 22 Nov 2017 21:22:09 +0000 (21:22 +0000)]
MFC r325552: s/NgSendMsgReply/NgSendReplyMsg/ in man to match the code.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>

6 years agoMFC r325558:
glebius [Wed, 22 Nov 2017 21:20:26 +0000 (21:20 +0000)]
MFC r325558:

  When parsing UDP messages skip optional hostname as described by
  RFC 3164.

PR: 200933
Submitted by: maxim
Reported by: Konstantin Pavlov <thresh nginx.com>

6 years agoMFC r325517, r325554
manu [Wed, 22 Nov 2017 14:06:40 +0000 (14:06 +0000)]
MFC r325517, r325554

r325517:
ctl: Make max_luns and max_ports tunable variables instead of hardcoded
defines.

Reviewed by: trasz (earlier version), bapt (earlier version), bcr (manpages)
Sponsored by: Gandi.net
Differential Revision: https://reviews.freebsd.org/D12836

r325554:
ctl(4): Insert a new line after a sentence-ending full stop.

Reported by: bjk
Sponsored by: Gandi.net
X-MFC-With:  r325517

6 years agoMFC r325532: Update arcmsr(4) to 1.40.00.01:
delphij [Wed, 22 Nov 2017 06:33:51 +0000 (06:33 +0000)]
MFC r325532: Update arcmsr(4) to 1.40.00.01:

 - Fix clear doorbell queue buffer for ADAPTER_TYPE_B
 - Fix release memory resource when detach device
 - Add support for ARC-1216, 1226 SAS 12Gb controllers
 - Declare some functions as static
 - Change checking dword read/write for IOP rqbuffer.

Many thanks to Areca for continuing to support FreeBSD.

Submitted by: 黃清隆 <ching2048 areca com tw>

6 years agoMFC r325813 (bz): Unbreak IPv6.
emaste [Tue, 21 Nov 2017 15:34:25 +0000 (15:34 +0000)]
MFC r325813 (bz): Unbreak IPv6.

No longer return ENXIO when trying to send an IPv6 packet in
nicvf_sq_add_hdr_subdesc().
Restructure the code so that the upper layer protocol parts are
agnostic of the L3 protocol (and no longer specific to IPv4).
With this basic IPv6 packets go through.  We are still seeing
weird behaviour which needs further diagnosis.

PR: 223669

6 years agoMFC r325811: vnic: report that the driver supports multicast
emaste [Tue, 21 Nov 2017 13:59:40 +0000 (13:59 +0000)]
MFC r325811: vnic: report that the driver supports multicast

The driver is currently hardcoded to force promiscuous mode, so all of
the MAC filtering code is presently unused and multicast should "just
work."  Report to the higher layers that multicast is supported.

PR: 223573
Reported by: bz
Sponsored by: The FreeBSD Foundation

6 years agoMFC 319493,319509,319520,319595,319677,319679-319681,319688,319689,
jhb [Tue, 21 Nov 2017 02:09:59 +0000 (02:09 +0000)]
MFC 319493,319509,319520,319595,319677,319679-319681,319688,319689,
319761-319768,320010,322899,322959,323020,323021,323151:

Sync libsysdecode, kdump, and truss with head (aside from changes such
as ino64 that are not applicable to 11).

319493:
Decode the arguments passed to __cap_rights_get() and cap_rights_limit().

319509:
Decode the argument passed to cap_getmode().

The returned integer value is output.

319520:
Decode the 'who' argument passed to getrusage().

Add a new sysdecode_getrusage_who() which decodes the RUSAGE_* constant
passed as the first argument to getrusage().  Use this function in both
kdump and truss to decode the first argument to getrusage().

319595:
Decode arguments to dup, dup2, getdirentries, pread, and pwrite.

- dup and dup2 print fd arguments in decimal.
- pread and pwrite are similar to read and write with the addition of the
  file offset.
- getdirentries displays the output entries as a string for now and also
  prints the value returned in *basep.  Eventually the buffer for
  getdirentries should perhaps be decoded as an array of dirent
  structures.

319677:
Decode arguments to ACL related system calls.

This only decodes the raw arguments but not the contents of the struct acl
objects.

319679:
Decode arguments passed to extended attribute related system calls.

The cmd argument passed to extattrctl() is not decoded as a string constant
but is just printed in hex.  The value is filesystem-specific but in
practice is only used with UFS1 filesystems.

319680:
Decode arguments to minherit().

319681:
Decode arguments to mlock(), mlockall(), and munlock().

319688:
Decode flags passed to mount(), nmount(), and unmount().

319689:
Decode arguments passed to msync().

319761:
Fix decoding of setpriority() arguments.

The PRIO_* 'which' value is stored in the first argument to setpriority(2),
not the last.  While here, decode the arguments to getpriority(2).

319762:
Decode arguments to getpriority() and setpriority().

319763:
Decode the arguments to ptrace().

This does not decode structures returned by ptrace().

319764:
Decode the arguments to quotactl().

319765:
Improve decoding of RB_AUTOBOOT in the 'howto' argument to reboot().

The reboot() system call accepts a mode (RB_AUTOBOOT, RB_HALT, RB_POWEROFF,
or RB_REROOT) as well as zero or more optional flags in 'howto'.
However, RB_AUTOBOOT was only displayed if 'howto' was exactly 0.
Combinations like 'RB_AUTOBOOT | RB_DUMP' were decoded as 'RB_DUMP'.
Instead, imply that RB_AUTOBOOT was specified if none of the other "mode"
flags were specified.

319766:
Decode the 'howto' argument to reboot().

319767:
Decode arguments to rtprio_thread() (same as rtprio()).

319768:
Decode arguments to rtprio() and rtprio_thread().

320010:
Decode arguments to sched_* family of system calls.

This includes decoding both scheduler policy constants and the sched_param
structure for sched_get_priority_max(), sched_get_priority_min(),
sched_getparam(), sched_getscheduler(), sched_rr_get_interval(),
sched_setparam(), and sched_setscheduler().

322899:
Decode arguments passed to thr_set_name().

322959:
Decode extra signal information for caught signals.

Decode fields from the siginfo_t stored in the PT_LWPINFO structure when a
signal is caught by a traced process.  This includes the signal code
(si_code) as well as additional members such as si_addr, si_pid, etc.

323020:
Trim stale prototype for ioctlname().

323021:
Decode signal information returned by system calls.

Specifically, decode the siginfo structure returned by sigtimedwait(),
sigwaitinfo(), and wait6().  While here, also decode the signal number
returned in the second argument to sigwait().

323151:
Decode pathconf() names, *at() flags, and sysarch() numbers in libsysdecode.

Move tables that were previously in truss over to libsysdecode.  truss
output is unchanged, but kdump has been updated to decode these fields.
In addition, sysdecode_sysarch_number() should support all platforms
whereas the old table in truss only supported x86.

PR: 214885, 215448

6 years agoMFC r325373, r325861:
gjb [Mon, 20 Nov 2017 19:05:08 +0000 (19:05 +0000)]
MFC r325373, r325861:
 r325373 (manu):
  release/arm: Do not install ubldr

 r325861 (manu):
  release: Update u-boot and firmware file for RPI-B target.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r325950, r325953:
gjb [Mon, 20 Nov 2017 15:57:11 +0000 (15:57 +0000)]
MFC r325950, r325953:
 r325950:
  Sort variables for consistency.

 r325953:
  Add general configuration files used by release/release.sh for
  big-iron installation images.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r325863:
gjb [Mon, 20 Nov 2017 15:46:23 +0000 (15:46 +0000)]
MFC r325863:
 Only copy /etc/resolv.conf to ${CHROOTDIR} if /etc/resolv.conf does
 not already exist within ${CHROOTDIR}.  This allows re-using a build
 chroot with CHROOTBUILD_SKIP set to a non-empty value and CHROOTDIR
 set to '/' in release.conf.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r325436: RTF_PINNED for an interface
eugen [Mon, 20 Nov 2017 09:23:08 +0000 (09:23 +0000)]
MFC r325436: RTF_PINNED for an interface

  Allow a process to assign an IP address to local ppp interface
  even if kernel routing table already has a route to the address in question
  installed by some routing daemon (PR 223129).

  Also, allow loopback route deletion when stopping a VIMAGE jail (PR 222647).

PR: 222647, 223129
Reviewed by: gnn
Approved by: mav (mentor)
Differential Revision: https://reviews.freebsd.org/D12747

6 years agoMFC r325759:
kib [Mon, 20 Nov 2017 08:12:40 +0000 (08:12 +0000)]
MFC r325759:
Do not leak PMC_PO_OWNS_LOGFILE on error.

6 years agoMFC r325383:
delphij [Mon, 20 Nov 2017 06:48:10 +0000 (06:48 +0000)]
MFC r325383:

Avoid calling get_controller_count() until attaching, this would avoid
costly PCI config space operations that slows down systems without the
hardware.

Many thanks to HighPoint for continued support of FreeBSD!

Submitted by: Steve Chang
Reported by: cperciva

6 years agoMFC r325441:
bcr [Sun, 19 Nov 2017 11:24:24 +0000 (11:24 +0000)]
MFC r325441:

Extend the synopsis section of md(4) to look more like other manpages
of this kind.  Describe how to compile the driver into the kernel
and how to load it as a module.
This is useful for people using the MINIMAL kernel configuration file.

PR: 218610
Submitted by: Harald Schmalzbauer (bugzilla.freebsd@omnilan.de)
Reviewed by: noone (1 month inactivity)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12271

6 years agoMFC r325444: ANSIfy sys/kern/md4c.c
emaste [Sun, 19 Nov 2017 00:32:16 +0000 (00:32 +0000)]
MFC r325444: ANSIfy sys/kern/md4c.c

PR: 223453
Submitted by: ota@j.email.ne.jp

6 years agoMFC r325616:
hselasky [Fri, 17 Nov 2017 15:48:03 +0000 (15:48 +0000)]
MFC r325616:
Make sure sin_zero is zero in ibcore. Else socket address maching using
bcmp() might fail.

Sponsored by: Mellanox Technologies

6 years agoMFC r325615:
hselasky [Fri, 17 Nov 2017 15:45:35 +0000 (15:45 +0000)]
MFC r325615:
Make sure the IPv6 scope ID gets zeroed when exchanging CMA messages in ibcore.
Else the IPv6 address matching might fail. This change adds support for both
embedded and non-embedded IPv6 scope IDs when passing a IPv6 link-local socket
address to RDMA. Prior to this change only global IPv6 addresses would work
with RDMA.

Sponsored by: Mellanox Technologies

6 years agoMFC r325614:
hselasky [Fri, 17 Nov 2017 15:37:36 +0000 (15:37 +0000)]
MFC r325614:
Multiple fixes for using IPv6 link-local addresses with RDMA in ibcore.

1) Fail to resolve RDMA address if rtalloc1() returns the loopback
device, lo0, as the gateway interface. Currently RDMA loopback is
not supported.

2) Use ip_dev_find() and ip6_dev_find() to lookup network interfaces
with matching IPv4 and IPv6 addresses, respectivly.

3) In addr_resolve() make sure the "ifa" pointer is always set, also when
the "ifp" is NULL. Else a NULL pointer access might happen trying to
read from the "ifa" pointer later on.

4) In rdma_addr_find_dmac_by_grh() make sure the "bound_dev_if" field
gets set properly instead of passing the scope ID through the IPv6
socket address structure. This is more in line with upstream OFED
in Linux.

5) In rdma_addr_find_smac_by_sgid() there is no need to pass the
scope ID for IPv6. Either it is stored in the "bound_dev_if" field
or ip6_dev_find() will find the correct network device regardless
of the scope ID.

Sponsored by: Mellanox Technologies

6 years agoMFC r325533:
hselasky [Fri, 17 Nov 2017 15:27:52 +0000 (15:27 +0000)]
MFC r325533:
Make the dma_alloc_coherent() function in the LinuxKPI NULL safe with regard
to the "dev" argument.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

6 years agoMFC: 325359
bapt [Fri, 17 Nov 2017 13:01:56 +0000 (13:01 +0000)]
MFC: 325359

Upgrade to Unicode 10.0.0

6 years agoMFC r325610: MFV r325609: 7531 Assign correct flags to prefetched buffers
avg [Fri, 17 Nov 2017 10:10:22 +0000 (10:10 +0000)]
MFC r325610: MFV r325609: 7531 Assign correct flags to prefetched buffers

6 years agoMFC r325361:
bapt [Fri, 17 Nov 2017 09:14:18 +0000 (09:14 +0000)]
MFC r325361:

Update to CLDR 32 and Unicode 10

Relnotes: yes

6 years agoMFC r325683: vnic: apply BPF tap before passing packet to hardware
emaste [Fri, 17 Nov 2017 00:38:00 +0000 (00:38 +0000)]
MFC r325683: vnic: apply BPF tap before passing packet to hardware

Previously we passed tx packets to hardware via nicvf_tx_mbuf_locked
and then to the BPF tap, with a possibly invalid mbuf which would result
in a panic.

PR: 223600
Discussed with: bz
Sponsored by: The FreeBSD Foundation, Packet.net (hardware)

6 years agoMFC r325035: MFV r325013,r325034: 640 number_to_scaled_string is duplicated in severa...
avg [Thu, 16 Nov 2017 23:27:27 +0000 (23:27 +0000)]
MFC r325035: MFV r325013,r325034: 640 number_to_scaled_string is duplicated in several commands

FreeBSD note: of all libcmdutils functionality ZFS (and other illumos
contrib code) currently uses only nicenum() function (which is similar
to humanize_number but has some formatting differences).  For this
reason I decided to not port the whole library.  As a result, nicenum.c
from libcmdutils is compiled into libzfs and libzpool.  This is a bit
ugly, but works.  If one day we are forced to create libillumos, then
the file should be moved to that library.

6 years agoMFC r325228: vdev_geom_close: close errored consumer even if vdev_reopening is set
avg [Thu, 16 Nov 2017 22:58:55 +0000 (22:58 +0000)]
MFC r325228: vdev_geom_close: close errored consumer even if vdev_reopening is set

6 years agoMFC r325608: MFV r325607: 8607 zfs: variable set but not used
avg [Thu, 16 Nov 2017 22:53:36 +0000 (22:53 +0000)]
MFC r325608: MFV r325607: 8607 zfs: variable set but not used

6 years agoMFC r325606: MFV r325605: 8713 Buffer overflow in dsl_dataset_name()
avg [Thu, 16 Nov 2017 22:44:51 +0000 (22:44 +0000)]
MFC r325606: MFV r325605: 8713 Buffer overflow in dsl_dataset_name()

6 years agoMFC r325227,r325272: geom_slice: do not destroy softc until providers are gone
avg [Thu, 16 Nov 2017 22:25:12 +0000 (22:25 +0000)]
MFC r325227,r325272: geom_slice: do not destroy softc until providers are gone

6 years agoMFC r325766
vangyzen [Thu, 16 Nov 2017 21:47:41 +0000 (21:47 +0000)]
MFC r325766

Fix formatting of _umtx_op(2)

Do not use macros in the -width of a .Bl, since mandoc does not support them.

Fix issues reported by igor and mandoc -Tlint.

Use a .Bl for list of clock IDs instead of a comma list.

Sponsored by: Dell EMC

6 years agoMFC r325764
vangyzen [Thu, 16 Nov 2017 21:45:10 +0000 (21:45 +0000)]
MFC r325764

Add __BEGIN_DECLS and __END_DECLS to <sys/umtx.h>

This allows C++ programs to call _umtx_op().

Sponsored by: Dell EMC

6 years agoMFC 319517: Add a cross-reference to sysdecode_socket_protocol(3).
jhb [Thu, 16 Nov 2017 19:07:19 +0000 (19:07 +0000)]
MFC 319517: Add a cross-reference to sysdecode_socket_protocol(3).

6 years agoMFC 325039: Rework pass through changes in r305485 to be safer.
jhb [Thu, 16 Nov 2017 18:22:03 +0000 (18:22 +0000)]
MFC 325039: Rework pass through changes in r305485 to be safer.

Specifically, devices that do not support PCI-e FLR and were not
gracefully shutdown by the guest OS could continue to issue DMA
requests after the VM was terminated.  The changes in r305485 meant
that those DMA requests were completed against the host's memory which
could result in random memory corruption.  Instead, leave ppt devices
that are not attached to a VM disabled in the IOMMU and only restore
the devices to the host domain if the ppt(4) driver is detached from a
device.

As an added safety belt, disable busmastering for a pass-through device
when before adding it to the host domain during ppt(4) detach.

PR: 222937

6 years agoMFC r320252, r320686, r325769:
gjb [Thu, 16 Nov 2017 15:59:29 +0000 (15:59 +0000)]
MFC r320252, r320686, r325769:
 r320252:
  In release/release.sh:
  - Rename chroot_arm_armv6_build_release() to chroot_arm_build_release()
    and make it hardware agnostic (such as armv6 -vs- armv7 -vs- arm64).
  - Evaluate EMBEDDED_TARGET differently so release/tools/arm.subr can
    be used for arm/armv6 and arm64/aarch64.
  - Update comments and copyright.

  In release/tools/arm.subr:
  - In arm_create_disk(), change the default alignment from 63 to 512k,
    fixing a boot issue on arm64 and EFI. [1]
  - Update comments and copyright.

 r320686:
  Fix the ftp-stage target for RPI3 images by loosening the
  constraints on the TARGET and TARGET_ARCH variables.

 r325769:
  Update the GUMSTIX image build to use arm/arm TARGET/TARGET_ARCH.
  Update the TARGET/TARGET_ARCH matching in release/release.sh and
  release/Makefile.mirrors for simplification.

Note: The RPI3.conf addition from r320252 is not included, as the
11-STABLE image fails to boot in my testing.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r325758:
kib [Thu, 16 Nov 2017 12:51:39 +0000 (12:51 +0000)]
MFC r325758:
Style bug.

6 years agoMFC 324993:
jhb [Thu, 16 Nov 2017 06:55:57 +0000 (06:55 +0000)]
MFC 324993:
Add a test for sending a signal while stepping a thread via PT_STEP.

6 years agoMFC r325865
gordon [Wed, 15 Nov 2017 22:34:15 +0000 (22:34 +0000)]
MFC r325865

Properly bzero kldstat structure to prevent kernel information leak.

Security: FreeBSD-SA-17:10.kldstat
Security: CVE-2017-1088

6 years agoMFC r324727 and r325555:
ed [Wed, 15 Nov 2017 15:56:08 +0000 (15:56 +0000)]
MFC r324727 and r325555:

  Import the latest CloudABI definitions, version 0.16.

  The most important change in this release is the removal of the
  poll_fd() system call; CloudABI's equivalent of kevent(). Though I think
  that kqueue is a lot saner than many of its alternatives, our
  experience is that emulating this system call on other systems
  accurately isn't easy. It has become a complex API, even though I'm not
  convinced this complexity is needed. This is why we've decided to take a
  different approach, by looking one layer up.

  We're currently adding an event loop to CloudABI's C library that is API
  compatible with libuv (except when incompatible with Capsicum).
  Initially, this event loop will be built on top of plain inefficient
  poll() calls. Only after this is finished, we'll work our way backwards
  and design a new set of system calls to optimize it.

  Interesting challenges will include integrating asynchronous I/O into
  such a system call API. libuv currently doesn't aio(4) on Linux/BSD, due
  to it being unreliable and having undesired semantics.

  Upgrade to CloudABI v0.17.

  Compared to the previous version, v0.16, there are a couple of minor
  changes:

  - CLOUDABI_AT_PID: Process identifiers for CloudABI processes.

    Initially, BSD process identifiers weren't exposed inside the runtime,
    due to them being pretty much useless inside of a cluster computing
    environment. When jobs are scheduled across systems, the BSD process
    number doesn't act as an identifier. Even on individual systems they
    may recycle relatively quickly.

    With this change, the kernel will now generate a UUIDv4 when executing
    a process. These UUIDs can be obtained within the process using
    program_getpid(). Right now, FreeBSD will not attempt to store this
    value. This should of course happen at some point in time, so that it
    may be printed by administration tools.

  - Removal of some unused structure members for polling.

    With the polling framework being simplified/redesigned, it turns out
    some of the structure fields were not used by the C library. We can
    remove these to keep things nice and tidy.

6 years agoMFC 323588: Recognize NT_PTLWPINFO and NT_ARM_VFP in FreeBSD ELF cores.
jhb [Wed, 15 Nov 2017 15:24:28 +0000 (15:24 +0000)]
MFC 323588: Recognize NT_PTLWPINFO and NT_ARM_VFP in FreeBSD ELF cores.

6 years agoMFC r325553:
kib [Wed, 15 Nov 2017 14:35:42 +0000 (14:35 +0000)]
MFC r325553:
Remove useless DEBUG printfs in i386 sendsig() implementations.

6 years agoMFC r325737:
bapt [Wed, 15 Nov 2017 12:22:56 +0000 (12:22 +0000)]
MFC r325737:

Update to 2017.10.21

6 years agoMFC r325717:
bapt [Wed, 15 Nov 2017 12:20:53 +0000 (12:20 +0000)]
MFC r325717:

Remove __unused attributed on arguments that are actually used

6 years agoMFC r325716:
bapt [Wed, 15 Nov 2017 12:17:51 +0000 (12:17 +0000)]
MFC r325716:

Fix some nroff style issue

6 years agoMFC 323584: Add a NT_ARM_VFP ELF core note to hold VFP registers for each thread.
jhb [Wed, 15 Nov 2017 02:03:38 +0000 (02:03 +0000)]
MFC 323584: Add a NT_ARM_VFP ELF core note to hold VFP registers for each thread.

The core note matches the format and layout of NT_ARM_VFP on Linux.
Debuggers use the AT_HWCAP flags to determine how many VFP registers
are actually used and their format.

6 years agoMFC 323581,323582,323583: Add ptrace operations for VFP registers.
jhb [Tue, 14 Nov 2017 22:18:13 +0000 (22:18 +0000)]
MFC 323581,323582,323583: Add ptrace operations for VFP registers.

323581:
Only mess with VFP state on the CPU for curthread for get/set_vfpcontext.

Future changes will use these functions to fetch and store VFP state for
threads other than curthread.

323582:
Add ptrace operations to fetch and store VFP registers.

323583:
Export get/set_vfpcontext from machdep.c.

Should have been part of the previous commit to add ptrace operations
for VFP registers.

6 years agoMFC r325009:
trasz [Tue, 14 Nov 2017 18:17:23 +0000 (18:17 +0000)]
MFC r325009:

Make gmountver(8) use direct dispatch.

MFC r325101:

Add back missing MTX_DEF, it still needs to be there.

(Although it's defined to be 0, so there's no functional change.)

6 years agoMFC r213931:
trasz [Tue, 14 Nov 2017 18:13:30 +0000 (18:13 +0000)]
MFC r213931:

Make gmountver(8) use G_PF_ACCEPT_UNMAPPED.

6 years agoMFC r324857:
trasz [Tue, 14 Nov 2017 18:07:51 +0000 (18:07 +0000)]
MFC r324857:

Add OID for the vm.overcommit sysctl. This makes it possible to remove
one call to sysctl(2) from jemalloc startup code. (That also requires
changes to jemalloc, but I plan to push those to upstream first.)

6 years agoMFC r324427:
trasz [Tue, 14 Nov 2017 18:01:48 +0000 (18:01 +0000)]
MFC r324427:

Document "tdnam" keyword to ps(1), and add "tdname" alias.

MFC r324429:

Fix long name (used by libxo) for the "tdnam" ps(1) keyword.

MFC r324430:

Undocument "tdnam" (leaving it as an alias), and rename the column
to TDNAME.

6 years agoMFC r324367:
trasz [Tue, 14 Nov 2017 17:57:48 +0000 (17:57 +0000)]
MFC r324367:

Fix kvm_getprocs(3) error reporting in ps(1).

Previously it just didn't work at all - kvm_getprocs(3) doesn't update
the &nentries when it returns NULL.  The end result was that ps(1) showed
garbage data instead of reporting kinfo_proc size mismatch.

6 years agoMFC r324276:
trasz [Tue, 14 Nov 2017 17:56:32 +0000 (17:56 +0000)]
MFC r324276:

Don't destroy gmountver(8) devices on shutdown, unless they are orphaned.
Otherwise we would fail to sync the filesystem on reboot.

6 years agoMFC r324199:
trasz [Tue, 14 Nov 2017 17:54:00 +0000 (17:54 +0000)]
MFC r324199:

Clear G_CF_ORPHAN when attaching. This fixes cases where the same
GEOM consumer can be orphaned, and then reattach to another provider.

From a user point of view, this makes gmountver(4) work again.

6 years agoMFC r320672:
trasz [Tue, 14 Nov 2017 17:05:34 +0000 (17:05 +0000)]
MFC r320672:

Cosmetic tweaks to the default shell rc files, mostly comments.

MFC r320678:

Fix typo introduced in r320672 - check for existence of the right file.

6 years agoMFC r320672:
trasz [Tue, 14 Nov 2017 17:03:56 +0000 (17:03 +0000)]
MFC r320672:

Run "resizewin -z" from the default shell profile files. This makes
the terminal work properly out of the box when logging over a serial
line, which is quite important for the user experience on boards like
Raspberry Pi.  It doesn't affect cases where the terminal size is
already non-zero, such as SSH or vt(4) sessions.

Note that this doesn't handle a scenario pointed out by rgrimes@:
when the terminal is resized after login, the terminal size won't
get updated even after logging out and back in.

6 years agoMFC 323580,323933,323934,324814,324817: Enable AT_HWCAP on arm.
jhb [Tue, 14 Nov 2017 16:03:07 +0000 (16:03 +0000)]
MFC 323580,323933,323934,324814,324817: Enable AT_HWCAP on arm.

I reused the SV_HWCAP stub to cover the sv_hwcap2 field as well.

323580:
Add AT_HWCAP flags for VFP settings for FreeBSD/arm.

These flags match the meaning and value of flags in Linux, though
Linux has many more flags.

323933:
Correct HWCAP_VFP3* values to match Linux.

323934:
Detect NEON and set HWCAP_NEON if present.

324814:
Add AT_HWCAP2 ELF auxiliary vector.
 - allocate value for new AT_HWCAP2 auxiliary vector on all platforms.
 - expand 'struct sysentvec' by new 'u_long *sv_hwcap2', in exactly
   same way as for AT_HWCAP.

324817:
Fullify implementation of AT_HWCAP and AT_HWCAP2 for ARMv6,7.
This makes elf_aux_info(3) useable for ARM ports.

Tested by: mmel

6 years agoMFC r324261:
trasz [Tue, 14 Nov 2017 16:00:21 +0000 (16:00 +0000)]
MFC r324261:

Fix iSCSI target panics on concurrent session teardown and display
(eg removing a target and doing "ctladm islist -v" at the same time).

6 years agoMFC r322401:
gjb [Tue, 14 Nov 2017 15:07:34 +0000 (15:07 +0000)]
MFC r322401:
 Avoid creating kernel-dbg.txz distribution sets and kernel-debug
 packages when MK_DEBUG_FILES is 'no'.

Differential Revision: https://reviews.freebsd.org/D12544 (related)
Sponsored by: The FreeBSD Foundation

6 years agoMFH (r325010): don't bother verifying a password that we know is too long.
des [Tue, 14 Nov 2017 10:48:30 +0000 (10:48 +0000)]
MFH (r325010): don't bother verifying a password that we know is too long.

Reported by: jkim@
Security: CVE-2016-6210

6 years agoMFC r325559: ifconfig_<interface>_descr
eugen [Tue, 14 Nov 2017 09:29:02 +0000 (09:29 +0000)]
MFC r325559: ifconfig_<interface>_descr

Add suitable knob ifconfig_<interface>_descr for static interface description.
Document availability of interface descriptions within rc.conf(5).

Approved by: avg (mentor)

6 years agoMFC r325671:
kib [Mon, 13 Nov 2017 09:07:30 +0000 (09:07 +0000)]
MFC r325671:
Check that the pmc index is less than the number of hardware PMCs,
instead of asserting the condition.

6 years agoMFC r324962:
fsu [Sun, 12 Nov 2017 18:06:43 +0000 (18:06 +0000)]
MFC r324962:
Set doreallocblks sysctl value to zero by default because of
possibility of filesystem corruption.

Approved by:    pfg (mentor)

6 years agoMFC r325008
truckman [Sun, 12 Nov 2017 01:26:43 +0000 (01:26 +0000)]
MFC r325008

Fix Dummynet AQM packet marking function ecn_mark() and fq_codel /
fq_pie schedulers packet classification functions in layer2 (bridge mode).

Dummynet AQM packet marking function ecn_mark() and fq_codel/fq_pie
schedulers packet classification functions (fq_codel_classify_flow()
and fq_pie_classify_flow()) assume mbuf is pointing at L3 (IP)
packet. However, this assumption is incorrect if ipfw/dummynet is
used to manage layer2 traffic (bridge mode) since mbuf will point
at L2 frame.  This patch solves this problem by identifying the
source of the frame/packet (L2 or L3) and adding ETHER_HDR_LEN
offset when converting an mbuf pointer to ip pointer if the traffic
is from layer2.  More specifically, in dummynet packet tagging
function, tag_mbuf(), iphdr_off is set to ETHER_HDR_LEN if the
traffic is from layer2 and set to zero otherwise. Whenever an access
to IP header is required, mtodo(m, dn_tag_get(m)->iphdr_off) is
used instead of mtod(m, struct ip *) to correctly convert mbuf
pointer to ip pointer in both L2 and L3 traffic.

Submitted by: lstewart
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D12506

6 years agoMFC r325389:
kib [Sat, 11 Nov 2017 12:16:19 +0000 (12:16 +0000)]
MFC r325389:
C++17 requires quick_exit(3) to be async-signal safe.

6 years agoMFC r325388:
kib [Sat, 11 Nov 2017 12:12:26 +0000 (12:12 +0000)]
MFC r325388:
x86: Do not emit unused TD_TID symbols.

6 years agoMFC r325387:
kib [Sat, 11 Nov 2017 12:09:33 +0000 (12:09 +0000)]
MFC r325387:
Eliminate unused load.

6 years agoMFC r325386:
kib [Sat, 11 Nov 2017 12:08:07 +0000 (12:08 +0000)]
MFC r325386:
Convert explicit panic() call to assert.

6 years agoMFC r324795:
kib [Fri, 10 Nov 2017 13:17:40 +0000 (13:17 +0000)]
MFC r324795:
Move swapout code into vm/vm_swapout.c.

6 years agoMFC r303627 (by alc):
kib [Fri, 10 Nov 2017 12:54:33 +0000 (12:54 +0000)]
MFC r303627 (by alc):
Restore the historical behavior of "sysctl vm.swap_idle_enabled=1".

6 years agoMFC r324807:
kib [Fri, 10 Nov 2017 12:45:09 +0000 (12:45 +0000)]
MFC r324807:
Take the vm object lock in read mode in vnode_generic_putpages().

6 years agoMFC r324794:
kib [Fri, 10 Nov 2017 12:42:50 +0000 (12:42 +0000)]
MFC r324794:
Do not overwrite clean blocks on pageout.

6 years agoMFC r325567:
kib [Fri, 10 Nov 2017 12:28:43 +0000 (12:28 +0000)]
MFC r325567:
Zero whole struct ptrace_lwpinfo to not leak kernel stack data.

Security: CVE-2017-1086

6 years agoMFC r325355:
ae [Fri, 10 Nov 2017 11:19:33 +0000 (11:19 +0000)]
MFC r325355:
  Use correct pointer in key_updateaddresses() when updating NAT-T config.

  key_updateaddresses() is used to update SA addresses and NAT-T
  configuration in SADB_UPDATE message. This is done using cloning SA
  content from old SA into new one. But addresses and NAT-T configuration
  are taking from SADB_UPDATE message. Use newsa pointer to set NAT-T
  properties into cloned SA.

  PR: 223382

6 years agoMFC r325362:
hselasky [Fri, 10 Nov 2017 08:42:37 +0000 (08:42 +0000)]
MFC r325362:
Allow CUSE(3) to free all memory mapped memory by using regular SWAP objects
instead of malloc(). The SWAP objects are automagically freed when there are no
more consumers. This greatly simplifies the mmap logic inside CUSE(3) in the
kernel. This change fixes an issue where mmapped memory can accumulate and never
get freed, if many different mmap sizes are needed over time. Further this
change fixes memory leaks when the CUSE(3) kernel module is unloaded.

While at it make sure the CUSE_ALLOC_PAGES_MAX limit is treated as an exclusive
limit. CUSE(3) memory maps must be less than CUSE_ALLOC_PAGES_MAX number of pages.

Reviewed by: kib @
Differential Revision: https://reviews.freebsd.org/D11392
Sponsored by: Mellanox Technologies

6 years agoMerge r323509 and r324994 adding Cavium LiquidIO Driver (lio)
sbruno [Thu, 9 Nov 2017 19:52:56 +0000 (19:52 +0000)]
Merge r323509 and r324994 adding Cavium LiquidIO Driver (lio)
to stable/11.

Submitted by: pkanneganti@cavium.com ((Prasad V Kanneganti)
Sponsored by: Cavium Networks
Differential Revision: https://reviews.freebsd.org/D12425

6 years agoMFC r325278:
hselasky [Thu, 9 Nov 2017 19:08:30 +0000 (19:08 +0000)]
MFC r325278:
Unconditionally include "opt_inet6.h" in the LinuxKPI.
This makes sure the INET6 macro gets properly defined,
also for kernel module builds.

Sponsored by: Mellanox Technologies

6 years agoMFC r324792:
hselasky [Thu, 9 Nov 2017 17:58:57 +0000 (17:58 +0000)]
MFC r324792:
The remote DMA TCP portspace selector, RDMA_PS_TCP, is used for both
iWarp and RoCE in ibcore. The selection of RDMA_PS_TCP can not be used
to indicate iWarp protocol use. Backport the proper IB device
capabilities from Linux upstream to distinguish between iWarp and
RoCE. Only allocate the additional socket required for iWarp for RDMA
IDs when at least one iWarp device present. This resolves
interopability issues between iWarp and RoCE in ibcore

Reviewed by: np @
Differential Revision: https://reviews.freebsd.org/D12563
Sponsored by: Mellanox Technologies

6 years agoMFC r324491:
hselasky [Thu, 9 Nov 2017 17:54:00 +0000 (17:54 +0000)]
MFC r324491:
Use common rdma_ip2gid() function instead of custom mlx5_ip2gid() one.

Sponsored by: Mellanox Technologies

6 years agoMFC r324490:
hselasky [Thu, 9 Nov 2017 17:49:45 +0000 (17:49 +0000)]
MFC r324490:
Add support for parsing and using IPv6 addresses in krping.

Sponsored by: Mellanox Technologies

6 years agoMFC r324492:
hselasky [Thu, 9 Nov 2017 17:47:33 +0000 (17:47 +0000)]
MFC r324492:
Make sure the IPv6 scope ID gets zeroed inside the GID. Else searching for a
valid GID entry based on IPv6 addresses can fail.

Sponsored by: Mellanox Technologies

6 years agoMFC r325277:
kib [Wed, 8 Nov 2017 12:13:25 +0000 (12:13 +0000)]
MFC r325277:
Do not run pmclog_configure_log() without pmc_sx protection.

6 years agoMFC r325276:
kib [Wed, 8 Nov 2017 12:11:54 +0000 (12:11 +0000)]
MFC r325276:
Be protective and check the po_file validity before dropping the ref.

6 years agoMFC r325275:
kib [Wed, 8 Nov 2017 12:10:14 +0000 (12:10 +0000)]
MFC r325275:
In hwpmc, do not double-close the logging file.

6 years agoMFC r325274:
kib [Wed, 8 Nov 2017 12:07:01 +0000 (12:07 +0000)]
MFC r325274:
There is no use for dropping Giant in the pmc syscall.

6 years agoMFC r325273:
kib [Wed, 8 Nov 2017 12:03:11 +0000 (12:03 +0000)]
MFC r325273:
Minor style tweaks.

6 years agoMFC r325271:
kib [Wed, 8 Nov 2017 12:00:49 +0000 (12:00 +0000)]
MFC r325271:
Use designated initializers for pmc sysent and module data.

6 years agoMFC r324972:
kib [Wed, 8 Nov 2017 11:47:00 +0000 (11:47 +0000)]
MFC r324972:
Tweaks to the top swap size calculations.

PR: 223149

6 years agoMFC r325285, r325447:
kib [Wed, 8 Nov 2017 11:44:02 +0000 (11:44 +0000)]
MFC r325285, r325447:
Restore an optimization that was temporary disabled by r324665.

6 years agoMFC r325270:
kib [Wed, 8 Nov 2017 11:25:19 +0000 (11:25 +0000)]
MFC r325270:
Consistently ensure that we do not load MXCSR with reserved bits set.