]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoSince r350426 this KASSERT doesn't serve any useful purpose.
glebius [Tue, 6 Aug 2019 16:11:00 +0000 (16:11 +0000)]
Since r350426 this KASSERT doesn't serve any useful purpose.

4 years agobsnmp: add asn1 message length validation
emaste [Tue, 6 Aug 2019 16:09:06 +0000 (16:09 +0000)]
bsnmp: add asn1 message length validation

admbugs: 780
Submitted by: Guido Vranken, bz
Reported by: Guido Vranken
Security: CVE-2019-5610

4 years agooce(4): potential out of bounds access before vector validation
kevans [Tue, 6 Aug 2019 13:09:20 +0000 (13:09 +0000)]
oce(4): potential out of bounds access before vector validation

Submitted by: Augustin Cavalier <waddlesplash@gmail.com>
Obtained from: Haiku (ec2b89264cfc63e05e611cce82cc449197403aa4)
MFC after: 3 days

4 years agoReference the RFC instead of the internet draft.
tuexen [Tue, 6 Aug 2019 11:26:30 +0000 (11:26 +0000)]
Reference the RFC instead of the internet draft.

MFC after: 1 week
Sponsored by: Netflix, Inc.

4 years agoFix a locking issue in sctp_accept.
tuexen [Tue, 6 Aug 2019 10:29:19 +0000 (10:29 +0000)]
Fix a locking issue in sctp_accept.

PR: 238520
Reported by: pho@
MFC after: 1 week

4 years agoFix build issues for the userland stack on Raspbian.
tuexen [Tue, 6 Aug 2019 08:33:21 +0000 (08:33 +0000)]
Fix build issues for the userland stack on Raspbian.

4 years agoamdtemp(4), amdsmn(4): Attach to Ryzen 3 (Zen 2) hostbridges
cem [Tue, 6 Aug 2019 03:54:27 +0000 (03:54 +0000)]
amdtemp(4), amdsmn(4): Attach to Ryzen 3 (Zen 2) hostbridges

PR: 239607
Reported by: "drclaw" <drclaw AT gmail.com>

4 years agoFix build from r350622
jhibbits [Tue, 6 Aug 2019 03:49:40 +0000 (03:49 +0000)]
Fix build from r350622

It helps if my local kernel build has INVARIANTS.

4 years agopowerpc/pmap: Simplify Book-E 64-bit page table management
jhibbits [Tue, 6 Aug 2019 03:16:06 +0000 (03:16 +0000)]
powerpc/pmap: Simplify Book-E 64-bit page table management

There is no need for the 64-bit pmap to have a fixed number of page table
buffers.  Since the 64-bit pmap has a DMAP, we can effectively have user
page tables limited only by total RAM size.

4 years agoRelax time constraint in pthread_cond_timedwait unit test
vangyzen [Mon, 5 Aug 2019 22:59:35 +0000 (22:59 +0000)]
Relax time constraint in pthread_cond_timedwait unit test

pthread_cond_timedwait() should wait _at least_ until the timeout,
but it might appear to wait longer due to system activity and
scheduling.  The test ignored fractional seconds when comparing the
actual and expected timeouts, so it allowed anywhere between zero
and one extra second of wait time.  Zero is a bit unreasonable.
Compare fractional seconds so we always allow up to one extra second.

Reviewed by: ngie
MFC after: 1 week
Sponsored by: Dell EMC Isilon

4 years agoValidate guest-supplied length of headers for TSO transmit requests.
jhb [Mon, 5 Aug 2019 21:39:55 +0000 (21:39 +0000)]
Validate guest-supplied length of headers for TSO transmit requests.

When transmitting a large TCP packet, the final transmit descriptor
includes the length of the protocol headers to be duplicated on each
segment.  The device model was trusting the guest-supplied value
without validating it.  A value of zero would result in the guest
being able to indirect a garbage pointer on the stack to overwrite
arbitrary memory in the bhyve process.  A value that was non-zero but
too small for the requested parameters resulted in the device model
reading and writing values beyond the end of the on-stack buffer used
to hold the template header.

To fix, validate the supplied length and drop requests to transmit
packets that would overflow the header buffer.  While here, initialize
the header pointer to NULL as a preventive measure so that any access
to an unallocated template header crashes they hypervisor
deterministically.

While here, only read the TCP sequence number if the packet being
split is a TCP packet.  The e1000 logic supports a segmentation of UDP
frames, and while UDP segmentation requires this part of the header to
be valid (so there is no buffer overflow), only reading the field when
needed is cleaner.

admbugs: 918
Reported by: Reno Robert <renorobert@gmail.com>
Reviewed by: markj
Approved by: so
Security: CVE-2019-5609

4 years agoprocdesc: fix the function name
oshogbo [Mon, 5 Aug 2019 20:31:17 +0000 (20:31 +0000)]
procdesc: fix the function name

I changed name of the function r350429 and forgot to update
the r350612 patch.

Reported by: jenkins
MFC after: 1 month

4 years agoprocess: style
oshogbo [Mon, 5 Aug 2019 20:26:01 +0000 (20:26 +0000)]
process: style

We don't need to check if the parent is already set.
This is done already in the proc_reparent.

No functional behaviour changes intended.

MFC after: 1 month

4 years agoexit1: fix style nits
oshogbo [Mon, 5 Aug 2019 20:20:14 +0000 (20:20 +0000)]
exit1: fix style nits

MFC after: 1 month

4 years agoprocdesc: fix reparenting when the debugger is attached
oshogbo [Mon, 5 Aug 2019 20:15:46 +0000 (20:15 +0000)]
procdesc: fix reparenting when the debugger is attached

The process is reparented to the debugger while it is attached.
  B          B
 /   ---->   |
A          A D

Every time when the process is reparented, it is added to the orphan list
of the previous parent:

A->orphan = B
D->orphan = NULL

When the A process will close the process descriptor to the B process,
the B process will be reparented to the init process.
  B            B - init
  |   ---->
A D          A   D

A->orphan = B
D->orphan = B

In this scenario, the B process is in the orphan list of A and D.

When the last process descriptor is closed instead of reparenting
it to the reaper let it stay with the debugger process and set
our previews parent to the reaper.

Add test case for this situation.
Notice that without this patch the kernel will crash with this test case:
panic: orphan 0xfffff8000e990530 of 0xfffff8000e990000 has unexpected oppid 1

Reviewed by: markj, kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D20361

4 years agoproc: introduce the proc_add_orphan function
oshogbo [Mon, 5 Aug 2019 20:11:57 +0000 (20:11 +0000)]
proc: introduce the proc_add_orphan function

This API allows adding the process to its parent orphan list.

Reviewed by: kib, markj
MFC after: 1 month

4 years agoexit1: postpone clearing P_TRACED flag until the proctree lock is acquired
oshogbo [Mon, 5 Aug 2019 19:59:23 +0000 (19:59 +0000)]
exit1: postpone clearing P_TRACED flag until the proctree lock is acquired

In case of the process being debugged. The P_TRACED is cleared very early,
which would make procdesc_close() not calling proc_clear_orphan().
That would result in the debugged process can not be able to collect
status of the process with process descriptor.

Reviewed by: markj, kib
Tested by: pho
MFC after: 1 month

4 years agoFix alignment issue r350599.
mav [Mon, 5 Aug 2019 19:30:28 +0000 (19:30 +0000)]
Fix alignment issue r350599.

MFC after: 10 days

4 years agoFix mis-merge.
kib [Mon, 5 Aug 2019 19:19:25 +0000 (19:19 +0000)]
Fix mis-merge.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoFix mis-merge
kib [Mon, 5 Aug 2019 19:16:33 +0000 (19:16 +0000)]
Fix mis-merge

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoAdd `nvmecontrol resv` to handle NVMe reservations.
mav [Mon, 5 Aug 2019 17:36:00 +0000 (17:36 +0000)]
Add `nvmecontrol resv` to handle NVMe reservations.

NVMe reservations are quite alike to SCSI persistent reservations and
can be used in clustered setups with shared multiport storage.

MFC after: 10 days
Relnotes: yes
Sponsored by: iXsystems, Inc.

4 years agoAdd a driver for Texas Instruments ADS101x/ADS111x i2c ADC chips.
ian [Mon, 5 Aug 2019 15:56:44 +0000 (15:56 +0000)]
Add a driver for Texas Instruments ADS101x/ADS111x i2c ADC chips.

Instances of the device can be configured using hints or FDT data.

Interfaces to reconfigure the chip and extract voltage measurements from
it are available via sysctl(8).

4 years ago[PPC64] Don't mark ld.bfd as obsolete
luporl [Mon, 5 Aug 2019 13:28:21 +0000 (13:28 +0000)]
[PPC64] Don't mark ld.bfd as obsolete

PowerPC64 still needs ld.bfd for 32-bit binaries/libraries.

This will be needed when ELFv2 becomes default, but there is no harm in
committing it already.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D21136

4 years agoImprove consistency. No functional change.
tuexen [Mon, 5 Aug 2019 13:22:15 +0000 (13:22 +0000)]
Improve consistency. No functional change.

MFC after: 3 days

4 years ago[PPC64] Fix rtld direct exec mode
luporl [Mon, 5 Aug 2019 13:22:02 +0000 (13:22 +0000)]
[PPC64] Fix rtld direct exec mode

Instead of restoring the saved values of argc, argv and envp,
these must be loaded from the stack that _rtld() modifies.

This fixes rtld direct exec mode.
E.g.: /libexec/ld-elf.so.1 /bin/ls

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D21131

4 years agoAdd common firewall test suite
thj [Mon, 5 Aug 2019 11:47:34 +0000 (11:47 +0000)]
Add common firewall test suite

Add a common test suite for the firewalls included in the base system. The test
suite allows common test infrastructure to test pf, ipfw and ipf firewalls from
test files containing the setup for all three firewalls.

Add the pass block test for pf, ipfw and ipf. The pass block test checks the
allow/deny functionality of the firewalls tested.

Submitted by:   Ahsan Barkati
Sponsored by:   Google, Inc. (GSoC 2019)
Reviewed by:    kp
Approved by:    bz (co-mentor)
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D21065

4 years agofrag6.c: rename ip6q[] to ipq6b[] and consistently use "bucket"
bz [Mon, 5 Aug 2019 11:01:12 +0000 (11:01 +0000)]
frag6.c: rename ip6q[] to ipq6b[] and consistently use "bucket"

The hash buckets array is called ip6q.  The data structure ip6q is a
description of different object, the one the array holds these days
(since r337776).  To clear some of this confusion, rename the array
to ip6qb.

When iterating over all buckets or addressing them directly, we
use at least the variables i, hash, and bucket.  To keep the
terminology consistent use the variable name "bucket" and always
make it an uint32_t and not sometimes an int.

No functional behaviour changes intended.

MFC after: 3 months
Sponsored by: Netflix

4 years agofrag6.c: re-order functions within file
bz [Mon, 5 Aug 2019 09:49:24 +0000 (09:49 +0000)]
frag6.c: re-order functions within file

Re-order functions within the file in preparation for an upcoming
code simplification.

No functional changes.

MFC after: 3 months
Sponsored by: Netflix

4 years agoRemove obsolete header file.
delphij [Mon, 5 Aug 2019 06:01:29 +0000 (06:01 +0000)]
Remove obsolete header file.

4 years agoEnable superpage promotion within the kernel pmap.
alc [Mon, 5 Aug 2019 02:44:04 +0000 (02:44 +0000)]
Enable superpage promotion within the kernel pmap.

Reviewed by: markj
X-MFC after: r350004
Differential Revision: https://reviews.freebsd.org/D21149

4 years agopowerpc: Get 32-bit AIM building with secure-PLT
jhibbits [Mon, 5 Aug 2019 01:37:18 +0000 (01:37 +0000)]
powerpc:  Get 32-bit AIM building with secure-PLT

The last few changes needed before 32-bit AIM builds with secure-PLT with
base GCC.  Because ofwcall32.S and swtch32.S were branching to the GOT it
could not use secure PLT.

4 years agoipfw: fix jail option after r348215
kevans [Mon, 5 Aug 2019 00:08:25 +0000 (00:08 +0000)]
ipfw: fix jail option after r348215

r348215 changed jail_getid(3) to validate passed-in jids as active jails
(as the function is documented to return -1 if the jail does not exist).
This broke the jail option (in some cases?) as the jail historically hasn't
needed to exist at the time of rule parsing; jids will get stored and later
applied.

Fix this caller to attempt to parse *av as a number first and just use it
as-is to match historical behavior. jail_getid(3) must still be used in
order for name arguments to work, but it's strictly a fallback in case we
weren't given a number.

Reported and tested by: Ari Suutari <ari stonepile fi>
Reviewed by: ae
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21128

4 years agortld-elf: Remove x86 elf_rtld.x linker scripts.
kib [Sun, 4 Aug 2019 21:43:34 +0000 (21:43 +0000)]
rtld-elf: Remove x86 elf_rtld.x linker scripts.

First, amd64 version of the script cannot work at least due to the
wrong architecture specification.  Second, kernel can activate shared
objects for long time, due to PIE support.

It seems the intent was to allow ld-elf.so.1 to be build and used as
an executable.  Since we have direct exec mode implemented for dso
ld-elf.so.1, the non-functional and commented out scripts can be
finally removed.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoFix 32-bit build again, post r350570.
jhibbits [Sun, 4 Aug 2019 20:00:39 +0000 (20:00 +0000)]
Fix 32-bit build again, post r350570.

Missed this part with my testing as well.  Pass the right type to
BUS_TRANSLATE_RESOURCE().

4 years agoFix 32-bit build post-r350570
jhibbits [Sun, 4 Aug 2019 19:55:43 +0000 (19:55 +0000)]
Fix 32-bit build post-r350570

The error message prints a rman_res_t, which is an uintmax_t.  Explicitly
cast, just for future-proofing, and use the correct format.

4 years agoFix the build after r350570.
jhibbits [Sun, 4 Aug 2019 19:47:02 +0000 (19:47 +0000)]
Fix the build after r350570.

Signed char cannot compare to values above 0x7f.  Use unsigned instead.

4 years agoAdd necessary bits for Linux KPI to work correctly on powerpc
jhibbits [Sun, 4 Aug 2019 19:28:10 +0000 (19:28 +0000)]
Add necessary bits for Linux KPI to work correctly on powerpc

PowerPC, and possibly other architectures, use different address ranges for
PCI space vs physical address space, which is only mapped at resource
activation time, when the BAR gets written.  The DRM kernel modules do not
activate the rman resources, soas not to waste KVA, instead only mapping
parts of the PCI memory at a time.  This introduces a
BUS_TRANSLATE_RESOURCE() method, implemented in the Open Firmware/FDT PCI
driver, to perform this necessary translation without activating the
resource.

In addition to system KPI changes, LinuxKPI is updated to handle a
big-endian host, by adding proper endian swaps to the I/O functions.

Submitted by: mmacy
Reported by: hselasky
Differential Revision: https://reviews.freebsd.org/D21096

4 years agopowerpc: Enable the BUS_DMA_NOCACHE flag handling
jhibbits [Sun, 4 Aug 2019 19:25:23 +0000 (19:25 +0000)]
powerpc: Enable the BUS_DMA_NOCACHE flag handling

The flag handling was committed commented out 7 years ago.  It works, and is
needed for LinuxKPI-based DRM drivers.

Also mark a local as potentially unusable, as it's only really used when KTR
is enabled.

Submitted by: mmacy

4 years agoResolve ipfilter kld unload issues related to VNET jails.
cy [Sun, 4 Aug 2019 12:47:38 +0000 (12:47 +0000)]
Resolve ipfilter kld unload issues related to VNET jails.

When the ipfilter kld is loaded, used within VNET jail, and unloaded,
then subsequent loading, use, and unloading of another packet filters
will cause the subsequently loaded netpfil kld's to panic.

The scenario is as follows:

cd /usr/tests/sys/netpfil/common

kldunload ipl
kldunload pfsync
kldunload ipfw

kyua test pass_block

kldload ipl
kyua test pass_block
kldunload ipl

kldload pfsync
kyua test pass_block
kldunload pfsync
-- page fault panic occurs here --

Reported by: "Ahsan Barkati" <ahsanbarkati@g.....com> via kp@
Discussed with: kp@
Tested by: kp@
MFC after: 3 days

4 years agoReturning an uninitialized error is a bad thing.
cy [Sun, 4 Aug 2019 12:47:35 +0000 (12:47 +0000)]
Returning an uninitialized error is a bad thing.

MFC after: 3 days

4 years agoThere is no need to explicitly add zlib, we already have it in
delphij [Sun, 4 Aug 2019 04:51:32 +0000 (04:51 +0000)]
There is no need to explicitly add zlib, we already have it in
sys/conf/files.

4 years agoAdd `nvmecontrol sanitize` command.
mav [Sat, 3 Aug 2019 19:24:56 +0000 (19:24 +0000)]
Add `nvmecontrol sanitize` command.

It allows to delete all user data from NVM subsystem in one of 3 methods.
It is a close equivalent of SCSI SANITIZE command of `camcontrol sanitize`,
so I tried to keep arguments as close as possible.

While there, fix supported sanitize methods reporting in `identify`.

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

4 years agoFix format spec for ILP32.
kib [Sat, 3 Aug 2019 18:26:16 +0000 (18:26 +0000)]
Fix format spec for ILP32.

Sponsored by: The FreeBSD Foundation

4 years agoamd64: Streamline exceptions and interrupts handlers.
kib [Sat, 3 Aug 2019 17:07:04 +0000 (17:07 +0000)]
amd64: Streamline exceptions and interrupts handlers.

PTI-mode entry points were coded to set up the environment identical
to non-PTI entry and then fall-through to non-PTI handlers, mostly.
This has the drawback of requiring two more SWAPGS, first to access
PCPU, and then to return to the state expected by the non-PTI entry
point.

Eliminate the duplication by doing more in entry stubs both for PTI
and non-PTI, and adjusting the common code to expect that SWAPGS and
some minimal registers saving is done by entries.

Some less often used entries, in particular, #GP, #NP, and #SS, which
can fault on doreti, are left as is because there are basically four
variants of entrance, and they are not performance-critical,
esp. comparing with e.g. #PF or interrupts.

Reviewed by: markj (previous version)
Tested by: pho (previous version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agobhyve: Ignore MSI/MSI-X interrupts sent to non-active vCPUs in
kib [Sat, 3 Aug 2019 16:57:14 +0000 (16:57 +0000)]
bhyve: Ignore MSI/MSI-X interrupts sent to non-active vCPUs in
physical destination mode.

This is mostly a nop, because the vmm initializes all vCPUs up to
vm_maxcpus, so even if the target CPU is not active, lapic/vlapic code
still has the valid data to use.  As John notes, dropping such
interrupts more closely matches the real harware, which ignores all
interrupts for not started APs.

Reviewed by: jhb
admbugs: 837
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agofrag6.c: fix includes
bz [Sat, 3 Aug 2019 16:56:44 +0000 (16:56 +0000)]
frag6.c: fix includes

Bring back systm.h after r350532 and banish errno.h, time.h, and
machine/atomic.h.

Reported by: bde (Thank you!)
Pointyhat to: bz
MFC after: 12 weeks
X-MFC: with r350532
Sponsored by: Netflix

4 years agoAdd per hub sysctl to expose port information for phyisical form etc.
takawata [Sat, 3 Aug 2019 16:13:44 +0000 (16:13 +0000)]
Add per hub sysctl to expose port information for phyisical form etc.

Reviewed by:hselasky
Differential Revision: https://reviews.freebsd.org/D20865

4 years agoProperly validte arguments for route deletion
gnn [Sat, 3 Aug 2019 14:42:07 +0000 (14:42 +0000)]
Properly validte arguments for route deletion

Reported by: Liang Zhuo brightiup.zhuo@gmail.com
MFC after: 1 week

4 years agoCapsicumize ping6
asomers [Sat, 3 Aug 2019 13:53:14 +0000 (13:53 +0000)]
Capsicumize ping6

Add capsicum support to ping6, mostly copying the strategy used for ping.

Submitted by: Ján Sučan <jansucan@gmail.com>
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21050

4 years agoFix parameter check broken at r350057.
mav [Sat, 3 Aug 2019 04:30:28 +0000 (04:30 +0000)]
Fix parameter check broken at r350057.

MFC after: 2 weeks

4 years agoif_mxge: update zlib version 1.0.4 to 1.2.11.
delphij [Sat, 3 Aug 2019 03:36:18 +0000 (03:36 +0000)]
if_mxge: update zlib version 1.0.4 to 1.2.11.

PR: 229763
Submitted by: Yoshihiro Ota <ota j email ne jp>
Differential Revision: https://reviews.freebsd.org/D20272

4 years agoAdd more random bits from NVMe 1.4.
mav [Sat, 3 Aug 2019 02:36:35 +0000 (02:36 +0000)]
Add more random bits from NVMe 1.4.

MFC after: 2 weeks

4 years agopowerpc/powernv: Fix OPAL cfgread/cfgwrite error handling
jhibbits [Sat, 3 Aug 2019 01:55:51 +0000 (01:55 +0000)]
powerpc/powernv: Fix OPAL cfgread/cfgwrite error handling

Freeze clearing needs to heppen any time OPAL reads return either an error
(except OPAL_HARDWARE), AND any time it returns 0xff for all bytes.

For cfgwrite, any error that's not OPAL_HARDWARE should be cleaned up.

4 years agoDon't reset memory attributes when mapping physical addresses for ACPI.
jhb [Sat, 3 Aug 2019 01:36:05 +0000 (01:36 +0000)]
Don't reset memory attributes when mapping physical addresses for ACPI.

Previously, AcpiOsMemory was using pmap_mapbios which would always map
the requested address Write-Back (WB).  For several AMD Ryzen laptops,
the BIOS uses AcpiOsMemory to directly access the PCI MCFG region in
order to access PCI config registers.  This has the side effect of
remapping the MCFG region in the direct map as WB instead of UC
hanging the laptops during boot.

On the one laptop I examined in detail, the _PIC global method used to
switch from 8259A PICs to I/O APICs uses a pair of PCI config space
registers at offset 0x84 in the device at 0:0:0 to as a pair of
address/data registers to access an indirect register in the chipset
and clear a single bit to switch modes.

To fix, alter the semantics of pmap_mapbios() such that it does not
modify the attributes of any existing mappings and instead uses the
existing attributes.  If a new mapping is created, this new mapping
uses WB (the default memory attribute).

Special thanks to the gentleman whose name I don't have who brought
two affected laptops to the hacker lounge at BSDCan.  Direct access to
the affected systems permitted finding the root cause within an hour
or so.

PR: 231760, 236899
Reviewed by: kib, alc
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20327

4 years agoFlip REPRODUCIBLE_BUILD back to off by default in head.
jhb [Sat, 3 Aug 2019 01:06:17 +0000 (01:06 +0000)]
Flip REPRODUCIBLE_BUILD back to off by default in head.

Having the full uname output can be useful on head even with
unmodified trees or trees that newvers.sh fails to recognize as
modified.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D20895

4 years agoSet ISOPEN in namei flags when opening executable interpreters.
jhb [Sat, 3 Aug 2019 01:02:52 +0000 (01:02 +0000)]
Set ISOPEN in namei flags when opening executable interpreters.

These vnodes are explicitly opened via VOP_OPEN via
exec_check_permissions identical to the main exectuable image.
Setting ISOPEN allows filesystems to perform suitable checks in
VOP_LOOKUP (e.g. close-to-open consistency in the NFS client).

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D21129

4 years agoMFC after: 3 days
cy [Fri, 2 Aug 2019 22:58:45 +0000 (22:58 +0000)]
MFC after: 3 days

4 years agoFix !INET build.
delphij [Fri, 2 Aug 2019 22:43:09 +0000 (22:43 +0000)]
Fix !INET build.

4 years agoBecause of AArch64's weak memory consistency model, we need to include a
alc [Fri, 2 Aug 2019 22:36:42 +0000 (22:36 +0000)]
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.

Reviewed by: andrew, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21126

4 years agoAdd bzip2recover.1.
markj [Fri, 2 Aug 2019 22:09:56 +0000 (22:09 +0000)]
Add bzip2recover.1.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoDecode few more NVMe log pages.
mav [Fri, 2 Aug 2019 20:16:21 +0000 (20:16 +0000)]
Decode few more NVMe log pages.

In particular: Changed Namespace List, Commands Supported and Effects,
Reservation Notification, Sanitize Status.

Add few new arguments to `nvmecontrol log` subcommand.

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

4 years agoOnly check the blessings table for known LORs.
markj [Fri, 2 Aug 2019 18:01:47 +0000 (18:01 +0000)]
Only check the blessings table for known LORs.

Previously we would check for blessings before marking a given lock
pair as reversed, so each "reversed" lock acquisition would require
a linear scan of the table.  Instead, check the table after marking
the pair as reversed but before generating a report.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21135

4 years agoFix warnings about unused identifiers when compiling without RATELIMIT.
markj [Fri, 2 Aug 2019 15:19:11 +0000 (15:19 +0000)]
Fix warnings about unused identifiers when compiling without RATELIMIT.

4 years agoFix one more atomic for i86
rrs [Fri, 2 Aug 2019 11:17:07 +0000 (11:17 +0000)]
Fix one more atomic for i86
Obtained from: mtuexen@freebsd.org

4 years agofrag6.c: make compile with gcc
bz [Fri, 2 Aug 2019 11:05:00 +0000 (11:05 +0000)]
frag6.c: make compile with gcc

Removing the prototype from the header and making the function static
in r350533 makes architectures using gcc complain "function declaration
isn't a prototype".  Add the missing void given the function has no
arguments.

Reported by: the CI machinery
Pointyhat to: bz
MFC after: 3 months
X-MFC with: r350533
Sponsored by: Netflix

4 years agofrag6.c: rename malloc type
bz [Fri, 2 Aug 2019 10:54:57 +0000 (10:54 +0000)]
frag6.c: rename malloc type

Rename M_FTABLE to M_FRAG6 as the former sounds very much like the former
"flowtable" rather than anything to do with fragments and reassembly.

While here, let malloc( , .. | M_ZERO) do the zeroing rather than calling
bzero() ourselves.

MFC after: 3 months
Sponsored by: Netflix

4 years agofrag6.c: remove dead code
bz [Fri, 2 Aug 2019 10:41:51 +0000 (10:41 +0000)]
frag6.c: remove dead code

Remove all the #if 0 and #if notyet blocks of dead code which have been
there for at least 18 years from what I can see.

No functional changes.

MFC after: 3 months
Sponsored by: Netflix

4 years agofrag6.c: move variables and sysctls into local file
bz [Fri, 2 Aug 2019 10:29:53 +0000 (10:29 +0000)]
frag6.c: move variables and sysctls into local file

Move the sysctls and the related variables only used in frag6.c
into the file and out of in6_proto.c.  That way everything belonging
together is in one place.

Sort the variables into global and per-vnet scopes and make
them static.  No longer export the (helper) function
frag6_set_bucketsize() now also file-local only.

Should be no functional changes, only reduced public KPI/KBI surface.

MFC after: 3 months
Sponsored by: Netflix

4 years agofrag6.c: sort includes
bz [Fri, 2 Aug 2019 10:06:54 +0000 (10:06 +0000)]
frag6.c: sort includes

Sort includes and remove duplicate kernel.h as well as the unneeded
systm.h.
Hide the mac framework incude behind #fidef MAC.

MFC after: 3 months
Sponsored by: Netflix

4 years agoIPv6 cleanup: kernel
bz [Fri, 2 Aug 2019 07:41:36 +0000 (07:41 +0000)]
IPv6 cleanup: kernel

Finish what was started a few years ago and harmonize IPv6 and IPv4
kernel names.  We are down to very few places now that it is feasible
to do the change for everything remaining with causing too much disturbance.

Remove "aliases" for IPv6 names which confusingly could indicate
that we are talking about a different data structure or field or
have two fields, one for each address family.
Try to follow common conventions used in FreeBSD.

* Rename sin6p to sin6 as that is how it is spelt in most places.
* Remove "aliases" (#defines) for:
  - in6pcb which really is an inpcb and nothing separate
  - sotoin6pcb which is sotoinpcb (as per above)
  - in6p_sp which is inp_sp
  - in6p_flowinfo which is inp_flow
* Try to use ia6 for in6_addr rather than in6p.
* With all these gone  also rename the in6p variables to inp as
  that is what we call it in most of the network stack including
  parts of netinet6.

The reasons behind this cleanup are that we try to further
unify netinet and netinet6 code where possible and that people
will less ignore one or the other protocol family when doing
code changes as they may not have spotted places due to different
names for the same thing.

No functional changes.

Discussed with: tuexen (SCTP changes)
MFC after: 3 months
Sponsored by: Netflix

4 years agoFix typo in r350529.
mav [Fri, 2 Aug 2019 04:04:18 +0000 (04:04 +0000)]
Fix typo in r350529.

MFC after: 2 weeks

4 years agoAdd more new fields and values from NVMe 1.4.
mav [Fri, 2 Aug 2019 03:43:24 +0000 (03:43 +0000)]
Add more new fields and values from NVMe 1.4.

MFC after: 2 weeks

4 years agoUse ATTR_DBM even when hardware dirty bit management is not enabled.
markj [Thu, 1 Aug 2019 22:48:06 +0000 (22:48 +0000)]
Use ATTR_DBM even when hardware dirty bit management is not enabled.

The ARMv8 reference manual only states that the bit is reserved in
this case; following Linux's example, use it instead of a
software-defined bit for the purpose of indicating that a managed
mapping is writable.

Reviewed by: alc, andrew
MFC after: r350004
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21121

4 years agoRename function added in r350523 to make gcc happy.
mav [Thu, 1 Aug 2019 22:22:06 +0000 (22:22 +0000)]
Rename function added in r350523 to make gcc happy.

MFC after: 2 weeks

4 years agoAdd IOCTL to translate nvdX into nvmeY and NSID.
mav [Thu, 1 Aug 2019 21:44:07 +0000 (21:44 +0000)]
Add IOCTL to translate nvdX into nvmeY and NSID.

While very useful by itself, it also makes `nvmecontrol` not depend on
hardcoded device names parsing, that in its turn makes simple to take
nvdX (and potentially any other) device names as arguments.

Also added IOCTL bypass from nvdX to respective nvmeYnsZ makes them
interchangeable for management purposes.

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

4 years agoIPv6 cleanup: netstat
bz [Thu, 1 Aug 2019 20:36:25 +0000 (20:36 +0000)]
IPv6 cleanup: netstat

Rename the variable for the in6_addr from in6p to ia6 to follow the
convention generally used in FreeBSD.

No functional changes.

MFC after: 3 months
Sponsored by: Netflix

4 years agoOpps use fetchadd_u64 not long to keep old 32 bit platforms
rrs [Thu, 1 Aug 2019 20:26:27 +0000 (20:26 +0000)]
Opps use fetchadd_u64 not long to keep old 32 bit platforms
happy.

4 years agoFix the reporting of multiple unknown parameters in an received INIT
tuexen [Thu, 1 Aug 2019 19:45:34 +0000 (19:45 +0000)]
Fix the reporting of multiple unknown parameters in an received INIT
chunk. This also plugs an potential mbuf leak.
Thanks to Felix Weinrank for reporting this issue found by fuzz-testing
the userland stack.

MFC after: 3 days

4 years agoInclude caph_rights_limit() in libegacy if need be.
markj [Thu, 1 Aug 2019 19:26:16 +0000 (19:26 +0000)]
Include caph_rights_limit() in libegacy if need be.

Reported by: jenkins
Sponsored by: The FreeBSD Foundation

4 years agoas: add deprecation notice to the man page
emaste [Thu, 1 Aug 2019 19:01:27 +0000 (19:01 +0000)]
as: add deprecation notice to the man page

In the future FreeBSD will ship without GNU binutils 2.17.50.  Add a
note advising users who require GNU as to install the binutils port
or package.

Note that on armv7, arm64, amd64, i386 we currently ship only two
binutils tools (as and objdump).  A deprecation notice was added to
objdump's man page some time ago.

PR: 233611
Discussed with: jhb
MFC after: 1 week
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

4 years agoCapsicumize size(1).
markj [Thu, 1 Aug 2019 18:57:37 +0000 (18:57 +0000)]
Capsicumize size(1).

Reviewed by: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21105

4 years agoCapsicumize readelf(1).
markj [Thu, 1 Aug 2019 18:57:08 +0000 (18:57 +0000)]
Capsicumize readelf(1).

Reviewed by: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21108

4 years agoCapsicumize addr2line(1).
markj [Thu, 1 Aug 2019 18:56:32 +0000 (18:56 +0000)]
Capsicumize addr2line(1).

Reviewed by: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21104

4 years agoAdd an MLINK for daemonfd(3).
markj [Thu, 1 Aug 2019 18:51:18 +0000 (18:51 +0000)]
Add an MLINK for daemonfd(3).

MFC after: 3 days

4 years agoFix formatting.
markj [Thu, 1 Aug 2019 18:51:06 +0000 (18:51 +0000)]
Fix formatting.

MFC after: 3 days

4 years agoOnly skip test cases sometimes failing in CI when they are running in CI
lwhsu [Thu, 1 Aug 2019 18:19:16 +0000 (18:19 +0000)]
Only skip test cases sometimes failing in CI when they are running in CI

Suggested by: jhb
Sponsored by: The FreeBSD Foundation

4 years agoreadelf: decode NT_GNU_PROPERTY_TYPE_0 / GNU_PROPERTY_X86_FEATURE_1_AND
emaste [Thu, 1 Aug 2019 17:59:56 +0000 (17:59 +0000)]
readelf: decode NT_GNU_PROPERTY_TYPE_0 / GNU_PROPERTY_X86_FEATURE_1_AND

These bits are used for Intel CET IBT/Shadow Stack.

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

4 years agoRevert r349863 (ACPICA 20190703).
jkim [Thu, 1 Aug 2019 17:45:43 +0000 (17:45 +0000)]
Revert r349863 (ACPICA 20190703).

This commit caused boot failures on some systems.

Requested by: scottl

4 years agoiflib: Prevent kernel panic caused by loading driver with a specific interrupt config...
erj [Thu, 1 Aug 2019 17:37:25 +0000 (17:37 +0000)]
iflib: Prevent kernel panic caused by loading driver with a specific interrupt configuration

If a device has only 1 MSI-X interrupt available and does not support either
MSI or legacy interrupts, iflib_device_register() will fail, leak memory and
MSI resources, and the driver will not load. Worse, if another iflib-using
driver tries to unload afterwards, a kernel panic will occur because the
previous failed iflib driver loead did not properly call "taskqgroup_detach()"
during it's cleanup.

This patch is band-aid for this situation -- don't try allocating MSI or legacy
interrupts if a single MSI-X interrupt was allocated, but fail to load instead.
As well, during the cleanup, properly call taskqgroup_detach() on the admin
task to prevent panics when other iflib drivers unload.

This whole interrupt allocation process actually needs re-doing to properly
support devices with only a single MSI-X interrupt, devices that only support
MSI-X, non-PCI devices, and multiple non-MSIX interrupts, as well.

Signed-off-by: Eric Joyner <erj@freebsd.org>
Reviewed by: marius@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D20747

4 years agoWhen responding with an ABORT to an INIT chunk containing a
tuexen [Thu, 1 Aug 2019 17:36:15 +0000 (17:36 +0000)]
When responding with an ABORT to an INIT chunk containing a
HOSTNAME parameter or a parameter with an illegal length, only
include an error cause indicating why the ABORT was sent.
This also fixes an mbuf leak which could occur.

MFC after: 3 days

4 years agoiflib: remove kobject class reference increment
erj [Thu, 1 Aug 2019 17:28:36 +0000 (17:28 +0000)]
iflib: remove kobject class reference increment

Commit message from Jake:
In iflib_register, the context is initialized as a kobject using the
device driver's "driver" kobject class. As part of this, the function
mistakenly increments the ref counter.

The ref counter is incremented twice, once in the code directly, and
once again by kobj_class_compile. However, there is no associated
decrement in the detach path. Because of this, the ref counter will
never go back down to zero, and thus the kobject method table will never
be released.

Remove this unnecessary reference count increment.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: jhb@, erj@
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21125

4 years agoremove obsolete kernel debugging script
emaste [Thu, 1 Aug 2019 17:02:58 +0000 (17:02 +0000)]
remove obsolete kernel debugging script

For quite some time kgdb has been internally handling FreeBSD kernel
module state; add-on scripts and tools are not needed.  asf(8) served
a similar purpose to this script and was removed in r335222.

PR: 229046
Reported by: jhb
Sponsored by: The FreeBSD Foundation

4 years agoobjdump: be explicit that GNU objdump that will be removed
emaste [Thu, 1 Aug 2019 14:42:41 +0000 (14:42 +0000)]
objdump: be explicit that GNU objdump that will be removed

We may install llvm-objdump as objdump (see review D18307) or just
provide no /usr/bin/objdump, but either way GNU objdump won't be
installed in the future.

MFC after: 3 days

4 years agoTry to decrease the number of bugs in unionfs after the VV_TEXT flag removal.
kib [Thu, 1 Aug 2019 14:40:37 +0000 (14:40 +0000)]
Try to decrease the number of bugs in unionfs after the VV_TEXT flag removal.

- Provide unionfs_add_writecount() which passes the writecount to the
  lower or upper vnode as appropriate.
- In unionfs VOP_RECLAIM() implementation, annulate unionfs
  writecounts from upper or lower vnode.  It is not clear that it is
  always correct to remove the all references from either lower or
  upper vnode, but we currently do not track which vnode get how many
  refs anyway.

Reported and tested by: t_uemura@macome.co.jp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoobjdump: move deprecation notice to indended spot in the man page
emaste [Thu, 1 Aug 2019 14:39:26 +0000 (14:39 +0000)]
objdump: move deprecation notice to indended spot in the man page

r335217 added a deprecation notice to the source file for the objdump
man page, and r335219 added it to the rendered objdump.1, but in the
wrong spot.

MFC after: 3 days

4 years agoMake umtxq_check_susp() to correctly handle thread exit requests.
kib [Thu, 1 Aug 2019 14:34:27 +0000 (14:34 +0000)]
Make umtxq_check_susp() to correctly handle thread exit requests.

The check for P_SINGLE_EXIT was shadowed by the (P_SHOULDSTOP || traced) check.

Reported by: bdrewery (might be)
Reviewed by: markj
Tested by: pho
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21124

4 years agoThis adds the third step in getting BBR into the tree. BBR and
rrs [Thu, 1 Aug 2019 14:17:31 +0000 (14:17 +0000)]
This adds the third step in getting BBR into the tree. BBR and
an updated rack depend on having access to the new
ratelimit api in this commit.

Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D20953

4 years agonewvers: append commit count to uname version string
emaste [Thu, 1 Aug 2019 14:13:04 +0000 (14:13 +0000)]
newvers: append commit count to uname version string

In a git world this provides a facsimile of a monotonically increasing
version number.  This might be refined further, but this provides a
starting point for investigation.

Reviewed by: cem
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20462

4 years agoacpi_resource.c: mention ThunderX2 firmware revision with issue
emaste [Thu, 1 Aug 2019 14:02:59 +0000 (14:02 +0000)]
acpi_resource.c: mention ThunderX2 firmware revision with issue

Presumably this will be fixed in the next version, and the workaround
could eventually be removed.  See r330113 and r346066 details.

4 years agotelnet: use asprintf for r349890 change
emaste [Thu, 1 Aug 2019 13:46:04 +0000 (13:46 +0000)]
telnet: use asprintf for r349890 change

Suggested by: imp
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation