]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agobsnmp: Fix operator precedence in error check in table_check_response
jhibbits [Mon, 18 Nov 2019 23:23:38 +0000 (23:23 +0000)]
bsnmp: Fix operator precedence in error check in table_check_response

Summary:
The ?: operator has a lower precedence than == and &&, so the result will always
be recorded as true.  Found by gcc8.

Reviewed by: ngie, ae
Differential Revision: https://reviews.freebsd.org/D22427

4 years agoAdd flua to the base system, install to /usr/libexec
kevans [Mon, 18 Nov 2019 23:21:13 +0000 (23:21 +0000)]
Add flua to the base system, install to /usr/libexec

FreeBSDlua ("flua") is a FreeBSD-private lua, flavored with whatever
extensions we need for base system operations. We currently support a subset
of lfs and lposix that are used in the rewrite of makesyscall.sh into lua,
added in r354786.

flua is intentionally written such that one can install standard lua and
some set of lua modules from ports and achieve the same effect.

linit_flua is a copy of linit.c from contrib/lua with lfs and lposix added
in. This is similar to what we do in stand/. linit.c has been renamed to
make it clear that this has flua-specific bits.

luaconf has been slightly obfuscated to make extensions more difficult. Part
of the problem is that flua is already hard enough to use as a bootstrap
tool because it's not in PATH- attempting to do extension loading would
require a special bootstrap version of flua with paths changed to protect
the innocent.

src.lua.mk has been added to make it easy for in-tree stuff to find flua,
whether it's bootstrap-flua or relying on PATH frobbing by Makefile.inc1.

Reviewed by: brooks, emaste (both earlier version), imp
Differential Revision: https://reviews.freebsd.org/D21893

4 years agoicmpv6: Fix mbuf change in mld
bz [Mon, 18 Nov 2019 21:59:47 +0000 (21:59 +0000)]
icmpv6: Fix mbuf change in mld

After r354748 mld_input() can change the mbuf.  The new pointer
is never returned to icmp6_input() and when passed to
icmp6_rip6_input() the mbuf may no longer valid leading to
a panic.
Pass a pointer to the mbuf to mld_input() so we can return an
updated version in the non-error case.

Add a test sending an MLD packet case which will trigger this bug.

Pointyhat to: bz
Reported by: gallatin, thj
MFC After: 2 weeks
X-MFC with: r354748
Sponsored by: Netflix

4 years agoipv6 tests
bz [Mon, 18 Nov 2019 21:54:29 +0000 (21:54 +0000)]
ipv6 tests

Add a simple ping6 test as well.

MFC after: 2 weeks
Sponsored by: Netflix

4 years agobus_dma_dmar_set_buswide(9): KPI to indicate that the whole dmar
kib [Mon, 18 Nov 2019 20:56:59 +0000 (20:56 +0000)]
bus_dma_dmar_set_buswide(9): KPI to indicate that the whole dmar
context should share page tables.

Practically it means that dma requests from any device on the bus are
translated according to the entries loaded for the bus:0:0 device.
KPI requires that the slot and function of the device be 0:0, and that
no tags for other devices on the bus were used.

The intended use are NTBs which pass TLPs from the downstream to the
host with slot:func of the downstream originator.

Reviewed and tested by: mav
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22434

4 years agoAdd a "B" suffix to memory quantities in top(1) output.
markj [Mon, 18 Nov 2019 20:55:01 +0000 (20:55 +0000)]
Add a "B" suffix to memory quantities in top(1) output.

Otherwise small quantities look nonsensical.  For instance, when
swapping in a single page we would print "4096 In".

Fix code indentation while here.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoAdd x86 msr tweak KPI.
kib [Mon, 18 Nov 2019 20:53:57 +0000 (20:53 +0000)]
Add x86 msr tweak KPI.

Use the KPI to tweak MSRs in mitigation code.

Reviewed by: markj, scottl
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22431

4 years agoCheck for errors from copyout() and suword*() in sv_copyout_args/strings.
jhb [Mon, 18 Nov 2019 20:07:43 +0000 (20:07 +0000)]
Check for errors from copyout() and suword*() in sv_copyout_args/strings.

Reviewed by: brooks, kib
Tested on: amd64 (amd64, i386, linux64), i386 (i386, linux)
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D22401

4 years agoSet MALLOC_DEBUG_MAXZONES=1 in GENERIC-NODEBUG configurations.
markj [Mon, 18 Nov 2019 20:03:28 +0000 (20:03 +0000)]
Set MALLOC_DEBUG_MAXZONES=1 in GENERIC-NODEBUG configurations.

The purpose of this option is to make it easier to track down memory
corruption bugs by reducing the number of malloc(9) types that might
have recently been associated with a given chunk of memory.  However, it
increases fragmentation and is disabled in release kernels.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agobcm2835_sdhci: use a macro for interrupts we handle
kevans [Mon, 18 Nov 2019 19:28:09 +0000 (19:28 +0000)]
bcm2835_sdhci: use a macro for interrupts we handle

This is just further simplification, very little functional change. In the
DMA interrupt handler, we *do* now acknowledge both DATA_AVAIL | SPACE_AVAIL
every time -- these operations are mutually exclusive, so while this is a
functional change, it's effectively a nop. Removing the 'mask' local allows
us to further simplify in a future change.

4 years agoFix grammar in gpart.8.
markj [Mon, 18 Nov 2019 19:05:52 +0000 (19:05 +0000)]
Fix grammar in gpart.8.

PR: 241973
MFC after: 3 days

4 years agobcm2835_sdhci: push DATA_END handling out of DMA interrupt path
kevans [Mon, 18 Nov 2019 18:40:35 +0000 (18:40 +0000)]
bcm2835_sdhci: push DATA_END handling out of DMA interrupt path

This simplifies the DMA interrupt handler quite a bit. The sdhci framework
will call platform_finish_transfer() if it's received SDHCI_INT_DATA_END, so
we can take care of any final cleanup there and simply not worry about the
possibility of it ending in the DMA interrupt path.

4 years agoFix inconsistencies in anonymous DOF files.
markj [Mon, 18 Nov 2019 18:34:23 +0000 (18:34 +0000)]
Fix inconsistencies in anonymous DOF files.

The DOF file output by dtrace -A contains only the loadable sections.
However, as it was created by a call to dtrace_dof_create() without
flags, the original DOF was created with the loadable sections.  The
result is that the DOF includes the section headers for the unloadable
sections (COMMENTS and UTSNAME) without these sections actually being
present.  This is inconsistent.

A simple change to anon_prog() ensures that the missing sections are
present in the outputted DOF.  Alternatively, the call to
dtrace_dof_create() could pass the DTRACE_D_STRIP flag stripping out the
loadable sections.  As the unloadable sections contain info useful for
debugging purposes they haven't been stripped.

Submitted by: Graeme Jenkinson <graeme.jenkinson@cl.cam.ac.uk>
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D21875

4 years agoGroup per-domain reservation data in the same structure.
markj [Mon, 18 Nov 2019 18:25:51 +0000 (18:25 +0000)]
Group per-domain reservation data in the same structure.

We currently have the per-domain partially populated reservation queues
and the per-domain queue locks.  Define a new per-domain padded
structure to contain both of them.  This puts the queue fields and lock
in the same cache line and avoids the false sharing within the old queue
array.

Also fix field packing in the reservation structure.  In many places we
assume that a domain index fits in 8 bits, so we can do the same there
as well.  This reduces the size of the structure by 8 bytes.

Update some comments while here.  No functional change intended.

Reviewed by: dougm, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22391

4 years agoWiden the vm_page aflags field to 16 bits.
markj [Mon, 18 Nov 2019 18:22:41 +0000 (18:22 +0000)]
Widen the vm_page aflags field to 16 bits.

We are now out of aflags bits, whereas the "flags" field only makes use
of five of its sixteen bits, so narrow "flags" to eight bits.  I have no
intention of adding a new aflag in the near future, but would like to
combine the aflags, queue and act_count fields into a single atomically
updated word.  This will allow vm_page_pqstate_cmpset() to become much
simpler and is a step towards eliminating the use of the page lock array
in updating per-page queue state.

The change modifies the layout of struct vm_page, so bump
__FreeBSD_version.

Reviewed by: alc, dougm, jeff, kib
Sponsored by: Netflix, Intel
Differential Revision: https://reviews.freebsd.org/D22397

4 years agoImplement vm.pmap.kernel_maps for arm64.
markj [Mon, 18 Nov 2019 15:37:01 +0000 (15:37 +0000)]
Implement vm.pmap.kernel_maps for arm64.

Reviewed by: alc
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22142

4 years agoLet arm64 pmap_qenter() and pmap_kenter() unconditionally set NX.
markj [Mon, 18 Nov 2019 15:36:46 +0000 (15:36 +0000)]
Let arm64 pmap_qenter() and pmap_kenter() unconditionally set NX.

As on amd64, there is no need for mappings created by these functions to
be executable.

Reviewed by: alc, andrew
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22141

4 years agoUpdate the ses(4) man page
asomers [Mon, 18 Nov 2019 14:12:33 +0000 (14:12 +0000)]
Update the ses(4) man page

This driver was largely rewritten in 2015 (svn r235911) but the man page was
never updated to match.

Reviewed by: trasz
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D22339

4 years agoJail and capability mode for shm_rename; add audit support for shm_rename
dab [Mon, 18 Nov 2019 13:31:16 +0000 (13:31 +0000)]
Jail and capability mode for shm_rename; add audit support for shm_rename

Co-mingling two things here:

  * Addressing some feedback from Konstantin and Kyle re: jail,
    capability mode, and a few other things
  * Adding audit support as promised.

The audit support change includes a partial refresh of OpenBSM from
upstream, where the change to add shm_rename has already been
accepted. Matthew doesn't plan to work on refreshing anything else to
support audit for those new event types.

Submitted by: Matthew Bryan <matthew.bryan@isilon.com>
Reviewed by: kib
Relnotes: Yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22083

4 years agofix up r354804, add new ZFS file mmp.c to kernel files
avg [Mon, 18 Nov 2019 10:46:55 +0000 (10:46 +0000)]
fix up r354804, add new ZFS file mmp.c to kernel files

Reported by: CI LINT build
MFC after: 4 weeks
X-MFC with: r354804

4 years agofix up r354804, link zstreamdump with libzfs
avg [Mon, 18 Nov 2019 10:34:27 +0000 (10:34 +0000)]
fix up r354804, link zstreamdump with libzfs

Since r354804 libzpool depends on libzfs for get_system_hostid symbol.
Except for zstreamdump, all binaries linked with libzpool were already
linked with libzfs.  So, zstreamdump is the only fall-out.

It's interesting that on amd64 not only I was able to successfully build
zstreamdump, I am able to run it despite having the unresolved symbol in
libzpool.

MFC after: 4 weeks
X-MFC with: r354804

4 years agoMake linux(4) open(2)/openat(2) return ELOOP instead of EMLINK,
trasz [Mon, 18 Nov 2019 10:19:16 +0000 (10:19 +0000)]
Make linux(4) open(2)/openat(2) return ELOOP instead of EMLINK,
when being passed O_NOFOLLOW.  This fixes LTP testcase openat02:5.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22384

4 years agoMFV r354378,r354379,r354386: 10499 Multi-modifier protection (MMP)
avg [Mon, 18 Nov 2019 09:38:35 +0000 (09:38 +0000)]
MFV r354378,r354379,r354386: 10499 Multi-modifier protection (MMP)

10499 Multi-modifier protection (MMP)
illumos/illumos-gate@e0f1c0afa46cc84d4b1e40124032a9a87310386e
https://github.com/illumos/illumos-gate/commit/e0f1c0afa46cc84d4b1e40124032a9a87310386e
https://www.illumos.org/issues/10499
  Port the following ZFS commits from ZoL to illumos.
  379ca9cf2 Multi-modifier protection (MMP)
  bbffb59ef Fix multihost stale cache file import
  0d398b256 Do not initiate MMP writes while pool is suspended

10701 Correct lock ASSERTs in vdev_label_read/write
illumos/illumos-gate@58447f688d5e308373ab16a3b129bc0ba0fbc154
https://github.com/illumos/illumos-gate/commit/58447f688d5e308373ab16a3b129bc0ba0fbc154
https://www.illumos.org/issues/10701
  Port of ZoL commit:
  0091d66f4e Correct lock ASSERTs in vdev_label_read/write
  At a minimum, this fixes a blown assert during an MMP test run when running on
  a DEBUG build.

11770 additional mmp fixes
illumos/illumos-gate@4348eb901228d2f8fa50bb132a34248e8662074e
https://github.com/illumos/illumos-gate/commit/4348eb901228d2f8fa50bb132a34248e8662074e
https://www.illumos.org/issues/11770
  Port a few additional MMP fixes from ZoL that came in after our
  initial MMP port.
  4ca457b065 ZTS: Fix mmp_interval failure
  ca95f70dff zpool import progress kstat
  (only minimal changes from above can be pulled in right now)
  060f0226e6 MMP interval and fail_intervals in uberblock

Note from the committer (me).
I do not have any use for this feature and I have not tested it.  I only
did smoke testing with multihost=off.
Please be aware.
I merged the code only to make future merges easier.

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Portions contributed by: Tim Chase <tim@chase2k.com>
Portions contributed by: sanjeevbagewadi <sanjeev.bagewadi@gmail.com>
Portions contributed by: John L. Hammond <john.hammond@intel.com>
Portions contributed by: Giuseppe Di Natale <dinatale2@llnl.gov>
Portions contributed by: Prakash Surya <surya1@llnl.gov>
Portions contributed by: Brian Behlendorf <behlendorf1@llnl.gov>
Author: Olaf Faaland <faaland1@llnl.gov>

MFC after: 4 weeks

4 years agoMFV r354798:
delphij [Mon, 18 Nov 2019 04:22:04 +0000 (04:22 +0000)]
MFV r354798:

Apply vendor fixes:

06de62c Detect multiplication overflow when computing sector position
46a8443 Limit the number of elements in a vector (found by oss-fuzz)

Requested by: wen
MFC after: 3 days
Security: CVE-2019-18218

4 years agoLink in NetBSD's unifdef(1) tests
cem [Mon, 18 Nov 2019 04:03:11 +0000 (04:03 +0000)]
Link in NetBSD's unifdef(1) tests

Skip one, is it currently fails.

4 years agoAlso clean LINT64 kernel configuration for powerpc
lwhsu [Mon, 18 Nov 2019 01:56:19 +0000 (01:56 +0000)]
Also clean LINT64 kernel configuration for powerpc

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agopowerpc: Re-add -Wno-redundant-decls to DPAA build flags
jhibbits [Sun, 17 Nov 2019 20:49:24 +0000 (20:49 +0000)]
powerpc: Re-add -Wno-redundant-decls to DPAA build flags

Since the DPAA code is from a third party, with minimal edits, there is no
intent to fix these specific warnings at this time.  Hide these warnings to
prevent the noise from hiding real warnings.

4 years agoFix error found by new clang operator precendence warning
arichardson [Sun, 17 Nov 2019 19:04:02 +0000 (19:04 +0000)]
Fix error found by new clang operator precendence warning

error: operator '?:' has lower precedence than '|'; '|' will be evaluated first

I discovered this in CheriBSD after updating our fork of clang to the latest
upstream master.

Reviewed By: ian
Differential Revision: https://reviews.freebsd.org/D22433

4 years agoAdd a helper function for testing a swap block and freeing it if empty.
dougm [Sun, 17 Nov 2019 18:38:37 +0000 (18:38 +0000)]
Add a helper function for testing a swap block and freeing it if empty.

Submitted by: ota_j.email.ne.jp
Approved by: alc, kib, dougm
Differential Revision: https://reviews.freebsd.org/D22402

4 years agoAchieve two goals at once: (1) Avoid an unnecessary broadcast TLB
alc [Sun, 17 Nov 2019 17:38:53 +0000 (17:38 +0000)]
Achieve two goals at once: (1) Avoid an unnecessary broadcast TLB
invalidation in pmap_remove_all(). (2) Prevent an "invalid ASID" assertion
failure in pmap_remove_all().

The architecture definition specifies that the TLB will not cache mappings
that don't have the "AF" bit set, so pmap_remove_all() needn't issue a TLB
invalidation for mappings that don't have the "AF" bit set.

We allocate ASIDs lazily.  Specifically, we don't allocate an ASID for a
pmap until we are activating it.  Now, consider what happens on a fork().
Before we activate the child's pmap, we use pmap_copy() to copy mappings
from the parent's pmap to the child's.  These new mappings have their "AF"
bits cleared.  Suppose that the page daemon decides to reclaim a page that
underlies one of these new mappings.  Previously, the pmap_invalidate_page()
performed by pmap_remove_all() on a mapping in the child's pmap would fail
an assertion because that pmap hasn't yet been assigned an ASID.  However,
we don't need to issue a TLB invalidation for such mappings because they
can't possibly be cached in the TLB.

Reported by: bob prohaska <fbsd@www.zefox.net>
Reviewed by: markj
MFC after: 1 week
X-MFC-before: r354286
Differential Revision: https://reviews.freebsd.org/D22388

4 years agoUpdate controlelf(1) to ahndle stack gap disable flag.
kib [Sun, 17 Nov 2019 14:54:43 +0000 (14:54 +0000)]
Update controlelf(1) to ahndle stack gap disable flag.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22379

4 years agoAdd elf image flag to disable stack gap.
kib [Sun, 17 Nov 2019 14:54:07 +0000 (14:54 +0000)]
Add elf image flag to disable stack gap.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22379

4 years agokern_exec: p_osrel and p_fctl0 were obliterated by failed execve(2) attempt.
kib [Sun, 17 Nov 2019 14:52:45 +0000 (14:52 +0000)]
kern_exec: p_osrel and p_fctl0 were obliterated by failed execve(2) attempt.

Zeroing of them is needed so that an image activator can update the
values as appropriate (or not set at all).

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22379

4 years agoamd64 copyout: remove irrelevant comment.
kib [Sun, 17 Nov 2019 14:41:47 +0000 (14:41 +0000)]
amd64 copyout: remove irrelevant comment.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 years agoDocument required size of buffer for elf_aux_info(3).
kib [Sun, 17 Nov 2019 14:11:08 +0000 (14:11 +0000)]
Document required size of buffer for elf_aux_info(3).

PR: 241884
Reported by: jbeich
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D22380

4 years agoAdd makesyscalls.lua, a rewrite of makesyscalls.sh
kevans [Sun, 17 Nov 2019 14:08:19 +0000 (14:08 +0000)]
Add makesyscalls.lua, a rewrite of makesyscalls.sh

This currently requires a suitable lua + luafilesystem + luaposix from the
ports tree to build. Discussion is underway in D21893 to add a suitable lua
to the base system, cleverly disguised and out of the way of normal
consumers.

makesyscalls.sh is a good target for rewrite into lua as it's currently a
sh+sed+awk script that can be difficult to add on to, at times. For
instance, adding a new COMPAT* option (that mimicks the behaivor of most
other COMPAT* options) requires a fairly substantial amount of copy/paste;
see r352693 for instance. Attempts to generate part of the awk script for
COMPAT* handling was (very kindly) rejected with a desire to just rewrite
the script in a single language that can handle all of it.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D21775

4 years agoThe loop in vm_map_protect that verifies that all transition map
dougm [Sun, 17 Nov 2019 06:50:36 +0000 (06:50 +0000)]
The loop in vm_map_protect that verifies that all transition map
entries are stabilized, repeatedly verifies the same entry. Check each
entry in turn.

Reviewed by: kib (code only), alc
Tested by: pho
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D22405

4 years agopowerpc: Return SIGILL if DSCR does not exist in m{f,t}spr emulation
jhibbits [Sun, 17 Nov 2019 01:01:02 +0000 (01:01 +0000)]
powerpc: Return SIGILL if DSCR does not exist in m{f,t}spr emulation

Guard against programs written for one powerpc target running on another,
and panicking the system due to not having the DSCR register.

4 years ago[PowerPC] Fix *context on ELFv2
bdragon [Sat, 16 Nov 2019 20:33:46 +0000 (20:33 +0000)]
[PowerPC] Fix *context on ELFv2

Due to ELFv1 specific code in _ctx_start.S and makecontext.c, userspace
context switching was completely broken on ELFv2.

With this change, we now pass the libthr test suite.

Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D22421

4 years agoActually hook CAM_IO_STATS up to the build
asomers [Sat, 16 Nov 2019 19:12:17 +0000 (19:12 +0000)]
Actually hook CAM_IO_STATS up to the build

It's still disabled by default, but now it can be enabled with config(5) and
it will be build in LINT.

Reviewed by: imp
MFC after: 1 week
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D22383

4 years agogcore: Don't add VSX notes on powerpcspe
jhibbits [Sat, 16 Nov 2019 18:24:28 +0000 (18:24 +0000)]
gcore: Don't add VSX notes on powerpcspe

powerpcspe does not support VSX at all, but gets the 'VMX' notes for free,
providing the SPE registers.

4 years agoUpdate to Zstandard 1.4.4
cem [Sat, 16 Nov 2019 16:39:08 +0000 (16:39 +0000)]
Update to Zstandard 1.4.4

The full release notes can be found on Github:

  https://github.com/facebook/zstd/releases/tag/v1.4.4

Notable changes in this release include improved decompression speed (about
10%).  See the Github release notes for more details.

MFC after: I'm not going to, but feel free
Relnotes: yes

4 years agopowerpcspe: Don't leak kernel registers in SPE dumps
jhibbits [Sat, 16 Nov 2019 16:36:20 +0000 (16:36 +0000)]
powerpcspe: Don't leak kernel registers in SPE dumps

save_vec_int() for SPE saves off only the high word of the register, leaving
the low word as "garbage", but really containing whatever was in the kernel
register at the time.  This leaks into core dumps, and in a near future
commit also into ptrace.  Instead, save the GPR in the low word in
save_vec_nodrop(), which is used only for core dumps and ptrace.

4 years agopowerpcspe: Mark asm statement in spe_save_reg_high as clobbering memory
jhibbits [Sat, 16 Nov 2019 16:27:31 +0000 (16:27 +0000)]
powerpcspe: Mark asm statement in spe_save_reg_high as clobbering memory

Modern gcc errors that "'vec[0]' is used uninitialized in this function"
without us telling it that vec is clobbered.  Neither clang nor gcc 4.2.1
error on the existing construct.

Submitted by: bdragon

4 years agoAdd boundary and overflow checks to the formulas used in the TCP CUBIC
tuexen [Sat, 16 Nov 2019 12:00:22 +0000 (12:00 +0000)]
Add boundary and overflow checks to the formulas used in the TCP CUBIC
congestion control module.

Submitted by: Richard Scheffenegger
Reviewed by: rgrimes@
Differential Revision: https://reviews.freebsd.org/D19118

4 years agoImprove TCP CUBIC specific after idle reaction.
tuexen [Sat, 16 Nov 2019 11:57:12 +0000 (11:57 +0000)]
Improve TCP CUBIC specific after idle reaction.
The adjustments are inspired by the Linux stack, which has had a
functionally equivalent implementation for more than a decade now.

Submitted by: Richard Scheffenegger
Reviewed by: Cheng Cui
Differential Revision: https://reviews.freebsd.org/D18982

4 years agoImplement a tCP CUBIC-specific after idle reaction.
tuexen [Sat, 16 Nov 2019 11:37:26 +0000 (11:37 +0000)]
Implement a tCP CUBIC-specific after idle reaction.
This patch addresses a very common case of frequent application stalls,
where TCP runs idle and looses the state of the network.

Submitted by: Richard Scheffenegger
Reviewed by: Cheng Cui
Differential Revision: https://reviews.freebsd.org/D18954

4 years agoRevert https://svnweb.freebsd.org/changeset/base/354708
tuexen [Sat, 16 Nov 2019 11:10:09 +0000 (11:10 +0000)]
Revert https://svnweb.freebsd.org/changeset/base/354708

I used the wrong Differential Revision, so back it out and do it right
in a follow-up commit.

4 years agoloader: remove unused variable from efipart.c
tsoome [Sat, 16 Nov 2019 08:16:50 +0000 (08:16 +0000)]
loader: remove unused variable from efipart.c

4 years agoRISC-V: busdma_bounce: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes
mhorne [Sat, 16 Nov 2019 01:25:51 +0000 (01:25 +0000)]
RISC-V: busdma_bounce: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes

RISC-V inherited this code from arm64, so implement the fix from r354712.
See the revision for the full description.

Submitted by: kevans (arm64 version)

4 years agoTSX Asynchronous Abort mitigation for Intel CVE-2019-11135.
scottl [Sat, 16 Nov 2019 00:26:42 +0000 (00:26 +0000)]
TSX Asynchronous Abort mitigation for Intel CVE-2019-11135.
This CVE has already been announced in FreeBSD SA-19:26.mcu.

Mitigation for TAA involves either turning off TSX or turning on the
VERW mitigation used for MDS. Some CPUs will also be self-mitigating
for TAA and require no software workaround.

Control knobs are:
machdep.mitigations.taa.enable:
        0 - no software mitigation is enabled
        1 - attempt to disable TSX
        2 - use the VERW mitigation
        3 - automatically select the mitigation based on processor
    features.

machdep.mitigations.taa.state:
        inactive        - no mitigation is active/enabled
        TSX disable     - TSX is disabled in the bare metal CPU as well as
                        - any virtualized CPUs
        VERW            - VERW instruction clears CPU buffers
not vulnerable - The CPU has identified itself as not being
  vulnerable

Nothing in the base FreeBSD system uses TSX.  However, the instructions
are straight-forward to add to custom applications and require no kernel
support, so the mitigation is provided for users with untrusted
applications and tenants.

Reviewed by: emaste, imp, kib, scottph
Sponsored by: Intel
Differential Revision: 22374

4 years agond6: retire defrouter_select(), use _fib() variant.
bz [Sat, 16 Nov 2019 00:17:35 +0000 (00:17 +0000)]
nd6: retire defrouter_select(), use _fib() variant.

Burn bridges and replace the last two calls of defrouter_select() with
defrouter_select_fib().  That allows us to retire defrouter_select()
and make it more clear in the calling code that it applies to all FIBs.

Sponsored by: Netflix

4 years agond6_rtr:
bz [Sat, 16 Nov 2019 00:02:36 +0000 (00:02 +0000)]
nd6_rtr:

Pull in the TAILQ_HEAD() as it is not needed outside nd6_rtr.c.
Rename the TAILQ_HEAD() struct and the nd_defrouter variable from
"nd_" to "nd6_" as they are not part of the RFC 3542 API which uses "ND_".

Ideally I'd like to also rename the struct nd_defrouter {} to "nd6_*"
but given that is used externally there is more work to do.

No functional changes.

MFC after: 3 weeks
Sponsored by: Netflix

4 years agoCreate a new sysctl subtree, machdep.mitigations. Its purpose is to organize
scottl [Fri, 15 Nov 2019 23:27:17 +0000 (23:27 +0000)]
Create a new sysctl subtree, machdep.mitigations.  Its purpose is to organize
knobs and indicators for code that mitigates functional and security issues
in the architecture/platform.  Controls for regular operational policy should
still go into places security, hw, kern, etc.

The machdep root node is inherently architecture dependent, but mitigations
tend to be architecture dependent as well.  Some cases like Spectre do cross
architectural boundaries, but the mitigation code for them tends to be
architecture dependent anyways, and multiple architectures won't be active
in the same image of the kernel.

Many mitigation knobs already exist in the system, and they will be moved
with compat naming in the future.  Going forward, mitigations should collect
in machdep.mitigations.

Reviewed by: imp, brooks, rwatson, emaste, jhb
Sponsored by: Intel

4 years agoif_llatbl: change htable_unlink_entry() to early exist if no work to do
bz [Fri, 15 Nov 2019 23:12:19 +0000 (23:12 +0000)]
if_llatbl: change htable_unlink_entry() to early exist if no work to do

Adjust the logic in htable_unlink_entry() to the one in
htable_link_entry() saving a block indent and making it more clear
in which case we do not do any work.

No functional change.

MFC after: 3 weeks
Sponsored by: Netflix

4 years agoUse a sv_copyout_auxargs hook in the Linux ELF ABIs.
jhb [Fri, 15 Nov 2019 23:01:43 +0000 (23:01 +0000)]
Use a sv_copyout_auxargs hook in the Linux ELF ABIs.

Reviewed by: emaste
Tested on: amd64 (linux64 only), i386
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D22356

4 years agoInitialize *comp_update with valid value.
mav [Fri, 15 Nov 2019 23:01:09 +0000 (23:01 +0000)]
Initialize *comp_update with valid value.

I've noticed that sometimes with enabled DMAR initial write from device
to this address is somehow getting delayed, triggering assertion due to
zero default being invalid.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoCleanup address range checks in ioat(4).
mav [Fri, 15 Nov 2019 22:47:59 +0000 (22:47 +0000)]
Cleanup address range checks in ioat(4).

 - Deduce allowed address range for bus_dma(9) from the hardware version.
Different versions (CPU generations) have different documented limits.
 - Remove difference between address ranges for src/dst and crc.  At least
docs for few recent generations of CPUs do not mention anything like that,
while older are already limited with above limits.
 - Remove address assertions from arguments.  While I do not think the
addresses out of allowed ranges should realistically happen there due to
the platforms physical address limitations, there is now bus_dma(9) to
make sure of that, preferably via IOMMU.
 - Since crc now has the same address range as src/dst, remove crc_dmamap,
reusing dst2_dmamap instead.

Discussed with: cem
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoRemove now unused IPv6 macros and update docs.
bz [Fri, 15 Nov 2019 21:55:41 +0000 (21:55 +0000)]
Remove now unused IPv6 macros and update docs.

After r354748-354750 all uses of the IP6_EXTHDR_CHECK() and
IP6_EXTHDR_GET() macros are gone from the kernel.  IP6_EXTHDR_GET0()
was unused.  Remove the macros and update the documentation.

Sponsored by: Netflix

4 years agoIP6_EXTHDR_CHECK(): remove the last instances
bz [Fri, 15 Nov 2019 21:51:43 +0000 (21:51 +0000)]
IP6_EXTHDR_CHECK(): remove the last instances

While r354748 removed almost all IP6_EXTHDR_CHECK() calls, these
are not part of the PULLDOWN_TESTS.
Equally convert these IP6_EXTHDR_CHECK()s here to m_pullup() and remove
the extra check and m_pullup() in tcp_input() under isipv6 given
tcp6_input() has done exactly that pullup already.

MFC after: 8 weeks
Sponsored by: Netflix

4 years agonetinet*: replace IP6_EXTHDR_GET()
bz [Fri, 15 Nov 2019 21:44:17 +0000 (21:44 +0000)]
netinet*: replace IP6_EXTHDR_GET()

In a few places we have IP6_EXTHDR_GET() left in upper layer protocols.
The IP6_EXTHDR_GET() macro might perform an m_pulldown() in case the data
fragment is not contiguous.

Convert these last remaining instances into m_pullup()s instead.
In CARP, for example, we will a few lines later call m_pullup() anyway,
the IPsec code coming from OpenBSD would otherwise have done the m_pullup()
and are copying the data a bit later anyway, so pulling it in seems no
better or worse.

Note: this leaves very few m_pulldown() cases behind in the tree and we
might want to consider removing them as well to make mbuf management
easier again on a path to variable size mbufs, especially given
m_pulldown() still has an issue not re-checking M_WRITEABLE().

Reviewed by: gallatin
MFC after: 8 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D22335

4 years agonetinet6: Remove PULLDOWN_TESTs.
bz [Fri, 15 Nov 2019 21:40:40 +0000 (21:40 +0000)]
netinet6: Remove PULLDOWN_TESTs.

Remove the KAME introduced PULLDOWN_TESTs which did not even
have a compile-time option in sys/conf to turn them on for a
custom kernel build. They made the code a lot harder to read
or more complicated in a few cases.

Convert the IP6_EXTHDR_CHECK() calls into FreeBSD looking code.
Rather than throwing the packet away if it would not fit the
KAME mbuf expectations, convert the macros to m_pullup() calls.
Do not do any extra manual conditional checks upfront as to
whether the m_len would suffice (*), simply let m_pullup() do
its work (incl. an early check).

Remove extra m_pullup() calls where earlier in the function or
the only caller has already done the pullup.

Discussed with: rwatson (*)
Reviewed by: ae
MFC after: 8 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D22334

4 years agoAllow per-file lex and yacc options.
bz [Fri, 15 Nov 2019 21:19:06 +0000 (21:19 +0000)]
Allow per-file lex and yacc options.

In order to allow software with multiple (different) options
for lex and yacc add extra per-file options to the calls.
This is especially useful when one .l file needs -Pprefix.

Reviewed by: imp
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D22337

4 years agoloader: add support for hybrid PMBR for GPT partition table
tsoome [Fri, 15 Nov 2019 20:43:39 +0000 (20:43 +0000)]
loader: add support for hybrid PMBR for GPT partition table

Note hybrid table is nor really UEFI specification compliant.

Sample hybrid partition table:
> ::mbr
Format: unknown
Signature: 0xaa55 (valid)
UniqueMBRDiskSignature: 0

PART TYPE                  ACTIVE  STARTCHS    ENDCHS      SECTOR     NUMSECT
0    EFI_PMBR:0xee         0       1023/254/63 1023/254/63 1          409639
1    0xff                  0       1023/254/63 1023/254/63 409640     978508408
2    FDISK_EXT_WIN:0xc     0       1023/254/63 1023/254/63 978918048  31250000
3    0xff                  0       1023/254/63 1023/254/63 1010168048 32
>

4 years agoCombine ELF sysvecs for MIPS to reduce code duplication.
jhb [Fri, 15 Nov 2019 19:00:20 +0000 (19:00 +0000)]
Combine ELF sysvecs for MIPS to reduce code duplication.

Reviewed by: brooks, kevans
Tested on: mips, mips64
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D22357

4 years agoloader: r354415 did miss to sort subpaths below the partitions
tsoome [Fri, 15 Nov 2019 18:57:00 +0000 (18:57 +0000)]
loader: r354415 did miss to sort subpaths below the partitions

Tested on actual system (MBP with UEFI 1.10).

4 years agocxgbev(4): Catch up with the pciids in the PF driver.
np [Fri, 15 Nov 2019 18:48:14 +0000 (18:48 +0000)]
cxgbev(4): Catch up with the pciids in the PF driver.

MFC after: 3 days
Sponsored by: Chelsio Communications

4 years agoAdd a sv_copyout_auxargs() hook in sysentvec.
jhb [Fri, 15 Nov 2019 18:42:13 +0000 (18:42 +0000)]
Add a sv_copyout_auxargs() hook in sysentvec.

Change the FreeBSD ELF ABIs to use this new hook to copyout ELF auxv
instead of doing it in the sv_fixup hook.  In particular, this new
hook allows the stack space to be allocated at the same time the auxv
values are copied out to userland.  This allows us to avoid wasting
space for unused auxv entries as well as not having to recalculate
where the auxv vector is by walking back up over the argv and
environment vectors.

Reviewed by: brooks, emaste
Tested on: amd64 (amd64 and i386 binaries), i386, mips, mips64
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D22355

4 years agoFix build race in bsd.files.mk
arichardson [Fri, 15 Nov 2019 18:34:36 +0000 (18:34 +0000)]
Fix build race in bsd.files.mk

We need to ensure that installdirs-FOO runs before installfiles-FOO since
otherwise the directory may not exist when we attempt to install the target.
This was randomly causing failures in our Jenkins instance when installing
drti.o in cddl/lib/drti.

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D22382

4 years agomakefs: Also set UFS di_birthtime when building on Linux
arichardson [Fri, 15 Nov 2019 18:34:30 +0000 (18:34 +0000)]
makefs: Also set UFS di_birthtime when building on Linux

Since st_birthtime doesn't exists on Linux (unless you use statx(2)), we
instead populate it with the st_ctime value.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D22386

4 years agoFix contents= being ignored in msdosfs makefs mtree
arichardson [Fri, 15 Nov 2019 18:34:23 +0000 (18:34 +0000)]
Fix contents= being ignored in msdosfs makefs mtree

I noticed this while trying to build an EFI boot image

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D22387

4 years agoFix regression from r353841: ctx.rc needs to be initialized,
glebius [Fri, 15 Nov 2019 18:02:37 +0000 (18:02 +0000)]
Fix regression from r353841: ctx.rc needs to be initialized,
otherwise driver might silently fail to initialize.

Pointy hat to: glebius

4 years agoUse __ as the separator for the exported vars in bsd.compiler/linker.mk
arichardson [Fri, 15 Nov 2019 16:43:36 +0000 (16:43 +0000)]
Use __ as the separator for the exported vars in bsd.compiler/linker.mk

By using '__' instead of '.' as the separator we can also support systems
that use dash as /bin/sh (it's the default shell on Ubuntu/Debian). Dash
will unset any environment variables that use a non alphanumeric+undedscore
character and therefore submakes will fail to import the COMPILER_*
variables if we use '.' as the separator.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D22381

4 years agoDisable ntpd stack gap. When ASLR with STACK GAP != 0 ntpd suffers SIGSEGV.
cy [Fri, 15 Nov 2019 16:34:35 +0000 (16:34 +0000)]
Disable ntpd stack gap. When ASLR with STACK GAP != 0 ntpd suffers SIGSEGV.

PR: 241421, 241960
Reported by: Vladimir Zakharov <zakharov.vv@gmail.com>,
dewayne@heuristicsystems.com.au
Reviewed by: kib, imp (previous version), ian (suggestion)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D22358

4 years agoSupport O_CLOEXEC in linux(4) open(2) and openat(2).
trasz [Fri, 15 Nov 2019 16:21:46 +0000 (16:21 +0000)]
Support O_CLOEXEC in linux(4) open(2) and openat(2).

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21966

4 years agond6: simplify code
bz [Fri, 15 Nov 2019 13:45:38 +0000 (13:45 +0000)]
nd6: simplify code

We are taking the same actions in both cases of the branch inside the block.
Simplify that code as the extra branch is not needed.

MFC after: 3 weeks
Sponsored by: Netflix

4 years agoRevert a patch that accidentally was committed with r354729
scottl [Fri, 15 Nov 2019 11:54:51 +0000 (11:54 +0000)]
Revert a patch that accidentally was committed with r354729

4 years agoFix a typo in how the AVX512DQ feature bit is checked.
scottl [Fri, 15 Nov 2019 11:53:06 +0000 (11:53 +0000)]
Fix a typo in how the AVX512DQ feature bit is checked.

Reviewed by: kib
Sponsored by: Intel

4 years agoPrevent potential underflow in ibcore.
hselasky [Fri, 15 Nov 2019 11:46:53 +0000 (11:46 +0000)]
Prevent potential underflow in ibcore.

Linux commit:
a9018adfde809d44e71189b984fa61cc89682b5e

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoCorrect MR length field to be 64-bit in ibcore.
hselasky [Fri, 15 Nov 2019 11:45:14 +0000 (11:45 +0000)]
Correct MR length field to be 64-bit in ibcore.

Linux commit:
edd31551148c09608feee6b8756ad148d550ee3b

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoif_llatbl: cleanup
bz [Fri, 15 Nov 2019 11:00:03 +0000 (11:00 +0000)]
if_llatbl: cleanup

Remove function prototypes which are not needed (no use before function
definition for these file static functions).

MFC after: 3 weeks
Sponsored by: Netflix

4 years agoMerge commit 5bbb604bb from llvm git (by Craig Topper):
dim [Fri, 15 Nov 2019 06:56:25 +0000 (06:56 +0000)]
Merge commit 5bbb604bb from llvm git (by Craig Topper):

  [InstCombine] Disable some portions of foldGEPICmp for GEPs that
  return a vector of pointers. Fix other portions.

  llvm-svn: 370114

This should fix instances of 'Assertion failed: (isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"), function cast, file
/usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255', when
building openjdk8 for aarch64 and armv7.

Reported by: jbeich
PR: 236566
MFC after: 3 days

4 years agoatomic: Add atomic_cmpset_masked to powerpc and use it
jhibbits [Fri, 15 Nov 2019 04:33:07 +0000 (04:33 +0000)]
atomic: Add atomic_cmpset_masked to powerpc and use it

Summary:
This is a more optimal way of doing atomic_compset_masked() than the
fallback in sys/_atomic_subword.h.  There's also an override for
_atomic_fcmpset_masked_word(), which may or may not be necessary, and is
unused for powerpc.

Reviewed by: kevans, kib
Differential Revision: https://reviews.freebsd.org/D22359

4 years agoRISC-V: Print SBI info at startup
mhorne [Fri, 15 Nov 2019 03:40:02 +0000 (03:40 +0000)]
RISC-V: Print SBI info at startup

SBI version 0.2 introduces functions for obtaining the details of the
SBI implementation, such as version and implemntation ID. Print this
info at startup when it is available.

Reviewed by: jhb, kp
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D22327

4 years agoAdd missing files from r354720
mhorne [Fri, 15 Nov 2019 03:37:49 +0000 (03:37 +0000)]
Add missing files from r354720

MFC with: r354720
Differential Revision: https://reviews.freebsd.org/D22326

4 years agoRISC-V: add support for SBI spec v0.2
mhorne [Fri, 15 Nov 2019 03:34:27 +0000 (03:34 +0000)]
RISC-V: add support for SBI spec v0.2

The Supervisor Binary Interface (SBI) specification v0.2 is a backwards
incompatible update to the SBI call interface for kernels running in
supervisor mode. The goal of this update was to make it easier for new
and optional functionality to be added to the SBI.

SBI functions are now called by passing an "extension ID" and a
"function ID" which are passed in a7 and a6 respectively. SBI calls
will also return an error and value in the following struct:

struct sbi_ret {
    long error;
    long value;
}

This version introduces several new functions under the "base"
extension. It is expected that all SBI implementations >= 0.2 will
support this base set of functions, as they implement some essential
services such as obtaining the SBI version, CPU implementation info, and
extension probing.

Existing SBI functions have been designated as "legacy". For the time
being they will remain implemented, but it is expected that in the
future their functionality will be duplicated or replaced by new SBI
extensions. Each legacy function has been assigned its own extension ID,
and for now we simply probe and assert for their existence.

Compatibility with legacy SBI implementations (such as BBL) is
maintained by checking the output of sbi_get_spec_version(). This
function is guaranteed to succeed by the new spec, but will return an
error in legacy implementations. We use this as an indicator of whether
or not we can rely on the new SBI base extensions.

For further info on the Supervisor Binary Interface, see:
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc

Reviewed by: kp, jhb
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D22326

4 years agoRISC-V: pass arg6 in sbi_call
mhorne [Fri, 15 Nov 2019 03:22:08 +0000 (03:22 +0000)]
RISC-V: pass arg6 in sbi_call

Allow for an additional argument to sbi_call which will be passed in a6.
This is required for SBI spec 0.2 support, as a6 will indicate the SBI
function ID.

While here, introduce some macros to clean up the calls.

Reviewed by: kp, jhb
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D22325

4 years agoplic: support irq distribution
mhorne [Fri, 15 Nov 2019 03:18:11 +0000 (03:18 +0000)]
plic: support irq distribution

Our PLIC implementation only enables interrupts on the boot cpu.
Implement plic_bind_intr() so that they can be redistributed near the
end of boot during intr_irq_shuffle().

This also slightly modifies how enable bits are handled in an attempt to
better fit the PIC interface. plic_enable_intr()/plic_disable_intr() are
converted to manage an interrupt source's threshold value, since this
value can be used as to globally enable/disable an irq. All handing of the
per-context enable bits is moved to the new methods plic_setup_intr()
and plic_bind_intr().

Reviewed by: br
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D21928

4 years agoplic: fix context calculation
mhorne [Fri, 15 Nov 2019 03:15:14 +0000 (03:15 +0000)]
plic: fix context calculation

The RISC-V PLIC (platform level interrupt controller) registers are divided up
by "context", which is purposefully left ambiguous in the PLIC spec. Currently
we assume each CPU number corresponds 1-to-1 with a context number, but that is
not correct. Most existing PLIC implementations (such as SiFive's) have
multiple contexts per-cpu. For example, a single CPU might have a context for
machine mode interrupts and a context for supervisor mode interrupts. To
complicate things further, FreeBSD renumbers the CPUs during boot, but the PLIC
driver still assumes that CPU ID equals the RISC-V hart number, meaning
interrupt enables/claims might be performed for the wrong context registers.

To fix this, we must calculate each CPU's context number during
attachment. This is done by reading the interrupt properties from the
device tree, from which a mapping from context to RISC-V hart to CPU
number can be created.

Reviewed by: br
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D21927

4 years agoFix build with GCC
jpaetzel [Fri, 15 Nov 2019 01:07:39 +0000 (01:07 +0000)]
Fix build with GCC

Fix suggested by: jhb, scottl
Sponsored by: Panzura

4 years agoAdd the pvscsi driver to the tree.
jpaetzel [Thu, 14 Nov 2019 23:31:20 +0000 (23:31 +0000)]
Add the pvscsi driver to the tree.

This driver allows to usage of the paravirt SCSI controller
in VMware products like ESXi.  The pvscsi driver provides a
substantial performance improvement in block devices versus
the emulated mpt and mps SCSI/SAS controllers.

Error handling in this driver has not been extensively tested
yet.

Submitted by: vbhakta@vmware.com
Relnotes: yes
Sponsored by: VMware, Panzura
Differential Revision: D18613

4 years agoBoot arm64 kernel using booti command from U-boot.
jhibbits [Thu, 14 Nov 2019 21:58:40 +0000 (21:58 +0000)]
Boot arm64 kernel using booti command from U-boot.

Summary:
Boot arm64 kernel using booti command from U-boot. booti can relocate initrd
image into higher ram addresses, therefore align the initrd load address to 1GiB
and create VA = PA map for it. Create L2 pagetable entries to copy the initrd
image into KVA.
(parts of the code in https://reviews.freebsd.org/D13861 was referred and used
as appropriate)

Submitted by: Siddharth Tuli <siddharthtuli_gmail.com>
Reviewed by: manu
Sponsored by: Juniper Networks, Inc
Differential Revision: https://reviews.freebsd.org/D22255

4 years ago[PowerPC64] Fix broken kernel modules due to LLD 9+ TOC optimization
bdragon [Thu, 14 Nov 2019 19:56:42 +0000 (19:56 +0000)]
[PowerPC64] Fix broken kernel modules due to LLD 9+ TOC optimization

LLD9 introduced a TOC optimization that isn't compatible with kernel dynamic
linker causing panic when loading kernel modules (pf, linuxkpi etc.)

This patch disables TOC optimization when building kernel modules.

Submitted by: Alfredo Dal'Ava Junior <alfredo.junior@eldorado.org.br>
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D22317

4 years agoarm64: busdma_bounce: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes
kevans [Thu, 14 Nov 2019 18:38:56 +0000 (18:38 +0000)]
arm64: busdma_bounce: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes

For any size that isn't page-aligned, we end up not pre-allocating enough
for a single mapping because we truncate the size instead of rounding up to
make sure the last bit is accounted for, leaving us one page shy of what we
need to fulfill a request.

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

4 years agoTidy syscall declerations.
brooks [Thu, 14 Nov 2019 17:11:52 +0000 (17:11 +0000)]
Tidy syscall declerations.

Pointer arguments should be of the form "<type> *..." and not "<type>* ...".

No functional change.

Reviewed by: kevans
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22373

4 years agoCompile in arm/unwind.c if options STACK is in effect; the new arm stack(9)
ian [Thu, 14 Nov 2019 17:04:19 +0000 (17:04 +0000)]
Compile in arm/unwind.c if options STACK is in effect; the new arm stack(9)
code now uses unwind.c.

4 years agoRewrite arm/stack_machdep.c for EABI; add stack(9) support to arm kernels.
ian [Thu, 14 Nov 2019 16:46:27 +0000 (16:46 +0000)]
Rewrite arm/stack_machdep.c for EABI; add stack(9) support to arm kernels.

The old stack_machdep.c code was written for the APCS ABI (aka "oldabi").
When we switched to ARM EABI (back in freebsd 10) this file never got
updated, and apparently nobody noticed that until now.

The new implementation uses the same stack unwinder code used by the
arm implemenation of the db_trace stuff.

4 years agoFor idle TCP sessions using the CUBIC congestio control, reset ssthresh
tuexen [Thu, 14 Nov 2019 16:28:02 +0000 (16:28 +0000)]
For idle TCP sessions using the CUBIC congestio control, reset ssthresh
to the higher of the previous ssthresh or 3/4 of the prior cwnd.

Submitted by: Richard Scheffenegger
Reviewed by: Cheng Cui
Differential Revision: https://reviews.freebsd.org/D18982

4 years agollvm: use elf_aux_info to get executable's path, if available
emaste [Thu, 14 Nov 2019 15:10:01 +0000 (15:10 +0000)]
llvm: use elf_aux_info to get executable's path, if available

Obtained from: LLVM a0a38b81ea
MFC with: r354692
Sponsored by: The FreeBSD Foundation

4 years agoPass more reasonable WAIT flags to bus_dma(9) calls.
mav [Thu, 14 Nov 2019 04:39:48 +0000 (04:39 +0000)]
Pass more reasonable WAIT flags to bus_dma(9) calls.

MFC after: 2 weeks