Commit Graph

271244 Commits

Author SHA1 Message Date
Alexander V. Chernikov
c2c8e360d8 tcp: virtualise net.inet.tcp.msl sysctl.
VNET teardown waits 2*MSL (60 seconds by default) before expiring
 tcp PCBs. These PCBs holds references to nexthops, which, in turn,
 reference ifnets. This chain results in VNET interfaces being destroyed
 and moved to default VNET only after 60 seconds.
Allow tcp_msl to be set in jail by virtualising net.inet.tcp.msl sysctl,
 permitting more predictable VNET tests outcomes.

MFC after:	1 week
Reviewed by:	glebius
Differential Revision: https://reviews.freebsd.org/D33270
2021-12-26 14:56:04 +00:00
Andriy Gapon
ace3370392 add exuberant ctags tags file to gitignore 2021-12-26 12:23:07 +02:00
Alexander Motin
1d6fb900ed x86: Remove CTLFLAG_NEEDGIANT from sysctls.
MFC after:	2 weeks
2021-12-25 22:24:20 -05:00
Alexander Motin
27ac2b2d49 LinuxKPI: Replace missed Giant with bus_topo_lock. 2021-12-25 22:02:07 -05:00
Alexander Motin
22405bb2e4 pccbb: Remove Giant mention in comments.
MFC after:	2 weeks
2021-12-25 21:51:48 -05:00
Alexander Motin
1886cef69b hwpmc: Remove CTLFLAG_NEEDGIANT from sysctl.
MFC after:	2 weeks
2021-12-25 21:40:14 -05:00
Alexander Motin
c214c2c004 uart: Remove CTLFLAG_NEEDGIANT from sysctl.
MFC after:	2 weeks
2021-12-25 21:30:02 -05:00
Alexander Motin
54daceab55 xen/blkfront: Remove CTLFLAG_NEEDGIANT from sysctl.
It only converts bit field into string.  It does not need locking.

MFC after:	1 week
2021-12-25 21:24:24 -05:00
Alexander Motin
6c101ed7a3 amdtemp: Remove CTLFLAG_NEEDGIANT from sysctls.
It seems to be needed only to serialize very old K8 registers access.
Introduce separate lock for that and remove Giant dependency.

MFC after:	2 weeks
2021-12-25 21:03:54 -05:00
Peter Holm
9a6201ac2f stress2: Fix "set-but-not-unused" warnings 2021-12-25 07:27:25 +00:00
Doug Moore
4bae154fe8 vm_page: Move a comment
fb38b29b56 (page_alloc_br) vm_page: Remove extra test, dup code from page alloc
should have moved a comment block when it moved the function call that followed it.

Move the comment block now.
2021-12-24 16:10:30 -06:00
Michal Meloun
6e9119768d tegra/ahci: do not advertise enclosure management facility
It is not implemented in HW.

MFC after:	1 week
2021-12-24 20:36:46 +01:00
Jessica Clarke
1846bbd1b3 arm64: Don't rely on host readelf for u-boot booti image generation
readelf is not a bootstrap tool and so cannot be relied upon to exist.
On macOS there is no system readelf, and even on Linux or FreeBSD where
it does exist, BUILD_WITH_STRICT_TMPPATH builds won't be able to use it.
Instead of making it a bootstrap tool, just use nm as that suffices and
already is a bootstrap tool.

Fixes:		28482babd0 ("arm64: Use new arm_kernel_boothdr script for generating booti images.")
Reviewed by:	emaste, mmel
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32734
2021-12-24 19:25:20 +00:00
Michal Meloun
be01656fa4 tegra124: Implement new get_gate method for tegra124 clocks.
MFC after:	1 week
2021-12-24 20:16:24 +01:00
Doug Moore
0d5fac2872 vm: alloc pages from reserv before breaking it
Function vm_reserv_reclaim_contig breaks a reservation with enough
free space to satisfy an allocation request and returns the free space
to the buddy allocator. Change the function to allocate the request
memory from the reservation before breaking it, and return that memory
to the caller. That avoids a second call to the buddy allocator and
guarantees successful allocation after breaking the reservation, where
that success is not currently guaranteed.

Reviewed by:	alc, kib (previous version)
Differential Revision:	https://reviews.freebsd.org/D33644
2021-12-24 12:59:16 -06:00
Michal Meloun
7c0ec66385 tegra210: Implement new get_gate method for tegra210 clocks.
MFC after:	1 week
2021-12-24 19:43:48 +01:00
Michal Meloun
1a74d77f85 extres/clk: Add a method to detect the HW state of the clock gate.
- add method to read gate enable/disable staust from HW
- show gate status in sysctl clock dump

MFC after:	1 week
2021-12-24 19:42:44 +01:00
Michal Meloun
72a2f3b5e2 extres/clk: Improve sysctl dump of clocks.
Always recalculate the frequency, the cache is lazily initialized so it is not always up to date.
While I'm in mark sysctl as MPSAFE.

Discussed with:	manu, adrian
MFC after:	1 week
2021-12-24 19:42:01 +01:00
Andrew Turner
8ddb4b9b66 Extract the arm64 signal code to a new file
This will be used by the vdso signal trampoline on arm64.

While here fix the license as this part of locore.S to correct the
copyright owner.

Sponsored by:	The FreeBSD Foundation
2021-12-24 11:59:43 +00:00
Dimitry Andric
ada8b24d48 Apply clang fix for crash or assertion failure compiling part of llvm
Merge commit 77e8f4eeeeed from llvm git (by David Green):

  [ARM] Define ComplexPatternFuncMutatesDAG

  Some of the Arm complex pattern functions call canExtractShiftFromMul,
  which can modify the DAG in-place. For this to be valid and handled
  successfully we need to define ComplexPatternFuncMutatesDAG.

  Differential Revision: https://reviews.llvm.org/D107476

When building parts of llvm targeting armv6 on stable/12, the following
assertion can appear (or if assertions are disabled, clang is likely to
crash):

Assertion failed: (NodeToMatch->getOpcode() != ISD::DELETED_NODE && "NodeToMatch was removed partway through selection"), function SelectCodeCommon, file /usr/src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp, line 3573.
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /usr/obj/usr/src/freebsd12-amd64/tmp/usr/bin/c++ -cc1 -triple armv6kz-unknown-freebsd12.3-gnueabihf -S --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -mrelocation-model static -mconstructor-aliases -target-cpu arm1176jzf-s -target-feature +vfp2 -target-feature +vfp2sp -target-feature -vfp3 -target-feature -vfp3d16 -target-feature -vfp3d16sp -target-feature -vfp3sp -target-feature -fp16 -target-feature -vfp4 -target-feature -vfp4d16 -target-feature -vfp4d16sp -target-feature -vfp4sp -target-feature -fp-armv8 -target-feature -fp-armv8d16 -target-feature -fp-armv8d16sp -target-feature -fp-armv8sp -target-feature -fullfp16 -target-feature +fp64 -target-feature -d32 -target-feature -neon -target-feature -sha2 -target-feature -aes -target-feature -fp16fml -target-feature +strict-align -target-abi aapcs-linux -mfloat-abi hard -fallow-half-arguments-and-returns -ffunction-sections -fdata-sections -O1 -std=c++14 -fdeprecated-macro -fno-rtti -fno-signed-char -faddrsig -fexperimental-new-pass-manager PPCISelLowering-009095.ii
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'PPCISelLowering-009095.cpp'.
4.	Running pass 'ARM Instruction Selection' on function '@_ZN4llvm17PPCTargetLoweringC2ERKNS_16PPCTargetMachineERKNS_12PPCSubtargetE'

This crash or assertion is fixed by the upstream commit.

MFC after:	3 days
2021-12-24 12:46:00 +01:00
Andriy Gapon
15910dc0bc adaspindown: check disk power mode before sending IDLE command
If a disk is already in STANDBY mode, then setting IDLE mode can
actually spin it up.

Reviewed by:	mav
MFC after:	4 weeks
Differential Revision:	https://reviews.freebsd.org/D33588
2021-12-24 11:02:22 +02:00
Doug Moore
184c63db3c Fix clerical error in page alloc
Fix a very recent change that introduced a page accounting error in
case of a reserveration being broken.
Reviewed by:	alc
Fixes:	fb38b29b56 (page_alloc_br) vm_page: Remove extra test, dup code from page alloc
Differential Revision:	https://reviews.freebsd.org/D33645
2021-12-24 02:47:21 -06:00
Alan Cox
b7ec0d268b arm64: Introduce and use pmap_pte_exists()
Use pmap_pte_exists() instead of pmap_pte() when the caller expects a
mapping to exist at a particular level.  The caller benefits in two
ways from using pmap_pte_exists().  First, because the level is
specified to pmap_pte_exists() as a constant, rather than returned, the
compiler can specialize the implementation of pmap_pte_exists() to the
caller's exact needs, i.e., generate fewer instructions.  Consequently,
within a GENERIC-NODEBUG kernel, 704 bytes worth of instructions are
eliminated from the inner loops of various pmap functions.  Second,
suppose that the mapping doesn't exist.  Rather than requiring every
caller to implement its own KASSERT()s to report missing mappings, the
caller can optionally have pmap_pte_exists() provide the KASSERT().

Reviewed by:	andrew, kib
Tested by:	andrew (an earlier version)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33597
2021-12-23 22:56:02 -06:00
Doug Moore
fb38b29b56 vm_page: Remove extra test, dup code from page alloc
Extract code common to functions vm_page_alloc_contig_domain and
vm_page_alloc_noobj_contig_domain into a new function.  Do so in a way
that eliminates a bound-to-fail reservation test after a reservation
is broken by a call from vm_page_alloc_contig_domain.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D33551
2021-12-23 22:45:47 -06:00
Rick Macklem
744c2dc7dd rpc: Delete AUTH_NEEDS_TLS(_MUTUAL_HOST) auth_stat values
I thought that these new auth_stat values had been agreed
upon by the IETF NFSv4 working group, but that no longer
is the case.  As such, delete them and use AUTH_TOOWEAK
instead.  Leave the code that uses these new auth_stat
values in the sources #ifdef notnow, in case they are
defined in the future.

MFC after:	1 week
2021-12-23 14:31:53 -08:00
John Baldwin
752e211e64 cxgbei: Don't fail task setup if the socket is disconnected.
When the initiator is reconnecting to the target, the connection may
temporarily be marked disconnected or not have an associated socket.
New I/O requests received by the initiator in this state should not
fail with ECONNRESET as that results in an I/O error back to userland.
Instead, they need to still succeed so that CAM can queue the requests
and send them once the connection is re-established.

Setting up DDP for zero-copy receive requires a socket, so just punt
on using DDP for these transfers.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications
2021-12-23 14:14:07 -08:00
Brandon Bergren
c583b02587 [PowerPC] PowerMac timebase sync for G4
Summary:
Disable timebase on (some) AIM platforms (tested on PowerMac G4) prior
to synchronization.

Some platforms use a GPIO to enable and disable timebase, while others
use a platform function.

This mirrors 0d69f00b on mpc85xx.

Todo:
 * Implement various G5 timebase controls.
 * Print out platform code on unknown G5s so we can collect it.
 * Change API to be give/take pairs like Linux does so it's possible to
   do a software sync protocol.

Reviewed By: #powerpc, jhibbits
Subscribers: mikael, markmi_dsl-only.net, luporl, alfredo
Tags: #powerpc
Differential Revision: https://reviews.freebsd.org/D29136
2021-12-23 16:06:07 -06:00
Jessica Clarke
a34d3ca6ef re: Avoid subobject overread when setting IDRn
IDR0-IDR5 can be read byte-by-byte but must be written to as 4-byte
words. The current code to do this is rather clunky and ends up reading
past the end of the union's eaddr member due to MAC addresses only being
6 bytes. In practice this ends up being fine because the align_dummy
member will pad the union to a multiple of 4 bytes, but this is dodgy,
and on CHERI with subobject bounds enforcement enabled, as is done in
CheriBSD's pure-capability kernel, will trap.

Instead, make the buffer in use the right size, just use an array of
uint32_t's rather than a char buffer that's then cast to uint32_t * to
simplify it in the process, and zero-initialise it first to avoid
reading uninitialised data in the trailing bytes.

Found by:	CHERI
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D33617
2021-12-23 20:19:31 +00:00
Adrian Chadd
95a70e9ea8 qca: add the TLMM code into the build
This adds the IPQ4018 TLMM code into the IPQ4018 build.

Differential Revision: https://reviews.freebsd.org/D33554
2021-12-23 10:42:00 -08:00
Adrian Chadd
4abe6533e9 qcom_tlmm: add initial gpio/pinmux controller (TLMM)
The qualcomm TLMM (top level mode manager) is their gpio/pinmux hardware
controller.

Although the pinmux is generic enough to use for the IPQ/APQ series
chips, I'm directly calling the IPQ4018 routines to expedite bring-up.

Notably, I'm not yet implementing the interrupt support - it's not
required at this stage of bring-up.

Differential Revision: https://reviews.freebsd.org/D33554
2021-12-23 10:41:41 -08:00
Adrian Chadd
0727f7b520 arm: add dwc3 as a compilable driver
The IPQ4018/IPQ4019 cores use the DWC3 core.  So make it available
here.
2021-12-23 10:36:51 -08:00
Ed Maste
5bc2e6e227 getfh: clarify that it is a privileged operation
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33629
2021-12-23 11:54:43 -05:00
Jessica Clarke
0aa8b18bc9 libc: Fix regexec when sizeof(char *) > sizeof(long)
The states macro is the type for engine.c to use, with states1 being a
local macro for regexec to use to determine whether it can use the small
matcher or not (by comparing nstates and 8*sizeof(states1)). However,
macro bodies are expanded in the context of their use, and so when
regexec uses states1 it uses the current value of states, which is left
over as char * from the large version (or, really, the multi-byte one,
but that reuses large's states). For all supported architectures in
FreeBSD, the two have the same size, and so this confusion is harmless.
However, for architectures like CHERI where that is not the case (or
Windows's LLP64 as discovered by LLVM and fixed in 2010 in 2e071faed8e2)
and sizeof(char *) is bigger than sizeof(long) regexec will erroneously
try to use the small matcher when nstates is between sizeof(long) and
sizeof(char *) (i.e. between 64 and 128 on CHERI, or 32 and 64 on LLP64)
and end up overflowing the number of bits in the underlying long if it
ever uses those high states. On weirder architectures where sizeof(long)
is greater than sizeof(char *) this also fixes it to not fall back on
the large matcher prematurely, but such architectures are likely limited
to the embedded space, if they exist at all.

Fix this by swapping round states and states1, so that states1 is
defined directly as being long and states is an alias for it for the
small matcher case.

Found by:	CHERI
2021-12-23 16:38:10 +00:00
Bjoern A. Zeeb
e51b46cefb net80211: fix debug printf
We are printing %p in _db_show_sta(), there is no need to prefix it
with 0x again to get a 0x0x...

Spsonsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-23 15:21:32 +00:00
John Baldwin
fa255ab1b8 ctld: Disable -Wcast-align warnings.
clang complains about the downcasts from struct connection to struct
ctld_connection as the alignment of struct ctld_connection is higher
on 32-bit platforms.  However, the warning is in this case harmless as
the downcasts are on objects originally allocated as instances of
struct ctld_connection with suitable alignment.

Reported by:	npn, gjb
Fixes:		6378393308 Add an internal libiscsiutil library.
Sponsored by:	Chelsio Communications
2021-12-22 15:23:45 -08:00
Glen Barber
acdc1de369 organization.dot: fix a typo
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-22 15:24:06 -05:00
Glen Barber
c6fce43de0 organization.dot: update the secteam roster
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-22 15:18:22 -05:00
Glen Barber
57be966ca9 organization.dot: fix ordering by last name
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-22 15:15:19 -05:00
Glen Barber
c89d1fea6b organization.dot: update the re@ roster
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-22 15:09:19 -05:00
John Baldwin
25700db366 libiscsiutil: Change keys_load/save to operate on data buffers.
This will be used in future changes to support large text requests
spanning multiple PDUs.

Provide wrapper functions keys_load/save_pdu that operate use a PDU's
data buffer.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33547
2021-12-22 10:43:24 -08:00
John Baldwin
2ccb8fde5e libiscsiutil: Use open_memstream to build the outgoing block of keys.
Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33546
2021-12-22 10:43:23 -08:00
John Baldwin
fd99905b45 libiscsiutil: Fix a memory leak with negotiation keys.
When keys are loaded from a received PDU, a copy of the received keys
block is saved in the keys struct and the name and value pointers
point into that saved block.  Freeing the keys frees this block.

However, when keys are added to a keys struct to build a set of keys
later sent in a PDU, the keys data block pointer is not used and
individual key names and values hold allocated strings.  When the keys
structure was freed, all of these individual key name and value
strings were leaked.

Instead, allocate copies of strings for names and values when parsing
a set of keys from a received PDU and free all of the individual key
name and value strings when deleting a set of keys.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33545
2021-12-22 10:43:23 -08:00
John Baldwin
6378393308 Add an internal libiscsiutil library.
Move some of the code duplicated between ctld(8) and iscsid(8) into a
libiscsiutil library.

Sharing the low-level PDU code did require having a
'struct connection' base class with a method table to permit separate
initiator vs target behavior (e.g. in handling proxy PDUs).

Reviewed by:	mav, emaste
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33544
2021-12-22 10:43:11 -08:00
Jessica Clarke
d2ef377430 Fix buffer overread in preloaded hostuuid parsing
Commit b6be9566d2 stopped prison0_init writing outside of the
preloaded hostuuid's bounds. However, the preloaded data will not
(normally) have a NUL in it, and so validate_uuid will walk off the end
of the buffer in its call to sscanf. Previously if there was any
whitespace in the string we'd at least know there's a NUL one past the
end due to the off-by-one error, but now no such byte is guaranteed.

Fix this by copying to a temporary buffer and explicitly adding a NUL.

Whilst here, change the strlcpy call to use a far less suspicious
argument for dstsize; in practice it's fine, but it's an unusual pattern
and not necessary.

Found by:	CHERI
Reviewed by:	emaste, kevans, jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33616
2021-12-22 16:47:23 +00:00
Toomas Soome
221376db0c loader.efi: to preserve heap space, use AllocatePages() for shadow_fb
shadow FB size could be rather large and depends on resolution,
instead of using heap, allocate dedicated space outside of heap.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D33600
MFC after: 2 weeks
2021-12-22 11:39:28 +02:00
Gordon Bergling
d34632a235 sound(4): Fix a typo in a source code comment
- s/aggresively/aggressively/

MFC after:	3 days
2021-12-22 10:18:35 +01:00
Gordon Bergling
be0b80b845 enetc(4): Fix a typo in a source code comment
- s/decriptors/descriptors/

MFC after:	3 days
2021-12-22 10:01:54 +01:00
Gordon Bergling
b5e0a70193 gfx_fb: Fix a typo in a source code comment
- s/decriptor/descriptor/

MFC after:	3 days
2021-12-22 10:00:42 +01:00
Jessica Clarke
6d5297569e libc: Fix "harmless" iconv one-byte overread
Checking there are still bytes left must be done before dereferencing
the pointer, not the other way round. This is harmless on traditional
architectures since the result will immediately be thrown away, and all
callers are in separate translation units so there is no potential for
optimising based on this out-of-bounds read. However, on CHERI, pointers
are bounded, and so this will trap if fed a string that does not have a
NUL within the first len bytes.

Found by:	CHERI
Reviewed by:	brooks
2021-12-21 22:47:38 +00:00
John Baldwin
d074adf18b cryptodev.h: Drop 'extern' from function prototypes.
Sponsored by:	Chelsio Communications
2021-12-21 12:33:49 -08:00