]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoAvoid copying a struct stat for acl_from_stat() calls.
markj [Thu, 1 Nov 2018 17:45:29 +0000 (17:45 +0000)]
Avoid copying a struct stat for acl_from_stat() calls.

CID: 1375584
MFC after: 2 weeks

5 years agoAdd the ARMv8.3 SCTLR_EL1 fields.
andrew [Thu, 1 Nov 2018 17:43:28 +0000 (17:43 +0000)]
Add the ARMv8.3 SCTLR_EL1 fields.

While here tag which architecture release fields were added and remove a
field that only existed in very early releases of the ARMv8 spec.

Sponsored by: DARPA, AFRL

5 years agoixl/iavf(4): Update remaining references of "num_queues" to "num_rx_queues"
erj [Thu, 1 Nov 2018 17:29:14 +0000 (17:29 +0000)]
ixl/iavf(4): Update remaining references of "num_queues" to "num_rx_queues"

This should fix a build issue when "options RSS" is set.

Reported by: bz@
Sponsored by: Intel Corporation

5 years agocarpstats are the last virtualised variable in the file and end up at the
bz [Thu, 1 Nov 2018 17:26:18 +0000 (17:26 +0000)]
carpstats are the last virtualised variable in the file and end up at the
end of the vnet_set.  The generated code uses an absolute relocation at
one byte beyond the end of the carpstats array.  This means the relocation
for the vnet does not happen for carpstats initialisation and as a result
the kernel panics on module load.

This problem has only been observed with carp and only on i386.
We considered various possible solutions including using linker scripts
to add padding to all kernel modules for pcpu and vnet sections.

While the symbols (by chance) stay in the order of appearance in the file
adding an unused non-file-local variable at the end of the file will extend
the size of set_vnet and hence make the absolute relocation for carpstats
work (think of this as a single-module set_vnet padding).

This is a (tmporary) hack.  It is the least intrusive one as we need a
timely solution for the upcoming release.  We will revisit the problem in
HEAD.  For a lot more information and the possible alternate solutions
please see the PR and the references therein.

PR: 230857
MFC after: 3 days

5 years agoAdd the ARMv8.3 HCR_EL2 register fields.
andrew [Thu, 1 Nov 2018 17:05:10 +0000 (17:05 +0000)]
Add the ARMv8.3 HCR_EL2 register fields.

MFC after: 1 month
Sponsored by: DARPA, AFRL

5 years agoRemove redundant checks for a NULL lbgroup table.
markj [Thu, 1 Nov 2018 15:52:49 +0000 (15:52 +0000)]
Remove redundant checks for a NULL lbgroup table.

No functional change intended.

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

5 years agoImprove style in in_pcbinslbgrouphash() and related subroutines.
markj [Thu, 1 Nov 2018 15:51:49 +0000 (15:51 +0000)]
Improve style in in_pcbinslbgrouphash() and related subroutines.

No functional change intended.

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

5 years agoCMSG_DATA(3): Use consistent variable names
0mp [Thu, 1 Nov 2018 15:40:57 +0000 (15:40 +0000)]
CMSG_DATA(3): Use consistent variable names

The description of CMSG_FIRSTHDR used two variables (mhdr and msg) to
reference the same thing. Use msghdr consistency across the manual page
instead.

Reviewed by: bcr
Approved by: krion (mentor, implicit), mat (mentor, implicit)
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D17804

5 years agolinuxkpi: Add GFP flags needed for ttm drivers
bwidawsk [Thu, 1 Nov 2018 15:30:01 +0000 (15:30 +0000)]
linuxkpi: Add GFP flags needed for ttm drivers

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Requested by: bwidawsk
MFC after: 3 days
Approved by: emaste (mentor)

5 years agoFix NFS client vnode locking to avoid a crash during forced dismount.
rmacklem [Thu, 1 Nov 2018 15:27:22 +0000 (15:27 +0000)]
Fix NFS client vnode locking to avoid a crash during forced dismount.

A crash was reported where the crash occurred in nfs_advlock() when the
NFS_ISV4(vp) macro was being executed. This was caused by the vnode
being VI_DOOMED due to a forced dismount in progress.
This patch fixes the problem by locking the vnode before executing the
NFS_ISV4() macro.

Tested by: rlibby
PR: 232673
Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D17757

5 years agoRun unbound-anchor when root.key is empty, not just when it is absent.
des [Thu, 1 Nov 2018 14:24:12 +0000 (14:24 +0000)]
Run unbound-anchor when root.key is empty, not just when it is absent.

PR: 232555
Submitted by: Ari Suutari <ari@stonepile.fi>
MFC after: 3 days

5 years agolibbe(3): Don't promote non-cloned BEs
kevans [Thu, 1 Nov 2018 14:00:56 +0000 (14:00 +0000)]
libbe(3): Don't promote non-cloned BEs

Most easily reproducible by attempting to activate the currently activated
BE, one would get a "not a cloned filesystem" error instead of success or a
sane message.

PR: 232488
MFC after: 3 days

5 years agolibsa: tftp should use calloc
tsoome [Thu, 1 Nov 2018 13:29:55 +0000 (13:29 +0000)]
libsa: tftp should use calloc

instead of malloc() memset(), use calloc().

5 years agolibsa: tftp should not read past file end
tsoome [Thu, 1 Nov 2018 13:12:05 +0000 (13:12 +0000)]
libsa: tftp should not read past file end

When we have the file size via tsize option, use it to make sure we
will not attempt to read past file end.

5 years agoRemove debug code which slipped in accidently.
tuexen [Thu, 1 Nov 2018 11:41:40 +0000 (11:41 +0000)]
Remove debug code which slipped in accidently.

MFC after: 4 weeks
X-MFC with: r339989
Sponsored by: Netflix, Inc.

5 years agomount_smbfs(8): Add the STANDARDS and HISTORY sections
0mp [Thu, 1 Nov 2018 11:37:19 +0000 (11:37 +0000)]
mount_smbfs(8): Add the STANDARDS and HISTORY sections

- Document that mount_smbfs(8) only supports SMB1 and that SMB2 and SMB3
  are not supported at the moment. Suggest users to browse ports for
  software compatible with newer versions of the protocol.
- Copy supported servers list from README.
- Add a SEE ALSO section and reference the chapter about Samba in the
  FreeBSD Handbook.
- Add a HISTORY section.
- Style changes:
  - Use Dq instead of Em in the EXAMPLES section.
  - Mark command modifiers with Cm.

Reviewed by: bcr
Approved by: krion (mentor, implicit), mat (mentor, implicit)
MFC after: 1 week
Sponsored by:   Bally Wulff Games & Entertainment GmbH
Differential Revision: https://reviews.freebsd.org/D17798

5 years agoImprove a comment to refer to the actual sections in the TCP
tuexen [Thu, 1 Nov 2018 11:35:28 +0000 (11:35 +0000)]
Improve a comment to refer to the actual sections in the TCP
specification for the comparisons made.
Thanks to lstewart@ for the suggestion.

MFC after: 4 weeks
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D17595

5 years agoUse the correct offsets for the trap frame in fork_trampoline.
andrew [Thu, 1 Nov 2018 10:25:22 +0000 (10:25 +0000)]
Use the correct offsets for the trap frame in fork_trampoline.

Sponsored by: DARPA, AFRL

5 years agoFix markup issues and add references to updated RFCs.
des [Thu, 1 Nov 2018 08:17:27 +0000 (08:17 +0000)]
Fix markup issues and add references to updated RFCs.

MFC after: 3 days

5 years agoIn preparation for adding inode check-hashes, convert the clri(8)
mckusick [Thu, 1 Nov 2018 03:38:57 +0000 (03:38 +0000)]
In preparation for adding inode check-hashes, convert the clri(8)
program to use the libufs library interface. No functional change
(as for now the libufs library does not do inode check-hashes).

Reviewed by:  kib
Sponsored by: Netflix

5 years agoAdd pci_early function to detect Intel stolen memory.
kib [Wed, 31 Oct 2018 23:17:00 +0000 (23:17 +0000)]
Add pci_early function to detect Intel stolen memory.

On some Intel devices BIOS does not properly reserve memory (called
"stolen memory") for the GPU.  If the stolen memory is claimed by the
OS, functions that depend on stolen memory (like frame buffer
compression) can't be used.

A function called pci_early_quirks that is called before the virtual
memory system is started was added. In Linux, this PCI early quirks
function iterates through all PCI slots to check for any device that
require quirks.  While this more generic solution is preferable I only
ported the Intel graphics specific parts because I think my
implementation would be too similar to Linux GPL'd solution after
looking at the Linux code too much.

The code regarding Intel graphics stolen memory was ported from
Linux. In the case of Intel graphics stolen memory this
pci_early_quirks will read the stolen memory base and size from north
bridge registers.  The values are stored in global variables that is
later read by linuxkpi_gplv2. Linuxkpi stores these values in a
Linux-specific structure that is read by the drm driver.

Relevant linuxkpi code is here:
https://github.com/FreeBSDDesktop/kms-drm/blob/drm-v4.16/linuxkpi/gplv2/src/linux_compat.c#L37

For now, only amd64 arch is suppor ted since that is the only arch
supported by the new drm drivers. I was told that Intel GPUs are
always located on 0:2:0 so these values are hard coded for now.

Note that the structure and early execution of the detection code is
not required in its current form, but we expect that the code will be
added shortly which fixes the potential BIOS bugs by reserving the
stolen range in phys_avail[].  This must be done as early as possible
to avoid conflicts with the potential usage of the memory in kernel.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Reviewed by: bwidawsk, imp
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16719
Differential revision: https://reviews.freebsd.org/D17775

5 years agoi386/MINIMAL: VERBOSE_SYSINIT=0 for consistency
kevans [Wed, 31 Oct 2018 22:55:43 +0000 (22:55 +0000)]
i386/MINIMAL: VERBOSE_SYSINIT=0 for consistency

MFC after: never

5 years agoCompile in VERBOSE_SYSINIT support by default, remain silent by default
kevans [Wed, 31 Oct 2018 22:38:19 +0000 (22:38 +0000)]
Compile in VERBOSE_SYSINIT support by default, remain silent by default

The loader tunable 'debug.verbose_sysinit' may be used to toggle verbosity.
This is added to the debugging section of these kernconfs to be turned off
in stable branches for clarity of intent.

MFC after: never

5 years agorescue: Add bectl(8)
kevans [Wed, 31 Oct 2018 20:42:18 +0000 (20:42 +0000)]
rescue: Add bectl(8)

Requested by: kevans, Shawn Webb
MFC after: 3 days

5 years agoAdd new rc keywords: enable, disable, delete
dteske [Wed, 31 Oct 2018 20:37:12 +0000 (20:37 +0000)]
Add new rc keywords: enable, disable, delete

This adds new keywords to rc/service to enable/disable a service's
rc.conf(5) variable and "delete" to remove the variable.

When the "service_delete_empty" variable in rc.conf(5) is set to "YES"
(default is "NO") an rc.conf.d file (in /etc/ or /usr/local/etc) is
deleted if empty after modification using "service $foo delete".

Submitted by: lme (modified)
Reviewed by: 0mp (previous version), lme, bcr
Relnotes: yes
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/D17113

5 years agoRemove unnecessary include from libstand.
glebius [Wed, 31 Oct 2018 19:59:20 +0000 (19:59 +0000)]
Remove unnecessary include from libstand.

5 years agoDefine QMD_SAVELINK() only for QUEUE_MACRO_DEBUG_TRASH case. Otherwise
glebius [Wed, 31 Oct 2018 19:37:11 +0000 (19:37 +0000)]
Define QMD_SAVELINK() only for QUEUE_MACRO_DEBUG_TRASH case. Otherwise
with QUEUE_MACRO_DEBUG_TRACE compilation fails due to unused variable.

5 years agocxgbe(4): Add rate limiting support for UDP.
np [Wed, 31 Oct 2018 19:19:13 +0000 (19:19 +0000)]
cxgbe(4): Add rate limiting support for UDP.

MFC after: 1 month
Sponsored by: Chelsio Communications

5 years agocxgbe(4): Report a reasonable non-zero if_hw_tsomaxsegsize to the
np [Wed, 31 Oct 2018 18:30:17 +0000 (18:30 +0000)]
cxgbe(4): Report a reasonable non-zero if_hw_tsomaxsegsize to the
kernel.

This reverts an accidental change that snuck in with r339628.

Sponsored by: Chelsio Communications

5 years agoAvoid binutils test in cleandir/obj stages
emaste [Wed, 31 Oct 2018 18:08:12 +0000 (18:08 +0000)]
Avoid binutils test in cleandir/obj stages

Further to r339946 skip the .error case for lack of in-tree binutils
support when we haven't set the toolchain feature variables.

Discussed with: arichardson
Sponsored by: The FreeBSD Foundation

5 years agops(1): Pet mandoc and igor
0mp [Wed, 31 Oct 2018 17:47:08 +0000 (17:47 +0000)]
ps(1): Pet mandoc and igor

- Use Xr to reference other manual pages.
- Reference execve(2) instead of exec(2) as exec(2) does not exist.
- Remove the deprecated "Tn" macro.
- Improve the formatting of the etime description.

Reviewed by: bcr
Approved by: krion (mentor, implicit), mat (mentor, implicit)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D17780

5 years agoAlways set the MP_QUIRK_CPULIST quirk under ACPI. This needs a run time
andrew [Wed, 31 Oct 2018 17:41:53 +0000 (17:41 +0000)]
Always set the MP_QUIRK_CPULIST quirk under ACPI. This needs a run time
check to only set it for emulators as the CPU list may be changed when
the emulator starts. Until this is working just always set it.

Sponsored by: DARPA, AFRL

5 years agofreebsd-update: add a progress report for the "fetching files..."
cem [Wed, 31 Oct 2018 17:37:54 +0000 (17:37 +0000)]
freebsd-update: add a progress report for the "fetching files..."

After patching step is done.

PR: 232857
Submitted by: mat@
MFC after: a week

5 years agoloader: issue edd probe before legacy ah=08 and detect no media
tsoome [Wed, 31 Oct 2018 16:42:40 +0000 (16:42 +0000)]
loader: issue edd probe before legacy ah=08 and detect no media

while probing for drives, use int13 extended info before standard one and
provide workaround for case we are not getting needed information in case
of floppy drive.

In case of INT13 errors, there are (at least) 3 error codes appearing in case
of missin media - 20h, 31h and 80h. Flag the no media and do not print an
error.

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

5 years agoReformat syscalls.master for better readability.
brooks [Wed, 31 Oct 2018 16:17:45 +0000 (16:17 +0000)]
Reformat syscalls.master for better readability.

This takes advantage of two recents changes to makesyscalls.sh:
r328598: Permit a range of syscall numbers for UNIMPL
r339624: Remove the need for backslashes in syscalls.master

Syscall declerations are now split across multiple lines with the
syscall name and variables each on seperate lines (with an exception for
syscalls taking no arguments.)

Reviewed by: imp
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17706

5 years agops(1): Add a standard exit status section
0mp [Wed, 31 Oct 2018 16:10:04 +0000 (16:10 +0000)]
ps(1): Add a standard exit status section

Reviewed by: bcr, eadler
Approved by: krion (mentor)
MFC after:      3 days
Differential Revision: https://reviews.freebsd.org/D17146

5 years agodtrace(1): remove reference to dtruss that was removed from base
yuripv [Wed, 31 Oct 2018 15:29:26 +0000 (15:29 +0000)]
dtrace(1): remove reference to dtruss that was removed from base
system in r300226.

PR: 211618
Reviewed by: gnn, markj, 0mp
Approved by: kib (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17762

5 years agousr.bin/sed/tests: fix one of the regression test cases by adding its
yuripv [Wed, 31 Oct 2018 15:04:41 +0000 (15:04 +0000)]
usr.bin/sed/tests: fix one of the regression test cases by adding its
results file to the build.

Reviewed by: kevans
Approved by: kib (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17776

5 years agoAdd __used to __CTOR_LIST__ and __DTOR_LIST__
emaste [Wed, 31 Oct 2018 14:19:58 +0000 (14:19 +0000)]
Add __used to __CTOR_LIST__ and __DTOR_LIST__

Enabling BSD_CRTBEGIN on amd64 resulted in
error: unused variable '__CTOR_LIST__'.

__CTOR_LIST__ is indeed unused in crtbegin.c; it marks the beginning of
the .ctors array and is used in crtend.c.  Annotate __DTOR_LIST__ as
well for consistency.

Discussed with: andrew
MFC with: r339738
Sponsored by: The FreeBSD Foundation

5 years agotpm(4): Add the STANDARDS and HISTORY sections
0mp [Wed, 31 Oct 2018 12:53:58 +0000 (12:53 +0000)]
tpm(4): Add the STANDARDS and HISTORY sections

Also, link to the homepage of the BSSSD project, which developed the
original driver.

Reviewed by: bcr, kevans
Approved by: krion (mentor, implicit), mat (mentor, implicit)
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D17608

5 years agoUse pmap_invalidate_all rather than invalidating 512 level 2 entries in
andrew [Wed, 31 Oct 2018 12:00:35 +0000 (12:00 +0000)]
Use pmap_invalidate_all rather than invalidating 512 level 2 entries in
the early pmap_mapbios/unmapbios code. It is even worse when there are
multiple L2 entries to handle as we would need to iterate over all pages.

Sponsored by: DARPA, AFRL

5 years agoDon't run cc --version during cleandir/obj stages
arichardson [Wed, 31 Oct 2018 10:45:28 +0000 (10:45 +0000)]
Don't run cc --version during cleandir/obj stages

This will no work when there is no cc in $PATH (which is the case before the
cross-tools stage once we no longer inherit $PATH in $WMAKE).
The variables set by bsd.compiler.mk/bsd.linker.mk are not needed in these
stages so this avoids a little bit of makefile parsing.

Reviewed By: emaste
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D16814

5 years agoRemove function prototypes for functions removed in r339943.
andrew [Wed, 31 Oct 2018 10:30:19 +0000 (10:30 +0000)]
Remove function prototypes for functions removed in r339943.

Sponsored by: DARPA, AFRL

5 years agoFix some style(9) issues in the arm64 pmap_mapbios/unmapbios. Split lines
andrew [Wed, 31 Oct 2018 09:39:38 +0000 (09:39 +0000)]
Fix some style(9) issues in the arm64 pmap_mapbios/unmapbios. Split lines
when they are too long.

Sponsored by: DARPA, AFRL

5 years agoRemove the unused arm64_cpu driver.
andrew [Wed, 31 Oct 2018 09:25:17 +0000 (09:25 +0000)]
Remove the unused arm64_cpu driver.

This was previously used for CPU initilisation, however this hasn't been
the case in a long time.

Sponsored by: DARPA, AFRL

5 years agoIn preparation for adding inode check-hashes, change the fsck_ffs
mckusick [Wed, 31 Oct 2018 05:17:53 +0000 (05:17 +0000)]
In preparation for adding inode check-hashes, change the fsck_ffs
inodirty() function to have a pointer to the inode being dirtied.
No functional change (as for now the parameter is ununsed).

Sponsored by: Netflix

5 years agoMerge cases with upper block.
araujo [Wed, 31 Oct 2018 01:27:44 +0000 (01:27 +0000)]
Merge cases with upper block.
This is a cosmetic change only to simplify code.

Reported by: anish
Sponsored by: iXsystems Inc.

5 years agoRevert r336984.
markj [Tue, 30 Oct 2018 22:40:40 +0000 (22:40 +0000)]
Revert r336984.

It appears to be responsible for random segfaults observed when lots
of paging activity is taking place, but the root cause is not yet
understood.

Requested by: alc
MFC after: now

5 years agoFix mips build after r339931.
bz [Tue, 30 Oct 2018 21:35:56 +0000 (21:35 +0000)]
Fix mips build after r339931.
I erroneously thought that it was two 64bit platforms which use link_elf_obj.c.

PR: 228854
Reported by: ci.f.o.
MFC after: 3 days
X-MFC with: r339931
Pointyhat to: bz

5 years agoAs a follow-up to r339930 and various reports implement logging in case
bz [Tue, 30 Oct 2018 20:51:03 +0000 (20:51 +0000)]
As a follow-up to r339930 and various reports implement logging in case
we fail during module load because the pcpu or vnet module sections are
full.  We did return a proper error but not leaving any indication to
the user as to what the actual problem was.

Even worse, on 12/13 currently we are seeing an unrelated error (ENOSYS
instead of ENOSPC, which gets skipped over in kern_linker.c) to be
printed which made problem diagnostics even harder.

PR: 228854
MFC after: 3 days

5 years agoWith more excessive use of modules, more kernel parts working with
bz [Tue, 30 Oct 2018 20:45:15 +0000 (20:45 +0000)]
With more excessive use of modules, more kernel parts working with
VIMAGE, and feature richness and global state increasing the 8k of
vnet module space are no longer sufficient for people and loading
multiple modules, e.g., pf(4) and ipl(4) or ipsec(4) will fail on
the second module.

Increase the module space to 8 * PAGE_SIZE which should be enough
to hold multiple firewalls, ipsec, multicast (as in the old days was
a problem), epair, carp, and any kind of other vnet enabled modules.

Sadly this is a global byte array part of the vnet_set, so we cannot
dynamically change its size;  otherwise a TUNABLE would have been
a better solution.

PR: 228854
Reported by: Ernie Luzar, Marek Zarychta
Discussed with: rgrimes on current
MFC after: 3 days

5 years agoInitial implementation of draft-ietf-6man-ipv6only-flag.
bz [Tue, 30 Oct 2018 20:08:48 +0000 (20:08 +0000)]
Initial implementation of draft-ietf-6man-ipv6only-flag.

This change defines the RA "6" (IPv6-Only) flag which routers
may advertise, kernel logic to check if all routers on a link
have the flag set and accordingly update a per-interface flag.

If all routers agree that it is an IPv6-only link, ether_output_frame(),
based on the interface flag, will filter out all ETHERTYPE_IP/ARP
frames, drop them, and return EAFNOSUPPORT to upper layers.

The change also updates ndp to show the "6" flag, ifconfig to
display the IPV6_ONLY nd6 flag if set, and rtadvd to allow
announcing the flag.

Further changes to tcpdump (contrib code) are availble and will
be upstreamed.

Tested the code (slightly earlier version) with 2 FreeBSD
IPv6 routers, a FreeBSD laptop on ethernet as well as wifi,
and with Win10 and OSX clients (which did not fall over with
the "6" flag set but not understood).

We may also want to (a) implement and RX filter, and (b) over
time enahnce user space to, say, stop dhclient from running
when the interface flag is set.  Also we might want to start
IPv6 before IPv4 in the future.

All the code is hidden under the EXPERIMENTAL option and not
compiled by default as the draft is a work-in-progress and
we cannot rely on the fact that IANA will assign the bits
as requested by the draft and hence they may change.

Dear 6man, you have running code.

Discussed with: Bob Hinden, Brian E Carpenter

5 years agoAdd malloc_domainset(9) and _domainset variants to other allocator KPIs.
markj [Tue, 30 Oct 2018 18:26:34 +0000 (18:26 +0000)]
Add malloc_domainset(9) and _domainset variants to other allocator KPIs.

Remove malloc_domain(9) and most other _domain KPIs added in r327900.
The new functions allow the caller to specify a general NUMA domain
selection policy, rather than specifically requesting an allocation from
a specific domain.  The latter policy tends to interact poorly with
M_WAITOK, resulting in situations where a caller is blocked indefinitely
because the specified domain is depleted.  Most existing consumers of
the _domain KPIs are converted to instead use a DOMAINSET_PREF() policy,
in which we fall back to other domains to satisfy the allocation
request.

This change also defines a set of DOMAINSET_FIXED() policies, which
only permit allocations from the specified domain.

Discussed with: gallatin, jeff
Reported and tested by: pho (previous version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17418

5 years agoOnly invoke 'ls' if the local modules directory exists.
jhb [Tue, 30 Oct 2018 18:20:34 +0000 (18:20 +0000)]
Only invoke 'ls' if the local modules directory exists.

This avoids a spurious make warning if /usr/local/sys/modules doesn't
exist.

Submitted by: rgrimes
Reported by: markj

5 years agoFix some problems that manifest when NUMA domain 0 is empty.
markj [Tue, 30 Oct 2018 17:57:40 +0000 (17:57 +0000)]
Fix some problems that manifest when NUMA domain 0 is empty.

- In uma_prealloc(), we need to check for an empty domain before the
  first allocation attempt, not after.  Fix this by switching
  uma_prealloc() to use a vm_domainset iterator, which addresses the
  secondary issue of using a signed domain identifier in round-robin
  iteration.
- Don't automatically create a page daemon for domain 0.
- In domainset_empty_vm(), recompute ds_cnt and ds_order after
  excluding empty domains; otherwise we may frequently specify an empty
  domain when calling in to the page allocator, wasting CPU time.
  Convert DOMAINSET_PREF() policies for empty domains to round-robin.
- When freeing bootstrap pages, don't count them towards the per-domain
  total page counts for now: some vm_phys segments are created before
  the SRAT is parsed and are thus always identified as being in domain 0
  even when they are not.  Then, when bootstrap pages are freed, they
  are added to a domain that we had previously thought was empty.  Until
  this is corrected, we simply exclude them from the per-domain page
  count.

Reported and tested by: Rajesh Kumar <rajfbsd@gmail.com>
Reviewed by: gallatin
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17704

5 years agoImplement the dump_stack() function in the LinuxKPI.
hselasky [Tue, 30 Oct 2018 16:42:56 +0000 (16:42 +0000)]
Implement the dump_stack() function in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 3 days
Sponsored by: Mellanox Technologies

5 years agoImplement __KERNEL_DIV_ROUND_UP() function macro in the LinuxKPI.
hselasky [Tue, 30 Oct 2018 16:32:52 +0000 (16:32 +0000)]
Implement __KERNEL_DIV_ROUND_UP() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 3 days
Sponsored by: Mellanox Technologies

5 years agoIntroduce an EXPERIMENTAL option for both src.conf(5) and the kernel.
bz [Tue, 30 Oct 2018 15:46:30 +0000 (15:46 +0000)]
Introduce an EXPERIMENTAL option for both src.conf(5) and the kernel.

In the last decade(s) we have seen both short term or long term projects
committed to the tree which were considered or even marked "experimental".
While out-of-tree development has become easier than it used to be in
CVS times, there still is a need to have the code shipping with HEAD but
not enabled by default.

While people may think about VIMAGE as one of the recent larger, long term
projects, early protocol implementations (before they are standardised)
are others.  (Free)BSD historically was one of the operating systems
which would have running code at early stages and help develop and
influence standardisation and the industry.

Give developers an opportunity to be more pro-active for early adoption
or running large scale code changes stumbling over each others but not
the user's feet.  I have not added the option to NOTES in order to avoid
breaking supported option builds, which require constant compile testing.

Discussed with: people in the corridor

5 years agoRemove no longer relevant comment, as suggested by imp@.
trasz [Tue, 30 Oct 2018 15:44:16 +0000 (15:44 +0000)]
Remove no longer relevant comment, as suggested by imp@.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRemove useless call to access(2) from tzcode. Quoting OpenBSD:
trasz [Tue, 30 Oct 2018 15:43:06 +0000 (15:43 +0000)]
Remove useless call to access(2) from tzcode.  Quoting OpenBSD:

> Remove doaccess variable and access(2) call since this interfers with
> applications like zdump(8) because pledge(2) doesn't allow access(2) to
> /usr/share/zoneinfo.
>
> millert@ better described why this call can go away:
>
> "This looks like an attempt to do access checks based on the real uid instead
> of the effective uid.  Basically for setuid programs we don't want to allow a
> user to set TZ to a path they should not be able to otherwise access.
>
> However, we already have a check for issetugid() above so I think the doaccess
> bits can just be removed and we can rely on open()."
>
> After discussion with tb@, deraadt@ and millert@, this was also OK'ed by them

Reviewed by: imp
Obtained from: OpenBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17701

5 years agoMake "nscd -t" work.
trasz [Tue, 30 Oct 2018 15:39:33 +0000 (15:39 +0000)]
Make "nscd -t" work.

Reviewed by: des@
MFC after: 2 weeks
Sponsored by: Chalmers University of Technology
Differential Revision: https://reviews.freebsd.org/D17563

5 years agoAlways stop the scheduler when entering kdb
vangyzen [Tue, 30 Oct 2018 14:54:15 +0000 (14:54 +0000)]
Always stop the scheduler when entering kdb

Set curthread->td_stopsched when entering kdb via any vector.
Previously, it was only set when entering via panic, so when
entering kdb another way, mutexes and such were still "live",
and an attempt to lock an already locked mutex would panic.

Reviewed by: kib, cem
Discussed with: jhb
Tested by: pho
MFC after: 2 months
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D17687

5 years agoBuild the csu tests on all architectures.
andrew [Tue, 30 Oct 2018 14:44:12 +0000 (14:44 +0000)]
Build the csu tests on all architectures.

The tests haven't been run them, but this is enough to build them so I can
get feedback on if the various crt.h headers are correct.

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoBump the number of fans supported from 8 to 12.
tuexen [Tue, 30 Oct 2018 11:51:09 +0000 (11:51 +0000)]
Bump the number of fans supported from 8 to 12.
The number of fans on a PowerMac7,3 with liquid cooling is 9.

Reviewed by: andreast@
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D17754

5 years agoDisable the .preinit_array test in DSOs, ld.bfd fails to link objects with
andrew [Tue, 30 Oct 2018 11:19:47 +0000 (11:19 +0000)]
Disable the .preinit_array test in DSOs, ld.bfd fails to link objects with
the section.

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoFix the location of the static keyword.
andrew [Tue, 30 Oct 2018 10:16:21 +0000 (10:16 +0000)]
Fix the location of the static keyword.

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoEmulate machine check related MSR_EXTFEATURES to allow guest OSes to
araujo [Tue, 30 Oct 2018 10:02:23 +0000 (10:02 +0000)]
Emulate machine check related MSR_EXTFEATURES to allow guest OSes to
boot on AMD FX Series.

PR: 224476
Submitted by: Keita Uchida <m@jgz.jp>
Reviewed by: rgrimes
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D17713

5 years agoAllow changing lagg(4) MTU.
araujo [Tue, 30 Oct 2018 09:53:57 +0000 (09:53 +0000)]
Allow changing lagg(4) MTU.

Previously, changing the MTU would require destroying the lagg and
creating a new one. Now it is allowed to change the MTU of
the lagg interface and the MTU of the ports will be set to match.

If any port cannot set the new MTU, all ports are reverted to the original
MTU of the lagg. Additionally, when adding ports, the MTU of a port will be
automatically set to the MTU of the lagg. As always, the MTU of the lagg is
initially determined by the MTU of the first port added. If adding an
interface as a port for some reason fails, that interface is reverted to its
original MTU.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Reviewed by: mav
Relnotes: Yes
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D17576

5 years agoRun the csu tests on a DSO. This builds the tests into a shared library,
andrew [Tue, 30 Oct 2018 09:43:26 +0000 (09:43 +0000)]
Run the csu tests on a DSO. This builds the tests into a shared library,
then runs these from the base test programs. With this we can check
crtbeginS.o and crtendS.o are working as expected.

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoThe jcr argument to _Jv_RegisterClasses is used, stop marking it otherwise.
andrew [Tue, 30 Oct 2018 09:36:31 +0000 (09:36 +0000)]
The jcr argument to _Jv_RegisterClasses is used, stop marking it otherwise.

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoConnect libc/tests/time to the build, adding test cases for strptime()
yuripv [Tue, 30 Oct 2018 02:37:23 +0000 (02:37 +0000)]
Connect libc/tests/time to the build, adding test cases for strptime()
issues fixed recently, and disabling the failing ones (mostly due to TZ
parsing differences with NetBSD).

Reviewed by: ngie
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D17546

5 years agopowerpc/mpc85xx: Reset the PCIe bus on attach
jhibbits [Tue, 30 Oct 2018 00:47:40 +0000 (00:47 +0000)]
powerpc/mpc85xx: Reset the PCIe bus on attach

It seems if a Radeon card is already initialized by u-boot, it won't be
reinitialized by the kernel, and the DRM module will fail to attach.  This
steals the reset code from mips/octopci.c to blindly reset the bus on attach.
This was tested on a AmigaOne X5000/20, such that it can be booted from the
local video console, and get a video console in FreeBSD.

5 years agoPermit local kernel modules to be built as part of a kernel build.
jhb [Tue, 30 Oct 2018 00:23:37 +0000 (00:23 +0000)]
Permit local kernel modules to be built as part of a kernel build.

Add support for "local" modules.  By default, these modules are
located in LOCALBASE/sys/modules (where LOCALBASE defaults to
/usr/local).  Individual modules can be built along with a kernel by
defining LOCAL_MODULES to the list of modules.  Each is assumed to be
a subdirectory containing a valid Makefile.  If LOCAL_MODULES is not
specified, all of the modules present in LOCALBASE/sys/modules are
built and installed along with the kernel.

This means that a port that installs a kernel module can choose to
install its source along with a suitable Makefile to
/usr/local/sys/modules/<foo>.  Future kernel builds will then include
that kernel module using the kernel configuration's opt_*.h headers
and install it into /boot/kernel along with other kernel-specific
modules.

This is not trying to solve the issue of folks running GENERIC release
kernels, but is instead aimed at folks who build their own kernels.
For those folks this ensures that kernel modules from ports will
always be using the right KBI, etc.  This includes folks running any
KBI-breaking kernel configs (such as PAE).

There are still some kinks to be worked out with cross-building (we
probably shouldn't include local modules in cross-built kernels by
default), but this is a sufficient starting point.

Reviewed by: imp
MFC after: 3 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D16966

5 years agoHave gconcat advertise delete support if one of its disks does.
markj [Tue, 30 Oct 2018 00:22:14 +0000 (00:22 +0000)]
Have gconcat advertise delete support if one of its disks does.

This follows the example set by other multi-disk GEOM classes.

PR: 232676
Tested by: noah.bergbauer@tum.de
MFC after: 1 month

5 years agoMake battery emptying rate available as sysctl variable.
jhb [Tue, 30 Oct 2018 00:19:44 +0000 (00:19 +0000)]
Make battery emptying rate available as sysctl variable.

Curiously, the in-kernel routines always use the design voltage to
convert from mA to mW, but acpiconf in userland uses the current
voltage.  As a result, this can report a different mW rate than
acpiconf.

Submitted by: Manuel Stühn <freebsdnewbie@freenet.de>
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D17077

5 years agoConvert amd64_get/set_fs/gsbase to ifunc.
kib [Tue, 30 Oct 2018 00:11:30 +0000 (00:11 +0000)]
Convert amd64_get/set_fs/gsbase to ifunc.

Note that this is the first use of ifuncs in our userspace.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

5 years agoRemove rtld use of libc amd64_set_fsbase().
kib [Mon, 29 Oct 2018 23:59:26 +0000 (23:59 +0000)]
Remove rtld use of libc amd64_set_fsbase().

One less non-trivial dependency of rtld on libc.  Also,
amd64_set_fsbase() is to be converted to ifunc, which I do not want to
support inside rtld.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoInitialize ifunc calling machinery earlier.
kib [Mon, 29 Oct 2018 23:56:39 +0000 (23:56 +0000)]
Initialize ifunc calling machinery earlier.

In particular, do it before the first call to allocate_initial_tls(),
which contains MD parts to set the initial thread' TLS pointer.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoamd64: Use ifuncs to select suitable implementation of set_pcb_flags().
kib [Mon, 29 Oct 2018 23:52:31 +0000 (23:52 +0000)]
amd64: Use ifuncs to select suitable implementation of set_pcb_flags().

There is no reason to check for PCB_FULL_IRET if FSGSBASE instructions
are not supported.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoTeach procstat -x about the AT_EHDRFLAGS ELF auxiliary vector.
jhb [Mon, 29 Oct 2018 23:48:20 +0000 (23:48 +0000)]
Teach procstat -x about the AT_EHDRFLAGS ELF auxiliary vector.

Submitted by: Shawn Webb <lattera@gmail.com>
Reviewed by: brooks
Obtained from: HardenedBSD (bb71e9889d1362df01c2e5162e84cd7a4fc029c8)
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D17067

5 years agoStyle.
kib [Mon, 29 Oct 2018 23:45:17 +0000 (23:45 +0000)]
Style.

Wrap long lines, use +4 spaces for continuation indent.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoClarify explanation of VFCF_SBDRY.
kib [Mon, 29 Oct 2018 23:43:17 +0000 (23:43 +0000)]
Clarify explanation of VFCF_SBDRY.

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

5 years agocxgbe/iw_cxgbe: Install the socket upcall before calling soconnect to
np [Mon, 29 Oct 2018 22:35:46 +0000 (22:35 +0000)]
cxgbe/iw_cxgbe: Install the socket upcall before calling soconnect to
ensure that it always runs when soisconnected does.

Submitted by: Krishnamraju Eraparaju @ Chelsio
MFC after: 1 month
Sponsored by: Chelsio Communications

5 years agoAdd support for "plain" (non-HMAC) SHA digests.
jhb [Mon, 29 Oct 2018 22:24:31 +0000 (22:24 +0000)]
Add support for "plain" (non-HMAC) SHA digests.

MFC after: 2 months
Sponsored by: Chelsio Communications

5 years agoAdd a note that epoch(9) may change, to untie our hands for any future MFCs.
glebius [Mon, 29 Oct 2018 22:10:52 +0000 (22:10 +0000)]
Add a note that epoch(9) may change, to untie our hands for any future MFCs.

5 years agorping(1): Make sure the socket address defaults to something reasonable
np [Mon, 29 Oct 2018 21:46:05 +0000 (21:46 +0000)]
rping(1): Make sure the socket address defaults to something reasonable
when running as the server.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Reviewed by: hselasky@, np@
MFC after: 1 month
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D17707

5 years agoExpose some netdump configuration parameters through sysctl.
markj [Mon, 29 Oct 2018 21:16:26 +0000 (21:16 +0000)]
Expose some netdump configuration parameters through sysctl.

Reviewed by: cem
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D17755

5 years agoFix get_maxfds() in jevents
arichardson [Mon, 29 Oct 2018 21:08:34 +0000 (21:08 +0000)]
Fix get_maxfds() in jevents

If RLIM_INFINITY == -1ULL (such as on macOS) the min() call will result
in a value of less than 1 being returned. This causes nftw() to fail
with EINVAL.

While touching this file also fix includes to work on Linux/macOS and don't
declare snprintf since it may have different attributes in the system
headers there.

Reviewed By: mmacy
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17682

5 years agortld-elf: fix more warnings to allow compiling with WARNS=6
arichardson [Mon, 29 Oct 2018 21:08:28 +0000 (21:08 +0000)]
rtld-elf: fix more warnings to allow compiling with WARNS=6

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17154

5 years agortld-elf: compile with WANRS=4 warnings other than -Wcast-align
arichardson [Mon, 29 Oct 2018 21:08:19 +0000 (21:08 +0000)]
rtld-elf: compile with WANRS=4 warnings other than -Wcast-align

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17153

5 years agortld-elf: make it compile with WARNS=3
arichardson [Mon, 29 Oct 2018 21:08:11 +0000 (21:08 +0000)]
rtld-elf: make it compile with WARNS=3

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17150

5 years agortld: set obj->textsize correctly
arichardson [Mon, 29 Oct 2018 21:08:02 +0000 (21:08 +0000)]
rtld: set obj->textsize correctly

With lld-generated binaries the first PT_LOAD will usually be a read-only
segment unless you pass --no-rosegment. For those binaries the textsize is
determined by the next PT_LOAD. To allow both LLD and bfd 2.17 binaries to
be parsed correctly use the end of the last PT_LOAD that is marked as
executable instead.

I noticed that the value was wrong while adding some debug prints for some rtld
changes for CHERI binaries. `obj->textsize` only seems to be used by PPC so the
effect is untested. However, the value before was definitely wrong and the new
result matches the phdrs.

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17117

5 years agoPass _BRANCH in the reldoc target to ensure the correct
gjb [Mon, 29 Oct 2018 21:03:43 +0000 (21:03 +0000)]
Pass _BRANCH in the reldoc target to ensure the correct
src branch is used when generating the hardware.html page.

MFC after: 3 days
MFC before: 12.0-BETA3
MFC with: r339873
Sponsored by: The FreeBSD Foundation

5 years agoSet OPTIONS_UNSET in the argument list to env(1), and add
gjb [Mon, 29 Oct 2018 20:53:05 +0000 (20:53 +0000)]
Set OPTIONS_UNSET in the argument list to env(1), and add
AVAHI to the list.  This fixes the textproc/docproj build
seemingly following FLAVORS being added.

Specifically, the problem with the dependency chain here is:
- textproc/docproj depends on print/cups, which sets AVAHI=on
  by default;
- net/avahi-app depends on devel/gobject-introspection, which
  requires python3+;
- graphics/netpbm depends on graphics/mesa-libs, which can
  only be built with python2.7;
- textproc/docproj depends on a number of graphics ports for
  font rendering, etc.

MFC after: 3 days
MFC before: 12.0-BETA3
Sponsored by: The FreeBSD Foundation

5 years agoInsert a .El line accidently committed in r339869.
tuexen [Mon, 29 Oct 2018 19:25:30 +0000 (19:25 +0000)]
Insert a .El line accidently committed in r339869.

Reported by: gjb@
MFC after: 3 days

5 years agoFix a nit
tuexen [Mon, 29 Oct 2018 19:14:56 +0000 (19:14 +0000)]
Fix a nit

Reported by: gjb@
MFC after: 3 days

5 years agoImplement dma_pool_zalloc() in the LinuxKPI.
hselasky [Mon, 29 Oct 2018 19:02:36 +0000 (19:02 +0000)]
Implement dma_pool_zalloc() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 3 days
Sponsored by: Mellanox Technologies

5 years agoMake the .ctors, .dtors, and .jcr markers as static. They shouldn't be
andrew [Mon, 29 Oct 2018 17:55:26 +0000 (17:55 +0000)]
Make the .ctors, .dtors, and .jcr markers as static. They shouldn't be
accessible from out of the files they are defined in.

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoInclude the csu test directories in BSD.tests.dist
andrew [Mon, 29 Oct 2018 17:13:12 +0000 (17:13 +0000)]
Include the csu test directories in BSD.tests.dist

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoCheck __dso_handle is NULL in non-DSO objects. It should only be non-NULL
andrew [Mon, 29 Oct 2018 17:03:20 +0000 (17:03 +0000)]
Check __dso_handle is NULL in non-DSO objects. It should only be non-NULL
when accessed from a shared object.

MFC with: r339738
Sponsored by: DARPA, AFRL