]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agopowerpc: Fix moea64 pmap from 347952
jhibbits [Sat, 18 May 2019 14:55:59 +0000 (14:55 +0000)]
powerpc: Fix moea64 pmap from 347952

vm_paddr_t is only 32 bits on AIM32 (currently), causing a build failure with
the shifting.

MFC after: 2 weeks
MFC with: r347952

5 years agoUpdate the DIAGNOSTIC-only vmem_check_sanity() after r347949.
markj [Sat, 18 May 2019 14:19:23 +0000 (14:19 +0000)]
Update the DIAGNOSTIC-only vmem_check_sanity() after r347949.

Cursor tags are special and shouldn't be subject to the existing checks.

Reported by: kib, David Wolfskill
MFC with: r347949

5 years agoMFV/ZoL: `zfs userspace` ignored all unresolved UIDs after the first
allanjude [Sat, 18 May 2019 12:27:22 +0000 (12:27 +0000)]
MFV/ZoL: `zfs userspace` ignored all unresolved UIDs after the first

zfsonlinux/zfs@88cfff182432e4d1c24c877f33b47ee6cf109eee

zfs_main: fix `zfs userspace` squashing unresolved entries

The `zfs userspace` squashes all entries with unresolved numeric
values into a single output entry due to the comparsion always
made by the string name which is empty in case of unresolved IDs.

Fix this by falling to a numerical comparison when either one
of string values is not found. This then compares any numerical
values after all with a name resolved.

Signed-off-by: Pavel Boldin <boldin.pavel@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reported by: clusteradm
Obtained from: ZFS-on-Linux
MFC after: 3 days

5 years agopowerpc64/pmap: NUMA-ize the page pv lock pool to reduce contention
jhibbits [Sat, 18 May 2019 11:14:43 +0000 (11:14 +0000)]
powerpc64/pmap: NUMA-ize the page pv lock pool to reduce contention

It was found during building llvm that the page pv lock pool was seeing very
high contention.  Since the pmap is already NUMA aware, it was surmised that
the domains were referencing similar pages in the different domains.  This
reduces contention to the point of noise in a lockstat(8) run (~51% down to
under 5%), reducing build times by up to 20%.

This doesn't do a perfect domain alignment, just a best-guess based on
hardware available, that the domain is roughly specified in the upper bits
of the PA.  Trying to be more clever would more than likely result in
reduced performance just on the work needed.

MFC after: 2 weeks

5 years agoUse M_NEXTFIT in memguard(9).
markj [Sat, 18 May 2019 02:02:14 +0000 (02:02 +0000)]
Use M_NEXTFIT in memguard(9).

memguard(9) wants to avoid reuse of freed addresses for as long as
possible.  Previously it maintained a racily updated cursor which was
passed to vmem_xalloc(9) as the minimum address.  However, vmem will
not in general return the lowest free address in the arena, so this
trick only really works until the cursor has wrapped around the first
time.

Reported by: alc
Reviewed by: alc
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D17227

5 years agoImplement the M_NEXTFIT allocation strategy for vmem(9).
markj [Sat, 18 May 2019 01:46:38 +0000 (01:46 +0000)]
Implement the M_NEXTFIT allocation strategy for vmem(9).

This is described in the vmem paper: "directs vmem to use the next free
segment after the one previously allocated."  The implementation adds a
new boundary tag type, M_CURSOR, which is linked into the segment list
and precedes the segment following the previous M_NEXTFIT allocation.
The cursor is used to locate the next free segment satisfying the
allocation constraints.

This implementation isn't O(1) since busy tags aren't coalesced, and we
may potentially scan the entire segment list during an M_NEXTFIT
allocation.

Reviewed by: alc
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D17226

5 years agoAdd DragonFly's partition number to fdisk(8) and diskmbr.h
cem [Sat, 18 May 2019 00:22:28 +0000 (00:22 +0000)]
Add DragonFly's partition number to fdisk(8) and diskmbr.h

This change doesn't make any attempt to add support for these slices to the
relevent GEOM classes.  Just register the number in fdisk and the canonical
list of kernel macros (diskmbr.h).

Obtained from: DragonFlyBSD (794d80aa519b394b3174f20776a) (small subset of)

5 years agoGrammar fixes for r347690.
kib [Fri, 17 May 2019 21:18:11 +0000 (21:18 +0000)]
Grammar fixes for r347690.

Submitted by: alc
MFC after: 3 days

5 years agonetmap: align if_ptnet to the changes introduced by r347233
vmaffione [Fri, 17 May 2019 20:29:31 +0000 (20:29 +0000)]
netmap: align if_ptnet to the changes introduced by r347233

This removes non-functional SCTP checksum offload support.
More information in the log message of r347233.

MFC after: 2 weeks

5 years agopowerpc/dtrace: Actually fix stack traces
jhibbits [Fri, 17 May 2019 19:57:08 +0000 (19:57 +0000)]
powerpc/dtrace: Actually fix stack traces

Fix stack unwinding such that requesting N stack frames in lockstat will
actually give you N frames, not anywhere from 0-3 as had been before.

lockstat prints the mutex function instead of the caller as the reported
locker, but the stack frame is detailed enough to find the real caller.

MFC after: 2 weeks

5 years agoAdd a new ioctl for the larger params struct that includes the label.
stevek [Fri, 17 May 2019 19:27:07 +0000 (19:27 +0000)]
Add a new ioctl for the larger params struct that includes the label.

We need to make the find_veriexec_file() function available publicly, so
rename it to mac_veriexec_metadata_find_file_info() and make it non-static.

Bump the version of the veriexec device interface so user space will know
the labelized version of fingerprint loading is available.

Approved by: sjg
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D20295

5 years agoAdd command to get version of the ioctl interface for the veriexec device.
stevek [Fri, 17 May 2019 18:25:53 +0000 (18:25 +0000)]
Add command to get version of the ioctl interface for the veriexec device.

Obtained from: Juniper Networks, Inc.
MFC after: 1 week

5 years agoRemove the notice that ae(4) will be removed in FreeBSD 13.
brooks [Fri, 17 May 2019 18:16:55 +0000 (18:16 +0000)]
Remove the notice that ae(4) will be removed in FreeBSD 13.

5 years agoBetter formatting for the logpage section
scottl [Fri, 17 May 2019 18:15:47 +0000 (18:15 +0000)]
Better formatting for the logpage section

5 years agoObtain a shared lock instead of exclusive in the MAC/veriexec
stevek [Fri, 17 May 2019 18:13:43 +0000 (18:13 +0000)]
Obtain a shared lock instead of exclusive in the MAC/veriexec
MAC_VERIEXEC_CHECK_PATH_SYSCALL per-MAC policy system call.

When we are checking the status of the fingerprint on a vnode using the
per-MAC-policy syscall, we do not need an exclusive lock on the vnode.

Even if there is more than one thread requesting the status at the same time,
the worst we can end up doing is processing the file more than once.

This can potentially be improved in the future with offloading the fingerprint
evaluation to a separate thread and blocking until the update completes. But
for now the race is acceptable.

Obtained from: Juniper Networks, Inc.
MFC after: 1 week

5 years agosysctls which should be restricted when securelevel is raised should also
stevek [Fri, 17 May 2019 18:09:48 +0000 (18:09 +0000)]
sysctls which should be restricted when securelevel is raised should also
be restricted when veriexec is enforced.

Add mpo_system_check_sysctl method to mac_veriexec which does this.

Obtained from: Juniper Networks, Inc.
MFC after: 1 week

5 years agoFix format strings for some debug messages that could have arguments that
stevek [Fri, 17 May 2019 18:06:24 +0000 (18:06 +0000)]
Fix format strings for some debug messages that could have arguments that
are different types across architectures by using %ju and typecasting to
uintmax_t, where appropriate.

Obtained from: Juniper Networks, Inc.
MFC after: 1 week

5 years agoProtect commands that are considered dangerous with checks for kmem write
stevek [Fri, 17 May 2019 18:02:26 +0000 (18:02 +0000)]
Protect commands that are considered dangerous with checks for kmem write
priv. This allows for MAC/veriexec to prevent apps that are not "trusted"
from using these commands.

Obtained from: Juniper Networks, Inc.
MFC after: 1 week

5 years agoEnsure we have obtained a lock on the process before calling
stevek [Fri, 17 May 2019 17:50:01 +0000 (17:50 +0000)]
Ensure we have obtained a lock on the process before calling
mac_veriexec_get_executable_flags(). Only try locking/unlocking if the caller
has not already acquired the process lock.

Obtained from: Juniper Networks, Inc.
MFC after: 1 week

5 years agoInstead of individual conditional statements to look for each hypervisor
stevek [Fri, 17 May 2019 17:21:32 +0000 (17:21 +0000)]
Instead of individual conditional statements to look for each hypervisor
type, use a table to make it easier to add more in the future, if needed.

Add VirtualBox detection to the table ("VBoxVBoxVBox" is the hypervisor
vendor string to look for.) Also add VM_GUEST_VBOX to the VM_GUEST
enumeration to indicate VirtualBox.

Save the CPUID base for the hypervisor entry that we detected. Driver code
may need to know about it in order to obtain additional CPUID features.

Approved by: bryanv, jhb
Differential Revision: https://reviews.freebsd.org/D16305

5 years agoFree microcode memory later.
kib [Fri, 17 May 2019 17:11:01 +0000 (17:11 +0000)]
Free microcode memory later.

With lockless DI, pmap_remove() requires operational thread lock,
which is initialized at SI_SUB_RUN_QUEUE for thread0.  Move it even
later where APs are started, the moment after which other boot memory
like trampoline stacks is already being freed.

Reported by: gtetlow
Sponsored by: The FreeBSD Foundation
MFC after: 30 days

5 years agopci: ecam: Correctly parse memory and IO region
manu [Fri, 17 May 2019 17:05:16 +0000 (17:05 +0000)]
pci: ecam: Correctly parse memory and IO region

When activating a resource do not compare the resource id to the adress.
Treat IO region as MEMORY region too.

Submitted by: Tuan Phan <tphan@amperecomputing.com> (Original Version)
Sponsored by: Ampere Computing, LLC
Differential Revision: https://reviews.freebsd.org/D20214

5 years agopci: ecam: Do not warn on mismatch of bus_end
manu [Fri, 17 May 2019 17:04:01 +0000 (17:04 +0000)]
pci: ecam: Do not warn on mismatch of bus_end

We cannot know the bus end number before parsing the MCFG table
so don't set the bus_end before that. If the MCFG table doesn't
exist we will set the configuration base address based on the _CBA
value and set the bus_end to the maximal number allowed by PCI.

Sponsored by: Ampere Computing, LLC

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

5 years agoImplement the ffs and fls functions, and their longer counterparts, in
dougm [Fri, 17 May 2019 15:52:17 +0000 (15:52 +0000)]
Implement the ffs and fls functions, and their longer counterparts, in
cpufunc, in terms of __builtin_ffs and the like, for arm64
architectures, and use those, rather than the simple libkern
implementations, in building arm64 kernels.

Tested by: greg_unrelenting.technology (earlier version)
Reviewed by: alc
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20250

5 years agoFCP-101: correct date of device driver removal.
brooks [Fri, 17 May 2019 15:44:11 +0000 (15:44 +0000)]
FCP-101: correct date of device driver removal.

5 years agoFCP-101: Bump __FreeBSD_version for device removal.
brooks [Fri, 17 May 2019 15:31:28 +0000 (15:31 +0000)]
FCP-101: Bump __FreeBSD_version for device removal.

Bump accidentally omitted from r347924 due to a rebase accident.

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

5 years agoFCP-101: Bump __FreeBSD_version for driver removal.
brooks [Fri, 17 May 2019 15:24:54 +0000 (15:24 +0000)]
FCP-101: Bump __FreeBSD_version for driver removal.

Remove gone_by_fcp101_dev macro.

Remove orphaned comment.

5 years agoFCP-101: Remove xe(4)
brooks [Fri, 17 May 2019 15:24:44 +0000 (15:24 +0000)]
FCP-101: Remove xe(4)

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove wb(4)
brooks [Fri, 17 May 2019 15:24:34 +0000 (15:24 +0000)]
FCP-101: Remove wb(4)

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove vx(4).
brooks [Fri, 17 May 2019 15:24:26 +0000 (15:24 +0000)]
FCP-101: Remove vx(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove txp(4).
brooks [Fri, 17 May 2019 15:24:17 +0000 (15:24 +0000)]
FCP-101: Remove txp(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove tx(4).
brooks [Fri, 17 May 2019 15:24:08 +0000 (15:24 +0000)]
FCP-101: Remove tx(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove tl(4).
brooks [Fri, 17 May 2019 15:24:00 +0000 (15:24 +0000)]
FCP-101: Remove tl(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove sn(4).
brooks [Fri, 17 May 2019 15:23:52 +0000 (15:23 +0000)]
FCP-101: Remove sn(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove sf(4).
brooks [Fri, 17 May 2019 15:23:43 +0000 (15:23 +0000)]
FCP-101: Remove sf(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove pcn(4).
brooks [Fri, 17 May 2019 15:23:34 +0000 (15:23 +0000)]
FCP-101: Remove pcn(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove fe(4).
brooks [Fri, 17 May 2019 15:23:26 +0000 (15:23 +0000)]
FCP-101: Remove fe(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove ex(4).
brooks [Fri, 17 May 2019 15:23:18 +0000 (15:23 +0000)]
FCP-101: Remove ex(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove ep(4).
brooks [Fri, 17 May 2019 15:23:10 +0000 (15:23 +0000)]
FCP-101: Remove ep(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove ed(4).
brooks [Fri, 17 May 2019 15:23:02 +0000 (15:23 +0000)]
FCP-101: Remove ed(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove de(4).
brooks [Fri, 17 May 2019 15:22:54 +0000 (15:22 +0000)]
FCP-101: Remove de(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove cs(4).
brooks [Fri, 17 May 2019 15:22:45 +0000 (15:22 +0000)]
FCP-101: Remove cs(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: Remove bm(4).
brooks [Fri, 17 May 2019 15:20:51 +0000 (15:20 +0000)]
FCP-101: Remove bm(4).

Relnotes: yes
FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoFCP-101: remove obsolete 10 and 10/100 Ethernet drivers.
brooks [Fri, 17 May 2019 15:19:12 +0000 (15:19 +0000)]
FCP-101: remove obsolete 10 and 10/100 Ethernet drivers.

Initial commit adding comment to ObsoleteFiles.  Each driver will be
removed in a seperate commit to allow later reverts if required.

FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D20230

5 years agoRemove unused define.
tychon [Fri, 17 May 2019 13:08:12 +0000 (13:08 +0000)]
Remove unused define.

Sponsored by: Dell EMC Isilon

5 years agoFix integer overflow in r346386.
tychon [Thu, 16 May 2019 22:27:38 +0000 (22:27 +0000)]
Fix integer overflow in r346386.

Sponsored by: Dell EMC Isilon

5 years agoRemove resolver_qual from DEFINE_IFUNC/DEFINE_UIFUNC macros.
kib [Thu, 16 May 2019 22:20:54 +0000 (22:20 +0000)]
Remove resolver_qual from DEFINE_IFUNC/DEFINE_UIFUNC macros.

In all practical situations, the resolver visibility is static.

Requested by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by: so (emaste)
Differential revision: https://reviews.freebsd.org/D20281

5 years agoFix mergemaster after r347638 and the master.passwd / group move.
brd [Thu, 16 May 2019 21:50:12 +0000 (21:50 +0000)]
Fix mergemaster after r347638 and the master.passwd / group move.

Check the legacy directory and use it instead if present.

Install these first if using beinstall.

UPDATING entry to follow.

Approved by: allanjude (mentor, in person)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20279

5 years agoLinuxKPI: Finalize import of seq_file.
johalun [Thu, 16 May 2019 21:17:18 +0000 (21:17 +0000)]
LinuxKPI: Finalize import of seq_file.

seq_file.h and linux_seq_file.c was imported form ports earlier but
linux_seq_file.c was never compiled in with the module. With this
commit base seq_file will replace ports seq_file and it required a
few modifications to not break functionality and build.

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoLinuxKPI: Add in_task macro.
johalun [Thu, 16 May 2019 21:07:37 +0000 (21:07 +0000)]
LinuxKPI: Add in_task macro.

This patch is part of D19565

Reviewed by: hps, bwidawsk
Approved by: imp (mentor), hps
Obtained from: bwidawsk
MFC after: 1 week

5 years agoreinstate 4GB DMA boundary workarounds for bge and aac
tychon [Thu, 16 May 2019 20:41:28 +0000 (20:41 +0000)]
reinstate 4GB DMA boundary workarounds for bge and aac

Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20277

5 years agoLinuxKPI: Fix build on powerpc/sparc.
johalun [Thu, 16 May 2019 19:32:11 +0000 (19:32 +0000)]
LinuxKPI: Fix build on powerpc/sparc.

Use cmpset instead of testandset in tasklet lock code.

Reviewed by: hps
Approved by: imp (mentor), hps
Obtained from: hps
MFC after: 1 week

5 years agomips: Implement basic pmap_kenter_device, pmap_kremove_device
cem [Thu, 16 May 2019 19:10:48 +0000 (19:10 +0000)]
mips: Implement basic pmap_kenter_device, pmap_kremove_device

Unbreak mips.BERI_DE4_SDROOT build, which uses device xdma. Device xdma
depends on the pmap_kenter_device APIs.

Reported by: tinderbox (local)
Sponsored by: Dell EMC Isilon

5 years agoFix hostname to be returned in an ICMPv6 NI Reply message defined
hrs [Thu, 16 May 2019 19:09:41 +0000 (19:09 +0000)]
Fix hostname to be returned in an ICMPv6 NI Reply message defined
in RFC 4620, ICMPv6 Node Information Queries.  A vnet jail with an
IPv6 address sent a hostname of the host environment, not the
jail, even if another hostname was set to the jail.

This change can be tested by the following commands:

 # ifconfig epair0 create
 # jail -c -n j1 vnet host.hostname=vnetjail path=/ persist
 # ifconfig epair0b vnet j1
 # ifconfig epair0a inet6 -ifdisabled auto_linklocal up
 # jexec j1 ifconfig epair0b inet6 -ifdisabled auto_linklocal up
 # ping6 -w ff02::1%epair0a

Differential Revision: https://reviews.freebsd.org/D20207
MFC after: 1 week

5 years agoAnnounce OpenBSD 6.5.
roberto [Thu, 16 May 2019 18:54:20 +0000 (18:54 +0000)]
Announce OpenBSD 6.5.

5 years agoLinuxKPI: Updates to tasklets for Linux 5.0.
johalun [Thu, 16 May 2019 18:03:08 +0000 (18:03 +0000)]
LinuxKPI: Updates to tasklets for Linux 5.0.

DRM drivers expect tasklets to have a counter for enable/disable calls.
Also, add a few more tasklet locking functions.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoLinuxKPI: Add group_leader member to struct task_struct.
johalun [Thu, 16 May 2019 17:53:36 +0000 (17:53 +0000)]
LinuxKPI: Add group_leader member to struct task_struct.

Assign self as group leader at creation to act as the only member of a
new process group.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoLinuxKPI: Update access_ok macro for v5.0.
johalun [Thu, 16 May 2019 17:44:17 +0000 (17:44 +0000)]
LinuxKPI: Update access_ok macro for v5.0.

Check LINUXKPI_VERSION macro for backwards compatibility.
It's recommended to update any drivers that depend on the older KPI
so we can deprecate < 5.0 code as we update to newer Linux version.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoAllow loading the same DMA address multiple times without any prior
tychon [Thu, 16 May 2019 17:41:16 +0000 (17:41 +0000)]
Allow loading the same DMA address multiple times without any prior
unload for the LinuxKPI.

Reviewed by: kib, zeising
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20181

5 years agoxdma(4): Fix invalid pointer use (breaks arm.SOCFPGA build)
cem [Thu, 16 May 2019 17:34:36 +0000 (17:34 +0000)]
xdma(4): Fix invalid pointer use (breaks arm.SOCFPGA build)

In xdma_handle_mem_node(), vmem_size_t and vmem_addr_t pointers were passed to
an FDT API that emits u_long values to the output parameter pointer.  This
broke on systems with both xdma and 32-bit vmem size/addr types (SOCFPGA).

Reported by: tinderbox
Sponsored by: Dell EMC Isilon

5 years agoarm64: Add the rename interpreter path for compat32 ld-elf
jhibbits [Thu, 16 May 2019 17:04:29 +0000 (17:04 +0000)]
arm64: Add the rename interpreter path for compat32 ld-elf

Let arm64 and arm32 dynamic binaries coexist.  Match all other compat32
archs.

Reviewed by: manu
Sponsored by: Juniper Networks, Inc

5 years agoFCP-101: ae(4) is sufficently popular to be moved to the keep list.
brooks [Thu, 16 May 2019 15:22:17 +0000 (15:22 +0000)]
FCP-101: ae(4) is sufficently popular to be moved to the keep list.

5 years agoamd64 pmap: sysctl vm.pmap.pcid_save_cnt should be read-only.
kib [Thu, 16 May 2019 14:33:32 +0000 (14:33 +0000)]
amd64 pmap: sysctl vm.pmap.pcid_save_cnt should be read-only.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoamd64 pmap: Add tunable vm.pmap.di_locked to set DI mode.
kib [Thu, 16 May 2019 14:29:09 +0000 (14:29 +0000)]
amd64 pmap: Add tunable vm.pmap.di_locked to set DI mode.

This is done mostly for debugging in field.  Also added the sysctl of
the same name to report used mode.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

5 years agoamd64 pmap: Rename DI functions.
kib [Thu, 16 May 2019 13:40:54 +0000 (13:40 +0000)]
amd64 pmap: Rename DI functions.

pmap_delayed_invl_started -> pmap_delayed_invl_start
pmap_delayed_invl_finished -> pmap_delayed_invl_finish

Requested by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 month

5 years agoamd64 pmap: rework delayed invalidation, removing global mutex.
kib [Thu, 16 May 2019 13:28:48 +0000 (13:28 +0000)]
amd64 pmap: rework delayed invalidation, removing global mutex.

For machines having cmpxcgh16b instruction, i.e. everything but very
early Athlons, provide lockless implementation of delayed
invalidation.

The implementation maintains lock-less single-linked list with the
trick from the T.L. Harris article about volatile mark of the elements
being removed. Double-CAS is used to atomically update both link and
generation.  New thread starting DI appends itself to the end of the
queue, setting the generation to the generation of the last element
+1.  On DI finish, thread donates its generation to the previous
element.  The generation of the fake head of the list is the last
passed DI generation.  Basically, the implementation is a queued
spinlock but without spinlock.

Many thanks both to Peter Holm and Mark Johnson for keeping with me
while I produced intermediate versions of the patch.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 month
MFC note: td_md.md_invl_gen should go to the end of struct thread
Differential revision: https://reviews.freebsd.org/D19630

5 years agosubr_turnstile: Extract some common code to a helper.
kib [Thu, 16 May 2019 13:17:57 +0000 (13:17 +0000)]
subr_turnstile: Extract some common  code to a helper.

Code walks the list of contested turnstiles to calculate the priority
to unlend.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agortld_malloc.c: cleanup morepages().
kib [Thu, 16 May 2019 13:13:33 +0000 (13:13 +0000)]
rtld_malloc.c: cleanup morepages().

Use roundup2() and rounddown2() instead of inlining them.
Get rid of the fd local variable, use literal -1 for the mmap argument.
Use MAP_FAILED as mmap(2) failure indicator.
After that, apply some style.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoRemove more dead definitions from rtld_malloc.c after r347019.
kib [Thu, 16 May 2019 13:07:26 +0000 (13:07 +0000)]
Remove more dead definitions from rtld_malloc.c after r347019.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoRevert r347582 for now.
markj [Thu, 16 May 2019 13:04:26 +0000 (13:04 +0000)]
Revert r347582 for now.

The inp lock still needs to be dropped when calling into the driver ioctl
handler, as some drivers expect to be able to sleep.

Reported by: kib

5 years agoimgact_elf.c: Add comment explaining the malloc/VOP_UNLOCK() dance
kib [Thu, 16 May 2019 13:03:54 +0000 (13:03 +0000)]
imgact_elf.c: Add comment explaining the malloc/VOP_UNLOCK() dance
from r347148.

Requested by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoarm64: bzero buffer for ucontext in freebsd32_swapcontext().
kib [Thu, 16 May 2019 13:00:35 +0000 (13:00 +0000)]
arm64: bzero buffer for ucontext in freebsd32_swapcontext().

This change is the same as r340994 for amd64.

PR: 237922
Submitted by: Young <yangx92@hotmail.com>
MFC after: 3 days

5 years agoThe "apropos ''" command no longer works; change development(7)
trasz [Thu, 16 May 2019 09:49:19 +0000 (09:49 +0000)]
The "apropos ''" command no longer works; change development(7)
to suggest "apropos ." instead.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agodb show thread: avoid overflow in tick conversion
rlibby [Thu, 16 May 2019 05:29:54 +0000 (05:29 +0000)]
db show thread: avoid overflow in tick conversion

The previous calculations for displaying the time since last switch
easily overflowed, after less than 36 min for hz=1000.  Now overflow
takes 2000 times longer (as long as ticks takes to wrap).

Reviewed by: cem, markj
Sponsored by: Dell EMC Isilon
Differential revision: https://reviews.freebsd.org/D20273

5 years agoiommu static analysis cleanup
rlibby [Thu, 16 May 2019 04:24:08 +0000 (04:24 +0000)]
iommu static analysis cleanup

A static analyzer complained about a couple instances of checking a
variable against NULL after already having dereferenced it.
 - dmar_gas_alloc_region: remove the tautological NULL checks
 - dmar_release_resources / dmar_fini_fault_log: don't deref unit->regs
   unless initialized.

And while here, fix an inverted initialization check in dmar_fini_qi.

Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential revision: https://reviews.freebsd.org/D20263

5 years agoThe driver list prints "(null)" for the NDIS driver when -h (help) or
cy [Thu, 16 May 2019 02:41:25 +0000 (02:41 +0000)]
The driver list prints "(null)" for the NDIS driver when -h (help) or
an unknown switch is passed outputting the command usage. This is
because the NDIS driver is uninitialized when usage help is printed.
To resolve this we initialize the driver prior to the possibility of
printing the usage help message.

Obtained from: The wpa_supplicant port
MFC after: 1 week

5 years agoipsec tests: Skip if ipsec.ko is not loaded
kp [Thu, 16 May 2019 02:18:57 +0000 (02:18 +0000)]
ipsec tests: Skip if ipsec.ko is not loaded

As of r347410 IPSec is no longer built into GENERIC. The ipsec.ko module must
be loaded before we can execute the IPSec tests.

Check this, and skip the tests if IPSec is not available.

5 years agolibbe(3): Descend into children of datasets w/ mountpoint=none
kevans [Thu, 16 May 2019 02:11:33 +0000 (02:11 +0000)]
libbe(3): Descend into children of datasets w/ mountpoint=none

These datasets will generally be canmount=noauto,mountpoint=none (e.g.
zroot/var) but have children that may need to be mounted. Instead of
skipping that segment for no good reason, descend.

Submitted by: Wes Maag
Reported by: Wes Maag
MFC after: 3 days

5 years agox86: Correctly identify bhyve hypervisor
cem [Thu, 16 May 2019 01:32:54 +0000 (01:32 +0000)]
x86: Correctly identify bhyve hypervisor

Spotted after a similar report by Olivier Cochard-LabbĂ©.

Sponsored by: Dell EMC Isilon

5 years agoMove master.passwd and group to lib/libc/gen/
brd [Thu, 16 May 2019 01:09:13 +0000 (01:09 +0000)]
Move master.passwd and group to lib/libc/gen/

libc was picked as the destination location for these because of the syscalls
that use these files as the lowest level place they are referenced.

Approved by: will (mentor), rgrimes, manu
Differential Revision: https://reviews.freebsd.org/D16728

5 years agox86: spell vpxor %zmm0 as vpxord
rlibby [Wed, 15 May 2019 18:13:43 +0000 (18:13 +0000)]
x86: spell vpxor %zmm0 as vpxord

Fix gcc/gas amd64 & i386 build after r347566.

Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20264

5 years agoLinuxKPI: Add helper macros IS_ALIGNED and DIV_ROUND_DOWN_ULL.
johalun [Wed, 15 May 2019 17:57:06 +0000 (17:57 +0000)]
LinuxKPI: Add helper macros IS_ALIGNED and DIV_ROUND_DOWN_ULL.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoProperly announce MD_CLEAR.
kib [Wed, 15 May 2019 17:55:41 +0000 (17:55 +0000)]
Properly announce MD_CLEAR.

Submitted by: Petr Lampa <lampa@fit.vutbr.cz>
MFC after: 3 days

5 years agoLinuxKPI: Move {lower|upper}_32_bits macros from port to base.
johalun [Wed, 15 May 2019 17:48:11 +0000 (17:48 +0000)]
LinuxKPI: Move {lower|upper}_32_bits macros from port to base.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoLinuxKPI: Include asm/atomic-long.h from atomic.h.
johalun [Wed, 15 May 2019 17:44:25 +0000 (17:44 +0000)]
LinuxKPI: Include asm/atomic-long.h from atomic.h.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoLinuxKPI: Add get_random_u32 function.
johalun [Wed, 15 May 2019 17:32:00 +0000 (17:32 +0000)]
LinuxKPI: Add get_random_u32 function.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoLinuxKPI: Update user_access_begin for Linux v5.0.
johalun [Wed, 15 May 2019 17:04:12 +0000 (17:04 +0000)]
LinuxKPI: Update user_access_begin for Linux v5.0.

Check the new LINUXKPI_VERSION macro for backwards compatibility.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoLinuxKPI: Expand ktime functionality.
johalun [Wed, 15 May 2019 16:59:04 +0000 (16:59 +0000)]
LinuxKPI: Expand ktime functionality.

Also, make ktime_get_raw call getnanouptime instead of getnanotime
to match (the correct) ktime_get_raw_ns.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years ago[ar71xx_gpio] Add AR9341/AR9342 to the list of chips for programming function/output...
adrian [Wed, 15 May 2019 16:51:08 +0000 (16:51 +0000)]
[ar71xx_gpio] Add AR9341/AR9342 to the list of chips for programming function/output enable.

This is reqired to use the gpiofunc behaviour for configuring GPIO
pins at boot time.

Submitted by: <yamori813@yahoo.co.jp>
Differential Revision: https://reviews.freebsd.org/D20170

5 years agoAdd small EXAMPLE section to bsearch.3.
bcr [Wed, 15 May 2019 15:54:27 +0000 (15:54 +0000)]
Add small EXAMPLE section to bsearch.3.

Submitted by: fernape (via Phabricator)
Reviewed by: bcr, jilles, dab
Approved by: bcr (man pages), jilles (src)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D19902

5 years agoAdd more obsolete files.
antoine [Wed, 15 May 2019 15:11:49 +0000 (15:11 +0000)]
Add more obsolete files.

5 years agoReplace the leap-seconds file in r347488 from USNO with a
delphij [Wed, 15 May 2019 03:39:27 +0000 (03:39 +0000)]
Replace the leap-seconds file in r347488 from USNO with a
leap-seconds file from NIST at ftp://ftp.nist.gov/pub/time.

Future updates should use the NIST version of file, available
at ftp://ftp.nist.gov/pub/time/leap-seconds.list .

Requested by:   ian@
Obtained from:  ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800
MFC after:      3 days

5 years agoLinuxKPI: Add prepare to pm_ops and bump FreeBSD version.
johalun [Tue, 14 May 2019 23:50:46 +0000 (23:50 +0000)]
LinuxKPI: Add prepare to pm_ops and bump FreeBSD version.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoLinuxKPI: Add vm_fault_t type.
johalun [Tue, 14 May 2019 23:32:02 +0000 (23:32 +0000)]
LinuxKPI: Add vm_fault_t type.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoLinuxKPI: Add context member to ww_mutex and bump FreeBSD version.
johalun [Tue, 14 May 2019 23:21:20 +0000 (23:21 +0000)]
LinuxKPI: Add context member to ww_mutex and bump FreeBSD version.

This patch is part of https://reviews.freebsd.org/D19565.

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoLinuxKPI: Let del_timer return a value to match Linux.
johalun [Tue, 14 May 2019 23:12:14 +0000 (23:12 +0000)]
LinuxKPI: Let del_timer return a value to match Linux.

This patch is part of https://reviews.freebsd.org/D19565.

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

5 years agoReplace global list for grouplist with list(s) for each exportlist element.
rmacklem [Tue, 14 May 2019 22:00:47 +0000 (22:00 +0000)]
Replace global list for grouplist with list(s) for each exportlist element.

In mountd.c, the grouplist structures are linked into a single global
linked list headed by "grphead". The only use of this linked list is
to free all list elements when the exportlist elements are also all being
free'd at the time the exports are being reloaded.
This patch replaces this one global linked list head with a list head in
each exportlist structure, where the grouplist elements for that exported
file system are linked.
The only change is that now the grouplist elements are free'd with the
associated exportlist element as they are free'd instead of all grouplist
elements being free'd after the exportlist elements are free'd. This
change should have no effect in practice.
This is being done, since a future patch that will add a "-I" option for
incrementally updating the exports in the kernel needs to know which
grouplist elements are associated with each exported file system and
having them linked into a list headed by the exportlist element does that.

MFC after: 1 month

5 years agoClose some races in multicast socket option handling.
markj [Tue, 14 May 2019 21:30:55 +0000 (21:30 +0000)]
Close some races in multicast socket option handling.

r333175 converted the global multicast lock to a sleepable sx lock,
so the lock order with respect to the (non-sleepable) inp lock changed.
To handle this, r333175 and r333505 added code to drop the inp lock,
but this opened races that could leave multicast group description
structures in an inconsistent state.  This change fixes the problem by
simply acquiring the global lock sooner.  Along the way, this fixes
some LORs and bogus error handling introduced in r333175, and commits
some related cleanup.

Reported by: syzbot+ba7c4943547e0604faca@syzkaller.appspotmail.com
Reported by: syzbot+1b803796ab94d11a46f9@syzkaller.appspotmail.com
Reviewed by: ae
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20070

5 years agoFix handling of r10 in Linux ptrace(2). This fixes decoding
trasz [Tue, 14 May 2019 20:59:44 +0000 (20:59 +0000)]
Fix handling of r10 in Linux ptrace(2).  This fixes decoding
of the 'flags' argument to mmap(2) with Linux strace(1).

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

5 years agotuntap: Defer clearing if_softc until after if_detach
kevans [Tue, 14 May 2019 20:32:29 +0000 (20:32 +0000)]
tuntap: Defer clearing if_softc until after if_detach

r346670 added an sx to close a race between the ifioctl handler and
interface destruction. Unfortunately, it clears if_softc immediately after
the interface is closed, but before if_detach has been invoked.

Any time before detachment, an interface that's part of a bridge may still
receive traffic that's pushed through tunstart/tunstart_l2 and promptly
lead to a panic because if_softc is now NULL.

Fix it by deferring the clearing of if_softc until after the interface has
detached and thus been removed from the bridge. if_softc still gets cleared
in case another thread has already entered the ioctl handler before it's
replaced with ifdead_ioctl.

Reported by: markj
MFC after: 3 days