]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFC r303018:
ae [Thu, 30 Mar 2017 14:20:27 +0000 (14:20 +0000)]
MFC r303018:
  Add named dynamic states support to ipfw(4).

  The keep-state, limit and check-state now will have additional argument
  flowname. This flowname will be assigned to dynamic rule by keep-state
  or limit opcode. And then can be matched by check-state opcode or
  O_PROBE_STATE internal opcode. To reduce possible breakage and to maximize
  compatibility with old rulesets default flowname introduced.
  It will be assigned to the rules when user has omitted state name in
  keep-state and check-state opcodes. Also if name is ambiguous (can be
  evaluated as rule opcode) it will be replaced to default.

  Reviewed by: julian
  Obtained from: Yandex LLC
  Relnotes: yes
  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D6674

MFC r304087:
  Do not warn about ambiguous state name when we inspect a comment token.

MFC r304089:
  Add an ability to attach comment to check-state rules.

MFC r310727 (by marius):
  Fix a bug in r272840; given that the optlen parameter of setsockopt(2)
  is a 32-bit socklen_t, do_get3() passes the kernel to access the wrong
  32-bit half on big-endian LP64 machines when simply casting the 64-bit
  size_t optlen to a socklen_t pointer.
  While at it and given that the intention of do_get3() apparently is to
  hide/wrap the fact that socket options are used for communication with
  ipfw(4), change the optlen parameter of do_set3() to be of type size_t
  and as such more appropriate than uintptr_t, too.

MFC r315305:
  Change the syntax of ipfw's named states.

  Since the state name is an optional argument, it often can conflict
  with other options. To avoid ambiguity now the state name must be
  prefixed with a colon.

Sponsored by: Yandex LLC

7 years agoMFC: 314547, 314770, 314828, 314891, 314956, 314962, 315235
dexuan [Thu, 30 Mar 2017 12:41:21 +0000 (12:41 +0000)]
MFC: 314547, 314770, 314828, 314891, 314956, 314962, 315235

r314547
    loader.efi: reduce the size of the staging area if necessary

    The loader assumes physical memory in [2MB, 2MB + EFI_STAGING_SIZE)
    is Conventional Memory, but actually it may not, e.g. in the case
    of Hyper-V Generation-2 VM (i.e. UEFI VM) running on Windows
    Server 2012 R2 host, there is a BootServiceData memory block at
    the address 47.449MB and the memory is not writable.

    Without the patch, the loader will crash in efi_copy_finish():
    see PR 211746.

    The patch verifies the end of the staging area, and reduces its
    size if necessary. This way, the loader will not try to write into
    the BootServiceData memory any longer.

    Thank Marcel Moolenaar for helping me on this issue!

    The patch also allocates the staging area in the first 1GB memory.
    See the comment in the patch for this.

    PR: 211746
    Reviewed by: marcel, kib, sephe
    Approved by: sephe (mentor)
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D9686

r314770
    loader.efi: fix recent UEFI-boot regression on physical machines

    This patch fixes my recent patch
    "loader.efi: reduce the size of the staging area if necessary", which
    causes EFI-boot failure on physical machines since Mar 2:
    on the host there is a 1MB LoaderData memory range, which splits
    the big Conventional Memory range into a small one (15MB) and a
    big one: the small one is too small to hold the staging area.

    We can actually use the LoaderData range safely, because when
    amd64_tramp -> efi_copy_finish() starts to run, we're almost at
    the very end of the efi loader code and we're going to "return"
    to the kernel entry, so we're pretty sure we won't access any loader
    data any more.

    For people who are interested in the details: please see
    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211746#c22

    PS, some people also reported the regression happened to FreeBSD VM
    running on Bhyve in EFI mode. This patch should resolve it too,
    though I don't have such a setup to test.

    Reviewed by: sephe
    Approved by: sephe (mentor)
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D9904

r314828
    loader.efi: fix an off-by-one bug in efi_verify_staging_size()

    Also remove the warning message: it may not be unusual to see
    the memory range containing 2MB is not of EfiConventionalMemory.

    Sponsored by: Microsoft

r314891
    loader.efi: finally fix the off-by-one bug in efi_verify_staging_size()

    r314828(loader.efi: fix an off-by-one bug in efi_verify_staging_size())
    doesn't really fix the bug and this patch adds the missing part.

    It's a shame that I didn't make everything correct at the very beginning...

    Sponsored by: Microsoft

r314956
    loader.efi: only reduce the size of the staging area on Hyper-V

    Doing this on physical hosts turns out to be problematic, e.g. see comment
    24 and 28 in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211746.

    To fix the real underlying issue correctly & thoroughly, IMO we need
    a relocatable kernel, but that would require a lot of complicated long
    term work:  https://reviews.freebsd.org/D9686?id=25414#inline-56969

    For now, let's only apply efi_verify_staging_size() to VMs running on
    Hyper-V, and restore the old behavior on physical machines since that
    has been working for people for a long period of time, though that's
    potentially unsafe...

    Sponsored by: Microsoft

r314962
    loader.efi: only include the machine/ header files on x86

    The 2 files may not exist on other archs like aarch64 and hence we
    can have a build failure there.

    Reported by: lwhsu
    Sponsored by: Microsoft

r315235
    loader.efi: use stricter check for Hyper-V

    Some other hypervisors like Xen can pretend to be Hyper-V but obviously
    they can't implement all Hyper-V features. Let's make sure we're genuine
    Hyper-V here.

    Also fix some minor coding style issues.

    PR: 211746
    Sponsored by: Microsoft

PR: 211746

7 years agoMFC r315776:
ngie [Thu, 30 Mar 2017 06:20:24 +0000 (06:20 +0000)]
MFC r315776:

Rename tests from <foo> to <foo>_test to match the FreeBSD test suite
naming scheme

usr.bin/diff/diff_test was renamed to usr.bin/diff/netbsd_diff_test
to avoid collisions with the renamed FreeBSD test.

7 years agoMFC r315798:
ngie [Thu, 30 Mar 2017 06:14:32 +0000 (06:14 +0000)]
MFC r315798:

DB_COMMAND(9): fix mandoc markup

Start new sentences on new lines.

7 years agoMFC r316050,r316051:
ngie [Thu, 30 Mar 2017 06:13:39 +0000 (06:13 +0000)]
MFC r316050,r316051:

r316050:

ctld: sort #includes per style(9)

- Only include sys/types.h or sys/param.h, not both.
- Sort alphabetically.

r316051:

ctldadm: sort #includes per style(9)

- Only include sys/types.h or sys/param.h, not both.
- Sort alphabetically.

7 years agoRegenerate src.conf(5)
ngie [Thu, 30 Mar 2017 06:11:56 +0000 (06:11 +0000)]
Regenerate src.conf(5)

Differential Revision: Dell EMC Isilon

7 years agoMFC r315764,r315765:
ngie [Thu, 30 Mar 2017 06:09:39 +0000 (06:09 +0000)]
MFC r315764,r315765:

r315764:

Add a WITHOUT_IPSEC_SUPPORT option description for src.conf(5)

This is a follow up commit to r313330.

r315765:

Fix mdoc(7) warning: new sentences should start on new lines

7 years agoMFC r315762:
ngie [Thu, 30 Mar 2017 06:07:36 +0000 (06:07 +0000)]
MFC r315762:

rc.conf(5): fix a .Xr call for chroot(8)

Add the missing section number to the .Xr call.

7 years agoMFC r315795:
ngie [Thu, 30 Mar 2017 06:06:47 +0000 (06:06 +0000)]
MFC r315795:

alq(9): fix mandoc markup

Start new sentence on a new line.

7 years agoMFC r315803:
ngie [Thu, 30 Mar 2017 06:05:30 +0000 (06:05 +0000)]
MFC r315803:

memguard(9): fix igor/manlint warnings

- Expand a contraction [1].
- Add a missing section number when referring to uma(9) with .Xr .

7 years agoMFC r315790:
ngie [Thu, 30 Mar 2017 06:04:13 +0000 (06:04 +0000)]
MFC r315790:

tuning(7): fix SEE ALSO section sorting

dummynet(4) should come before eventtimers(4)

7 years agoMFC r315788:
ngie [Thu, 30 Mar 2017 06:02:48 +0000 (06:02 +0000)]
MFC r315788:

build(7): sort SEE ALSO section

tests(7) should be grouped in the man section 7 group, not the section 8 group.

7 years agoMFC r315802:
ngie [Thu, 30 Mar 2017 06:00:36 +0000 (06:00 +0000)]
MFC r315802:

ifnet(9): fix some igor/manlint warnings

- Fix typos (queueing -> queuing) [1].
- Add missing section number for polling .Xr reference [2].

7 years agoMFC r315804:
ngie [Thu, 30 Mar 2017 05:58:31 +0000 (05:58 +0000)]
MFC r315804:

PCI_IOV_*INIT(9): fix make manlint warnings

Add missing section number when referring to PCI_IOV_*INIT(9) with .Xr
from the other corresponding manpage.

7 years agoMFC r315772:
ngie [Thu, 30 Mar 2017 05:54:22 +0000 (05:54 +0000)]
MFC r315772:

tmpfs(5): fix mdoc warnings

- Delete trailing whitespace
- Sort SEE ALSO order: mmap(2)'s Xr should come before nmount(2)'s Xr.

7 years agoMFC r315789:
ngie [Thu, 30 Mar 2017 05:50:36 +0000 (05:50 +0000)]
MFC r315789:

tests(7): fix mdoc warning

Continue sentence in "Configuring the tests" on a new line.

7 years agoMFC r316049:
ngie [Thu, 30 Mar 2017 05:49:23 +0000 (05:49 +0000)]
MFC r316049:

Allow WARNS to be overridden by the end-user

7 years agoBackport mlx4{en,ib}(4) from ^/head
ngie [Thu, 30 Mar 2017 05:47:18 +0000 (05:47 +0000)]
Backport mlx4{en,ib}(4) from ^/head

MFCing other pieces would be very structurally disruptive. This just
brings back the manpages so they can be used by end-users and to ease
future backports.

svn:mergeinfo omitted, in part because this is a direct commit to
^/stable/11.

Sponsored by: Dell EMC Isilon

7 years agoRevert r316226 (I used the wrong commit message)
ngie [Thu, 30 Mar 2017 05:44:54 +0000 (05:44 +0000)]
Revert r316226 (I used the wrong commit message)

Pointyhat to: ngie

7 years agoMFC r315797:
ngie [Thu, 30 Mar 2017 05:43:18 +0000 (05:43 +0000)]
MFC r315797:

buf_ring(9): fix mandoc markup

Remove spurious trailing comma after `buf_ring_peek` in the NAME
section.

7 years agoMFC r315759,r315761:
ngie [Thu, 30 Mar 2017 05:41:27 +0000 (05:41 +0000)]
MFC r315759,r315761:

r315759 (by gjb):

Add mlx5en(4) to the hardware page. [1]
Belatedly bump copyright years after several changes.

r315761:

Add cxgbe(4), ixl(4), and mlx4en(4) to the hardware release notes

7 years agoMFC r315759,r315761:
ngie [Thu, 30 Mar 2017 05:22:02 +0000 (05:22 +0000)]
MFC r315759,r315761:

r315759 (by gjb):

Add mlx5en(4) to the hardware page. [1]
Belatedly bump copyright years after several changes.

r315761:

Add cxgbe(4), ixl(4), and mlx4en(4) to the hardware release notes

7 years agoMFC r316053:
ngie [Thu, 30 Mar 2017 05:18:28 +0000 (05:18 +0000)]
MFC r316053:

pthread_mutex_consistent: sort SEE ALSO by reference name

7 years agoMFC r315774:
ngie [Thu, 30 Mar 2017 05:17:27 +0000 (05:17 +0000)]
MFC r315774:

mount.conf(8): fix a .Xr call

Add the missing section number for devfs(5)

7 years agoMFC r315796:
ngie [Thu, 30 Mar 2017 05:16:41 +0000 (05:16 +0000)]
MFC r315796:

bus_alloc_resource(9): fix mandoc markup

Add missing comma after `.Nm bus_alloc_resource_any` in NAME section.

7 years agoMFC r314372:
ngie [Thu, 30 Mar 2017 05:14:52 +0000 (05:14 +0000)]
MFC r314372:

Use "build" instead of "all" when building ports modules

"all" in ports currently means "stage the ports", which requires root today,
and brings to light other potential issues, like ENAMETOOLONG with staged
directories (bug 161481, etc).

This fixes buildkernel for me when run as a non-root user, assuming all
of the prerequisites have been installed beforehand and are up-to-date.

Discussed with: swills (IRC)

7 years agoMFC r315734:
ngie [Thu, 30 Mar 2017 05:13:47 +0000 (05:13 +0000)]
MFC r315734:

style(9): sort #includes

7 years agoMFC: 313176, 313177, 313359
gnn [Thu, 30 Mar 2017 02:50:21 +0000 (02:50 +0000)]
MFC: 313176, 313177, 313359

Replace the implementation of DTrace's RAND subroutine for generating
low-quality random numbers with a modern implementation (xoroshiro128+)
that is capable of generating better quality randomness without compromising performance.

Submitted by: Graeme Jenkinson

7 years agoMFC: 311225, 311243, 313045
gnn [Thu, 30 Mar 2017 02:38:30 +0000 (02:38 +0000)]
MFC: 311225, 311243, 313045

Fix DTrace TCP tracepoints to not use mtod() as it is both unnecessary and
dangerous.  Those wanting data from an mbuf should use DTrace itself to get
the data.

Add an mbuf to ipinfo_t translator to finish cleanup of mbuf passing to TCP probes.

7 years agoMFC r309192
sevan [Thu, 30 Mar 2017 02:03:34 +0000 (02:03 +0000)]
MFC r309192

Fix null dereference when running out of nodes during rename.

PR:             212370
Submitted by:   Sascha Wildner <swildner AT gmail>
Reviewed by:    bcr (mentor)
Approved by:    bapt
Obtained from:  NetBSD
Differential Revision:  https://reviews.freebsd.org/D8643

7 years agoMFC r312692
sevan [Thu, 30 Mar 2017 01:52:02 +0000 (01:52 +0000)]
MFC r312692

Improve wording when describing -mmin.
PR: 215922
Submitted by: danielsh AT apache DOT org
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D9313

7 years agoMFC r316022,r316023:
jamie [Thu, 30 Mar 2017 01:37:34 +0000 (01:37 +0000)]
MFC r316022,r316023:

  Fix hexadecimal escape codes in jail.conf(5).

PR: 218154
Submitted by: Masahiro Konishi <mkonishi@sea.plala.or.jp>

7 years agoMFC 309552
sevan [Thu, 30 Mar 2017 01:30:27 +0000 (01:30 +0000)]
MFC 309552

Adjust formatting highlighted by igor.

PR: 214683
Submitted by: Anindya Mukherjee <anindya49 AT hotmail DOT com>
Reviewed by: jilles
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D8591

7 years agoMFC 312684
sevan [Thu, 30 Mar 2017 01:18:58 +0000 (01:18 +0000)]
MFC 312684

Extend manual to cover more commands and options.

PR:             203406
Submitted by:   Fehmi Noyan Isi (fnoyanisi AT yahoo DOT com)
Approved by:    wblock (mentor)
Differential Revision:   https://reviews.freebsd.org/D8691

7 years agoMFC 315964
sevan [Thu, 30 Mar 2017 00:58:04 +0000 (00:58 +0000)]
MFC 315964
ftp.microsoft.com is dead and the document was not archived, point to the full
protocol spec document instead.
Fix spelling mistake flagged by igor.
Rephrase bad sentence flagged by igor.

Approved by:  bcr (mentor)
Differential Revision:  https://reviews.freebsd.org/D10111

7 years agoMFC r315545: Remove hackish code delaying ATIOs to unknown virtual port.
mav [Wed, 29 Mar 2017 16:16:39 +0000 (16:16 +0000)]
MFC r315545: Remove hackish code delaying ATIOs to unknown virtual port.

Since we support RQSTYPE_RPT_ID_ACQ, that functionality is only useful
in loop mode, which probably doesn't worth having this hack in 2017.

7 years agoMFC r315536: Move <= 23xx PDB workaround to generic code.
mav [Wed, 29 Mar 2017 16:15:18 +0000 (16:15 +0000)]
MFC r315536: Move <= 23xx PDB workaround to generic code.

It is chip-specific and has nothing to do with platform.

7 years agoMFC r315534: Remove some dead stuff.
mav [Wed, 29 Mar 2017 16:14:04 +0000 (16:14 +0000)]
MFC r315534: Remove some dead stuff.

7 years agoMFC r315533: Move 24xx RQSTYPE_NOTIFY handling to generic code.
mav [Wed, 29 Mar 2017 16:12:41 +0000 (16:12 +0000)]
MFC r315533: Move 24xx RQSTYPE_NOTIFY handling to generic code.

This code has nothing to do with specific platform.

7 years agoMFC r315507: Reorganize RQSTYPE_NOTIFY handling for chips <= 23xx.
mav [Wed, 29 Mar 2017 16:10:34 +0000 (16:10 +0000)]
MFC r315507: Reorganize RQSTYPE_NOTIFY handling for chips <= 23xx.

There were two copies of the code: one in generic code was half-broken, and
another in platform code was never called.  Leave only one in generic code
and working.

7 years agoMFC r315489: Move RQSTYPE_ABTS_RCVD parsing into generic code.
mav [Wed, 29 Mar 2017 16:03:33 +0000 (16:03 +0000)]
MFC r315489: Move RQSTYPE_ABTS_RCVD parsing into generic code.

7 years agoMFC r315488: Extend nt_lun to full 8 byte.
mav [Wed, 29 Mar 2017 16:02:19 +0000 (16:02 +0000)]
MFC r315488: Extend nt_lun to full 8 byte.

7 years agoMFC r315485: Remove dead remnants of SPI target.
mav [Wed, 29 Mar 2017 15:57:50 +0000 (15:57 +0000)]
MFC r315485: Remove dead remnants of SPI target.

7 years agoMFC r315482: Use isp_target_put_entry() in places where it can be.
mav [Wed, 29 Mar 2017 15:56:25 +0000 (15:56 +0000)]
MFC r315482: Use isp_target_put_entry() in places where it can be.

This unifies the code and removes some duplication.

7 years agoMFC r315478: Do some notify acks cleanup.
mav [Wed, 29 Mar 2017 15:45:04 +0000 (15:45 +0000)]
MFC r315478: Do some notify acks cleanup.

ISPASYNC_TARGET_NOTIFY_ACK makes no sense without argument.

7 years agoMFC r315327: Remove not very useful ATIO/INOT stats.
mav [Wed, 29 Mar 2017 15:43:51 +0000 (15:43 +0000)]
MFC r315327: Remove not very useful ATIO/INOT stats.

While there polish respective debug logging.

7 years agoMFC r315307: Refactor interrupt handling.
mav [Wed, 29 Mar 2017 15:42:35 +0000 (15:42 +0000)]
MFC r315307: Refactor interrupt handling.

Instead of single isp_intr() function doing all possible magic, introduce
four different functions to handle mailbox operation completions, async
events, response and ATIO queues.  The goal is to isolate different code
paths to make code more readable, and to make easier support for multiple
interrupt vectors.  Even oldest hardware in many cases can identify what
code path it should run on interrupt.  Contemporary hardware can assign
them to different interrupt vectors.

7 years agoMFC r315303: Fix panic when SIM dereferenced before allocation.
mav [Wed, 29 Mar 2017 15:40:45 +0000 (15:40 +0000)]
MFC r315303: Fix panic when SIM dereferenced before allocation.

7 years agoMFC r315298: Fix ancient bug from r84597, which broke 23xx after r315234.
mav [Wed, 29 Mar 2017 15:39:13 +0000 (15:39 +0000)]
MFC r315298: Fix ancient bug from r84597, which broke 23xx after r315234.

7 years agoMFC r314870: Add mechanism to unload CAM periph drivers.
mav [Wed, 29 Mar 2017 15:25:34 +0000 (15:25 +0000)]
MFC r314870: Add mechanism to unload CAM periph drivers.

For now it allows to unload CTL kernel module if there are no target-capable
SIMs in CAM.  As next step full teardown of CAM targets can be implemented.

7 years agoMFC r315711: Fix printing bits above first eight.
mav [Wed, 29 Mar 2017 14:57:41 +0000 (14:57 +0000)]
MFC r315711: Fix printing bits above first eight.

7 years agoMFC r315331:
kib [Wed, 29 Mar 2017 11:03:08 +0000 (11:03 +0000)]
MFC r315331:
Implement LD_BIND_NOT knob for rtld.

MFC r315337:
Disable LD_BIND_NOT for setugid processes.

MFC r315429 (by jilles):
Document that LD_BIND_NOT is unset for setugid processes.

7 years agoMFC r309068 (by jhb):
kib [Wed, 29 Mar 2017 10:59:46 +0000 (10:59 +0000)]
MFC r309068 (by jhb):
Fix _mips_rtld_bind() to handle ELF filters.

7 years agoMFC r315738:
ngie [Wed, 29 Mar 2017 08:01:38 +0000 (08:01 +0000)]
MFC r315738:

Document some more 10GbE+ network drivers in loader.conf

- if_cxgbe
- if_ixl
- if_ixlv
- sfxge

7 years agoMFC r315699:
ngie [Wed, 29 Mar 2017 08:00:13 +0000 (08:00 +0000)]
MFC r315699:

Print out name of non-dynamic sysctl in sysctl_remove_oid_locked

This will provide a slightly better smoking gun than just stating
"can't remove non-dynamic nodes!" when calling sysctl_ctx_free(9)
and sysctl_remove_{name,oid}(9) with a non-dynamic (likely
static) sysctl.

7 years agoMFC r315697:
ngie [Wed, 29 Mar 2017 07:30:59 +0000 (07:30 +0000)]
MFC r315697:

libkvm: fix warning issues post-r291406

- Fix -Wunused warnings with *_native detection handlers by marking `kd`
  __unused, except with arm/mips, where a slightly more complicated scheme
  is required to handle the native case vs the non-native case.
- Fix -Wmissing-variable-declarations warnings by marking struct kvm_arch
  objects static.

Tested with: WIP test code (D10024) // kgdb7121 (i386 crash/kernel on amd64)

7 years agoMFC r315201, r315920, r315921, r315922, r316008, and r316062.
np [Wed, 29 Mar 2017 02:20:07 +0000 (02:20 +0000)]
MFC r315201, r315920, r315921, r315922, r316008, and r316062.

r315201:
cxgbe(4):  Fix an always-true assertion (reported by PVS-Studio).

sys/dev/cxgbe/t4_main.c: PVS-Studio: Expression is Always True (CWE-571) (3)

r315920:
cxgbe/iw_cxgbe: c4iw_connect should always returns a -ve errno on failure.

r315921:

cxgbe/iw_cxgbe: alloc_ep expects a gfp_t, and it's always ok to sleep during
alloc_ep.

r315922:
cxgbe/iw_cxgbe: allocations that use GFP_KERNEL (which is M_WAITOK on
FreeBSD) cannot fail.

r316008:
cxgbe/iw_cxgbe: Remove unused code.

r316062:
cxgbe/iw_cxgbe: Defer the handling of error CQEs and RDMA_TERMINATE to
the thread that deals with socket state changes.  This eliminates
various bad races with the ithread.

7 years agoMFC r315280 r315287
vangyzen [Wed, 29 Mar 2017 01:21:48 +0000 (01:21 +0000)]
MFC r315280 r315287

When the RTC is adjusted, reevaluate absolute sleep times based on the RTC

POSIX 2008 says this about clock_settime(2):

    If the value of the CLOCK_REALTIME clock is set via clock_settime(),
    the new value of the clock shall be used to determine the time
    of expiration for absolute time services based upon the
    CLOCK_REALTIME clock.  This applies to the time at which armed
    absolute timers expire.  If the absolute time requested at the
    invocation of such a time service is before the new value of
    the clock, the time service shall expire immediately as if the
    clock had reached the requested time normally.

    Setting the value of the CLOCK_REALTIME clock via clock_settime()
    shall have no effect on threads that are blocked waiting for
    a relative time service based upon this clock, including the
    nanosleep() function; nor on the expiration of relative timers
    based upon this clock.  Consequently, these time services shall
    expire when the requested relative interval elapses, independently
    of the new or old value of the clock.

When the real-time clock is adjusted, such as by clock_settime(3),
wake any threads sleeping until an absolute real-clock time.
Such a sleep is indicated by a non-zero td_rtcgen.  The sleep functions
will set that field to zero and return zero to tell the caller
to reevaluate its sleep duration based on the new value of the clock.

At present, this affects the following functions:

    pthread_cond_timedwait(3)
    pthread_mutex_timedlock(3)
    pthread_rwlock_timedrdlock(3)
    pthread_rwlock_timedwrlock(3)
    sem_timedwait(3)
    sem_clockwait_np(3)

I'm working on adding clock_nanosleep(2), which will also be affected.

Reported by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Relnotes: yes
Sponsored by: Dell EMC

7 years agoMFC r315640
vangyzen [Tue, 28 Mar 2017 13:39:04 +0000 (13:39 +0000)]
MFC r315640

Port the getaddrinfo(1) utility from NetBSD.

PR: 183148
Submitted by: Lohith Bellad <lohithbsd@gmail.com>
Obtained from: NetBSD
Relnotes: yes
Sponsored by: Dell EMC

7 years agoMFC r315242: Fix late and noauto with geli swap
amdmi3 [Tue, 28 Mar 2017 10:43:19 +0000 (10:43 +0000)]
MFC r315242: Fix late and noauto with geli swap

With the following in /etc/fstab:

/dev/gpt/swap.eli none swap sw,late 0 0

swap will not be enabled, with `swapon -aL' complaining:

swapon: Invalid option: late

This happens because swap_on_geli_args() which parses geli arguments
out of all mount options does not expect late or noauto among them.
Fix this by explicitly allowing these arguments.

Reviewed by: jilles
Approved by: jilles
Differential Revision: D9835

7 years agoMFC r315279: Remove some dead/broken code paths around async handling
mav [Tue, 28 Mar 2017 10:25:56 +0000 (10:25 +0000)]
MFC r315279: Remove some dead/broken code paths around async handling

7 years agoMFC r315273: Remove tangled isp_mbox_continue() mechanism.
mav [Tue, 28 Mar 2017 10:24:41 +0000 (10:24 +0000)]
MFC r315273: Remove tangled isp_mbox_continue() mechanism.

It was implemented to reduce context switches when uploading firmware to
card's RAM.  But this mechanism is not used last 10 years since all mbox
operations are now polled, and it was never used for cards produced in
last 15 years.  Newer cards can use DMA to upload firmware.

7 years agoMFC r315236: Remove dangerous and questionable isp_mboxcmd_qnw() call.
mav [Tue, 28 Mar 2017 10:23:32 +0000 (10:23 +0000)]
MFC r315236: Remove dangerous and questionable isp_mboxcmd_qnw() call.

7 years agoMFC r315234: Improvements around attach, reset and detach.
mav [Tue, 28 Mar 2017 10:11:00 +0000 (10:11 +0000)]
MFC r315234: Improvements around attach, reset and detach.

This change fixes DMA resource leak on driver unload.  Also it removes
DMA resources allocation for hardcoded number of requests before fetching
the real number from firmware.  Also it prepares ground for more flexible
IRQs allocation according to firmware capabilities.

7 years agoMFC r313436,r313437,r313438,r314587,r315687:
ngie [Tue, 28 Mar 2017 06:13:21 +0000 (06:13 +0000)]
MFC r313436,r313437,r313438,r314587,r315687:

r313436:

Clarify #includes for hexdump(3) vs sbuf_hexdump(9)

hexdump(3) only requires libutil.h, whereas sbuf_hexdump(9) requires
sys/types.h (for ssize_t) and sys/sbuf.h

r313437:

Create link from hexdump(3) to sbuf_hexdump(9) as the manpage describes
sbuf_hexdump(9)'s behavior

r313438:

Clean up trailing and leading whitespace for variables to make it
consistent with the rest of the file and style.Makefile(9) a bit
more

r314587:

Correct MLINKS for sbuf_hexdump(9)

sbuf_hexdump(9) should be linked to sbuf(9), not hexdump(3). Another
review will be posted to deduplicate the sbuf_hexdump reference in
in hexdump(3) or at the very least make the information less duplicative.

r315687:

Document sbuf_hexdump(9) in just sbuf(9)

- Remove duplicate references to sbuf_hexdump(9) from hexdump(3).
  sbuf_hexdump(9) already pointed back to hexdump(3) for implementation
  details.
- Refer to sbuf_hexdump(9) instead of sbuf(9) for completeness

7 years agoMFC r315281:
kib [Tue, 28 Mar 2017 06:07:59 +0000 (06:07 +0000)]
MFC r315281:
Use atop() instead of OFF_TO_IDX() for convertion of addresses or
addresses offsets, as intended.

MFC r315580 (by alc):
Simplify the logic for clipping the range returned by the pager to fit
within the map entry.
Use atop() rather than OFF_TO_IDX() on addresses.

7 years agoMFC r315686,r315688:
ngie [Tue, 28 Mar 2017 06:03:43 +0000 (06:03 +0000)]
MFC r315686,r315688:

r315686:

kvm_geterr: handle `kd` == NULL in a deterministic/graceful manner

Return a NUL string instead of just working by accident with kvm_geterr(3)
when MALLOC_PRODUCTION is disabled (I didn't confirm the MALLOC_PRODUCTION
being enabled path).

Document the new explicit return behavior for kvm_geterr(3), as well
as the previous implicit behavior, i.e., the buffer attached to
returned via kvm_geterr(3) would be empty if a previous error hadn't been
stored in `kd`.

r315688:

kvm_write: fix -Wcast-qual warning in pointer arithmetic argument

Cast buf to `const char *` when doing arithmetic operation to match
`cp`'s type [1].

7 years agoMFC r315871: MFV r315791: ntp 4.2.8p10.
delphij [Tue, 28 Mar 2017 04:48:17 +0000 (04:48 +0000)]
MFC r315871: MFV r315791: ntp 4.2.8p10.

7 years agoMFC r315639:
ngie [Mon, 27 Mar 2017 18:31:00 +0000 (18:31 +0000)]
MFC r315639:

libcam: NULL out freed `ccb.cdm.matches` and `ccb.cdm.patterns` pointers

This is being done to avoid potential double frees with the values.

7 years agoMFC r314245:
ngie [Mon, 27 Mar 2017 18:28:15 +0000 (18:28 +0000)]
MFC r314245:

Fill MK_LIBTHR as far as lib/libthr is concerned

There are other areas of the tree that will need to be evaluated for sanity
if they're supposed to be conditionally compiled out of the build/install,
like libzpool

Relnotes: yes (this might break someone's system if have the knob set)

7 years agoMFC r315641,r315642:
ngie [Mon, 27 Mar 2017 18:26:19 +0000 (18:26 +0000)]
MFC r315641,r315642:

r315641:

bsnmp: don't leak snmp_client.fd in open_client_udp(..) on connect(2) failure

r315642:

bsnmp: explicitly test the return value for open_client_{local,udp} in snmp_open(..)

open_client_* returns -1 on failure; 0 on success. Ensure that the return value is
0 -- otherwise exit snmp_open(..).

7 years agoMFC r315690:
ngie [Mon, 27 Mar 2017 18:24:17 +0000 (18:24 +0000)]
MFC r315690:

Delete trailing whitespace (no functional change)

7 years agoMFC r315595,r315601,r315603,r315647:
ngie [Mon, 27 Mar 2017 18:22:33 +0000 (18:22 +0000)]
MFC r315595,r315601,r315603,r315647:

r315595:

Remove a commented out line before kvm_getprocs(3)

The commented out return value for kvm_getprocs(3) was misleading -- the
uncommented line is correct.

No content change

r315601:

kvm_open2(3): remove '*' when describing addr argument for `resolver`

As noted by vangyzen, with a similar issue in D10022, the pointer portion of
the .Fa macro call is unnecessary, so remove the '*'.

r315603:

kvm_close(3): return `error` instead of blindly returning `0`

`error` is the accumulated error from previous close(2) calls.

This bug has been present since the libcall's import from 4.4BSD
Lite (r1573).

Noticed by: vangyzen (D10022)
Relnotes: yes

r315647:

Handle kd == NULL gracefully with kvm_close(3)

Don't segfault in kvm_close(3) if provided a NULL pointer. Instead, return
-1 and set errno to EINVAL.

Document this new behavior explicitly.

7 years agoMFC 315229: Remove remnant of r315163.
mav [Mon, 27 Mar 2017 08:29:02 +0000 (08:29 +0000)]
MFC 315229: Remove remnant of r315163.

7 years agoMFC r315878:
kevlo [Mon, 27 Mar 2017 01:06:25 +0000 (01:06 +0000)]
MFC r315878:
Don't initialize if_output to ether_output(), ether_ifattach() does it for
us already.  While here, remove NOTYET code since if_watchdog is no longer
used.

Reviewed by: royger

7 years agoMFC 315529
kp [Sun, 26 Mar 2017 18:11:40 +0000 (18:11 +0000)]
MFC 315529

pf: Fix rule evaluation after inet6 route-to

In pf_route6() we re-run the ruleset with PF_FWD if the packet goes out
of a different interface. pf_test6() needs to know that the packet was
forwarded (in case it needs to refragment so it knows whether to call
ip6_output() or ip6_forward()).

This lead pf_test6() to try to evaluate rules against the PF_FWD
direction, which isn't supported, so it needs to treat PF_FWD as PF_OUT.
Once fwdir is set correctly the correct output/forward function will be
called.

PR:             217883
Submitted by:   Kajetan Staszkiewicz
Sponsored by:   InnoGames GmbH

7 years agoMFC r314942:
bapt [Sun, 26 Mar 2017 18:08:55 +0000 (18:08 +0000)]
MFC r314942:

Import the awk(1) manpage from OpenBSD

As discussed during AsiaBSDcon devsummit, import the manpage from OpenBSD which
is has been rewritten in mdoc(7) format making it readable by default with
mandoc, it also has been extended by OpenBSD to cover all awk(1) options

Obtained from: OpenBSD
MFC: 1 week

7 years agoMFC r314903:
bapt [Sun, 26 Mar 2017 18:07:59 +0000 (18:07 +0000)]
MFC r314903:

Remove reference to GNU info hier(7)
we have removed texinfo in FreeBSD 11.0

7 years agoMFC r314520:
bapt [Sun, 26 Mar 2017 18:06:22 +0000 (18:06 +0000)]
MFC r314520:

Import dma snapshot from git 2017-02-10

The only change is:
use basename to select executable identity

PR: 216910
Submitted by: Andrej Ebert <andrej@ebert.su>

7 years agoMFC r314902:
bapt [Sun, 26 Mar 2017 18:04:05 +0000 (18:04 +0000)]
MFC r314902:

texinfo is gone in r276551 remove the related directories

Reported by: jbeich

7 years agoMFC r315053-r315054, r315056
bapt [Sun, 26 Mar 2017 18:01:53 +0000 (18:01 +0000)]
MFC r315053-r315054, r315056

r315053:
Add share/man if it exists to the MANPATH

localbase is not consistent with base for manpages:
/usr/local/man vs /usr/share/man adding share/man allows to fix that
inconsistency and would permit to remove tons of patches/modifications in the
ports tree

r315054:
Extend functionality MANPATH in man(1) to followup with apropos(1) from
mandoc.

If MANPATH begins with a colon, it is appended to the default list; if it ends
with a colon, it is prepended to the default list; or if it contains two
adjacent colons, the standard search path is inserted between the colons.  If
none of these conditions are met, it overrides the standard search path.

Import the MANPATH description from mandoc into the man(1) man page

Reported by: kargl
MFC after: 1 week

r315056:
Remove the warning when MANPATH is set in the environment

The MANPATH environment variable behaviour is documented properly in the manpage
and it now has extended to new feature that allows to make MANPATH env variable
extending the default search path rather than overwriting it making the warning
painful

Reported by: kargl
MFC after: 1 week

7 years agoMFC r315571:
bapt [Sun, 26 Mar 2017 17:46:42 +0000 (17:46 +0000)]
MFC r315571:

Canada adheres to ISO 8601, let's make the locale reflecting that fact

PR: 200079
MFC after: 1 week
Submitted by: Dan McGregor <dan.mcgregor@usask.ca>
Reported by: A.J. Kehoe IV (Nanoman) <freebsd-bugs@nanoman.ca>
Differential Revision: https://reviews.freebsd.org/D9925

7 years agoMFC r315161: Try to slight untangle I/O and loop status handling.
mav [Sun, 26 Mar 2017 08:53:29 +0000 (08:53 +0000)]
MFC r315161: Try to slight untangle I/O and loop status handling.

7 years agoMFC r315160: Remove code for unsupported FreeBSD versions.
mav [Sun, 26 Mar 2017 08:52:14 +0000 (08:52 +0000)]
MFC r315160: Remove code for unsupported FreeBSD versions.

7 years agoMFC r315163: Remove strange config_intrhook_establish() magic.
mav [Sun, 26 Mar 2017 08:50:50 +0000 (08:50 +0000)]
MFC r315163: Remove strange config_intrhook_establish() magic.

Interrupts are enabled as part of chip reset just during driver attach.
Later "enabling" of already enabled interrupts is useless.

7 years agoMFC r315552:
kib [Sun, 26 Mar 2017 00:59:15 +0000 (00:59 +0000)]
MFC r315552:
Fix off-by-one in the vm_fault_populate() code.

7 years agoMFC r315588:
kib [Sun, 26 Mar 2017 00:56:24 +0000 (00:56 +0000)]
MFC r315588:
Update the list of cpudev ioctls which require write access.

7 years agoMFC r315586:
kib [Sun, 26 Mar 2017 00:53:34 +0000 (00:53 +0000)]
MFC r315586:
Style.

7 years agoMFC r315412, r314852:
badger [Sat, 25 Mar 2017 20:14:08 +0000 (20:14 +0000)]
MFC r315412, r314852:

r315412:
    Don't clear p_ptevents on normal SIGKILL delivery

    The ptrace() user has the option of discarding the signal. In such a
    case, p_ptevents should not be modified. If the ptrace() user decides to
    send a SIGKILL, ptevents will be cleared in ptracestop(). procfs events
    do not have the capability to discard the signal, so continue to clear
    the mask in that case.

r314852:
    don't stop in issignal() if P_SINGLE_EXIT is set

    Suppose a traced process is stopped in ptracestop() due to receipt of a
    SIGSTOP signal, and is awaiting orders from the tracing process on how
    to handle the signal. Before sending any such orders, the tracing
    process exits. This should kill the traced process. But suppose a second
    thread handles the SIGKILL and proceeds to exit1(), calling
    thread_single(). The first thread will now awaken and will have a chance
    to check once more if it should go to sleep due to the SIGSTOP.  It must
    not sleep after P_SINGLE_EXIT has been set; this would prevent the
    SIGKILL from taking effect, leaving a stopped orphan behind after the
    tracing process dies.

    Also add new tests for this condition.

Sponsored by: Dell EMC

7 years agoMFC r315499:
dchagin [Sat, 25 Mar 2017 14:28:20 +0000 (14:28 +0000)]
MFC r315499:

Remove superflous break statment.

7 years agoMFC r315503:
dchagin [Sat, 25 Mar 2017 14:26:45 +0000 (14:26 +0000)]
MFC r315503:

As noted by Roel Bouwman Linux allows a large buffer size than the
struct ucred size. Fix this.

PR:           102956

7 years agoMFC r315278:
dchagin [Sat, 25 Mar 2017 14:25:20 +0000 (14:25 +0000)]
MFC r315278:

Fix usage of the same 'i' variable in the external and nested loops.

7 years agoMFC r313992, r314075, r314118, r315484:
badger [Sat, 25 Mar 2017 13:33:23 +0000 (13:33 +0000)]
MFC r313992, r314075, r314118, r315484:

r315484:
    ptrace_test: eliminate assumption about thread scheduling

    A couple of the ptrace tests make assumptions about which thread in a
    multithreaded process will run after a halt. This makes the tests less
    portable across branches, and susceptible to future breakage. Instead,
    twiddle thread scheduling and priorities to match the tests'
    expectation.

r314118:
    Actually fix buildworlds other than i386/amd64/sparc64 after r313992

    Disable offending test for platforms without a userspace visible
    breakpoint().

r314075:
    Fix world build for archs where __builtin_debugtrap() does not work.

    The offending code was introduced in r313992.

r313992:
    Defer ptracestop() signals that cannot be delivered immediately

    When a thread is stopped in ptracestop(), the ptrace(2) user may request
    a signal be delivered upon resumption of the thread. Heretofore, those signals
    were discarded unless ptracestop()'s caller was issignal(). Fix this by
    modifying ptracestop() to queue up signals requested by the ptrace user that
    will be delivered when possible. Take special care when the signal is SIGKILL
    (usually generated from a PT_KILL request); no new stop events should be
    triggered after a PT_KILL.

    Add a number of tests for the new functionality. Several tests were authored
    by jhb.

PR: 212607
Sponsored by: Dell EMC

7 years agoMFC r315745:
dim [Sat, 25 Mar 2017 12:29:15 +0000 (12:29 +0000)]
MFC r315745:

Cherry-pick libcxxrt commit 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92:

Author: David Chisnall <theraven@FreeBSD.org>
Date:   Wed Mar 22 12:27:08 2017 +0000

    Simplify some code.

    realloc() with a null pointer is equivalent to malloc, so we don't need
    to handle the two cases independently.

    Fixes #46

This should help with lang/beignet and other programs, which expect
__cxa_demangle(name, NULL, NULL, &status) to return zero in status.

PR: 213732

7 years agoMFC r315689:
dim [Sat, 25 Mar 2017 12:21:20 +0000 (12:21 +0000)]
MFC r315689:

Gcc has incompatible internal declarations for __divtc3 and __multc3 as
defined in compiler-rt, but it has no option to silence its warning, so
make gcc warnings for libcompiler_rt non-fatal.

Noticed by: lwhsu

7 years agoMFC r315087, r315146:
mav [Sat, 25 Mar 2017 11:47:23 +0000 (11:47 +0000)]
MFC r315087, r315146:
Improve ctl(4) description, including frontends and backends.

7 years agoMFC r315084: Increase device openings to tagged maximum.
mav [Sat, 25 Mar 2017 11:44:34 +0000 (11:44 +0000)]
MFC r315084: Increase device openings to tagged maximum.

Some SIMs report much less untagged device openings then tagged ones.
Target mode devices are not handled by regular probing routines, and so
there is nothing to increase queue size for them to the SIM's maximum.
To fix that resize the queue explicitly on ctl periph registration.
This radically improves performance of mpt(4) in target mode.

Also fetch and report device queue statistics in `ctladm dumpstructs`,
since regular way of `camcontrol tags` is not usable in target mode.

7 years agoMFC r315082: Allow XPT_GDEV_STATS for UNCONFIGURED devices.
mav [Sat, 25 Mar 2017 11:35:31 +0000 (11:35 +0000)]
MFC r315082: Allow XPT_GDEV_STATS for UNCONFIGURED devices.

Queue statistics has nothing to do with presence or absence of INQUIRY
data, etc.  Target mode devices are never configured, but have queues.

7 years agoMFC r315716
grehan [Sat, 25 Mar 2017 05:41:34 +0000 (05:41 +0000)]
MFC r315716
  Bring the handling of the y axis in the ums driver in-line with the other
  axes.

  No functional change.

7 years agoMFC r315715 Fix a type in bhyve's USB mouse emulation.
grehan [Sat, 25 Mar 2017 05:21:49 +0000 (05:21 +0000)]
MFC r315715  Fix a type in bhyve's USB mouse emulation.