Commit Graph

258922 Commits

Author SHA1 Message Date
Jessica Clarke
5e912f5fec aic7xxx: Fix re-building firmware with -fno-common
The generated C output for aicasm_scan.l defines yylineno already, so
references to it from other files should use an extern declaration.

The STAILQ_HEAD use in aicasm_symbol.h also provided an identifier,
causing it to both define the struct type and define a variable of that
struct type, causing any C file including the header to define the same
variable. This variable is not used (and confusingly clashes with a
field name just below) and was likely caused by confusion when switching
between defining fields using similar type macros and defining the type
itself.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30525
2021-05-28 19:07:17 +01:00
Mark Johnston
6bb5699d2b libradius: Fix attribute length validation in rad_get_attr(3)
The length of the attribute header needs to be excluded when comparing
the attribute length against the length of the packet.  Otherwise,
validation may incorrectly fail when fetching the final attribute in a
message.

Fixes:		8d5c78130 ("libradius: Fix input validation bugs")
Reported by:	Peter Eriksson
Tested by:	Peter Eriksson
MFC after:	now
Sponsored by:	The FreeBSD Foundation
2021-05-28 12:58:29 -04:00
Lutz Donnerhacke
5434ebd256 tests/libalias: Measure cleanup time separatly
After long test runs, a lot of ressouces can be allocated.  Freeing
them takes a considerable amount of time.
2021-05-28 17:29:10 +02:00
Edward Tomasz Napierala
023ee5392c linux: make linux64.ko loadable again on aarch64
This should probably get deduplicated; this is a quick fix
just to unbreak things.

Fixes:		6d926e850d
Sponsored By:	EPSRC
2021-05-28 14:20:30 +00:00
Nathan Whitehorn
40923b0c81 Fix scripted installation from media without local distfiles.
The bsdinstall script target did not have the infrastructure to fetch
distfiles from a remote server the way the interactive installer does
on e.g. bootonly media. Solve this by factoring out the parts of the
installer that deal with fetching missing distributions into a new
install stage called 'fetchmissingdists', which is called by both the
interactive and scripted installer frontends.

In the course of these changes, cleaned up a few other issues with
the fetching of missing distribution files and added a warning if
fetching the MANIFEST file, which is used to verify the integrity of
the distribution files. We should at some point add cryptographic
signatures to MANIFEST so that it can be fetched safely if not present
on the install media (which it is for bootonly media).

Initial patch by: Vinícius Zavam
PR:		255659, 250928
Reviewed by:	dteske
MFC after:	4 weeks
Differential Revision:	https://reviews.freebsd.org/D27121
2021-05-28 10:01:27 -04:00
Ed Maste
d097687b31 arm64: correct END() copy-pasteo for generic_bs_fault
PR:		256197
Reported by:	Nick Reilly
MFC after:	1 week
Fixes:		95a85c125d ("Add NetBSD compatible bus_space_peek_N()...")
Sponsored by:	The FreeBSD Foundation
2021-05-28 09:10:11 -04:00
Edward Tomasz Napierala
c0f171736a Regen after 6d926e850d.
Sponsored By:	EPSRC
2021-05-28 09:04:17 +01:00
Edward Tomasz Napierala
6d926e850d linux: add new syscall numbers
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D30193
2021-05-28 09:02:16 +01:00
Ram Kishore Vegesna
7377d3831b ocs_fc: Fix use after free bug in ocs_hw_async_call()
Freed ctx is used in the later callee ocs_hw_command(),
which is a use after free bug.

Return error if sli_cmd_common_nop() failed.

PR: 255865
Reported by: lylgood@foxmail.com
Approved by:: markj
2021-05-28 11:21:10 +05:30
Ram Kishore Vegesna
dd722ccd6e ocs_fc: Fix a use after free in ocs_sport_free
Domain which could be freed is used while freeing the sport.
Use ocs from sport.

PR: 255866
Reported by: lylgood@foxmail.com
Approved by:: markj
2021-05-28 10:56:13 +05:30
Rick Macklem
96b40b8967 nfscl: Use hash lists to improve expected search performance for opens
A problem was reported via email, where a large (130000+) accumulation
of NFSv4 opens on an NFSv4 mount caused significant lock contention
on the mutex used to protect the client mount's open/lock state.
Although the root cause for the accumulation of opens was not
resolved, it is obvious that the NFSv4 client is not designed to
handle 100000+ opens efficiently.  When searching for an open,
usually for a match by file handle, a linear search of all opens
is done.

Commit 3f7e14ad93 added a hash table of lists hashed on file handle
for the opens.  This patch uses the hash lists for searching for
a matching open based of file handle instead of an exhaustive
linear search of all opens.
This change appears to be performance neutral for a small number
of opens, but should improve expected performance for a large
number of opens.

This commit should not affect the high level semantics of open
handling.

MFC after:	2 weeks
2021-05-27 19:08:36 -07:00
Ruslan Bukin
f81b451dcc hdspe: Support for mono sound.
This is useful when you have a single monitor speaker.
2021-05-27 21:40:21 +01:00
Mark Johnston
f3851b235b ktrace: Fix a race with fork()
ktrace(2) may toggle trace points in any of
1. a single process
2. all members of a process group
3. all descendents of the processes in 1 or 2

In the first two cases, we do not permit the operation if the process is
being forked or not visible. However, in case 3 we did not enforce this
restriction for descendents. As a result, the assertions about the child
in ktrprocfork() may be violated.

Move these checks into ktrops() so that they are applied consistently.

Allow KTROP_CLEAR for nascent processes. Otherwise, there is a window
where we cannot clear trace points for a nascent child if they are
inherited from the parent.

Reported by:	syzbot+d96676592978f137e05c@syzkaller.appspotmail.com
Reported by:	syzbot+7c98fcf84a4439f2817f@syzkaller.appspotmail.com
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30481
2021-05-27 15:52:20 -04:00
Mark Johnston
e00bae5c18 kevent: Prohibit negative change and event list lengths
Previously, a negative change list length would be treated the same as
an empty change list.  A negative event list length would result in
bogus copyouts.  Make kevent(2) return EINVAL for both cases so that
application bugs are more easily found, and to be more robust against
future changes to kevent internals.

Reviewed by:	imp, kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30480
2021-05-27 15:52:20 -04:00
Mark Johnston
f885100773 ktrace: Handle negative array sizes in ktrstructarray
ktrstructarray() may be used to create copies of kevent(2) change and
event arrays.  It is called before parameter validation is done and so
should check for bogus array lengths before allocating a copy.

Reported by:	syzkaller
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30479
2021-05-27 15:52:20 -04:00
Dmitry Chagin
434c46c006 rtwn_usb(4): Add a USB ID for the TP-Link Archer T2U v3.
PR:		256203
Submitted by:	Steve Kargl sgk at troutmask.apl.washington.edu
MFC after:	2 weeks
2021-05-27 21:52:10 +03:00
Eric van Gyzen
427f12f150 libprocstat kstack: fix race with thread creation
When collecting kernel stacks for a target process, if the process
adds a thread between the two calls to sysctl, ignore the additional
threads.  Previously, procstat would print only a useless error
message.  Now, it prints a consistent snapshot of the stacks.
We know that snapshot is already stale, but it could still be stale
even with a more complex fix to reallocate and retry, so such a fix
is hardly worth the effort.

Reported by:	Daniel.Mitchell@emc.com
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2021-05-27 11:44:00 -05:00
Randall Stewart
8c69d988a8 tcp: When we have an out-of-order FIN we do want to strip off the FIN bit.
The last set of commits fixed both a panic (in rack) and an ACK-war (in freebsd and bbr).
However there was a missing case, i.e. where we get an out-of-order FIN by itself.
In such a case we don't want to leave the FIN bit set, otherwise we will do the
wrong thing and ack the FIN incorrectly. Instead we need to go through the
tcp_reasm() code and that way the FIN will be stripped and all will be well.

Reviewed by: mtuexen,rscheff
Sponsored by: Netflix Inc
Differential Revision:	https://reviews.freebsd.org/D30497
2021-05-27 10:50:32 -04:00
Bjoern A. Zeeb
4cc8a9da49 LinuxKPI: add HWEIGHT32()
Add HWEIGHT32() macro needed by iwlwifi and while here add the 8/16/64
variants likewise.

Sponsored by:	The FreeBSD Foundation
MFC after:	12 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30501
2021-05-27 13:38:30 +00:00
Bjoern A. Zeeb
9b6835f3ab LinuxKPI: netdevice.h remove more ifnet operating macros
Now that mlx4 and ofed either are operating on ifnet functions
directly or have a private copy of these macros, we can remove them
from linux/netdevice.h.
With this only the #define for net_device to ifnet is left.

Sponsored by:	The FreeBSD Foundation
MFC after:	12 days
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D30478
2021-05-27 12:26:01 +00:00
Bjoern A. Zeeb
825b7d4c9d OFED: migrate LinuxKPI net_device/ifnet macros into ofed
The LinuxKPI net_device actually is an ifnet; in order to further
clean that up so we can extend "net_device" migrate the few macros
left into ofed and make sure the header is included in all files
which need access to the macros.

Sponsored by:	The FreeBSD Foundation
MFC after:	12 days
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D30477
2021-05-27 12:26:01 +00:00
Bjoern A. Zeeb
60afad6fc3 mlx4: replace LinuxKPI macros with ifnet functions
The LinuxKPI net_device actually is an ifnet;  in order to further
clean that up so we can extend "net_device" replace the few macros
inline in mlx4.

Sponsored by:	The FreeBSD Foundation
MFC after:	12 days
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D30476
2021-05-27 12:26:01 +00:00
Hans Petter Selasky
16fa3dcba0 ibstat: Include prototype for sysctlbyname().
Fixes the following compile warning:
      implicit declaration of function 'sysctlbyname' is invalid in C99
      [-Wimplicit-function-declaration]

Found by:	J87
Differential Revision:	https://reviews.freebsd.org/D30484
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-05-27 09:42:30 +02:00
Peter Holm
0a9e7899e2 stress2: Removed three mksnap_ffs(8) tests from the exclude list 2021-05-27 08:52:12 +02:00
Navdeep Parhar
5ef87bf8b6 cxgbe(4): Fix an incorrect assert.
CTRL and OFLD tx queues do not have automatic tx credit flush enabled so
it is okay for the cidx not to be the same as the pidx when the queue is
destroyed.

Reported by:	Jithesh Arakkan @ Chelsio
MFC after:	1 week
Sponsored by:	Chelsio Communications
2021-05-26 22:57:06 -07:00
Navdeep Parhar
740d722def cxgbe(4): Use correct argument in call to hashdestroy.
This fixes a panic on driver module unload.

Fixes:	24b98f288d cxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management.
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2021-05-26 22:31:06 -07:00
Mark Johnston
8d5c781306 libradius: Fix input validation bugs
Approved by:	so
Security:	FreeBSD-SA-21:12.libradius
Security:	CVE-2021-29629
MFC after:	now
Sponsored by:	The FreeBSD Foundation
2021-05-26 16:30:23 -04:00
Lutz Donnerhacke
f4c460dacd tests/libalias: Fix build error due to wrong prototype 2021-05-26 21:59:12 +02:00
Aleksandr Rybalko
198566e04a hwpmc: Move 4 bits of mode to extend class size to 8
Since r289025 we have had at least 5 bits class size.
Before that it was even 16 bits, but macro handling conversion between
pmcid and set of CPU, MODE, CLASS, ROWINDEX still use 4 bits class size
and 8 bits mode size.

This breaks some libpmc API methods, like pmc_capabilities.

Since we only have 4 modes and MODE field is a number (not a bitfield)
this patch moves 4 bits of mode to extend the CLASS field.

Reviewed by:	mhorne, emaste
Sponsored by:	Ampere Computing LLC
Submitted by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D30047
2021-05-26 18:40:58 +00:00
Richard Scheffenegger
c358f1857f tcp: Use local CC data only in the correct context
Most CC algos do use local data, and when calling
newreno_cong_signal from there, the latter misinterprets
the data as its own struct, leading to incorrect behavior.

Reported by:  chengc_netapp.com
Reviewed By:  chengc_netapp.com, tuexen, #transport
MFC after:    3 days
Sponsored By: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D30470
2021-05-26 20:15:53 +02:00
Lutz Donnerhacke
fef99da69f tests/libalias: Add missing prototype to fix build error 2021-05-26 19:39:06 +02:00
Mark Johnston
4cf3327528 acpi: Add missing error handling to acpi_pci_link_route_irqs()
Otherwise the resouce buffer may have been freed when
AcpiSetCurrentResources() is called, leading to a use-after-free.

PR:		255862
Submitted by:	Lv Yunlong <lylgood@foxmail.com> (original version)
MFC after:	1 week
2021-05-26 10:49:30 -04:00
Mark Johnston
27130028a5 ktls.4: Mention mb_use_ext_pgs in the "sysctl nodes" section
Reviewed by:	rmacklem, jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30403
2021-05-26 10:49:30 -04:00
Mark Johnston
ba5bc6e8f9 rpcsec_gss: Use a designated initializer for rpc_gss_ops
No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-05-26 10:45:40 -04:00
Mark Johnston
16f8f89c5c cxgb: Avoid a read-after-free in get_packet() when cxgb_debug is on
PR:		224927
MFC after:	1 week
2021-05-26 10:45:40 -04:00
Mark Johnston
771e95d2e2 netsmb: Avoid a read-after-free in smb_t2_request_int()
Defer freeing the request structure until we've decided whether the
request should be retried.

PR:		255881
MFC after:	1 week
2021-05-26 10:45:40 -04:00
Mark Johnston
71776d6719 oce: Fix handling of m_pullup() errors in oce_tso_setup()
m_pullup() frees the input mbuf chain upon a failure.  Set *mpp to NULL
in this case to ensure that the caller does not free the chain again.

PR:		224928
Submitted by:	Lv Yunlong <lylgood@foxmail.com> (original version)
MFC after:	1 week
2021-05-26 10:42:36 -04:00
Lutz Donnerhacke
d62e1ecba0 tests/libalias: Add port forwardings
Add port forwardings to the performance tests.  This will cause random
incoming packets to match the random port forwardings opends beforehand.

MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30443
2021-05-26 16:34:22 +02:00
Lutz Donnerhacke
6e87898a2c tests/libalias: Improve testing
gettimeofday(3) is almost as expensive as the calls to libalias.
So the call frequency for this call is reduced by a factor of 1000 in
order to neglect it's influence.

Using NAT entries became more realistic: A communication of a random
length of up to 150 packets (10% outgoing, 90% incoming) is applied
for each entry.

Precision of the execution time is raised to see the trends better.

Reviewed by:	kp
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30405
2021-05-26 16:26:44 +02:00
Lutz Donnerhacke
755bab6d55 tests/libalias: Test LibAliasIn on redirection
Extend the test suite for libalias(3) to incoming connections.
Test the various types of redirections.

MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30408
2021-05-26 16:19:24 +02:00
Lutz Donnerhacke
f1462ab051 tests/libalias: Factor out common primitives
Rework the tests to check the correct layer in a single test.
Factor out tests for reuse in other modules.

MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30412
2021-05-26 16:16:07 +02:00
Ed Maste
3f2508b7f3 elfctl: avoid touching file if no change made
Suggested by:	brooks
Reviewed by:	brooks, markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30452
2021-05-26 10:12:12 -04:00
Andrew Gallatin
df8437a93d cxgbe: fix enabling lro & rxtimestamps
A recent change caused iq flags, like LRO, to be set before
init_iq(). However, init_iq() clears those flags, so they
became effectively impossible to set.   This change moves
the initializion of these flags to after the call to init_iq().
This fixes LRO.

Differential Revision: https://reviews.freebsd.org/D30460
Reviewed by: np, rrs
Sponsored by: Netflix
Fixes: 43bbae1948 <https://reviews.freebsd.org/R10:43bbae19483fbde0a91e61acad8a6e71e334c8b8>"
2021-05-26 10:00:07 -04:00
Mark Johnston
4c599db71a vmm: Let guests enable SMEP/SMAP if the host supports it
Reviewed by:	kib, grehan, jhb
Tested by:	grehan (AMD)
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30462
2021-05-26 09:34:52 -04:00
Kristof Provost
9d0bc96ef8 pf tests: Only log critical errors from scapy
See a26e895f3d. Silence these new tests as
well.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-05-26 13:18:47 +02:00
Kristof Provost
3032c35388 pf: Move nvlist conversion functions to pf_nv
Separate the conversion functions (between kernel structs and nvlists)
to pf_nv. This reduces the size of pf_ioctl.c, which is already quite
large and complex, a good bit. It also keeps all the fairly
straightforward conversion code together.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30359
2021-05-26 13:18:47 +02:00
Bjoern A. Zeeb
c35034b338 LinuxKPI/OFED/mlx4: cleanup netdevice.h some more
This removes all unused bits from linux/netdevice.h and migrates two
inline functions into the mlx4 and ofed code respectively.

This gets the mlx4/ofed (struct ifnet) specific bits down to 7 lines
in netdevice.h.

Sponsored by:	The FreeBSD Foundation
MFC after:	13 days
Reviewed by:	hselasky, kib
Differential Revision: https://reviews.freebsd.org/D30461
2021-05-26 12:30:02 +00:00
Eugene Grosbein
3bca93e042 rc.d/random: add support for zero harvest_mask
Replace the check for zero harvest_mask with new check for empty string.
This allows one to specify harvest_mask="0" that disables harversting
entropy from all but "pure" sources. Exact bit values for "pure" sources
differ for stable/12 and later branches, so it is handy to use zero.
The check for zero pre-dates introduction of "pure" non-maskable sources
Use empty string to disable altering sysctl kern.random.harvest.mask.

Note that notion of "pure" random sources is not documented in user level
manual pages yet. Still, it helps to extend battery life for hardware
with embedded "Intel Secure Key RNG" by disabling all other sources.

Note that no defaults changed and default behaviour is not affected.

Reported by:	Dmitry Luhtionov
2021-05-26 18:30:24 +07:00
Edward Tomasz Napierala
905d192d6f Unstaticize parts of coredumping code
This makes it possible to call __elfN(size_segments) and __elfN(puthdr)
from Linux coredump code.

Reviewed By:	kib
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D30455
2021-05-26 11:51:57 +01:00
Randall Stewart
4f3addd94b tcp: Add a socket option to rack so we can test various changes to the slop value in timers.
Timer_slop, in TCP, has been 200ms for a long time. This value dates back
a long time when delayed ack timers were longer and links were slower. A
200ms timer slop allows 1 MSS to be sent over a 60kbps link. Its possible that
lowering this value to something more in line with todays delayed ack values (40ms)
might improve TCP. This bit of code makes it so rack can, via a socket option,
adjust the timer slop.

Reviewed by: mtuexen
Sponsered by: Netflix Inc
Differential Revision:	https://reviews.freebsd.org/D30249
2021-05-26 06:43:30 -04:00