]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r352783:
Cy Schubert [Mon, 30 Sep 2019 02:32:51 +0000 (02:32 +0000)]
MFC r352783:

Fix a typo.

4 years agoMFC r351828:
Warner Losh [Mon, 30 Sep 2019 01:59:27 +0000 (01:59 +0000)]
MFC r351828:

  Support doorbell strides != 0.

4 years agoMFC r352627:
Mark Johnston [Mon, 30 Sep 2019 01:25:37 +0000 (01:25 +0000)]
MFC r352627:
Implement x86 dtrace_invop_(un)init() in C.

4 years agoMFC r352624:
Mark Johnston [Mon, 30 Sep 2019 01:25:14 +0000 (01:25 +0000)]
MFC r352624:
Set NX on some non-leaf direct map page table entries.

4 years agoMFC r352626:
Mark Johnston [Mon, 30 Sep 2019 01:24:44 +0000 (01:24 +0000)]
MFC r352626:
Fix a harmless typo.

4 years agoMFC r349225:
Li-Wen Hsu [Mon, 30 Sep 2019 00:01:54 +0000 (00:01 +0000)]
MFC r349225:

Finsh readding Big5 in r317204, which was reverting r315568.  This commit
reverts r315569.

Reported by: Ting-Wei Lan <lantw44 gmail com>
Discussed with: kevlo
Sponsored by: The FreeBSD Foundation

4 years agoMFC r351728, r352581 (by kib), r352606 (by kib):
Mark Johnston [Sun, 29 Sep 2019 22:41:06 +0000 (22:41 +0000)]
MFC r351728, r352581 (by kib), r352606 (by kib):
Add a sysctl to dump kernel mappings and their properties on amd64.

4 years agoMFC r351628, r351744:
Mark Johnston [Sun, 29 Sep 2019 22:37:59 +0000 (22:37 +0000)]
MFC r351628, r351744:
Update and clean up the UMA man page.

4 years agoMFC r351802:
Xin LI [Sun, 29 Sep 2019 20:05:48 +0000 (20:05 +0000)]
MFC r351802:

Correct overflow logic in fullpath().

Obtained from: OpenBSD

4 years agoMFC r352597: Add support for ps -H on corefiles in libkvm
Mike Karels [Sun, 29 Sep 2019 06:12:51 +0000 (06:12 +0000)]
MFC r352597: Add support for ps -H on corefiles in libkvm

Add support for kernel threads in kvm_getprocs() and the underlying
kvm_proclist() in libkvm when fetching from a kernel core file. This
has been missing/needed for several releases, when kernel threads became
normal threads.  The loop over the processes now contains a sub-loop for
threads, which iterates beyond the first thread only when threads are
requested.  Also set some fields such as tid that were previously
uninitialized.

Sponsored by:   Forcepoint LLC

4 years agoMFC r352737:
Cy Schubert [Sun, 29 Sep 2019 03:41:15 +0000 (03:41 +0000)]
MFC r352737:

ipf mistakenly regards UDP packets with a checksum of 0xffff as bad.

Obtained from: NetBSD fil.c r1.30, NetBSD PR/54443

4 years agoMFC r352304, r352540
Cy Schubert [Sun, 29 Sep 2019 03:36:50 +0000 (03:36 +0000)]
MFC r352304, r352540

r352304:
No longer mlock() ntpd pages by default in memory thus allowing its
pages to page as necessary.

To restore historic BSD behaviour add the following to ntp.conf:
rlimit memlock 32

Discussed on: freebsd-current@ between Sept 6-9, 2019
Reported by: Users using ASLR with stack gap != 0
Reviewed by: ian, kib, rgrimes (all previous versions)
Differential Revision: https://reviews.freebsd.org/D21581

r352540:
Follow up on r352304 which disabled default mlockall() at startup.
Unfortunately though the original tarball supports this in ./configure
(for Linux), to fully support disabling of mlockall() by default requires
a little extra help otherwise the following is logged in syslog:

Cannot set RLIMIT_MEMLOCK: Operation not permitted

4 years agoMFC r352369: Relax TX draining in ns8250_bus_transmit().
Alexander Motin [Sun, 29 Sep 2019 02:55:57 +0000 (02:55 +0000)]
MFC r352369: Relax TX draining in ns8250_bus_transmit().

Since TX interrupt is generated when THRE is set, wait for TEMT set means
wait for full character transmission time.  At low speeds that may take
awhile, burning CPU time while holding sc_hwmtx lock, also congested.

This is partial revert of r317659.

4 years agoMFC r352710:
Dimitry Andric [Sat, 28 Sep 2019 08:57:29 +0000 (08:57 +0000)]
MFC r352710:

Do not left-shift a negative number (inducing undefined behavior in
C/C++) in exp(3), expf(3), expm1(3) and expm1f(3) during intermediate
computations that compute the IEEE-754 bit pattern for |2**k| for
integer |k|.

The implementations of exp(3), expf(3), expm1(3) and expm1f(3) need to
compute IEEE-754 bit patterns for 2**k in certain places.  (k is an
integer and 2**k is exactly representable in IEEE-754.)

Currently they do things like 0x3FF0'0000+(k<<20), which is to say they
take the bit pattern representing 1 and then add directly to the
exponent field to get the desired power of two.  This is fine when k is
non-negative.

But when k<0 (and certain classes of input trigger this), this
left-shifts a negative number -- an operation with undefined behavior in
C and C++.

The desired semantics can be achieved by instead adding the
possibly-negative k to the IEEE-754 exponent bias to get the desired
exponent field, _then_ shifting that into its proper overall position.

(Note that in case of s_expm1.c and s_expm1f.c, there are SET_HIGH_WORD
and SET_FLOAT_WORD uses further down in each of these files that perform
shift operations involving k, but by these points k's range has been
restricted to 2 < k <= 56, and the shift operations under those
circumstances can't do anything that would be UB.)

Submitted by: Jeff Walden, https://github.com/jswalden
Obtained from: https://github.com/freebsd/freebsd/pull/411
Obtained from: https://github.com/freebsd/freebsd/pull/412

4 years agoMFC r352699:
Dimitry Andric [Sat, 28 Sep 2019 08:54:32 +0000 (08:54 +0000)]
MFC r352699:

In suite.test.mk, test if ${DESTDIR} exists before attempting to run
chflags -R on it, otherwise the command will error out.  (Note that
adding -f to the chflags invocation does not help, unlike with rm.)

4 years agoMFC r352582, r352585:
Konstantin Belousov [Sat, 28 Sep 2019 07:33:08 +0000 (07:33 +0000)]
MFC r352582, r352585:
Make non-ASLR pie base tunable.

4 years agoMFC r352579: Allocate callout wheel from the respective memory domain.
Alexander Motin [Sat, 28 Sep 2019 02:15:23 +0000 (02:15 +0000)]
MFC r352579: Allocate callout wheel from the respective memory domain.

4 years agoMFC r351422: Report Clock Power Management support and status.
Alexander Motin [Sat, 28 Sep 2019 01:31:33 +0000 (01:31 +0000)]
MFC r351422: Report Clock Power Management support and status.

Since we already report ASPM, why not to go further.

4 years agoMFC r352544: Improve ioat(4) NUMA-awareness.
Alexander Motin [Sat, 28 Sep 2019 00:59:39 +0000 (00:59 +0000)]
MFC r352544: Improve ioat(4) NUMA-awareness.

Allocate ioat->ring memory from the device domain.
Schedule ioat->poll_timer to the first CPU of the device domain.

According to pcm-numa tool from intel-pcm port, this reduces number of
remote DRAM accesses while copying data by 75%.  And unless it is a noise,
I've noticed some speed improvement when copying data to other domain.

4 years agoMFC r352635:
Li-Wen Hsu [Fri, 27 Sep 2019 22:11:50 +0000 (22:11 +0000)]
MFC r352635:

Clean LINT* kernel configurations for arm*

Sponsored by: The FreeBSD Foundation

4 years agoMFC r352315:
Li-Wen Hsu [Fri, 27 Sep 2019 15:28:01 +0000 (15:28 +0000)]
MFC r352315:

Improve the description of big5(5)

- Fix the statement that big5 is a de facto standard of Traditional Chinese
  text [1]
- Add a BUGS section describes the problem of big5 and suggests use utf8

PR: 189095
Submitted by: Brennan Vincent <brennan@umanwizard.com> [1]
Reviewed by: Ting-Wei Lan <lantw44@gmail.com>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21622

4 years agoMFC r344839:
Rebecca Cran [Fri, 27 Sep 2019 05:12:28 +0000 (05:12 +0000)]
MFC r344839:

Add retry loop around GetMemoryMap call to fix fragmentation bug

The call to BS->AllocatePages can cause the memory map to become framented,
causing BS->GetMemoryMap to return EFI_BUFFER_TOO_SMALL more than once. For
example this can happen on the MinnowBoard Turbot, causing the boot to stop
with an error. Avoid this by calling GetMemoryMap in a loop.

4 years agoDocument logic for __DEFAULT_DEPENDENT_OPTIONS
Simon J. Gerraty [Fri, 27 Sep 2019 00:11:09 +0000 (00:11 +0000)]
Document logic for __DEFAULT_DEPENDENT_OPTIONS

MFC of r352370

Reviewed by: stevek
Differential Revision: https://reviews.freebsd.org/D21640

4 years agoUse .undef per variable
Simon J. Gerraty [Fri, 27 Sep 2019 00:08:40 +0000 (00:08 +0000)]
Use .undef per variable

Attempting to expand a variable to a list of vars to .undef
does not actually work.

MFC of r343066

Reviewed by: bdrewery
Differential Revision: D17251

4 years agoMFC r349342 (by imp):
Alexander Motin [Thu, 26 Sep 2019 19:47:54 +0000 (19:47 +0000)]
MFC r349342 (by imp):
Use the cam_ed copy of ata_params rather than malloc and freeing
memory for it. This reaches into internal bits of xpt a little, and
I'll clean that up later.

4 years agoMFC r352363:
Ian Lepore [Thu, 26 Sep 2019 17:07:30 +0000 (17:07 +0000)]
MFC r352363:

Apply a runtime patch to the FDT data for imx6 to fix iomuxc problems.

The latest imported FDT data defines a node for an iomuxc-gpr device,
which we don't support (or need, right now) in addition to the usual
iomuxc device.  Unfortunately, the dts improperly assigns overlapping
ranges of mmio space to both devices.  The -gpr device is also a syscon
and simple_mfd device.

At runtime the simple_mfd driver attaches for the iomuxc-gpr node, then
when the real iomuxc driver comes along later, it fails to attach because
it tries to allocate its register space, and it's already partially in
use by the bogus instance of simple_mfd.

This change works around the problem by simply disabling the node for
the iomuxc-gpr device, since we don't need it for anything.

4 years agoMFC r352551: elf_common: add ELF note names
Ed Maste [Thu, 26 Sep 2019 16:39:33 +0000 (16:39 +0000)]
MFC r352551: elf_common: add ELF note names

r348628 added a definition of NT_GNU_BUILD_ID.  Some software (Valgrind)
also expects a #define for the note name (ELF_NOTE_GNU) in the case that
NT_GNU_BUILD_ID is defined.

PR: 239669
Sponsored by: The FreeBSD Foundation

4 years agoMFC r352513, r352514, r352662:
Michael Gmelin [Thu, 26 Sep 2019 16:34:43 +0000 (16:34 +0000)]
MFC r352513, r352514, r352662:

As suggested by koobs, MFC recent freebsd-update changes to
have a consistent user experience on all supported
versions.

r352513:
freebsd-update.8: appease igor

igor follows American style guides in the belief that abbreviations i.e.
and e.g. are always followed by a comma.  Make that change now so that
future updates to freebsd-update.8 do not complain about this.

r352514:
freebsd-update: make usage output consistent

Drop trailing . which appeared only on description of IDS.

r352662:
freebsd-update: Add `updatesready' and `showconfig' commands

`freebsd-update updatesready' can be used to check if there are any pending
fetched updates that can be installed.

`freebsd-update showconfig' writes freebsd-update's configuration to
stdout.

This also changes the exit code of `freebsd-update install' to 2 in case
there are no updates pending to be installed and there wasn't a fetch phase
in the same invocation. This allows scripts to tell apart these error
conditions without breaking existing jail managers.

PR: 240757, 240177, 229346
Reviewed by: manpages (bcr), secteam (emaste), yuripv
Differential Revision: https://reviews.freebsd.org/D21473

4 years agosrc.conf.5: regen after r352754, WITH_PIE
Ed Maste [Thu, 26 Sep 2019 16:09:28 +0000 (16:09 +0000)]
src.conf.5: regen after r352754, WITH_PIE

Sponsored by: The FreeBSD Foundation

4 years agoAdd WITH_PIE knob to build Position Independent Executables
Ed Maste [Thu, 26 Sep 2019 16:05:57 +0000 (16:05 +0000)]
Add WITH_PIE knob to build Position Independent Executables

MFC r344179: Add WITH_PIE knob to build Position Independent Executables

Building binaries as PIE allows the executable itself to be loaded at a
random address when ASLR is enabled (not just its shared libraries).

With this change PIE objects have a .pieo extension and INTERNALLIB
libraries libXXX_pie.a.

MK_PIE is disabled for some kerberos5 tools, Clang, and Subversion, as
they explicitly reference .a libraries in their Makefiles.  These can
be addressed on an individual basis later.  MK_PIE is also disabled for
rtld-elf because it is already position-independent using bespoke
Makefile rules.

Currently only dynamically linked binaries will be built as PIE.

MFC r344181: Fix Makefile conditional after r344179

MFC r344182: Use make's :tl instead of checking "no" and "NO"

MFC r344189: Fixup bsd.prog.mk after r344182

MFC r344211: wlandebug: disable PIE to fix build failure

libifconfig is built as a static-only PRIVATELIB (and there is no _pie.a
version) so disable PIE in libifconfig's consumer.

r345489: Fix GNU objdump build under WITH_PIE

Explicitly specified bare .a libraries need ${PIE_SUFFIX}.

r345490: Apply WITH_PIE changes to other binutils components

Followon to r345489, explicitly specified bare .a libraries need
${PIE_SUFFIX} (although these still built).

r345778: Fix gdb/kgdb build under WITH_PIE

Explicitly specified bare .a libraries need ${PIE_SUFFIX}.

Sponsored by: The FreeBSD Foundation

4 years agosrc.conf.5: regen after r352752, WITH_BIND_NOW
Ed Maste [Thu, 26 Sep 2019 15:52:42 +0000 (15:52 +0000)]
src.conf.5: regen after r352752, WITH_BIND_NOW

Sponsored by: The FreeBSD Foundation

4 years agoAdd a WITH_BIND_NOW build knob
Ed Maste [Thu, 26 Sep 2019 15:50:18 +0000 (15:50 +0000)]
Add a WITH_BIND_NOW build knob

MFC r340186: Add a WITH_BIND_NOW build knob

The linker's -z now flag sets the DF_BIND_NOW flag, which signals to the
runtime loader that all relocation processing should be performed at
process startup rather than on demand.  In combination with lld's
default of enabling relro this causes the GOT to be made read-only when
the process starts, preventing straightforward GOT overwrite attacks.

MFC r341429: disable BIND_NOW in libc, libthr, and rtld

An issue remains with BIND_NOW and processes using threads.  For now,
restore libc's BIND_NOW disable, and also disable BIND_NOW in rtld and
libthr.

MFC r345625: revert r341429 "disable BIND_NOW in libc, libthr, and rtld"

r345620 by kib@ fixed the rtld issue that caused a crash at startup
during resolution of libc's ifuncs with BIND_NOW.

MFC r345638: Revert change accidentally committed along with r345625

MFC r345640: Revert other accidentally committed part of r345625

Sponsored by: The FreeBSD Foundation

4 years agoMFC r352634:
Mark Johnston [Thu, 26 Sep 2019 15:38:06 +0000 (15:38 +0000)]
MFC r352634:
ping6: Use caph_rights_limit(3) for STDIN_FILENO

4 years agoMFC r352625:
Mark Johnston [Thu, 26 Sep 2019 15:37:40 +0000 (15:37 +0000)]
MFC r352625:
Revert r316820.

PR: 233952

4 years agompr/mps crash badly. Part of the stability added use of atomic64 functions not
Warner Losh [Thu, 26 Sep 2019 12:54:52 +0000 (12:54 +0000)]
mpr/mps crash badly. Part of the stability added use of atomic64 functions not
present on 32-bit powerpc. Merge the part that removes mps from the build
on this tier 2 platform. Working mpr/mps in 12 and 12.1 on our tier 1 platforms
is more important.

MFC r341754:

  Remove the mps driver from powerpc 32bit GENERIC, and don't build it and mpr
  as a module for powerpc or mips.  An upcoming commit will cause these drivers
  to rely on the presence of 64bit atomic operations.  Discussed with jhibbits.

Relnotes: YES

4 years agoCatch up with stability fixes to mpr/mps in -current since 12
Warner Losh [Thu, 26 Sep 2019 01:54:24 +0000 (01:54 +0000)]
Catch up with stability fixes to mpr/mps in -current since 12
was branched.

MFC r341755,r342354,r342355,r342386,r342387,r342388,r342526,r342528,
r342530,r342531,r342533,r342534,r342535,r342536,r342659,r345479,
r345485,r345573,r347237,r349849,r349909:

  r341755:
    Copy and clear the reply descriptor atomically.  This prevents concurrency
    in the interrupt handlers (usually due to timeout/error recovery) from
    seeing and processing the same descriptor twice.
  r342354:
    mps(4), mpr(4): Fix lifetime of command buffer for mp?sas_get_sata_identify
  r342355:
    mps(4), mpr(4): remove SATA ID command cancellation hack
  r342386:
    First step in refactoring and fixing the error recovery and task management
    code in the mpr and mps drivers.  Eliminate duplicated code and fix some
    comments.
  r342387:
    Commands for user-initated device resets should come from the high-priority
    allocator.  Prior to this change, they would leak from the normal
    allocator.
  r342388:
    Further refactoring for task management commands.  Also fix a related typo
    from the previous commit.
  r342526:
    Update MPI header files version to 2.00.52 from 2.00.48
  r342528:
    Copy back the Sense data at proper location expected by the application
  r342530:
    Added support for NVMe Task Management
  r342531:
    Add Sea,Aero adapter support
  r342533:
    Enable atomic type descriptor support only for Sea & Aero cards
  r342534:
    On Aero/Sea A0 cards retry MPT Fusion registers reads for max three times
  r342535:
    Update copyright information
  r342536:
    Update mpr driver version to v23.00.00.00-fbsd
  r342659:
    Fix whitespace from r342528
  r345479:
    r329522 created problemss with commands that enter the TIMEDOUT state but
    are successfully returned by the card (usually due to an abort being issued
    as part of timeout recovery). Remove what amounts to an insufficient
    KASSERT, and don't overwrite the state value. State should probably be
    re-designed, and that will be done with a future commit.
  r345485:
    Add event table decoding for SAS Broadcast Primitive events.
  r345573:
    Add missing break statements.  Coverity CID 1400446.
  r347237:
    Add missing newline to debug printf.
  r349849:
    Fix bugs in recovery path and improve cm tracking
  r349909:
    More fully implement the state machine.

Sponsored by: Netflix, Inc

4 years agoMFC r352506: fix dsl_scan_ds_clone_swapped logic
Andriy Gapon [Wed, 25 Sep 2019 20:00:59 +0000 (20:00 +0000)]
MFC r352506: fix dsl_scan_ds_clone_swapped logic

PR: 239566

4 years agoMFC r352590: print summary line for space estimate of zfs send from bookmark
Andriy Gapon [Wed, 25 Sep 2019 19:55:52 +0000 (19:55 +0000)]
MFC r352590: print summary line for space estimate of zfs send from bookmark

4 years agoMFC r346550:
Mark Johnston [Wed, 25 Sep 2019 19:52:34 +0000 (19:52 +0000)]
MFC r346550:
Use separate descriptors in bhyve's stdio uart backend.

4 years agoMFC r351810: shutdown_halt: make sure that watchdog timer is stopped
Andriy Gapon [Wed, 25 Sep 2019 19:51:22 +0000 (19:51 +0000)]
MFC r351810: shutdown_halt: make sure that watchdog timer is stopped

4 years agoMFC r351601: scsi_cd: whitespace cleanup
Andriy Gapon [Wed, 25 Sep 2019 19:48:07 +0000 (19:48 +0000)]
MFC r351601: scsi_cd: whitespace cleanup

4 years agoMFC r351599,r351600: scsi_cd: make the media check asynchronous
Andriy Gapon [Wed, 25 Sep 2019 19:46:17 +0000 (19:46 +0000)]
MFC r351599,r351600: scsi_cd: make the media check asynchronous

PR: 219857

4 years agoMFC r352493: Fix typo, setting hidden flag instead of reparse.
Alexander Motin [Wed, 25 Sep 2019 15:50:36 +0000 (15:50 +0000)]
MFC r352493: Fix typo, setting hidden flag instead of reparse.

4 years agoMFC r342563:
Justin Hibbits [Wed, 25 Sep 2019 14:33:08 +0000 (14:33 +0000)]
MFC r342563:

libm: Include float.h to get LDBL_MANT_DIG

The long double aliases of double functions are only exposed as aliases if
LDBL_MANT_DIG is 53 (same as DBL_MANT_DIG).  Without float.h included these
files were not exposing weak aliases as expected, leading to link failures
if programs use the *l functions.  This should fix editors/calligra on
targets with 64-bit long double, which uses erfl and erfcl.  Found on
powerpc64.

4 years agoMFC r352488:
Konstantin Belousov [Wed, 25 Sep 2019 13:29:56 +0000 (13:29 +0000)]
MFC r352488:
truss: decode sysctl names.

4 years agoMFC r352486:
Konstantin Belousov [Wed, 25 Sep 2019 13:28:06 +0000 (13:28 +0000)]
MFC r352486:
sysctl: use names instead of magic numbers.

4 years agoMFC r352564: msdosfs: do not deget unlinked denodes
Kyle Evans [Wed, 25 Sep 2019 12:58:49 +0000 (12:58 +0000)]
MFC r352564: msdosfs: do not deget unlinked denodes

When a file is unlinked, the denode is not reclaimed until the last
reference is dropped, but the directory entry is immediately up for reuse.
This is a problem later when createde goes to grab a denode for the newly
created entry -- we search the hash and find a dead denode, then return that
without even bumping the reference count and the data later gets truncated
when the the last reference to the unlinked file is dropped.

This manifested itself as a broken in-place strip(1) on msdosfs.

The comment indicating that we want to skip these denodes has been updated
to reflect where this is actually done.

4 years agoMFC r352594:
Michael Tuexen [Wed, 25 Sep 2019 10:46:05 +0000 (10:46 +0000)]
MFC r352594:

Don't hold the info lock when calling sctp_select_a_tag().

This avoids a double lock bug in the NAT colliding state processing
of SCTP. Thanks to Felix Weinrank for finding and reporting this issue in
https://github.com/sctplab/usrsctp/issues/374
He found this bug using fuzz testing.

4 years agoMFC r352592:
Michael Tuexen [Wed, 25 Sep 2019 10:44:10 +0000 (10:44 +0000)]
MFC r352592:

Cleanup the RTO calculation and perform some consistency checks
before computing the RTO.
This should fix an overflow issue reported by Felix Weinrank in
https://github.com/sctplab/usrsctp/issues/375
for the userland stack and found by running a fuzz tester.

4 years agoMFC r352550:
Michael Tuexen [Wed, 25 Sep 2019 10:42:34 +0000 (10:42 +0000)]
MFC r352550:

Fix the handling of invalid parameters in ASCONF chunks.
Thanks to Mark Wodrich from Google for reproting the issue in
https://github.com/sctplab/usrsctp/issues/376
for the userland stack.

4 years agoMFC r352512:
Michael Tuexen [Wed, 25 Sep 2019 10:40:49 +0000 (10:40 +0000)]
MFC r352512:

When the RACK stack computes the space for user data in a TCP segment,
it wasn't taking the IP level options into account. This patch fixes this.
In addition, it also corrects a KASSERT and adds protection code to assure
that the IP header chain and the TCP head fit in the first fragment as
required by RFC 7112.

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

4 years agoMFC r352511:
Michael Tuexen [Wed, 25 Sep 2019 10:38:44 +0000 (10:38 +0000)]
MFC r352511:

When processing an incoming IPv6 packet over the loopback interface which
contains Hop-by-Hop options, the mbuf chain is potentially changed in
ip6_hopopts_input(), called by ip6_input_hbh().
This can happen, because of the the use of IP6_EXTHDR_CHECK, which might
call m_pullup().
So provide the updated pointer back to the called of ip6_input_hbh() to
avoid using a freed mbuf chain in`ip6_input()`.

Reviewed by: markj@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D21664

4 years agoMFC r352459:
Konstantin Belousov [Tue, 24 Sep 2019 06:31:56 +0000 (06:31 +0000)]
MFC r352459:
ifconfig: add report of the string from SIOCGIFDOWNREASON.

Sponsored by: Mellanox Technologies

4 years agoMFC r352458:
Konstantin Belousov [Tue, 24 Sep 2019 06:30:34 +0000 (06:30 +0000)]
MFC r352458:
Add SIOCGIFDOWNREASON.

Sponsored by: Mellanox Technologies

4 years agoMFC r352456:
Konstantin Belousov [Tue, 24 Sep 2019 06:19:41 +0000 (06:19 +0000)]
MFC r352456:
realloc(x, 0) should not return NULL.

PR: 240456

4 years agoMFC r352455:
Konstantin Belousov [Tue, 24 Sep 2019 06:18:48 +0000 (06:18 +0000)]
MFC r352455:
Return EISDIR when directory is opened with O_CREAT without O_DIRECTORY.

PR: 240452

4 years agoMFC r352430:
Mitchell Horne [Tue, 24 Sep 2019 02:41:39 +0000 (02:41 +0000)]
MFC r352430:

RISC-V: Support EARLY_AP_STARTUP

4 years agoMFC r352036:
Mitchell Horne [Tue, 24 Sep 2019 02:38:08 +0000 (02:38 +0000)]
MFC r352036:

Fix compilation of locore.S with clang

4 years agoMFC r352035:
Mitchell Horne [Tue, 24 Sep 2019 02:36:09 +0000 (02:36 +0000)]
MFC r352035:

Remove a duplicate KTR entry

4 years agoMFC r352034:
Mitchell Horne [Tue, 24 Sep 2019 02:33:03 +0000 (02:33 +0000)]
MFC r352034:

RISC-V: fix kernel CFLAGS with clang

4 years agoMFC r352033:
Mitchell Horne [Tue, 24 Sep 2019 02:28:17 +0000 (02:28 +0000)]
MFC r352033:

Allow for compiler versions >= 10

4 years agoMFC r352393, r352457:
Konstantin Belousov [Mon, 23 Sep 2019 13:45:50 +0000 (13:45 +0000)]
MFC r352393, r352457:
nfscl_loadattrcache: fix rest of the cases to not call
vnode_pager_setsize() under the node mutex.

4 years agoMFC r352384:
Konstantin Belousov [Mon, 23 Sep 2019 07:22:22 +0000 (07:22 +0000)]
MFC r352384:
Increase the size of the send and receive buffers for YP client rpc
calls to max allowed UDP datagram size.

Sponsored by: Mellanox Technologies

4 years agoMFC r352542: freebsd-update: Fix src component detection
Michael Gmelin [Sun, 22 Sep 2019 19:53:29 +0000 (19:53 +0000)]
MFC r352542: freebsd-update: Fix src component detection

PR: 224048, 238558, 239997
Reviewed by:    emaste
Differential Revision:  https://reviews.freebsd.org/D21579

4 years agoMFC r352256:
Mark Johnston [Sun, 22 Sep 2019 18:07:52 +0000 (18:07 +0000)]
MFC r352256:
Remove a redundant NULL pointer check in cpuset_modify_domain().

4 years agoMFC r352447,r352449,r352507: MFZoL: Add -vnP support to 'zfs send' for bookmarks
Andriy Gapon [Sun, 22 Sep 2019 11:40:43 +0000 (11:40 +0000)]
MFC r352447,r352449,r352507: MFZoL: Add -vnP support to 'zfs send' for bookmarks

4 years agoMFC r352518:
Cy Schubert [Sun, 22 Sep 2019 05:16:10 +0000 (05:16 +0000)]
MFC r352518:

Reduce calls to close(2) at startup through the use of closefrom(2).

Submitted by: pawel.biernacki@gmail.com
Reviewed by: mjg, cy
Differential Revision: https://reviews.freebsd.org/D21715

4 years agoMFC r352567:
Hiroki Sato [Sat, 21 Sep 2019 14:03:41 +0000 (14:03 +0000)]
MFC r352567:

Add a workaround for servers which respond RPC_PROGNOTREGISTERED
to a clnt_create() call even when it is actually a program
version mismatch.

Normally the server is supposed to return RPC_PROGVERSMISMATCH
when it supports the specified program but not support
the specified version.  Some filers return RPC_PROGNOTREGISTERED
to RQUOTA v2 calls and FreeBSD does not retry with the old
v1 calls.  This change fixes this failure scenario.

Submitted by: Jian-Bo Liao
PR: 236179

4 years agoMFC: r342869, r344398, r344446, r344448, r345713, r345980, r347415,
Jung-uk Kim [Fri, 20 Sep 2019 22:07:59 +0000 (22:07 +0000)]
MFC: r342869, r344398, r344446, r344448, r345713, r345980, r347415,
r349863, r350510, r351095

Merge ACPICA up to 20190703.

4 years agoMFC r352246: SIOCSIFNAME: Do nothing if we're not actually changing
Kyle Evans [Fri, 20 Sep 2019 21:27:41 +0000 (21:27 +0000)]
MFC r352246: SIOCSIFNAME: Do nothing if we're not actually changing

Instead of throwing EEXIST, just succeed if the name isn't actually
changing. We don't need to trigger departure or any of that because there's
no change from consumers' perspective.

PR: 240539

4 years agoMFC r352260:
Michael Zhilin [Fri, 20 Sep 2019 19:56:30 +0000 (19:56 +0000)]
MFC r352260:

[Bug 240473] add support of Ralink RT5390R Wireless Card

This commit adds PCI ID of Ralink RT5390R into ids table of driver ral.
Tests show stability of card during day. Network speed is reasonable (
around several megabytes per second).

PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240473
Reported by: zetrotrack000@gmail.com
Reviewed by: ray
Approved by: ray
Differential Revision:  https://reviews.freebsd.org/D21604

4 years agoMFC r352263:
Michael Zhilin [Fri, 20 Sep 2019 19:45:37 +0000 (19:45 +0000)]
MFC r352263:

[jail] removal by jid doesn't trigger pre/post stop scripts

This commit fixes bug: command "jail -r" didn't trigger pre/post stop
commands (and others) defined in config file if jid is specified insted of
name. Also it adds basic tests for usr.sbin/jail to avoid regression.

Reviewed by: jamie, kevans, ray
Differential Revision: https://reviews.freebsd.org/D21328

4 years agoMFC r352303:
Konstantin Belousov [Fri, 20 Sep 2019 07:24:18 +0000 (07:24 +0000)]
MFC r352303:
riscv trap_pfault: remove unneeded hold of the process around vm_fault() call.

4 years ago- Set stable/12 back to 'STABLE', now that all work on the 12.1 release
Glen Barber [Fri, 20 Sep 2019 00:07:48 +0000 (00:07 +0000)]
- Set stable/12 back to 'STABLE', now that all work on the 12.1 release
  cycle will take place in the releng/12.1 branch.
- Bump __FreeBSD_version.

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC (Netgate)

4 years agoMFC: r351653
Jung-uk Kim [Thu, 19 Sep 2019 22:39:13 +0000 (22:39 +0000)]
MFC: r351653

Add support for TP-Link Archer T2U Nano.

4 years agoMF r349585
Alan Cox [Thu, 19 Sep 2019 20:45:23 +0000 (20:45 +0000)]
MF r349585
  Tidy up pmap_copy().  Notably, deindent the innermost loop by making a
  simple change to the control flow.  Replace an unnecessary test by a
  KASSERT.  Add a comment explaining an obscure test.

4 years agoMFC r352520 (partial):
Glen Barber [Thu, 19 Sep 2019 18:50:42 +0000 (18:50 +0000)]
MFC r352520 (partial):
 The original commit was a direct commit to stable/12, as at the time it
 was presumed it would not be necessary for head.  However, when it is
 time to create a releng branch or switch from PRERELEASE/STABLE to
 BETA/RC, the pkg(7) Makefile needs further adjusting.  This commit
 includes those further adjustments, evaluating the BRANCH variable from
 release/Makefile to determine the pkg(7) repository to use.

Approved by: re (kib, insta-MFC)
Sponsored by: Rubicon Communications, LLC (Netgate)

4 years agoMFC r352417:
Alan Somers [Thu, 19 Sep 2019 17:42:17 +0000 (17:42 +0000)]
MFC r352417:

Fix an off-by-one error from r351961

That revision addressed a Coverity CID that could lead to a buffer overflow,
but it had an off-by-one error in the buffer size check.

Reported by: Coverity
Coverity CID: 1405530
MFC-With: 351961
Sponsored by: The FreeBSD Foundation

4 years agoMFC r350335:
Alan Cox [Thu, 19 Sep 2019 15:12:32 +0000 (15:12 +0000)]
MFC r350335:
Simplify the handling of superpages in pmap_clear_modify().  Specifically,
if a demotion succeeds, then all of the 4KB page mappings within the
superpage-sized region must be valid, so there is no point in testing the
validity of the 4KB page mapping that is going to be write protected.

Deindent the nearby code.

4 years agoMFC r349526:
Alan Cox [Thu, 19 Sep 2019 14:36:30 +0000 (14:36 +0000)]
MFC r349526:

When we protect PTEs (as opposed to PDEs), we only call vm_page_dirty()
when, in fact, we are write protecting the page and the PTE has PG_M set.
However, pmap_protect_pde() was always calling vm_page_dirty() when the PDE
has PG_M set.  So, adding PG_NX to a writeable PDE could result in
unnecessary (but harmless) calls to vm_page_dirty().

Simplify the loop calling vm_page_dirty() in pmap_protect_pde().

4 years agoMFC r352438:
Michael Tuexen [Thu, 19 Sep 2019 10:01:19 +0000 (10:01 +0000)]
MFC r352438:

Only allow a SCTP-AUTH shared key to be updated by the application
if it is not deactivated and not used.
This avoids a use-after-free problem.

Reported by: da_cheng_shao@yeah.net

4 years agoMFC r352386:
Michael Tuexen [Thu, 19 Sep 2019 09:59:37 +0000 (09:59 +0000)]
MFC r352386:
Don't write to memory outside of the allocated array for SACK blocks.

Obtained from: rrs@
Sponsored by: Netflix, Inc.

4 years agoMFC r348380:
Jayachandran C. [Wed, 18 Sep 2019 23:33:38 +0000 (23:33 +0000)]
MFC r348380:

arm64 gicv3_its: Fix a typo

Fix 'Cavium' spelling in errata description.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D20418

4 years agoMFC r339517:
Jayachandran C. [Wed, 18 Sep 2019 23:30:27 +0000 (23:30 +0000)]
MFC r339517:

arm generic_timer: fix armv8 timer desc

In the FDT based probe, check for "arm,armv8-timer" before "arm,armv7-timer".
This gets the description right when the timer node has both entries in
compatible list.

4 years agoMFC r348377-r348379, r349347
Jayachandran C. [Wed, 18 Sep 2019 23:23:34 +0000 (23:23 +0000)]
MFC r348377-r348379, r349347

r348377:
gic_v3: consolidate per-cpu redistributor information

Update 'struct gic_redists' to consolidate all per-cpu redistributor
information into a new 'struct redist_pcpu'. Provide a new interface
(GICV3_IVAR_REDIST) for the GIC driver, which can be used to retrieve
the per-cpu data.

This per-cpu redistributor struct will be later used to improve the
GIC ITS setup.

While there, remove some unused fields in gic_v3_var.h interface.
No functional changes.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D19842

r348378:
gicv3_its: refactor LPI init into a new function

Move the per-cpu LPI intialization to a separate function. This is
in preparation for a commit that does LPI init only once for a CPU,
even when there are multiple ITS blocks associated with the CPU.

No functional changes in this commit.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D19843

r348379:
gicv3_its: do LPI init only once per CPU

The initialization required for LPIs (setting up pending tables etc.)
has to be done just once per CPU, even in the case where there are
multiple ITS blocks associated with the CPU.

Add a flag lpi_enabled in the per-cpu distributor info for this and
use it to ensure that we call its_init_cpu_lpi() just once.

This enables us to support platforms where multiple GIC ITS blocks
can generate LPIs to a CPU.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D19844

r349347:
arm64 gicv3_its: enable all ITS blocks for a CPU

We now support multiple ITS blocks raising interrupts to a CPU.
Add all available CPUs to the ITS when no NUMA information is
available.

This reverts the check added in r340602, at that tim we did not
suppport multiple ITS blocks for a CPU.

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

4 years agoMFC r349348:
Jayachandran C. [Wed, 18 Sep 2019 23:18:26 +0000 (23:18 +0000)]
MFC r349348:

arm64 acpi_iort: add some error handling

Print warnings for some bad kernel configurations (like NUMA disabled
with multiple domains). Check and report some firmware errors (like
incorrect proximity domain entries).

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

4 years agoMFC r348291:
Jayachandran C. [Wed, 18 Sep 2019 23:12:07 +0000 (23:12 +0000)]
MFC r348291:

arm64 nexus: remove incorrect warning

acpi_config_intr() will be called when an arm64 system booted with ACPI.
We do the interrupt mapping for ACPI interrupts in nexus_acpi_map_intr()
on arm64, so acpi_config_intr() has to just return success without
printing this error message.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D19432

4 years agoMFC r343853, r343856, r343860
Jayachandran C. [Wed, 18 Sep 2019 23:08:51 +0000 (23:08 +0000)]
MFC r343853, r343856, r343860

r343853:
arm64 acpi: Add support for IORT table

Add new file arm64/acpica/acpi_iort.c to support the "IO Remapping
Table" (IORT). The table is specified in ARM document "ARM DEN 0049D"
titled "IO Remapping Table Platform Design Document".  The IORT table
has information on the associations between PCI root complexes, SMMU
blocks and GIC ITS blocks in the system.

The changes are to parse and save the information in the IORT table.
The API to use this information is added to sys/dev/acpica/acpivar.h.

The acpi_iort.c also has code to check the GIC ITS nodes seen in the
IORT table with corresponding entries in MADT table (for validity)
and with entries in SRAT table (for proximity information).

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D18002

r343856:
arm64 gicv3: add IORT and NUMA support

acpi_iort.c has added support to query GIC proximity and MSI XREF
ID for GIC ITS blocks. Use this when GIC ITS blocks are initialized
from ACPI.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D18003

r343860:
pci_host_generic_acpi: use IORT data for MSI/MSI-X

Use the information from IORT parsing to translate the PCI RID to
GIC ITS device ID. And similarly, use the information to find the
PIC XREF identifier to be used for PCI devices.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D18004

4 years agoMFC r341743-r341744
Jayachandran C. [Wed, 18 Sep 2019 22:55:24 +0000 (22:55 +0000)]
MFC r341743-r341744

r341743:
acpica: support parsing of arm64 affinity in acpi_pxm.c

ACPI SRAT table on arm64 uses GICC entries to provide CPU locality
information. These entries use an AcpiProcessorUid to identify the
CPU (unlike on x86 where the entries have an APIC ID).

Update acpi_pxm.c to extend the cpu_add/cpu_find/cpu_get_info
functions to handle AcpiProcessorUid. Use the updated functions
while parsing ACPI_SRAT_GICC_AFFINITY entry for arm64.

Also update sys/conf/files.arm64 to build acpi_pxm.c when ACPI is
enabled.

Reviewed by: markj (previous version)
Differential Revision: https://reviews.freebsd.org/D17942

r341744:
arm64: add ACPI based NUMA support

Use the newly defined SRAT/SLIT parsing APIs in arm64 to support
ACPI based NUMA.

Reviewed by: markj

4 years agoMFC r341741-r341742
Jayachandran C. [Wed, 18 Sep 2019 22:44:59 +0000 (22:44 +0000)]
MFC r341741-r341742

r341741:
x86/acpica/srat.c: Add API for parsing proximity tables

The SLIT and SRAT ACPI tables needs to be parsed on arm64 as well, on
systems that use UEFI/ACPI firmware and support NUMA. To do this, we
need to move most of the logic of x86/acpica/srat.c to dev/acpica and
provide an API that architectures can use to parse and configure ACPI
NUMA information.

This commit adds the API in srat.c as a first step, without making any
functional changes. We will move the common code to sys/dev/acpica
as the next step.

The functions added are:
  * int acpi_pxm_init(int ncpus, vm_paddr_t maxphys) - to allocate and
    initialize data structures used
  * void acpi_pxm_parse_tables(void) - parse SRAT/SLIT, save the cpu and
    memory proximity information
  * void acpi_pxm_set_mem_locality(void) - use the saved data to set
    memory locality
  * void acpi_pxm_set_cpu_locality(void) - use the saved data to set cpu
    locality
  * void acpi_pxm_free(void) - free data structures allocated by init

On arm64, we do not have an cpu APIC id that can be used as index to
store CPU data, we need to use the Processor Uid. To help with this,
define internal functions cpu_add, cpu_find, cpu_get_info to store
and get CPU proximity information.

Reviewed by: markj, jhb (previous version)
Differential Revision: https://reviews.freebsd.org/D17940

r341742:
acpica : move SRAT/SLIT parsing to sys/dev/acpica

This moves the architecture independent parts of sys/x86/acpica/srat.c
to sys/dev/acpica/acpi_pxm.c, to be used later on arm64. The function
declarations are moved to sys/dev/acpica/acpivar.h

We also need to update sys/conf/files.{i386,amd64} to use the new file.
No functional changes.

Reviewed by: markj, imp
Differential Revision: https://reviews.freebsd.org/D17941

4 years agoMFC r351819: procstat/tests: Fix flakiness by waiting for program to start
Jilles Tjoelker [Wed, 18 Sep 2019 19:21:20 +0000 (19:21 +0000)]
MFC r351819: procstat/tests: Fix flakiness by waiting for program to start

Some of the procstat tests start a program "while1" and examine the process
using procstat, but did not wait properly for it to start (kill -0 will
succeed immediately after the child process has been created).

Instead, have "while1" write something when it starts, and use a fifo to
wait for that.

PR: 233587, 233588

4 years agoMFC r351192, r351203
Alan Somers [Wed, 18 Sep 2019 17:18:09 +0000 (17:18 +0000)]
MFC r351192, r351203

r351192:
periodic: fix anticongestion for scripts run after security

Revision 316342, which introduced the anticongestion feature, failed to
consider that the periodic scripts are executed by a recursive invocation of
periodic.  The recursive invocation wrongly cleaned up a temporary file that
should've been cleaned up only by the original invocation.  The result is
that if the first script that requests an anticongestion sleep runs after
the security scripts, the sleep won't happen.

Fix this bug by delaying cleanup until the end of the original invocation.

PR: 236564
Submitted by: Yasuhiro KIMURA <yasu@utahime.org>
Reviewed by: imp

r351203:
periodic: replace "tty" with "test -t 0"

Apparently using tty for this purpose has been deprecated since 4.4 Lite.

Reviewed by: cy
Differential Revision: https://reviews.freebsd.org/D21318

4 years agoMFC r349768
Alan Cox [Wed, 18 Sep 2019 14:38:42 +0000 (14:38 +0000)]
MFC r349768
  Restructure cache_handle_range to avoid repeated barriers.  Specifically,
  restructure cache_handle_range so that all of the data cache operations are
  performed before any instruction cache operations.  Then, we only need one
  barrier between the data and instruction cache operations and one barrier
  after the instruction cache operations.

  On an Amazon EC2 a1.2xlarge instance, this simple change reduces the time
  for a "make -j8 buildworld" by 9%.

4 years agoMFC r350546
Alan Cox [Wed, 18 Sep 2019 14:27:09 +0000 (14:27 +0000)]
MFC r350546
  Because of AArch64's weak memory consistency model, we need to include a
  memory barrier between the stores for initializing a page table page and
  the store for adding that page to the page table.  Otherwise, a page table
  walk by another processor's MMU could see the page table page before it
  sees the initialized entries.

  Simplify pmap_growkernel().  In particular, eliminate an unnecessary TLB
  invalidation.

4 years agoMFC r352137:
Hans Petter Selasky [Wed, 18 Sep 2019 07:31:31 +0000 (07:31 +0000)]
MFC r352137:
Callout drain does not have to be followed by a callout stop call.
Fix bogus code.

Sponsored by: Mellanox Technologies

4 years agoMFC r352207:
Hans Petter Selasky [Wed, 18 Sep 2019 07:28:54 +0000 (07:28 +0000)]
MFC r352207:
Use true and false when dealing with bool type in the LinuxKPI.
No functional change.

Sponsored by: Mellanox Technologies

4 years agoMFC r352206:
Hans Petter Selasky [Wed, 18 Sep 2019 07:26:43 +0000 (07:26 +0000)]
MFC r352206:
Fix synchronous work drain issue in the LinuxKPI.

A work callback may restart itself. Loop in the drain function to see if the
work has been rescheduled and stop the subsequent reschedules, if any.

Sponsored by: Mellanox Technologies

4 years agoMFC r350463
Alan Cox [Wed, 18 Sep 2019 07:25:04 +0000 (07:25 +0000)]
MFC r350463
  In pmap_advise(), when we encounter a superpage mapping, we first demote
  the mapping and then destroy one of the 4 KB page mappings so that there
  is a potential trigger for repromotion.  Currently, we destroy the first
  4 KB page mapping that falls within the (current) superpage mapping or the
  virtual address range [sva, eva).  However, I have found empirically that
  destroying the last 4 KB mapping produces slightly better results,
  specifically, more promotions and fewer failed promotion attempts.
  Accordingly, this revision changes pmap_advise() to destroy the last 4 KB
  page mapping.  It also replaces some nearby uses of boolean_t with bool.

4 years agoMFC r340602:
Jayachandran C. [Wed, 18 Sep 2019 07:22:37 +0000 (07:22 +0000)]
MFC r340602:

gitv3_its: fixes for multiple GIC ITS blocks

First pass of support for multiple GIC ITS blocks with ACPI.
Changes are to:
 * register the correct subset of interrupts with pic_register
   in case of ACPI.
 * initialize just the cpu interface for the first ITS, when
   domain information is not avialable. This has to be done
   until we split the per-CPU init to do LPI setup just once.
 * remove duplicate check for the GIC ITS domain, the sc_cpus
   are setup from domain, so the check again in per-CPU init
   seems unnecessary.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17841

4 years agoMFC r352205:
Hans Petter Selasky [Wed, 18 Sep 2019 07:21:08 +0000 (07:21 +0000)]
MFC r352205:
Fix broken DECLARE_TASKLET() macro after r347852.

Sponsored by: Mellanox Technologies