]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoRemove some unnecessary includes
jhibbits [Thu, 19 Oct 2017 02:14:39 +0000 (02:14 +0000)]
Remove some unnecessary includes

6 years agosysctl: only take mem lock if oldlen is > 4 * PAGE_SIZE
mjg [Thu, 19 Oct 2017 01:38:31 +0000 (01:38 +0000)]
sysctl: only take mem lock if oldlen is > 4 * PAGE_SIZE

The previous limit of just one page is hit by ps.

The entire mechanism should be reworked, if not whacked. It seems the intent
is to reduce kernel dos-ability - some handlers wire the amount of memory
passed here. Handlers should probably stop wiring in the first place or in
the worst case indicate they are doing so so that the check is done only if
necessary. It should also probably be a counter, not a lock.

MFC after: 1 week

6 years agoexecve: avoid one proc lock/unlock trip unless PTRACE_EXEC is set
mjg [Thu, 19 Oct 2017 00:46:15 +0000 (00:46 +0000)]
execve: avoid one proc lock/unlock trip unless PTRACE_EXEC is set

MFC after: 1 week

6 years agoTidy up pmc support at execve.
mjg [Thu, 19 Oct 2017 00:38:14 +0000 (00:38 +0000)]
Tidy up pmc support at execve.

The proc-specific check is inherently racy, so the code can just unlock
beforehand.

MFC after: 1 week

6 years agosysvsem: check if semu_list has anything on it before grabbing the lock
mjg [Thu, 19 Oct 2017 00:31:00 +0000 (00:31 +0000)]
sysvsem: check if semu_list has anything on it before grabbing the lock

This should get a process-specific support instead.

MFC after: 1 week

6 years agoAdopt jail.8 to our brave new bsdinstall world
bjk [Wed, 18 Oct 2017 22:56:46 +0000 (22:56 +0000)]
Adopt jail.8 to our brave new bsdinstall world

Submitted by: Steve Kargl
MFC after: 3 days

6 years agoDon't take Giant for SMP status and cpu topology sysctls.
mjg [Wed, 18 Oct 2017 22:00:44 +0000 (22:00 +0000)]
Don't take Giant for SMP status and cpu topology sysctls.

Not only this lock doesn't play any role here, dirtying it slows down
other things a little bit as giant-held checks (e.g. DROP_GIANT) are
spread all over the kernel.

MFC after: 1 week

6 years agoFix a signed/unsigned warning.
tuexen [Wed, 18 Oct 2017 21:08:35 +0000 (21:08 +0000)]
Fix a signed/unsigned warning.

MFC after: 1 week

6 years agoAbort an SCTP association, when a DATA chunk is followed by an unknown
tuexen [Wed, 18 Oct 2017 20:17:44 +0000 (20:17 +0000)]
Abort an SCTP association, when a DATA chunk is followed by an unknown
chunk with a length smaller than the minimum length.

Thanks to Felix Weinrank for making me aware of the problem.
MFC after: 3 days

6 years agoql*_def.h: fix QL_ALIGN parenthesization
rlibby [Wed, 18 Oct 2017 19:28:28 +0000 (19:28 +0000)]
ql*_def.h: fix QL_ALIGN parenthesization

QL_ALIGN is a set of copies of roundup2, but it was missing an outer set
of parentheses, which began to matter with r324538. Now, fully copy the
parenthesization of roundup2.

Reviewed by: davidcs
Differential Revision: https://reviews.freebsd.org/D12673

6 years agoImport the latest CloudABI definitions, version 0.16.
ed [Wed, 18 Oct 2017 19:22:53 +0000 (19:22 +0000)]
Import the latest CloudABI definitions, version 0.16.

The most important change in this release is the removal of the
poll_fd() system call; CloudABI's equivalent of kevent(). Though I think
that kqueue is a lot saner than many of its alternatives, our
experience is that emulating this system call on other systems
accurately isn't easy. It has become a complex API, even though I'm not
convinced this complexity is needed. This is why we've decided to take a
different approach, by looking one layer up.

We're currently adding an event loop to CloudABI's C library that is API
compatible with libuv (except when incompatible with Capsicum).
Initially, this event loop will be built on top of plain inefficient
poll() calls. Only after this is finished, we'll work our way backwards
and design a new set of system calls to optimize it.

Interesting challenges will include integrating asynchronous I/O into
such a system call API. libuv currently doesn't aio(4) on Linux/BSD, due
to it being unreliable and having undesired semantics.

Obtained from: https://github.com/NuxiNL/cloudabi

6 years agoRevert change which got in accidently.
tuexen [Wed, 18 Oct 2017 18:59:35 +0000 (18:59 +0000)]
Revert change which got in accidently.

6 years agoFix a bug introduced in r324638.
tuexen [Wed, 18 Oct 2017 18:56:56 +0000 (18:56 +0000)]
Fix a bug introduced in r324638.
Thanks to Felix Weinrank for making me aware of this.

MFC after: 3 days

6 years agoRemove CPU_HAVEFPU.
jhb [Wed, 18 Oct 2017 17:23:16 +0000 (17:23 +0000)]
Remove CPU_HAVEFPU.

Instead, use a runtime decision to handle COP1 traps.  If floating point
support is present in the current CPU, enable saving of the floating point
state.  If support is not present, fail with SIGILL.

Reviewed by: imp, br
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D12707

6 years agoTeach beinstall to use and prefer svnlite, with a fallback to svn.
brd [Wed, 18 Oct 2017 15:48:26 +0000 (15:48 +0000)]
Teach beinstall to use and prefer svnlite, with a fallback to svn.

Approved by: will

6 years agoMove kernel dump offset tracking into MI code.
markj [Wed, 18 Oct 2017 15:38:05 +0000 (15:38 +0000)]
Move kernel dump offset tracking into MI code.

All of the kernel dump implementations keep track of the current offset
("dumplo") within the dump device. However, except for textdumps, they
all write the dump sequentially, so we can reduce code duplication by
having the MI code keep track of the current offset. The new
dump_append() API can be used to write at the current offset.

This is needed to implement support for kernel dump compression in the
MI kernel dump code.

Also simplify dump_encrypted_write() somewhat: use dump_write() instead
of duplicating its bounds checks, and get rid of the redundant offset
tracking.

Reviewed by: cem
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11722

6 years agoAdd references to sysrc(8).
se [Wed, 18 Oct 2017 13:25:44 +0000 (13:25 +0000)]
Add references to sysrc(8).

Reported by: Kurt Jaeger (lists at opsec.eu)

6 years agolibsa/ip: stop read loop on bad fragments
tsoome [Wed, 18 Oct 2017 08:06:05 +0000 (08:06 +0000)]
libsa/ip: stop read loop on bad fragments

Lets try to clear out from case of overlapping etc fragments and stop read.

Reported by: Dan McDonald

6 years agolibsa/ip.c: misplaced comment, ip_v is half char, not ip_p
tsoome [Wed, 18 Oct 2017 07:39:21 +0000 (07:39 +0000)]
libsa/ip.c: misplaced comment, ip_v is half char, not ip_p

The comment should be at previous line.

Reported by: Dan McDonald

6 years agoDo not report reduction of swap zone if it was not.
kib [Wed, 18 Oct 2017 07:27:43 +0000 (07:27 +0000)]
Do not report reduction of swap zone if it was not.

After r324600 we see the actual reservation.

Reported by: jkim
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoext2: delete redundant decl of ext2_fserr
rlibby [Wed, 18 Oct 2017 00:41:23 +0000 (00:41 +0000)]
ext2: delete redundant decl of ext2_fserr

Fix gcc build after r324706.

Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D12709

6 years agoImprove computation of {BC,LL}OBJS.
jonathan [Wed, 18 Oct 2017 00:33:20 +0000 (00:33 +0000)]
Improve computation of {BC,LL}OBJS.

Now that OBJS has grown an OBJS_SRCS_FILTER variable, use this variable
in the computation of BCOBJS and LLOBJS too. Also move BCOBJS and LLOBJS
computation to be next to the OBJS computation: this should both make
the parallel structure clearer and serve to remind people changing OBJS
that parallel changes are required in BCOBJS and LLOBJS.

A side effect of this change is that BCOBJS and LLOBJS will be available
even when LLVM_LINK has not been defined, but that seems like a positive
change: there's no reason we can't ask "what bitcode files would you
generate" just because we can't link those files together into a
complete bitcode representation of a binary or library.

Reviewed by: sjg
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12701

6 years agoImprove logic of CLEANFILES+=${PROG_FULL}.{bc,ll}.
jonathan [Wed, 18 Oct 2017 00:30:15 +0000 (00:30 +0000)]
Improve logic of CLEANFILES+=${PROG_FULL}.{bc,ll}.

The build rule describing how to create ${PROG_FULL}.{bc,ll} is only
dependent on LLVM_LINK being defined, not on MK_DEBUG_FILES being "yes".
Move the addition of ${PROG_FULL}.{bc,ll} out of the conditional block
under `.if ${MK_DEBUG_FILES} != "no"` and up next to where the build
rules for ${PROG_FULL}.{bc,ll} are defined.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12703

6 years agoRemove mbpool(9) now that it has no consumers.
brooks [Wed, 18 Oct 2017 00:18:03 +0000 (00:18 +0000)]
Remove mbpool(9) now that it has no consumers.

mbpool existed to support NICs with memory interfaces and all remaining
comsumers were removed earlier this year with NATM.

Reviewed by: jhb
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10513

6 years agoRevert "Unify boot1 with loader" change r324646
imp [Tue, 17 Oct 2017 23:38:27 +0000 (23:38 +0000)]
Revert "Unify boot1 with loader" change r324646

Back out the unification commit to boot1. There's some issues on the
arm and arm64 platforms that need to be addressed with code
changes. There's also a discussion on arch@ about the future of
boot1.efi vs just using loader.efi that needs to play out. So take a
pause on these changes until the arm issues can be fixed and it's
clear boot1.efi will survive into FreeBSD 12.

OK'd by: Eric@meatspace

6 years agoembed_mfs: add error handling, usage
emaste [Tue, 17 Oct 2017 21:13:26 +0000 (21:13 +0000)]
embed_mfs: add error handling, usage

Ensure that we are called with two arguments, and that the output file
is writable. Also, if we cannot find the mfs section report the output
file name rather than "kernel", as this script may be used with other
than kernels.

Sponsored by: The FreeBSD Foundation

6 years agoAdd inital extents read-write support.
fsu [Tue, 17 Oct 2017 20:45:44 +0000 (20:45 +0000)]
Add inital extents read-write support.

Approved by:    pfg (mentor)
MFC after:      6 months
RelNotes:       Yes

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

6 years agocxgbe: delete now-redundant vnet decls
rlibby [Tue, 17 Oct 2017 20:37:31 +0000 (20:37 +0000)]
cxgbe: delete now-redundant vnet decls

r324539 gathered some vnet decls into netinet/tcp_var.h, so that they
are now redundant in dev/cxgbe/tom/{t4_cpl_io.c,t4_ddp.c}. This triggers
gcc -Wredundant-decls.

Reviewed by: np
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12674

6 years agoFix a racy VI_DOOMED check in MNT_VNODE_FOREACH_ALL().
markj [Tue, 17 Oct 2017 19:41:45 +0000 (19:41 +0000)]
Fix a racy VI_DOOMED check in MNT_VNODE_FOREACH_ALL().

MNT_VNODE_FOREACH_ALL() is supposed to avoid returning doomed vnodes,
but the VI_DOOMED check it used was done without the vnode interlock
held, so it could race with a concurrent vgone().

Submitted by: Don Morris <don.morris@isilon.com>
Reviewed by: kib, mckusick
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12704

6 years agoloader.mk: clean md.o even if MD_IMAGE_SIZE not defined
emaste [Tue, 17 Oct 2017 19:11:29 +0000 (19:11 +0000)]
loader.mk: clean md.o even if MD_IMAGE_SIZE not defined

We don't normally provide special handling for optionally-included src
files, but md.o depends on both md.c and the value of ${MD_IMAGE_SIZE}.
Previously if one built with MD_IMAGE_SIZE, executed "make clean", and
then built with a different MD_IMAGE_SIZE md.o would not be rebuilt.

Reported by: Zakary Nafziger
Sponsored by: The FreeBSD Foundation

6 years agoWe need to include disk.o in libuboot.a when we're building with
imp [Tue, 17 Oct 2017 19:11:19 +0000 (19:11 +0000)]
We need to include disk.o in libuboot.a when we're building with
support for disk access.

Sponsored by: Netflix

6 years agoAdd a test for r324671 along with some other masked tests.
bdrewery [Tue, 17 Oct 2017 19:01:01 +0000 (19:01 +0000)]
Add a test for r324671 along with some other masked tests.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoloader: initialize dv_cleanup in md.c to eliminate clang warning
emaste [Tue, 17 Oct 2017 18:00:01 +0000 (18:00 +0000)]
loader: initialize dv_cleanup in md.c to eliminate clang warning

Submitted by: Zakary Nafziger <worldofzak@gmail.com>
Sponsored by: The FreeBSD Foundation

6 years agoUpdate wpa_supplicant/hostapd for 2017-01 vulnerability release.
gordon [Tue, 17 Oct 2017 17:22:36 +0000 (17:22 +0000)]
Update wpa_supplicant/hostapd for 2017-01 vulnerability release.

hostapd: Avoid key reinstallation in FT handshake
Prevent reinstallation of an already in-use group key
Extend protection of GTK/IGTK reinstallation of WNM-Sleep Mode cases
Fix TK configuration to the driver in EAPOL-Key 3/4 retry case
Prevent installation of an all-zero TK
Fix PTK rekeying to generate a new ANonce
TDLS: Reject TPK-TK reconfiguration
WNM: Ignore Key Data in WNM Sleep Mode Response frame if no PMF in use
WNM: Ignore WNM-Sleep Mode Response if WNM-Sleep Mode has not been used
WNM: Ignore WNM-Sleep Mode Response without pending request
FT: Do not allow multiple Reassociation Response frames
TDLS: Ignore incoming TDLS Setup Response retries

Submitted by: jhb
Obtained from: https://w1.fi/security/2017-01/ (against later version)
Security: FreeBSD-SA-17:07
Security: CERT VU#228519
Security: CVE-2017-13077
Security: CVE-2017-13078
Security: CVE-2017-13079
Security: CVE-2017-13080
Security: CVE-2017-13081
Security: CVE-2017-13082
Security: CVE-2017-13086
Security: CVE-2017-13087
Security: CVE-2017-13088
Differential Revision: https://reviews.freebsd.org/D12693

6 years agoAdd LLVM IR libraries to CLEANFILES.
jonathan [Tue, 17 Oct 2017 16:29:50 +0000 (16:29 +0000)]
Add LLVM IR libraries to CLEANFILES.

We previously taught the build system how to create files like libfoo.bc,
but neglected to teach it about cleaning such files up. Rectify this now.

MFC after: 1 week
Sponsored by: DARPA, AFRL

6 years agonever retry oustanding requests when terminating iscsi session
avg [Tue, 17 Oct 2017 16:03:59 +0000 (16:03 +0000)]
never retry oustanding requests when terminating iscsi session

CAM_REQ_ABORTED sounds natural for aborting outstanding requests when
tearing down a session, but that status actually causes eligible
requests to be tried again.  That's completely useless, so let's use
CAM_DEV_NOT_THERE instead.  Perhaps there is a better status, but this
should be good enough.  The change should affect only the session
termination.

Tested by: Ben RUBSON <ben.rubson@gmail.com>
Reviewed by: mav, trasz
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12653

6 years agoiscsi: do not hold the global lock while tearing down a session
avg [Tue, 17 Oct 2017 15:39:38 +0000 (15:39 +0000)]
iscsi: do not hold the global lock while tearing down a session

It should be sufficient to hold the lock just for removing the session
from the session list.  Everything else should be covered by the session
specific lock.

On top of that, at present we can get a deadlock caused by waiting on
the CAM SIM reference count while holding the global lock.  A specific
scenario involving ZFS is this:
- concurrent termination of two sessions, S1 and S2
- session S1 completed all I/Os and sleeps in CAM waiting for device
  close by ZFS;
- session S2 is also dead now, but can not forcefully complete
  outstanding requests by calling iscsi_session_cleanup() from
  iscsi_maintenance_thread_terminate(), since it can't get the same
  global sc_lock;
- as soon as there are unfinished requests, ZFS can not do
  spa_config_enter() as writer, and so can not close the device for
  session S1;
- deadlock.

Reported by: Ben RUBSON <ben.rubson@gmail.com>
Tested by: Ben RUBSON <ben.rubson@gmail.com>
Reviewed by: mav, trasz
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12652

6 years agoDragonFly 5.0.0 release added.
maxim [Tue, 17 Oct 2017 14:37:12 +0000 (14:37 +0000)]
DragonFly 5.0.0 release added.

6 years agoRemove lib/libstand again, accidentally readded in r324683
emaste [Tue, 17 Oct 2017 02:53:42 +0000 (02:53 +0000)]
Remove lib/libstand again, accidentally readded in r324683

6 years agowrite.2: correct maximum nbytes size for EINVAL error
emaste [Tue, 17 Oct 2017 02:51:45 +0000 (02:51 +0000)]
write.2: correct maximum nbytes size for EINVAL error

In FreeBSD 11 and later debug.iosize_max_clamp defaults to 0, and the
maximum nbytes count for write(2) is SSIZE_MAX. Update the man page to
document this, and mention the sysctl that can be set to obtain the
previous behaviour.

PR: 196666
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoStyle. Replace 8 spaces with a tab.
cy [Tue, 17 Oct 2017 01:15:55 +0000 (01:15 +0000)]
Style. Replace 8 spaces with a tab.

MFC after: 2 weeks (with prior commit to this file)

6 years agoProvide an option to run the anticongestion ntpd leapfile fetch in
cy [Tue, 17 Oct 2017 01:15:13 +0000 (01:15 +0000)]
Provide an option to run the anticongestion ntpd leapfile fetch in
the background.

Original patch submitted by feld@. I added the "optional" bit.

Submitted by: feld (original patch)
MFC after: 2 weeks

6 years agogdb kernel server: fixup Search:memory style
rlibby [Tue, 17 Oct 2017 01:12:17 +0000 (01:12 +0000)]
gdb kernel server: fixup Search:memory style

This is a NFC patch to move around the Search:memory implementation so
that it doesn't exceed the standard column width and doesn't take so
much vertical space in gdb_trap.

Submitted by: Daniel O'Connor <darius@dons.net.au>
Reviewed by: cem, jhb
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12684

6 years agoUse taskqueue(9) to do writes/commits to mirrored DSs concurrently.
rmacklem [Mon, 16 Oct 2017 23:28:12 +0000 (23:28 +0000)]
Use taskqueue(9) to do writes/commits to mirrored DSs concurrently.

When the NFSv4.1 pNFS client is using a Flexible File Layout specifying
mirrored Data Servers, it must do the writes and commits to all mirrors.
This patch modifies the client to use a taskqueue to perform these writes
and commits concurrently.
The number of threads can't be changed for taskqueue(9), so it is set
to 4 * mp_ncpus by default, but this can be overridden by setting the
sysctl vfs.nfs.pnfsiothreads.

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

6 years agombuf(9): unbreak m_fragment()
avos [Mon, 16 Oct 2017 21:46:11 +0000 (21:46 +0000)]
mbuf(9): unbreak m_fragment()

- Fix it by replacing m_cat() with m_prev->m_next = m_new
(m_cat() will try to append data - as a result, there will be no
fragmentation).
- Move some constants out of the loop.

Was previously tested with D4077.

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

6 years agoifnet(9): split ifc_alloc_unit() (should simplify code flow)
avos [Mon, 16 Oct 2017 21:21:31 +0000 (21:21 +0000)]
ifnet(9): split ifc_alloc_unit() (should simplify code flow)

Allocate smallest unit number from pool via ifc_alloc_unit_next()
and exact unit number (if available) via ifc_alloc_unit_specific().

While here, address possible deadlock (mentioned in PR).

PR: 217401
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D12551

6 years agoRe-evaluate thread' signal mask after ptracestop().
kib [Mon, 16 Oct 2017 20:21:51 +0000 (20:21 +0000)]
Re-evaluate thread' signal mask after ptracestop().

The stop drops process lock, which allows the signal mask to be
changed and our selected signal might become blocked, i.e. should be
returned to the process queue instead of delivery.

Also, for the existing check of the process no longer having an
attached debugger, we should not loose the signal, but requeue it.

Reported and tested by: bdrewery
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoImprove assertion that an ignored or blocked signal is not delivered.
kib [Mon, 16 Oct 2017 20:15:19 +0000 (20:15 +0000)]
Improve assertion that an ignored or blocked signal is not delivered.

Split two conditions into separate asserts.  Print additional details,
like the signal number and action value.

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

6 years agoStyle.
kib [Mon, 16 Oct 2017 20:11:29 +0000 (20:11 +0000)]
Style.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoThis child is expected to exit on SIGTRAP, don't leave a core behind.
bdrewery [Mon, 16 Oct 2017 20:06:24 +0000 (20:06 +0000)]
This child is expected to exit on SIGTRAP, don't leave a core behind.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoAdd a quick description of the geom_getxml(3), geom_xml2tree(3),
romain [Mon, 16 Oct 2017 17:21:52 +0000 (17:21 +0000)]
Add a quick description of the geom_getxml(3), geom_xml2tree(3),
geom_gettree(3) and geom_deletetree(3) functions provided by libgeom and are
not documented in libgeom(3).

Reviewed by: mav, bjk, allanjude
Approved by: allanjude
Differential Revision: https://reviews.freebsd.org/D12679

6 years agoProperly reset the fields in clean_unrhdr.
mjoras [Mon, 16 Oct 2017 16:14:50 +0000 (16:14 +0000)]
Properly reset the fields in clean_unrhdr.

In r324542 I neglected to reset the first and last fields of struct
unrhdr. This causes a tmpfs to fail the unr(9) consistency checks with
DIAGNOSTIC on. Fix this by resetting the fields by calling init_unrhdr.
While here, change a loop to use TAILQ_FOREACH_SAFE since it is more
readable and equally fast.

Reported by: David Wolfskill <david@catwhisker.org>
Approved by: rstone (mentor)
Sponsored by: Dell EMC Isilon

6 years agoFix the pv_chunks pc_lru tailq handling in reclaim_pv_chunk().
kib [Mon, 16 Oct 2017 15:16:24 +0000 (15:16 +0000)]
Fix the pv_chunks pc_lru tailq handling in reclaim_pv_chunk().

For processing, reclaim_pv_chunk() removes the pv_chunk from the lru
list, which makes pc_lru linkage invalid.  Then the pmap lock is
released, which allows for other thread to free the last pv entry
allocated from the chunk and call free_pv_chunk(), which tries to
modify the invalid linkage.

Similarly, the chunk is inserted into the private tailq new_tail
temporary.  Again, free_pv_chunk() might be run and corrupt the
linkage for the new_tail after the pmap lock is dropped.

This is a consequence of r299788 elimination of pvh_global_lock, which
allowed for reclaim to run in parallel with other pmap calls which
free pv chunks.

As a fix, do not remove the chunk from pc_lru queue, use a marker to
remember the position in the queue iteration.  We can safely operate
on the chunks after the chunk's pmap is locked, we fetched the chunk
after the marker, and we checked that chunk pmap is same as we have
locked, because chunk removal from pc_lru requires both pv_chunk_mutex
and the pmap mutex owned.

Note that the fix lost an optimization which was present in the
previous algorithm.  Namely, new_tail requeueing rotated the pv chunks
list so that reclaim didn't scan the same pv chunks that couldn't be
freed (because they contained a wired and/or superpage mapping) on
every invocation.  An additional change is planned which would improve
this.

Reported and tested by: pho
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agopf tests: Use pft_set_rules everywhere
kp [Mon, 16 Oct 2017 15:05:32 +0000 (15:05 +0000)]
pf tests: Use pft_set_rules everywhere

We now have a utility function to set pf rules in the jail. Use it
whenever we need to set the pf rules in the test jail.

6 years agopf tests: Basic IPv6 forwarding tests
kp [Mon, 16 Oct 2017 15:03:45 +0000 (15:03 +0000)]
pf tests: Basic IPv6 forwarding tests

Pass/block packets in the forwarding path with pf.

Introduce the pft_set_rules() helper function, because we need to
remember to flush states between individual tests. If not we can get
packets passing despite rules blocking them because they match states
created in a previous test.

Extend pft_ping.py to be able to send IPv6 echo requests.

6 years agopf: test set-tos
kp [Mon, 16 Oct 2017 15:01:49 +0000 (15:01 +0000)]
pf: test set-tos

Introduce tests for the set-tos feature of pf. Teach pft_ping.py to send
and verify ToS flags.

6 years agoAdd Creative vendor ID.
mav [Mon, 16 Oct 2017 12:54:53 +0000 (12:54 +0000)]
Add Creative vendor ID.

MFC after: 1 week

6 years agoSave VFP state in getcontext(3) on ARM.
mmel [Mon, 16 Oct 2017 12:53:54 +0000 (12:53 +0000)]
Save VFP state in getcontext(3) on ARM.
This is a last followup of r315974, which fixes userland part
of VFP save/restore problems described in PR 217611.

PR: 217611
MFC after: 2 weeks

6 years agoUpdate details of interface capabilities changed by bridge(4).
mav [Mon, 16 Oct 2017 12:32:57 +0000 (12:32 +0000)]
Update details of interface capabilities changed by bridge(4).

PR: 221122
MFC after: 1 week

6 years agowlandebug(8): add a sanity check.
avos [Mon, 16 Oct 2017 07:15:50 +0000 (07:15 +0000)]
wlandebug(8): add a sanity check.

6 years agowlandebug(8): obtain original interface name via ifconfig_get_orig_name()
avos [Mon, 16 Oct 2017 07:01:27 +0000 (07:01 +0000)]
wlandebug(8): obtain original interface name via ifconfig_get_orig_name()

6 years agolibifconfig: allow to get original interface name via ifconfig_get_orig_name()
avos [Mon, 16 Oct 2017 06:54:26 +0000 (06:54 +0000)]
libifconfig: allow to get original interface name via ifconfig_get_orig_name()

Uses the same method as in tools/tools/ifinfo/ifinfo.c
(via net.link.generic sysctl).

Tested with modified wlandebug(8).

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

6 years agoRemove the libstand directory which is now empty.
delphij [Mon, 16 Oct 2017 04:46:28 +0000 (04:46 +0000)]
Remove the libstand directory which is now empty.

6 years agoExplicitly inlcude SYSDIR in the include path -- need machine path too?
imp [Mon, 16 Oct 2017 03:59:58 +0000 (03:59 +0000)]
Explicitly inlcude SYSDIR in the include path -- need machine path too?

6 years agoLOADER_foo_SUPPORTED
imp [Mon, 16 Oct 2017 03:59:52 +0000 (03:59 +0000)]
LOADER_foo_SUPPORTED

6 years agoMove all the ficl common code into ficl.mk
imp [Mon, 16 Oct 2017 03:59:44 +0000 (03:59 +0000)]
Move all the ficl common code into ficl.mk

There's a number of copies of basically identical code to enable
building forth in /boot/loader. Move it all into ficl.mk.

6 years agocreate defs.mk for common definitions
imp [Mon, 16 Oct 2017 03:59:38 +0000 (03:59 +0000)]
create defs.mk for common definitions

6 years agotweak style
imp [Mon, 16 Oct 2017 03:59:33 +0000 (03:59 +0000)]
tweak style

6 years agoMove common/Makefile.inc to sys/boot/loader.mk.
imp [Mon, 16 Oct 2017 03:59:28 +0000 (03:59 +0000)]
Move common/Makefile.inc to sys/boot/loader.mk.

Makefile.inc has a specific meaning in the tree, and
common/Makefile.inc doesn't quite fit into that. Rename it to
loader.mk and it will be a place to collect common things to all
/boot/loader programs there.

Sponsored by: Netflix

6 years agoRename top level Makefile.ficl to ficl.mk.
imp [Mon, 16 Oct 2017 03:59:22 +0000 (03:59 +0000)]
Rename top level Makefile.ficl to ficl.mk.

6 years agoMove orphaned man pages into new man directory from common. This helps
imp [Mon, 16 Oct 2017 03:59:17 +0000 (03:59 +0000)]
Move orphaned man pages into new man directory from common. This helps
keep cleaer that common is just for the MI files for /boot/loader
programs.

Sponsored by: Netflix

6 years agoUnify boot1 with loader
imp [Mon, 16 Oct 2017 03:59:11 +0000 (03:59 +0000)]
Unify boot1 with loader

Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor
to use the common efi_main.c.

Submitted by: Eric McCorkle
Differential Revision: https://reviews.freebsd.org/D10447

6 years agoZero out the ccb's alloated on the stack for the dump routines to more
imp [Sun, 15 Oct 2017 23:54:04 +0000 (23:54 +0000)]
Zero out the ccb's alloated on the stack for the dump routines to more
closely match a ccb returned from xpt_get_ccb().

Sponsored by: Netflix

6 years agoCloser examination shows that nvme and CAM both normally zero-fill
imp [Sun, 15 Oct 2017 23:53:55 +0000 (23:53 +0000)]
Closer examination shows that nvme and CAM both normally zero-fill
allocations (for req and ccb, which ultimately contain the
nvme_cmd). As such, we can micro-optimize these routines. Add a
comment to this effect, and bzero the ccb used to make the requests
for the nda dump rotuine so it more closely matches a ccb allocated
with xpt_get_ccb().

Sponsored by: Netflix

6 years agoFix the client IP address reported by nfsdumpstate for 64bit arch and NFSv4.1.
rmacklem [Sun, 15 Oct 2017 22:22:27 +0000 (22:22 +0000)]
Fix the client IP address reported by nfsdumpstate for 64bit arch and NFSv4.1.

The client IP address was not being reported for some NFSv4 mounts by
nfsdumpstate. Upon investigation, two problems were found for mounts
using IPv4. One was that the code (originally written and tested on i386)
assumed that a "u_long" was a "uint32_t" and would exactly store an
IPv4 host address. Not correct for 64bit arches.
Also, for NFSv4.1 mounts, the field was not being filled in. This was
basically correct, because NFSv4.1 does not use a callback address.
However, it meant that nfsdumpstate could not report the client IP addr.
This patch should fix both of these issues.
For IPv6, the address will still not be reported. The original NFSv4 RFC
only specified IPv4 callback addresses. I think this has changed and, if so,
a future commit to fix reporting of IPv6 addresses will be needed.

Reported by: manu
PR: 223036
MFC after: 2 weeks

6 years agoFix the handling of parital and too short chunks.
tuexen [Sun, 15 Oct 2017 19:33:30 +0000 (19:33 +0000)]
Fix the handling of parital and too short chunks.

Ensure that the current behaviour is consistent: stop processing
of the chunk, but finish the processing of the previous chunks.

This behaviour might be changed in a later commit to ABORT the
assoication due to a protocol violation, but changing this
is a separate issue.

MFC after: 3 days

6 years agoAdd information needed by Linux libdrm 2.4.74 (shipped with CentOS 7.4).
tijl [Sun, 15 Oct 2017 19:28:14 +0000 (19:28 +0000)]
Add information needed by Linux libdrm 2.4.74 (shipped with CentOS 7.4).

Create a config file for PCI devices that exposes their configuration
space.  Only fields needed by libdrm are filled in (vendor, device,
revision, subvendor and subdevice).

Link /sys/class/drm/card%d/device to the PCI device directory.

6 years agoSet DEVNAME to dri/card%d. This works with both in-tree drm and drm-next
tijl [Sun, 15 Oct 2017 19:21:15 +0000 (19:21 +0000)]
Set DEVNAME to dri/card%d.  This works with both in-tree drm and drm-next
and is also the value used on Linux.

Tested by: Greg V <greg@unrelenting.technology>

6 years agoWhen a Linux program tries to access a /path the kernel tries
tijl [Sun, 15 Oct 2017 18:53:21 +0000 (18:53 +0000)]
When a Linux program tries to access a /path the kernel tries
/compat/linux/path before /path.  Stop following symbolic links when
looking up /compat/linux/path so dead symbolic links aren't ignored.
This allows syscalls like readlink(2) and lstat(2) to work on such links.
And open(2) will return an error now instead of trying /path.

6 years agoUse nvme_ctrlr_poll instead of nvme_ctrlr_intx_handler since it is
imp [Sun, 15 Oct 2017 16:19:09 +0000 (16:19 +0000)]
Use nvme_ctrlr_poll instead of nvme_ctrlr_intx_handler since it is
more general and doesn't try to access registers that may be undefined
when the card is in MSIX mode.

This change, along with r324630, r324631, r324632, makes nda crash
dumps work again. Previously, they only worked on CPU 0 when the stack
garbage was just so.

Sponsored by: Netflix
Suggested by: scottl@ (who provided earlier version of the patch)

6 years agoCreate general polling function for the nvme controller. Use it when
imp [Sun, 15 Oct 2017 16:18:08 +0000 (16:18 +0000)]
Create general polling function for the nvme controller. Use it when
we're doing the various pin-based interrupt modes. Adjust
nvme_ctrlr_intx_handler to use nvme_ctrlr_poll.

Sponsored by: Netflix
Suggested by: scottl@

6 years agoBe nicer on the dump stack by allocating only a ccb_nvmeio rather than
imp [Sun, 15 Oct 2017 16:18:03 +0000 (16:18 +0000)]
Be nicer on the dump stack by allocating only a ccb_nvmeio rather than
a full ccb. This saves a few hundre bytes, which might be important
during a crash dump...

Sponsored by: Netflix
Suggested by: scottl@

6 years agoExplicitly set reserved fields and 'fuse' to 0. This prevents us from
imp [Sun, 15 Oct 2017 16:17:59 +0000 (16:17 +0000)]
Explicitly set reserved fields and 'fuse' to 0. This prevents us from
acidentally sending bogus values in these fields, which some drives
may reject with an error or worse (undefined behavior).

This is especially needed for the ndadump routine which allocates the
cmd from stack garbage....

Sponsored by: Netflix

6 years agoUpdate comment to reflect actual default timeout.
imp [Sun, 15 Oct 2017 16:17:55 +0000 (16:17 +0000)]
Update comment to reflect actual default timeout.

Sponsored by: Netflix

6 years agoAdd special handling for current in-tree drm devices, like r323692 added
tijl [Sun, 15 Oct 2017 16:08:22 +0000 (16:08 +0000)]
Add special handling for current in-tree drm devices, like r323692 added
for drm-next.

6 years agoUse sizeof instead of strlen on string constants. The compiler doesn't
tijl [Sun, 15 Oct 2017 16:03:45 +0000 (16:03 +0000)]
Use sizeof instead of strlen on string constants.  The compiler doesn't
optimise the strlen calls away with -ffreestanding.

6 years agoReplace some magic numbers in usb_template(4) code with #defines.
trasz [Sun, 15 Oct 2017 11:46:11 +0000 (11:46 +0000)]
Replace some magic numbers in usb_template(4) code with #defines.
There should be no functional changes.

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

6 years agorc.subr: Remove test that is always true.
jilles [Sun, 15 Oct 2017 11:28:41 +0000 (11:28 +0000)]
rc.subr: Remove test that is always true.

The code above always sets _pidcmd to a non-empty value.

6 years agoFix ctld segfaulting when using ucl conf file format and having duplicated
bapt [Sun, 15 Oct 2017 08:03:14 +0000 (08:03 +0000)]
Fix ctld segfaulting when using ucl conf file format and having duplicated
lun or target

Submitted by: Nikita Kozlov <nikita.kozlov at blade-group.com>
MFC after: 3 days
Sponsored by: blade
Differential Revision: https://reviews.freebsd.org/D12646

6 years agoSync (make same) the offsetof macro definition in include/ with the
cy [Sun, 15 Oct 2017 02:40:13 +0000 (02:40 +0000)]
Sync (make same) the offsetof macro definition in include/ with the
definition of the same in sys/sys/. The problem was discovered while
working on implementing a new C11 gets_s() for libc. (The new gets_s()
requires rsize_t found in include/stddef.h.) The solution to sync the two
definitions was suggested by ed@ while discussing D12667.

Suggested by: ed
MFC after: 2 weeks

6 years agomlx4: use enum constants instead of const vars for case exprs
rlibby [Sat, 14 Oct 2017 23:25:44 +0000 (23:25 +0000)]
mlx4: use enum constants instead of const vars for case exprs

Follow up from r324201 to fix compilation with gcc, which complains
about non-ICE case expressions.

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

6 years agoAdd extended attributes support to fuse kernel module.
fsu [Sat, 14 Oct 2017 19:02:52 +0000 (19:02 +0000)]
Add extended attributes support to fuse kernel module.

Author:         kem
Reviewed by:    cem, pfg (mentor)
Approved by:    pfg (mentor)
MFC after:      2 weeks

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

6 years agoSwitch procstat from subcommand flags to verbs
brooks [Sat, 14 Oct 2017 18:38:36 +0000 (18:38 +0000)]
Switch procstat from subcommand flags to verbs

- Use an enumerated value instead of separate flags for commands
- Look for a verb if no command flag is set
- Lookup the "xocontainer" value based on the command
- Document the new command verbs in the man-page

Submitted by: kdrakehp@zoho.com
Differential Revision: https://reviews.freebsd.org/D10916

6 years agoCode cleanup, not functional change.
tuexen [Sat, 14 Oct 2017 10:02:59 +0000 (10:02 +0000)]
Code cleanup, not functional change.

This avoids taking a pointer of a packed structure which allows simpler
compilation of the userland stack.

MFC after: 1 week

6 years agoFix wrong v_free_count annotation - (f) instead of (a)
mjg [Sat, 14 Oct 2017 04:27:58 +0000 (04:27 +0000)]
Fix wrong v_free_count annotation - (f) instead of (a)

Reported by: alc

6 years agomtx: fix up owner_mtx after r324609
mjg [Sat, 14 Oct 2017 00:47:30 +0000 (00:47 +0000)]
mtx: fix up owner_mtx after r324609

Now that MTX_UNOWNED is 0 the test was alwayas false.

6 years agoReduce traffic on vm_cnt.v_free_count
mjg [Fri, 13 Oct 2017 21:54:34 +0000 (21:54 +0000)]
Reduce traffic on vm_cnt.v_free_count

The variable is modified with the highly contended page free queue lock.
It unnecessarily shares a cacheline with purely read-only fields and is
re-read after the lock is dropped in the page allocation code making the
hold time longer.

Pad the variable just like the others and store the value as found with
the lock held instead of re-reading.

Provides a modest 1%-ish speed up in concurrent page faults.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D12665

6 years agomtx: change MTX_UNOWNED from 4 to 0
mjg [Fri, 13 Oct 2017 20:31:56 +0000 (20:31 +0000)]
mtx: change MTX_UNOWNED from 4 to 0

The value is spread all over the kernel and zeroing a register is
cheaper/shorter than setting it up to an arbitrary value.

Reduces amd64 GENERIC-NODEBUG .text size by 0.4%.

MFC after: 1 week

6 years agoRegenerate usb.conf
kp [Fri, 13 Oct 2017 20:29:35 +0000 (20:29 +0000)]
Regenerate usb.conf

6 years agoSupport the D-Link DWM-222 LTE Dongle
kp [Fri, 13 Oct 2017 19:41:35 +0000 (19:41 +0000)]
Support the D-Link DWM-222 LTE Dongle

Submitted by: Daniel Hänschke <jailedemon@googlemail.com>