Commit Graph

243813 Commits

Author SHA1 Message Date
Alan Somers
7cc426fb42 ping: add a basic functional test
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21289
2019-08-22 15:00:36 +00:00
Li-Wen Hsu
cdac716946 Fix path issues after r351212
This fixes sys.netpfil.pf.forward.v4 and sys.netpfil.pf.icmp.cve_2019_5598
failures in CI system.

Sponsored by:	The FreeBSD Foundation
2019-08-22 12:08:35 +00:00
Brooks Davis
075ac3b446 Reorganise conditionals to reduce duplication.
No functional change.

Obtained from:	CheriBSD
MFC after:	3 days
Sponsored by:	DARPA, AFRL
2019-08-22 10:21:07 +00:00
Bjoern A. Zeeb
c982e56f4b usb: fix usb_fdt_support.c when altq enabled (usb_ehernet.h changes)
After r351243 when ALTQ was enabled in the kernel, the inline functions
in ifq.h would not have full type information as if_var.h was not
included.

Given usb_ethernet.h already includes all the various headers (which)
is the cause of the problem here, add if_var.h to it.  This fixes the
builds again.

Reported by:	CI system, e.g. FreeBSD-head-aarch64-LINT
2019-08-22 09:24:43 +00:00
Bjoern A. Zeeb
fada51254f w: initialize save_p to silence 'may be used uninitilized'
After r351379 save_p may be used uninitialized.  Set it to NULL before
first assignment so that a later NULL check will work correctly.

Reported by:		CI system for gcc platforms
MFC after:		1 week
X-MFC with:		351379 (karels)
2019-08-22 07:52:06 +00:00
Xin LI
aa9cb40e30 When creating a new FAT32 filesystem, use "unknown" (0xFFFFFFFF) for
FSI_Nxt_Free instead of providing a wrong value.

With this change, fsck_msdosfs would no longer complain about invalid
FSInfo information.

MFC after:	2 weeks
2019-08-22 06:14:06 +00:00
Conrad Meyer
acef7371c5 Fix i386 build after r351368
Reported by:	cy
Submitted by:	cy
2019-08-22 04:31:07 +00:00
Cy Schubert
4d93130daf Specifying array sizes for fully initialized tables at compile time is
redundant.

MFC after:	1 week
2019-08-22 03:33:10 +00:00
Mike Karels
ec9801de1e Change w(1) to compute FROM (host) field size dynamically
It's nice to be able to display a full IPv6 host address if
needed, but it's also nice to display more than 3 characters of a command
line. Compute the needed size for the FROM column in an earlier pass,
and determine the maximum, then print what fits for the command.

Reviewed by:	marcel@ (markm@ previous revision)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21211
2019-08-22 03:28:31 +00:00
Warner Losh
acc48026b3 Remove stray line that was duplicated.
Noticed by: rpokala@
2019-08-22 02:53:51 +00:00
Warner Losh
b2f7d03be1 Document Intel RST support just added 2019-08-22 02:53:46 +00:00
Rick Macklem
b4c64c61f2 Add a couple of lines noting that r351372 maps ENOTTY->EINVAL for other cases. 2019-08-22 01:29:59 +00:00
Mark Johnston
1689dc666c Document r351361. 2019-08-22 01:18:36 +00:00
Rick Macklem
df9bc7df42 Map ENOTTY to EINVAL for lseek(SEEK_DATA/SEEK_HOLE).
Without this patch, when an application performed lseek(SEEK_DATA/SEEK_HOLE)
on a file in a file system that does not have its own VOP_IOCTL(), the
lseek(2) fails with errno ENOTTY. This didn't seem appropriate, since
ENOTTY is not listed as an error return by either the lseek(2) man page
nor the POSIX draft for lseek(2).
This was discussed on freebsd-current@ here:
http://docs.FreeBSD.org/cgi/mid.cgi?CAOtMX2iiQdv1+15e1N_r7V6aCx_VqAJCTP1AW+qs3Yg7sPg9wA

This trivial patch maps ENOTTY to EINVAL for lseek(SEEK_DATA/SEEK_HOLE).

Reviewed by:	markj
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D21300
2019-08-22 01:15:06 +00:00
Conrad Meyer
5df6fa4344 gdb(4): Style
No functional change.

I was surprised to find that no sys/ header already defines the -1 EOF
convention anywhere, so defined one locally.
2019-08-22 00:36:16 +00:00
Conrad Meyer
799176810a gdb(4):amd64: Bump MI GDB_BUFSZ for more efficient transfers
A bigger buffer reduces the RTTs to transfer long messages and is otherwise
relatively harmless, especially on systems with plenty of memory.
2019-08-22 00:35:17 +00:00
Conrad Meyer
5555afa14e gdb(4): Implement qXfer:threads:read
This streams out an XML document over several GDB packets describing all
threads in the system; their ids, name, and any loosely defined "extra info"
we feel like including.  For now, I have included a string version of the run
state, similar to some of the DDB logic to stringify thread state.

The benefit of supporting this in addition to the qfThreadInfo/qsThreadInfo
packing is that in this mode, the host gdb does not ask for every thread's
"qThreadExtraInfo," saving per-thread round-trips on "info threads."

To use this feature, (k)gdb needs to be built with the --with-expat option.
I would encourage enabling this option by default in our GDB port, if it is
not already.

Finally, there is another optional attribute you can specify per-thread
called a "handle."  Handles are arbitrarily long sequences of bytes,
represented in the XML as hexadecimal.  It is unclear to me how or if GDB
actually uses handles for anything.  So I have left them out.
2019-08-22 00:34:11 +00:00
Conrad Meyer
c4fbbfaa47 gdb(4): Add basic 'qSupported' support
This is where the host GDB tells us what features it supports, and we
respond with the list we support.  For now, just report PacketSize.
2019-08-22 00:19:41 +00:00
Conrad Meyer
76c8c0902c gdb(4): Include thread in Target Halt Reason
This saves a round trip of the gdb remote inferior attempting to find
the thread id of the halted thread.

Sponsored by:	Dell EMC Isilon
2019-08-22 00:19:14 +00:00
John Baldwin
821fe3d3a4 Use 'const' for keys and IVs passed to software encryption algorithms.
Specifically, use 'const' for the key passed to the 'setkey' method
and 'const' for the 'iv' passed to the 'reinit' method.

Reviewed by:	cem
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D21347
2019-08-22 00:02:08 +00:00
Mark Johnston
e1a29d8c67 Add hold events for lockmgr probes, missed in r351361.
MFC with:	r351361
2019-08-21 23:47:01 +00:00
Mark Johnston
5b699f1614 Add lockmgr(9) probes to the lockstat DTrace provider.
They follow the conventions set by rw and sx lock probes.  There is
an additional lockstat:::lockmgr-disown probe.

Update lockstat(1) to report on contention and hold events for
lockmgr locks.  Document the new probes in dtrace_lockstat.4, and
deduplicate some of the existing probe descriptions.

Reviewed by:	mjg
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21355
2019-08-21 23:43:58 +00:00
Mateusz Guzik
81f666e79d nullfs: lock the vnode with LK_SHARED in null_vptocnp
null_nodeget which follows almost always finds the target vnode in the hash,
avoiding insmntque1 altogether. Should it be needed, it already checks if the
lock needs to be upgraded.

Reviewed by:	kib
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20244
2019-08-21 23:24:40 +00:00
Mark Johnston
6ad06a5e50 Fix inverted predicates for sx lock hold events in lockstat(1).
This caused shared sx holds to be reported as exclusive, and vice
versa.

Reviewed by:	mjg
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2019-08-21 23:13:00 +00:00
Warner Losh
51c5de5f25 Document RST support in nvme(4) and ahci(4). 2019-08-21 22:18:07 +00:00
Warner Losh
93289cfcd2 Create a AHCI attachment for nvme.
Intel has created RST and many laptops from vendors like Lenovo and Asus. It's a
mechanism for creating multiple boot devices under windows. It effectively hides
the nvme drive inside of the ahci controller. The details are supposed to be a
trade secret. However, there's a reverse engineered Linux driver, and this
implements similar operations to allow nvme drives to attach. The ahci driver
attaches nvme children that proxy the remapped resources to the child. nvme_ahci
is just like nvme_pci, except it doesn't do the PCI specific things. That's
moved into ahci where appropriate.

When the nvme drive is remapped, MSI-x interrupts aren't forwarded (the linux
driver doesn't know how to use this either). INTx interrupts are used
instead. This is suboptimal, but usually sufficient for the laptops these parts
are in.

This is based loosely on https://www.spinics.net/lists/linux-ide/msg53364.html
submitted, but not accepted by, Linux. It was written by Dan Williams. These
changes were written from scratch by Olivier Houchard.

Submitted by: cognet@ (Olivier Houchard)
2019-08-21 22:18:01 +00:00
Warner Losh
f182f928db Separate the pci attachment from the rest of nvme
Nvme drives can be attached in a number of different ways. Separate out the PCI
attachment so that we can have other attachment types, like ahci and various
types of NVMeoF.

Submitted by: cognet@
2019-08-21 22:17:55 +00:00
Alan Somers
99f13ae12c ping: add -H option for enabling reverse DNS lookup
This is the reverse of the -n flag.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
Sponsored by:	Google LLC (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21356
2019-08-21 21:05:15 +00:00
Alexander Motin
71a2818142 Improve NVMe hot unplug handling.
If device is unplugged from the system (CSTS register reads return
0xffffffff), it makes no sense to send any more recovery requests or
expect any responses back.  If there is a detach call in such state,
just stop all activity and free resources.  If there is no detach
call (hot-plug is not supported), rely on normal timeout handling,
but when it trigger controller reset, do not wait for impossible and
quickly report failure.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2019-08-21 20:17:30 +00:00
Mark Johnston
9fb7c918ef Remove manual wire_count adjustments from the unmapped mbuf code.
The original code came from a desire to minimize the number of updates
to v_wire_count, which prior to r329187 was updated using atomics.
However, there is no significant benefit to batching today, so simply
allocate pages using VM_ALLOC_WIRED and rely on system accounting.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D21323
2019-08-21 20:01:52 +00:00
Konstantin Belousov
65174f684c Fix _pthread_cancel_enter() and _pthread_cancel_leave() jmptable entries.
PR:	240022
Reported by:	Andrew Gierth <andrew@tao11.riddles.org.uk>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2019-08-21 19:53:50 +00:00
Mark Johnston
6bc13e042f Modify pipe_poll() to properly check for pending direct writes.
With r349546, it is a responsibility of the writer to clear PIPE_DIRECTW
after pinned data has been read.  In particular, once a reader has
drained this data, there is a small window where the pipe is empty but
PIPE_DIRECTW is set.  pipe_poll() was using the presence of PIPE_DIRECTW
to determine whether to return POLLIN, so in this window it would
claim that data was available to read when this was not the case.

Fix this by modifying several checks for PIPE_DIRECTW to instead look
at the number of residual bytes in data pinned by a direct writer.  In
some cases we really do want to check for PIPE_DIRECTW, since the
presence of this flag indicates that any attempt to write to the pipe
will block on the existing direct writer.

Bisected and test case provided by:	mav
Tested by:	pho
Reviewed by:	kib
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21333
2019-08-21 19:35:04 +00:00
Ed Maste
59e9b3695a makefs: Verify that the BPB media descriptor and FAT ID match
From r322982 in sys/fs/msdosfs.
2019-08-21 19:09:40 +00:00
Ed Maste
476b0ab758 makefs: share denode.h between kernel msdosfs and makefs
There is no need to duplicate this file when it can be trivially
shared (just exposing sections previously under #ifdef _KERNEL).

MFC with:	r351273
Differential Revision:	The FreeBSD Foundation
2019-08-21 19:07:13 +00:00
Mark Johnston
8b90607f20 Simplify vm_page_dequeue() and fix an assertion.
- Add a vm_pagequeue_remove() function to physically remove a page
  from its queue and update the queue length.
- Remove vm_page_pagequeue_lockptr() and let vm_page_pagequeue()
  return NULL for dequeued pages.
- Avoid unnecessarily reloading the queue index if vm_page_dequeue()
  loses a race with a concurrent queue operation.
- Correct an always-true assertion: vm_page_dequeue() may be called
  from the page allocator with the page unlocked.  The assertion
  m->order == VM_NFREEORDER simply tests whether the page has been
  removed from the vm_phys free lists; instead, check whether the
  page belongs to an object.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D21341
2019-08-21 16:11:12 +00:00
Mark Johnston
acad79e66f Unconditionally enable debug.vm_lowmem.
It is useful for testing purposes to be able to drain UMA caches, so
do not limit the sysctl to DIAGNOSTIC kernels.

MFC after:	1 week
Sponsored by:	Netflix
2019-08-21 16:01:17 +00:00
Mark Johnston
930b195263 Don't requeue active pages in vm_swapout_object_deactivate_pages().
As of r332974 the page daemon does not requeue pages during a scan
of the active queue, so there is not much value in doing so here
either.

Reviewed by:	alc, dougm, kib
MFC after:	1 week
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D21343
2019-08-21 15:52:10 +00:00
Alan Somers
229e8bf2bb ping: do reverse DNS lookup of the target address
When printing replies, ping will now attempt a reverse DNS lookup of the
target.  That can be suppressed by using the "-n" option.  Curiously, ping
has always done reverse lookups in certain error paths, but never in the
success path.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google LLC (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21351
2019-08-21 14:52:12 +00:00
Bjoern A. Zeeb
6d7adebad5 gprof: disable building of a.out components
On arm64, riscv, and s390x disable building of aout components.
This allows gprof to build on these architectures which never supported
the legacy a.out binary format.

Obtained from:		s390x branch
MFC after:		3 months
2019-08-21 10:54:52 +00:00
Randall Stewart
e13ad86c67 Fix an issue when TSO and Rack play together. Basically
an retransmission of the initial SYN (with data) would
cause us to strip the SYN and decrement/increase offset/len
which then caused us a -1 offset and a panic.

Reported by:	Larry Rosenman
(Michael Tuexen helped me debug this at the IETF)
2019-08-21 10:45:28 +00:00
Bjoern A. Zeeb
e303ee524e athhal: disable unused function (big endian only)
Disable ar9300_swap_tx_desc() for the moment.  It is an unused
function only tried to compile on big endian systems.

Found by:	s390x buildkernel
MFC after:	3 months
2019-08-21 10:42:31 +00:00
Xin LI
443127c517 Use MTX_NEW instead of bzero().
Submitted by:	cem
2019-08-21 08:15:30 +00:00
Xin LI
5473ef874e Fix sound on headset jack for ThinkPad T51. 2019-08-21 08:01:43 +00:00
Xin LI
ee318606ce Fix a panic in ubt_do_hci_request.
The 'mtx' is on stack and can contain garbages that would cause mtx_init
(and in turn lock_init) to think that the mutex was already initialized.
2019-08-21 07:45:39 +00:00
Mateusz Guzik
d7cf1814bd seqc: predict false for _in_modify and type fixes for _consistent_*
seqc_consistent_* return bool, not seqc. [0]

While here annotate the rarely true condition - it is expected to run
into it on vare occasion (compared to the other case).

Reported by:	oshogbo [0]
Sponsored by:	The FreeBSD Foundation
2019-08-21 04:54:48 +00:00
Justin Hibbits
aef13f050c dpaa: Fix warnings in dtsec(4) found by clang
These are all trivial warnings that have no real functional change.
2019-08-21 02:26:22 +00:00
Ed Maste
51e79affa3 makefs: share fat.h between kernel msdosfs and makefs
There is no reason to duplicate this file when it can be trivially
shared (just exposing one section previously under #ifdef _KERNEL).

Reviewed by:	imp, cem
MFC with:	r351273
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21346
2019-08-21 02:21:40 +00:00
Alexander Motin
51b92c1af6 Formalize NVMe controller consumer life cycle.
This fixes possible double call of fail_fn, for example on hot removal.
It also allows ctrlr_fn to safely return NULL cookie in case of failure
and not get useless ns_fn or fail_fn call with NULL cookie later.

MFC after:	2 weeks
2019-08-21 02:17:39 +00:00
Ed Maste
ef63362055 makefs: use char * not void * for buf b_data, drop casts in msdos
(The kernel uses caddr_t.)

Suggested by:	cem
Reviewed by:	cem
MFC with:	r351273
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21348
2019-08-21 01:45:29 +00:00
Alan Somers
c43633c6a1 ping: Add tests of the Internet checksum function
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google LLC (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21340
2019-08-20 21:59:48 +00:00