Commit Graph

222026 Commits

Author SHA1 Message Date
Hans Petter Selasky
8402f058ad Fix implementation of task_pid_group_leader() in the LinuxKPI.
In FreeBSD thread IDs and procedure IDs have distinct number
spaces. When asking for the group leader task ID in the LinuxKPI,
return the procedure ID and let this resolve to the first task in the
procedure having a valid LinuxKPI task structure pointer.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-04-06 10:26:03 +00:00
Hans Petter Selasky
1ea4c85781 Implement proper support for memory map operations in the LinuxKPI,
like open, close and fault using the character device pager.

Some notes about the implementation:

1) Linux drivers set the vm_ops and vm_private_data fields during a
mmap() call to indicate that the driver wants to use the LinuxKPI VM
operations. Else these operations are not used.

2) The vm_private_data pointer is associated with a VM area structure
and inserted into an internal LinuxKPI list. If the vm_private_data
pointer already exists, the existing VM area structure is used instead
of the allocated one which gets freed.

3) The LinuxKPI's vm_private_data pointer is used as the callback
handle for the FreeBSD VM object. The VM subsystem in FreeBSD has a
similar list to identify equal handles and will only call the
character device pager's close function once.

4) All LinuxKPI VM operations are serialized through the mmap_sem
sempaphore, which is per procedure, which prevents simultaneous access
to the shared VM area structure when receiving page faults.

Obtained from:		kmacy @
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-04-06 09:34:54 +00:00
Hans Petter Selasky
e54b103e70 Before registering a new mm_struct in the LinuxKPI check if other
tasks in the belonging procedure already have a valid mm_struct and
reference that instead.

The mm_struct in the LinuxKPI should be shared among all tasks
belonging to the same procedure. This has to do with with the mmap_sem
semaphore which should serialize all VM operations inside a given
procedure. Linux based drivers depend on this behaviour.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-04-06 09:07:01 +00:00
Enji Cooper
0e6acb2653 Use __FBSDID instead of the license agreement to embed the $FreeBSD$ RCS keyword
Reminded by a comment made by markj w.r.t. using __FBSDID in .c files ala a
past Phabricator review.

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-06 05:36:35 +00:00
Enji Cooper
b824378b14 sbuf(3): add some basic functional tests for the library
Areas not covered still [positive functionality wise] are:
- sbuf_{clear,get,set}_flags
- sbuf_new (in particular, with fixed buffers, etc).

Some basic negative testing has been added, but more will be added in the
future.

This work was in part to validate work done by cem in r288223, and ian
before that.

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-06 05:29:28 +00:00
Enji Cooper
128668745b sbuf(9): add MLINKS for sbuf_{clear,get,set}_flags(9)
These functions were added in r279992.

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-06 05:02:03 +00:00
Enji Cooper
fa602b5bd0 sbuf(3): expose sbuf_{clear,get,set}_flags(3) via libsbuf
These functions were added to sbuf(9) in r279992, but never
exposed to userspace. Expose them now so they can be used/tested.

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-06 04:58:51 +00:00
Enji Cooper
1d30387920 atf-c: fix documentation description for atf_utils_wait(3)
atf_utils_wait(3) should be used in combination with atf_utils_fork(3),
not itself (atf_utils_wait(3)).

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-06 03:50:58 +00:00
Enji Cooper
e90ede1cc8 sbuf(9): clarify kernel-only APIs
- move sbuf_bcopyin(9) and sbuf_copyin(9) near sbuf_new_for_sysctl(9), as
  all three functions are kernel-only APIs.
- add #ifdef _KERNEL around sbuf_*copyin and sbuf_new_for_sysctl(9) to
  make it visually clear that they are kernel-only APIs.

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-06 02:46:09 +00:00
Enji Cooper
a6848fd560 sbuf(9): convert SYNOPSIS section from .Fn entries to .Fo/.Fa/.Fc entries
This shortens the column count on many lines considerably.

While here, add "(void)" to sbuf_new_auto(3) for consistency with style(9)
recommendations.

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-06 02:40:52 +00:00
Enji Cooper
7beb104d30 Add sys/types.h #include to EXAMPLE to provide a complete functional
standalone example program

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-06 02:03:35 +00:00
Alan Somers
e2a212c1fb Quiet 450.status-security when *_inline="YES"
Previously, 450.status-security would always set rc=3 in inline mode,
because it doesn't know whether "periodic security" is going to find
anything interesting. But this annoyingly results in daily reports that
simply say "Security check: \n\n-- End of daily output --".

This change fixes that by testing whether "periodic security" printed
anything, and setting 450.status-security's exit status to 3 if it did. An
alternative would be to change the exit status of periodic(8) to be the
worst of its scripts' exit statuses, but that would be a more intrusive
change.

Reviewed by:	brian
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D10267
2017-04-06 01:37:03 +00:00
Adrian Chadd
2d6ab41dcd [net80211] refactor out the A-MPDU dispatch routine.
The "dispatch a frame from the A-MPDU reorder buffer" code is essentially
duplicated in a couple of places.  This refactors it out into a single
place in preparation for A-MSDU in A-MPDU offload support, where multiple
A-MSDUs are decap'ed in hardware to 802.3/802.11 frames, but with the
same sequence number.

Reviewed by:	avos
Differential Revision:	https://reviews.freebsd.org/D10240
2017-04-06 01:35:42 +00:00
Cy Schubert
89f0a53cfe Revert r316516. des@ asked that r316516 be reverted so that he can spend
a little more time getting r316487 right.

Requested by:	des@
2017-04-06 00:15:18 +00:00
Ed Maste
07e89ad740 makefs: zero memory
NetBSD revs:
ffs/buf.c	1.14

Obtained from:	NetBSD
2017-04-06 00:07:11 +00:00
Sean Bruno
ec2408187e Don't overrite vf->flags variable at the end of ixgbe(4) ixgbe_add_vf().
Found by PVS-Studio Static code analyzer.

PR:		217748
Submitted by:	razmyslov@viva64.com
MFC after:	1 week
2017-04-05 22:01:49 +00:00
Ed Maste
d204af1e41 bsdgrep: Handle special case of single-byte NUL pattern
PR:		202022
Submitted by:	Kyle Evans <kevans91 at ksu.edu>
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10102
2017-04-05 20:11:05 +00:00
Sean Bruno
6916de8666 Fix a double free in ixgbe_rxeof()
Submitted by:	rstone
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10255
2017-04-05 19:52:49 +00:00
John Baldwin
fd46810af6 Fix the linker emulation setting for riscv.
Reported by:	lwhsu
MFC after:	1 week
Sponsored by:	DARPA / AFRL
2017-04-05 18:59:58 +00:00
Ed Maste
799c5faa8b bsdgrep: create additional tests for coverage on recent fixes
Create additional tests to cover regressions that were discovered by
PRs linked to reviews D10098, D10102, and D10104.

It is worth noting that neither bsdgrep(1) nor gnugrep(1) in the base
system currently pass all of these tests, and gnugrep(1) not quite being
up to snuff was also noted in at least one of the PRs.

PR:		175314 202022 195763 180990 197555 197531 181263 209116
Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reviewed by:	cem, ngie, emaste
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10112
2017-04-05 18:41:44 +00:00
Alan Somers
4db3787dd9 Fix memory leak in "gpart bootcode"
Also, annotate that gpart_issue never returns

Reported by:	Coverity
CID:		1007105
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-04-05 18:31:26 +00:00
Bryan Drewery
9c0e1d45c5 Stop building assym.o into the module.
DTrace includes assym.s, to build this we build assym.o, however
this is unneeded as assym.s only contains macros.

Remove the need to build this by removing it from OBJS, but keep assym.s
in the module dependencies via DPSRCS.

This fixes the build when there is no assembler, e.g. on arm64 without
the external binutils.

Submitted by:	andrew
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10041
2017-04-05 17:56:21 +00:00
Bryan Drewery
f8a35ad1bd Support assym.s in DPSRCS to depend on it but not link it in.
Reported by:	andrew
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-04-05 17:56:17 +00:00
Konstantin Belousov
ea52525928 Make nfs pageout coherent with the dirty state of the buffers.
Write out the dirty pages using VOP_WRITE() instead of directly
calling ncl_writerpc(). The state of the buffers now reflects the
write, fixing some hard to diagnose consistency and write order
issues.  The change also allowed to remove remapping of paged out
pages into kernel space and related allocation of the phys buffer.

Reviewed by:	markj, rmacklem
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D10241
2017-04-05 17:26:20 +00:00
Konstantin Belousov
b73cd4d344 Handle nfs IO_ASYNC write requests asynchronously.
Reviewed by:	markj, rmacklem
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
X-Differential revision:	https://reviews.freebsd.org/D10241
2017-04-05 17:20:31 +00:00
Alan Somers
fc9437c886 Fix clearing geom metadata if DIOCGSECTORSIZE fails
An unhandled error case would result in passing SIZE_MAX to malloc.
While I'm here, remove an unnecessary NULL check before free

Reported by:	Coverity
CID:		1017793
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-04-05 17:17:18 +00:00
Konstantin Belousov
48fe926362 Handle possible vnode reclamation after ncl_vinvalbuf() call.
ncl_vinvalbuf() might need to upgrade vnode lock, allowing the vnode
to be reclaimed by other thread.  Handle the situation, indicated by
the returned error zero and VI_DOOMED iflag set, converting it into
EBADF.  Handle all calls, even where the vnode is exclusively locked
right now.

Reviewed by:	markj, rmacklem
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
X-Differential revision:	https://reviews.freebsd.org/D10241
2017-04-05 17:11:39 +00:00
Konstantin Belousov
0226f65940 Add V_VMIO flag for vinvalbuf(9) to indicate that the flush request
was issued during VM-initiated i/o (pageout), so that the function
does not try to flush or remove pages or wait for the vm object
paging-in-progress counter.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential revision:	https://reviews.freebsd.org/D10241
2017-04-05 16:57:53 +00:00
Ryan Stone
4af540d197 Revert the optimization from r304436
r304436 attempted to optimize the handling of incoming UDP packet by only
making an expensive call to in_broadcast() if the mbuf was marked as an
broadcast packet.  Unfortunately, this cannot work in the case of point-to-
point L2 protocols like PPP, which have no notion of "broadcast".  The
optimization has been disabled for several months now with no progress
towards fixing it, so it needs to go.
2017-04-05 16:57:13 +00:00
Konstantin Belousov
65b9599a76 Extract calculation of ioflags from the vm_pager_putpages flags into a
helper.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential revision:	https://reviews.freebsd.org/D10241
2017-04-05 16:56:04 +00:00
Konstantin Belousov
3dbb0ca646 Some style fixes for vnode_pager_generic_putpages(), in the local
declaration block.

Reviewed by:	markj (as part of the larger patch)
Tested by:	pho (as part of the larger patch)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential revision:	https://reviews.freebsd.org/D10241
2017-04-05 16:45:00 +00:00
Konstantin Belousov
53b6404819 Use int instead of boolean_t for flags argument type in
vnode_pager_generic_putpages() prototype; change the argument name to
reflect that it is flags.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential revision:	https://reviews.freebsd.org/D10241
2017-04-05 16:30:41 +00:00
Alan Somers
6504428e9c Remove a duplicate fclose() that snuck into r316501
Reported by:	Coverity
CID:		1373338
MFC after:	20 days
X-MFC-With:	316501
Sponsored by:	Spectra Logic Corp
2017-04-05 16:13:36 +00:00
Hans Petter Selasky
6e3e654490 Unify error handling when si_drv1 is NULL in the LinuxKPI.
Make sure the character device poll callback function does not return
an error code, but a POLLXXX value, in case of failure.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-04-05 12:48:24 +00:00
Hans Petter Selasky
0bd68b774d Implement down_write_killable() in the LinuxKPI.
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-04-05 12:10:02 +00:00
Sepherosa Ziehau
b3b75d9c84 hyperv/hn: Fixat RNDIS rxfilter after the successful RNDIS init.
Under certain conditions on certain versions of Hyper-V, the RNDIS
rxfilter is _not_ zero on the hypervisor side after the successful
RNDIS initialization, which breaks the assumption of any following
code (well, it breaks the RNDIS API contract actually).  Clear the
RNDIS rxfilter explicitly, drain packets sneaking through, and drain
the interrupt taskqueues scheduled due to the stealth packets.

Reported by:	dexuan@
MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D10230
2017-04-05 08:25:22 +00:00
Sepherosa Ziehau
498ef762ec hyperv/storvsc: Fixup SRB status.
This unbreaks GEN2 Hyper-V cd support.

Submitted by:	Hongjiang Zhang <honzhan microsoft com>
Reviewed by:	dexuan@
MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D10212
2017-04-05 08:15:47 +00:00
Cy Schubert
4360d992ef r316487 altered the defined values of rc_force from "yes" (for yes)
and NULL (for no) to "no" (for no) and no change to the definition
of yes. Two rc.d scripts, dhclient and bgfsck check rc_force for
yesi, using test -n, and no, using test -z. The redefinition of
yes and no by r316487 caused rc.d/dhclient, when invoked by devd
using a devd.conf rule, to assign DHCP assigned IP addresses for
interfaces with statically assigned interfaces, breaking boot.
Point of breakage was at line 25 of etc/rc.d/dhclient (r301068)
where $rc_force needs to be NULL.

MFC after:	3 weeks
X-MFC with:	r316487
2017-04-05 05:23:09 +00:00
Sepherosa Ziehau
3f1b91c58d hyperv/kbd: Add support for synthetic keyboard.
Synthetic keyboard is the only supported keyboard on GEN2 Hyper-V.

Submitted by:	Hongjiang Zhang <honzhan microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D10196
2017-04-05 05:01:23 +00:00
John Baldwin
dc653882d4 Always pass the linker emulation via -m when linking modules and kernels.
Previously the linker emulation was only passed when building binary
objects for firmware modules.  This change always passes the desired
output format for kernel modules and kernels rather than requiring the
toolchain's default output format to match the desired output format.
This in turn permits use of external toolchains whose default output
format does not match the desired output format.

Reviewed by:	imp, emaste
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D10085
2017-04-05 03:05:04 +00:00
John Baldwin
5da3b3772f Sync SYSTEM_LD in Makefile.arm with kern.pre.mk.
- Add --no-warn-mismatch.
- Use same whitespace to make future updates simpler.

Reviewed by:	imp (part of a larger change)
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D10085
2017-04-05 03:00:52 +00:00
John Baldwin
dd3c43299e Use correct linker emulation name for armeb.
MFC after:	1 week
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D10085
2017-04-05 02:52:49 +00:00
John Baldwin
813b8a9e89 Add an implementation of __ffssi2() derived from __ffsdi2().
Newer versions of GCC include an __ffssi2() symbol in libgcc and the
compiler can emit calls to it in generated code.  This is true for at
least GCC 6.2 when compiling world for mips and mips64.

Reviewed by:	jmallett, dim
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D10086
2017-04-05 02:40:53 +00:00
John Baldwin
2e2e26d14e Don't leak a session and lock if a GMAC key has an invalid length.
Reviewed by:	delphij (secteam)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10273
2017-04-05 01:46:41 +00:00
Conrad Meyer
a96da1c3fb ufs: Export UFS_MAXNAMLEN to pathconf, statfs
Rather than the global NAME_MAX constant.  This change is required to
support systems with a NAME_MAX/MAXNAMLEN that differs from UFS_MAXNAMLEN.

This was missed in r313475 due to the alternative spelling ("NAME_MAX") of
MAXNAMLEN.  This change is also similar in spirit to r313780.

Reported by:	ngie@
Sponsored by:	Dell EMC Isilon
2017-04-05 01:44:03 +00:00
Andrey V. Elsukov
1bbe19e65b Use unique SPI.
MFC after:	1 week
2017-04-04 23:30:05 +00:00
Andrey V. Elsukov
b72ff4a149 In the example section show that TCP-MD5 connection needs SA for both
directions.

Submitted by:	Mike Tancsa <mike at sentex net>
MFC after:	1 week
2017-04-04 23:28:22 +00:00
Navdeep Parhar
3128b167ed cxgbe(4): Program the global RSS key once instead of once per ifnet.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-04 23:14:03 +00:00
Enji Cooper
ba8c8a0ca2 Don't assume NAME_MAX is 255
Query the filesystem limit via getconf(3) instead

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-04 21:36:13 +00:00
Enji Cooper
d2d2a79c1a Clean up more trailing whitespace in the licensing tort that
happened to be spaces, not tabs

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-04 21:30:24 +00:00