Commit Graph

258427 Commits

Author SHA1 Message Date
Dimitry Andric
0dad05dd30 Add a few missed libalias_cuseeme files to ObsoleteFiles.inc 2021-05-03 22:45:08 +02:00
Dimitry Andric
1c3dcf8d57 Add a few missed libprivateevent files to ObsoleteFiles.inc 2021-05-03 22:43:39 +02:00
Dimitry Andric
d134e49615 Add a few missed gnuregex libraries to ObsoleteFiles.inc 2021-05-03 22:40:11 +02:00
Dimitry Andric
b9ec6f2ef9 Add a whole bunch of missed obsolete manpages to ObsoleteFiles.inc 2021-05-03 22:24:27 +02:00
Sai Rajesh Tallamraju
64881da478 ixgbe: Restore AIM support
AIM (adaptive interrupt moderation) was part of BSD11 driver. Upon IFLIB
migration, AIM feature got lost. Re-introducing AIM back into IFLIB
based IXGBE driver.

One caveat is that in BSD11 driver, a queue comprises both Rx and Tx
ring. Starting from BSD12, Rx and Tx have their own queues and rings.
Also, IRQ is now only configured for Rx side. So, when AIM is
re-enabled, we should now consider only Rx stats for configuring EITR
register in contrast to BSD11 where Rx and Tx stats were considered to
manipulate EITR register.

Reviewed by:	gallatin, markj
Sponsored by:	NetApp, Inc.
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D27344
2021-05-03 13:47:14 -04:00
Mark Johnston
f161d294b9 Add missing sockaddr length and family validation to various protocols
Several protocol methods take a sockaddr as input.  In some cases the
sockaddr lengths were not being validated, or were validated after some
out-of-bounds accesses could occur.  Add requisite checking to various
protocol entry points, and convert some existing checks to assertions
where appropriate.

Reported by:	syzkaller+KASAN
Reviewed by:	tuexen, melifaro
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29519
2021-05-03 13:35:19 -04:00
Elliott Mitchell
a3c7da3d08 kern/intr: declare interrupt vectors unsigned
These should never get values large enough for sign to matter, but one
of them becoming negative could cause problems.

MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D29327
2021-05-03 13:24:30 -04:00
Zhenlei Huang
1d712c0537 traceroute6: Properly calculate UDP checksum
The revision D25604 capsicumize traceroute6. For UDP the send socket was
changed from SOCK_DGRAM to SOCK_RAW and thus the UDP checksum need be
calculated by application itself other than the kernel.

outpacket is filled with zeros by line 707, thus the first round the UDP
checksum is correct. But subsequent rounds outudp->uh_sum will be left
with garbage.

PR:		255507
Reviewed by:	ae, markj, tuexen
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D30042
2021-05-03 13:24:30 -04:00
Mark Johnston
243b324f96 devfs: Avoid comparison with an uninitialized var in devfs_fp_check()
devvn_refthread() will initialize *devp only if it succeeds, so check for
success before comparing with fp->f_data.  Other devvn_refthread()
callers are careful to do this.

Reported by:	KMSAN
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30068
2021-05-03 13:24:30 -04:00
Mark Johnston
2b2d77e720 VOP_STAT: Provide a default value for va_gen
Some filesystems, e.g., pseudofs and the NFSv3 client, do not provide
one.

Reviewed by:	kib
Reported by:	KMSAN
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30091
2021-05-03 13:24:30 -04:00
Mark Johnston
cdfcfc607a smp: Initialize arg->cpus sooner in smp_rendezvous_cpus_retry()
Otherwise, if !smp_started is true, then smp_rendezvous_cpus_done() will
harmlessly perform an atomic RMW on an uninitialized variable.

Reported by:	KMSAN
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-05-03 13:24:30 -04:00
Mark Johnston
02e7a6514e bhyve: Set SO_REUSEADDR on the gdb stub socket
Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30037
2021-05-03 13:24:30 -04:00
Konstantin Belousov
7cb40543e9 filt_timerexpire: do not iterate over the interval
User-supplied data might make this loop too time-consuming. Divide
directly, and handle both the possibility that we were woken up earlier,
and arithmetic overflows/underflows from the calculation.

Reported and tested by:	pho (previous version)
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D30069
2021-05-03 19:49:54 +03:00
Dimitry Andric
b87a5b266d ndis: remove leftover ndis_events binary and manpage
Fixes:		bfc99943b0 ("ndis(4): remove as previous announced")
2021-05-03 18:37:42 +02:00
Konstantin Belousov
73e8f06ac5 gcore: add option to dump core using kernel facility
-k switch causes gcore to use ptrace(PT_COREDUMP) instead of manually
reading process memory and constructing the core.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:18:26 +03:00
Konstantin Belousov
c192228b73 gcore: split code to open core file into helper
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:18:26 +03:00
Konstantin Belousov
87a64872cd Add ptrace(PT_COREDUMP)
It writes the core of live stopped process to the file descriptor
provided as an argument.

Based on the initial version from https://reviews.freebsd.org/D29691,
submitted by Michał Górny <mgorny@gentoo.org>.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:18:26 +03:00
Konstantin Belousov
68d311b666 ptracestop: mark threads suspended there with the new TDB_SSWITCH flag
This way threads in ptracestop can be discovered by debugger

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:18:25 +03:00
Konstantin Belousov
9ebf9100ba ptrace: do not allow for parallel ptrace requests
Set a new P2_PTRACEREQ flag around the request Wait for the target     .
process P2_PTRACEREQ flag to clear before setting ours                 .

Otherwise, we rely on the moment that the process lock is not dropped
until the stopped target state is important.  This is going to be no
longer true after some future change.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:16:30 +03:00
Konstantin Belousov
54c8baa021 kern_ptrace(): extract code to determine ptrace eligibility into helper
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:13:48 +03:00
Konstantin Belousov
2bd0506c8d kern_ptrace: change type of proctree_locked to bool
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:13:48 +03:00
Konstantin Belousov
af928fded0 Add thread_run_flash() helper
It unsuspends single suspended thread, passed as the argument.
It is up to the caller to arrange the target thread to suspend later,
since the state of the process is not changed from stopped.  In particular,
the unsuspended thread must not leave to userspace, since boundary code
is not prepared to this situation.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:13:47 +03:00
Konstantin Belousov
15465a2c25 Add sleepq_remove_nested()
The helper removes the thread from a sleep queue, assuming that it would
need to sleep. The sleepq_remove_nested() function is intended for quite
special case, where suspended thread from traced stopped process is
temporary unsuspended to do some work on behalf of the debugger in the
target context, and this work might require sleep.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:13:47 +03:00
Konstantin Belousov
86ffb3d1a0 ELF coredump: define several useful flags for the coredump operations
- SVC_ALL request dumping all map entries, including those marked as
  non-dumpable
- SVC_NOCOMPRESS disallows compressing the dump regardless of the sysctl
  policy
- SVC_PC_COREDUMP is provided for future use by userspace core dump
  request

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:13:47 +03:00
Konstantin Belousov
5bc3c61780 imgact_elf: consistently pass flags from coredump down to helper functions
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:13:47 +03:00
Alan Somers
3b57d80c7a daemon: add some basic tests
MFC after:	2 weeks
Sponsored by:	Axcient
Differential Revision:	https://reviews.freebsd.org/D29316
2021-05-03 09:55:40 -06:00
Edward Tomasz Napierala
7818653fd6 cam: fix integer overflow during inquiry
From my understanding this could happen with iSCSI LUNs with
unusually long names.  The bug would make CAM fail to retrieve
the full inquiry data.  Instead of bumping the size of the local
variable, just use a macro.

Reviewed By:	imp, mav
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#50
Differential Revision:	https://reviews.freebsd.org/D29991
2021-05-03 15:20:17 +01:00
Jose Luis Duran
8f1562430f Add Apollo Lake SIO/LPSS UARTs PCI IDs
Add PCI IDs for Intel Apollo Lake Series HSUARTs:

    # pciconf -ll
    drv   selector      class    rev  hdr  vendor device subven subdev
    uart0@pci0:0:24:0:  118000   0b   00   8086   5abc   8086   7270
    uart1@pci0:0:24:1:  118000   0b   00   8086   5abe   8086   7270
    uart2@pci0:0:24:2:  118000   0b   00   8086   5ac0   8086   7270
    uart3@pci0:0:24:3:  118000   0b   00   8086   5aee   8086   7270

NB (Intel Document Number 336256-004US):
1. The E3900 and A3900 Series Processors support four LPSS_UART ports,
   while the N- and J- Series Processors support only LPSS_UART [2:1]
   ports.
2. The LPSS_UART1 port is dedicated for discrete Global Navigation
   Satellite System (GNSS).  This port can be used for generic UART
   functionality if GNSS is not used.
3. The LPSS_UART2 port is dedicated for host OS debug.
4. The LPSS_UART0 and LPSS_UART3 ports are for generic UART functionality.
5. Only UART [1:0] ports support DMA.

PR:	255556
Submitted by:	Jose Luis Duran <jlduran@gmail.com>
MFC after:	1 week
2021-05-03 14:38:52 +03:00
Jose Luis Duran
5b8b6b26e4 uart_bus_pci.c: Style
Wrap long lines, use tab instead of spaces.

PR:	255556
Submitted by:	Jose Luis Duran <jlduran@gmail.com>
MFC after:	1 week
2021-05-03 14:38:52 +03:00
Jose Luis Duran
0ea8a7f36d ifconfig: Minor documentation fix
Fix what appears to have been a small copy/paste typo in ifconfig(8)'s
documentation (man page and header file).

Not that it matters anymore.

Reference: Table I-2 in IEEE Std 802.1Q-2014.

PR:	255557
Submitted by:	Jose Luis Duran <jlduran@gmail.com>
MFC after:	1 week
2021-05-03 14:38:52 +03:00
Andrew Turner
0ec205197b Also enable IPIs on 32-bit arm
This was missed in 2420f6a

Reported by:	tuexen, imp
2021-05-03 08:36:57 +00:00
Lutz Donnerhacke
5c4fe2ac81 service/ipfw: Silence warning on restart
Once the ipfw0 interface has been created, ifconfig(8) create will
throw a warning: ifconfig: create: bad value' when trying to create it
again.

PR:		241013
Submitted by:	Jose Luis Duran
Approved by:	kp
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D30083
2021-05-03 12:27:20 +02:00
Peter Holm
cff133b05b stress2: Added a regression test 2021-05-03 09:08:43 +02:00
Peter Holm
a7d46ad087 stress2: Added a syzkaller reproducer 2021-05-03 09:05:32 +02:00
Peter Holm
573bd33a33 stress2: Fix a typo. 2021-05-03 08:45:55 +02:00
Michael Tuexen
8b3d0f6439 sctp: improve address list scanning
If the alternate address has to be removed, force the stack to
find a new one, if it is still needed.

MFC after:	3 days
2021-05-03 02:50:05 +02:00
Michael Tuexen
a89481d328 sctp: improve restart handling
This fixes in particular a possible use after free bug reported
Anatoly Korniltsev and Taylor Brandstetter for the userland stack.

MFC after:	3 days
2021-05-03 02:20:24 +02:00
Alexander Motin
655c200cc8 Fix build after 5f2e183505. 2021-05-02 20:07:38 -04:00
Alexander Motin
2760658b21 Improve UMA cache reclamation.
When estimating working set size, measure only allocation batches, not free
batches.  Allocation and free patterns can be very different.  For example,
ZFS on vm_lowmem event can free to UMA few gigabytes of memory in one call,
but it does not mean it will request the same amount back that fast too, in
fact it won't.

Update working set size on every reclamation call, shrinking caches faster
under pressure.  Lack of this caused repeating vm_lowmem events squeezing
more and more memory out of real consumers only to make it stuck in UMA
caches.  I saw ZFS drop ARC size in half before previous algorithm after
periodic WSS update decided to reclaim UMA caches.

Introduce voluntary reclamation of UMA caches not used for a long time. For
each zdom track longterm minimal cache size watermark, freeing some unused
items every UMA_TIMEOUT after first 15 minutes without cache misses. Freed
memory can get better use by other consumers.  For example, ZFS won't grow
its ARC unless it see free memory, since it does not know it is not really
used.  And even if memory is not really needed, periodic free during
inactivity periods should reduce its fragmentation.

Reviewed by:	markj, jeff (previous version)
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D29790
2021-05-02 19:45:23 -04:00
Michael Tuexen
5f2e183505 sctp: improve error handling in INIT/INIT-ACK processing
When processing INIT and INIT-ACK information, also during
COOKIE processing, delete the current association, when it
would end up in an inconsistent state.

MFC after:	3 days
2021-05-02 22:41:35 +02:00
Rick Macklem
4f592683c3 copy_file_range(2): improve copying of a large hole to EOF
PR#255523 reported that a file copy for a file with a large hole
to EOF on ZFS ran slowly over NFSv4.2.
The problem was that vn_generic_copy_file_range() would
loop around reading the hole's data and then see it is all
0s. It was coded this way since UFS always allocates a data
block near the end of the file, such that a hole to EOF never exists.

This patch modifies vn_generic_copy_file_range() to check for a
ENXIO returned from VOP_IOCTL(..FIOSEEKDATA..) and handle that
case as a hole to EOF. asomers@ confirms that it works for his
ZFS test case.

PR:	255523
Tested by:	asomers
Reviewed by:	asomers
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30076
2021-05-02 16:04:27 -07:00
Lutz Donnerhacke
bf7cc0f9cb sbin/ipfw: Fix null pointer deference when printing counters
ipfw -[tT] prints statistics of the last access. If the rule was never
used, the counter might be not exist.  This happens unconditionally on
inserting a new rule.  Avoid printing statistics in this case.

PR:	255491
Reported by:	Haisheng Zhouz
Reviewed by:	ae
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30046
2021-05-02 21:28:46 +02:00
Xin LI
f6b6d216ca usr.bin/netstat: use roundup2 when rounding up to power of 2.
MFC after:	 2 weeks
2021-05-02 09:30:22 -07:00
Xin LI
9769f6f808 usr.bin/patch: remove unneeded header.
MFC after:	2 weeks
2021-05-02 09:27:32 -07:00
Charlie Li
c229f4aa0c
Add myself (vishwin) as a ports committer
Following section 7.1 in Committer's Guide.

Approved by: arrowd (mentor)
Differential Revision: https://reviews.freebsd.org/D30078
2021-05-02 10:20:46 -04:00
Andrew Turner
2420f6aed9 Enable IPIs on CPU 0 on arm and arm64
Not all interrupt controllers enable IPIs by default as the Arm
GIC specs make it an implementation defined option. As at least two
hypervisors have also previously masked the IPIs on boot.

As we already enable these IPIs on the non-boot CPUs it is expected
this is a safe operation.

Differential Revision:	https://reviews.freebsd.org/D26975
2021-05-02 07:43:34 +00:00
Andrew Turner
fe38224977 Implement bus_map_resource on arm64
This will allow us to allocate an unmapped memory resource, then
later map it with a specific memory attribute.

This is also needed for virtio with the modern PCI attachment.

Reviewed by:	kib (via D29723)
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D29694
2021-05-02 07:35:16 +00:00
Xin LI
50d31dbc6e less: upgrade to v581.2.
MFC after:	1 week
2021-05-01 23:16:08 -07:00
Xin LI
bb457ab744 Vendor import of less v581.2. 2021-05-01 23:13:19 -07:00
Justin Hibbits
be48fe6000 powerpc/xive: Remove POWER9 DD1 IRQ bits
The OPAL_XIVE_*_VIA_IFW flags are used only for POWER9 DD1, which we
don't support.

Noticed while perusing Linux and skiboot git logs.
2021-05-01 16:18:02 -05:00