Commit Graph

282177 Commits

Author SHA1 Message Date
Kyle Evans
3610bffd28 pkill: use an ARG_MAX size buffer for argument matching
Right now pkill/pgrep cut off at _POSIX2_LINE_MAX (2048), but argument
strings can be much larger (ARG_MAX is 256K/512K).  Stop arbitrarily
cutting the search off at 2K, rather than documenting the limit.

Reviewed by:	allanjude (earlier version), des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D38663
2023-03-20 14:19:36 -05:00
Mark Johnston
c3179891f8 kerneldump: Inline dump_savectx() into its callers
The callers of dump_savectx() (i.e., doadump() and livedump_start())
subsequently call dumpsys()/minidumpsys(), which dump the calling
thread's stack when writing the dump.  If dump_savectx() gets its own
stack frame, that frame might be clobbered when its caller later calls
dumpsys()/minidumpsys(), making it difficult for debuggers to unwind the
stack.

Fix this by making dump_savectx() a macro, so that savectx() is always
called directly by the function which subsequently calls
dumpsys()/minidumpsys().

This fixes stack unwinding for the panicking thread from arm64
minidumps.  The same happened to work on amd64, but kgdb reports the
dump_savectx() calls as coming from dumpsys(), so in that case it
appears to work by accident.

Fixes:	c9114f9f86 ("Add new vnode dumper to support live minidumps")
Reviewed by:	mhorne, jhb
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D39151
2023-03-20 14:16:28 -04:00
Daniel Kolesa
3ce64010f8 sh(1): fix history file write checking
We cannot just compare histsizeval() against 0, since that returns
a string pointer, which is always non-zero (non-null). The logic
in sethistsize() initializes the history size to 100 with values
that are non-number, and an empty string counts as that. Therefore,
the only time we want to not write into history with HISTSIZE val
set is when it's explicitly 0.

MFC after:	2 weeks
2023-03-20 17:56:56 +01:00
Kristof Provost
a6719858a4 pf tests: try to trigger locking issues in pfsync_timeout()
PR:		268246
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC (Netgate)
2023-03-20 16:39:14 +01:00
Kristof Provost
53247cdf12 pfsync: fix pfsync_undefer_state() locking
pfsync_undefer_state() takes the bucket lock, but could get called from
places (e.g. from pfsync_update_state() or pfsync_delete_state()) where
we already held the lock.

As it can also be called from places where we don't yet hold the lock
create new locked variant for use when the lock is already held. Keep
using pfsync_undefer_state() where the lock must still be taken.

PR:		268246
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC (Netgate)
2023-03-20 16:39:14 +01:00
Kristof Provost
844ad2828a pfsync: add missing unlock in pfsync_defer_tmo()
The callout for pfsync_defer_tmo() is created with
CALLOUT_RETURNUNLOCKED, because while the callout framework takes care
of taking the lock we want to run a few operations outside of the lock,
so we unlock ourselves.

However, if `sc->sc_sync_if == NULL` we return without releasing the
lock, and leak the lock, causing later deadlocks.
Ensure we always release the bucket lock when we exit pfsync_defer_tmo()

PR:		268246
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC (Netgate)
2023-03-20 16:39:14 +01:00
Mark Johnston
cc9158d74d netipsec tests: Serialize
The tunnel mode tests use VNET jails and reuse jail names.  Until this
is addressed, serialize them.

MFC after:	1 week
2023-03-20 12:21:17 -04:00
Glen Barber
e4e139b828 pkg-stage.sh: update port trailing version information
Reported by:	Ian Smith, Graham Perrin
MFC after:	1 week
X-MFC-13.2:	NO

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-20 10:36:51 -04:00
Kristof Provost
511a6d5ed3 carp: use if_name()
Reported by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-20 14:37:10 +01:00
Kristof Provost
b1a4ccdd83 carp: document peer/peer6 and mcast/mcast6 in the relevant man pages
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D38943
2023-03-20 14:37:10 +01:00
Kristof Provost
ddbd3a2b7c carp tests: unicast tests (IPv6)
Test the new unicast carp mode for IPv6.

There's a routing hop between the peers, to ensure that the TTL check is
correctly disabled for unicast carp.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D38942
2023-03-20 14:37:09 +01:00
Kristof Provost
92c5dbbb13 carp tests: unicast tests (IPv4)
Test the new unicast carp mode for IPv4.

There's a routing hop between the peers, to ensure that the TTL check is
correctly disabled for unicast carp.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D38941
2023-03-20 14:37:09 +01:00
Kristof Provost
137818006d carp: support unicast
Allow users to configure the address to send carp messages to. This
allows carp to be used in unicast mode, which is useful in certain
virtual configurations (e.g. AWS, VMWare ESXi, ...)

Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D38940
2023-03-20 14:37:09 +01:00
Christos Margiolis
3afba490c1 libdtrace: fix indendation in dt_printd()
No functional change.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39145
2023-03-20 09:34:20 -04:00
Dmitry Mikushin
ef9f49a21a arm64: Adding a missing include file
Adding a missing include file, which provides the definition of
SYSCTL_INT.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D39149
2023-03-20 11:23:01 +00:00
Kristof Provost
9d48283d60 carp tests: test manually switch between backup and master
There's been at least one issue where we failed to correctly enter
NET_EPOCH that was triggered in this scenario.
Add a test case for it to make it easier to detect issues like this in
the future.

Reviewed by:	zlei
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39115
2023-03-20 10:52:53 +01:00
Kristof Provost
40e0435964 carp: add netlink interface
Allow carp configuration information to be supplied and retrieved via
netlink.

Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39048
2023-03-20 10:52:27 +01:00
Konstantin Belousov
62b572694b ext2_dirbad(): fix !DTRACE build
Fixes:	3c2dc524c3
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2023-03-20 10:44:22 +02:00
Zhenlei Huang
082895ebec xhci(4): Describe Fresco Logic FL1009 USB 3.0 controller
Reviewed by:	hselasky
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38922
2023-03-20 12:04:14 +08:00
Xin LI
c917796c04 MFV: xz 5.4.2.
MFC after:	2 weeks
2023-03-19 19:30:08 -07:00
Xin LI
88417d17c2 Vendor import of xz 5.4.2 (trimmed) 2023-03-19 10:03:12 -07:00
Jose Luis Duran
ea6d169266 ping: Avoid reporting negative time statistics
Display a warning when the time goes back.

PR:		192417
Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38480
2023-03-19 12:24:06 -04:00
Jose Luis Duran
076b718d9e ping tests: Add tests for IP header options
The function pr_pack() prints out a packet, if the IP packet contains
options, these are printed as well.

Test the functionality fixed in
70960bb86a.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38470
2023-03-19 12:23:44 -04:00
Jose Luis Duran
1dc1f6bd31 ping: Remove pr_retip()
Ping used to provide some sort of packet sniffing capabilities, this was
in an era where hubs were used and tcpdump wasn't invented.

pr_iph() is a function that prints the IP header of the packet.

pr_retip() is essentially a wrapper function to pr_iph(), that also
displays the source and destination ports of a TCP or UDP packet.

After ef9e6dc7ee some of this
functionality was almost removed, to only display packets sent by us
(26+ years ago).

At this point, reaching this code path was only possible by doctoring
the original packet.

After 46d7b45a26 this code path can never
be reached.

Remove the code.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38475
2023-03-19 12:23:22 -04:00
Jose Luis Duran
20b4130314 ping: Print the IP options of the original packet
When an ICMP packet contains an IP packet in its payload, and that
original IP packet contains options, these options were not displayed
accordingly in pr_iph().

pr_iph() is a function that prints the original "quoted packet" IP
header, with only an IP struct as an argument.  The IP struct does not
contain IP options, and it is not guaranteed that the options will be
contiguous in memory to the IP struct after
d9cacf605e.

Pass the raw ICMP data along with the IP struct, in order to print the
options, if any.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38469
2023-03-19 12:23:06 -04:00
Peter Holm
ce7b20e512 stress2: Added more FFS tests 2023-03-19 09:55:00 +01:00
Gordon Bergling
d37cca6570 tcp_rack.4: Correct a link in the SEE ALSO section
The PDF at arxiv.org is only accessible when
retrieving it via the website.

MFC after:	3 days
2023-03-19 09:49:33 +01:00
Kirk McKusick
191115cfb6 Fix syntax error in 0697670.
Reported by: Michael Tuexen
2023-03-18 17:03:32 -07:00
Michael Tuexen
48345048cd sctp: fix typo in assignment 2023-03-18 23:58:50 +01:00
Kirk McKusick
069767091e Do not panic in case of corrupted UFS/FFS directory.
Historically the system panic'ed when it encountered a corrupt
directory. This change recovers well enough to continue operations.
This change is made in response to a similar change made in the ext2
filesystem as described in the cited Differential Revision.

MFC after:    2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38503
2023-03-18 15:37:58 -07:00
Mark Johnston
bad8f86843 netgraph tests: Serialize
Some tests share names for netgraph nodes, so they cannot be run in
parallel.

MFC after:	1 week
2023-03-18 16:57:11 -04:00
Konstantin Belousov
2b4b3789f8 acpi_wakeup.c: apply the reviewer' editorial corrections to the comment text.
Fixes:	02904a06c7
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39146
2023-03-18 17:47:19 +02:00
Konstantin Belousov
02904a06c7 amd64: properly recalculate mitigations knobs after resume
Revision r333125 AKA 986c4ca387 forced clear cpu_stdext_feature3
on suspend, since at that time microcode update was not reloaded
early on resume. Then, revision 050f5a8405 started re-reading
cpu_stdext_feature3 again. Since modern CPUs do not require mitigations
from the Skylake era, this went unnoticed for some time.

Keep zeroing cpu_stdext_feature3 on suspend, but re-read it in more
controlled way on resume after microcode is reloaded, and recalculate
active workarounds based on actual microcode capabilities.

Reported and tested by:	romain
Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39146
2023-03-18 17:40:05 +02:00
Alexander V. Chernikov
9ee6278b78 netstat: fix double-free in netlink error code path.
CID:	1504382
2023-03-18 14:01:46 +00:00
Alexander V. Chernikov
aee2f11bf4 netstat: simplify netlink route printing code.
A number of improvements has commited to snl(3) recently.
A notable one is snl(3) build-in parsers for all of the objects
 exported by the kernel.

This change updates netlink handling code to the latest available snl(3)
API.
2023-03-18 13:05:41 +00:00
Alexander V. Chernikov
046acc2bfd netlink: add public ucred accessor for nlp.
MFC after:	2 weeks
2023-03-18 11:44:29 +00:00
Alexander V. Chernikov
568a645ba5 netlink: fix capped uncapped ack handling in snl(3).
Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D39144
MFC after:	2 weeks
2023-03-18 11:35:56 +00:00
Peter Holm
bce30c896d stress2: Added two syzkaller reproducers 2023-03-18 10:31:31 +01:00
Gordon Bergling
ac6bc808f5 smbfs.5: Us .An -nosplit for the AUTHORS section
Use .An -nosplit for the AUTHORS section, so that
it renders without an unnecessary newline.

No .Dd bump since it isn't a content change.

MFC after:	3 days
2023-03-18 10:02:59 +01:00
Wei Hu
8ea7fa16d9 uart: Don't change settings or throttle putc for Hyper-V
Azure setup does not like it when FreeBSD overrides the settings of the
UART device. When Hyper-V is detected, don't do this and also don't
throttle putc() output. This is a workaround for the early boot hang
of FreeBSD on Azure.

Tested on Azure, ESXi (VM with serial port), and SG-8200

PR:		264267
Reviewed by:	kevans, whu
Tested by:	whu
Obtained from:	Rubicon Communications, LLC (Netgate)
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
2023-03-18 07:07:54 +00:00
Wei Hu
927358dd98 amd64 loader: Use efiserialio for Hyper-V booted systems
UEFI provides ConIn/ConOut handles for consoles that it supports,
which include the text-video and serial ports. When the serial port
is available, use the UEFI driver instead of direct io-port accesses
to avoid conflicts between the firmware and direct hardware access, as
happens on Hyper-V (Azure) setups.

This change enables efiserialio to be built for efi-amd64 and has
higher order priority vs comconsole, and only uses efiserialio
if the hypervisor is Hyper-V. When efiserialio successfully
probes, it will set efi_comconsole_avail=true which will prevent
comconsole from probing in this setup.

Tested on Hyper-V, ESXi and Azure VMs.

PR:		264267
Reviewed by:	kevans, whu
Tested by:	whu
Obtained from:	Rubicon Communications, LLC (Netgate)
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
2023-03-18 07:07:35 +00:00
Konstantin Belousov
ab3ff87a33 Belately bump __FreeBSD_version for introduction of __libc_start1()
and move of most of the initialization code from csu to libc.

Requested by:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2023-03-18 08:31:41 +02:00
Fedor Uporov
3c2dc524c3 Do not panic in case of corrupted directory
The panic() will be called under ext2_dirbad()
function in case of rw mount. It cause user confusion,
like in BZ 265951.

PR:			265951
Reviewed by:		pfg, mckusick
MFC after:		2 week
Differential revision:  https://reviews.freebsd.org/D38503
2023-03-18 09:16:24 +03:00
Fedor Uporov
366da717de Add root directory entry check.
Add check that directory entry with ino=EXT2_ROOTINO
have correct namelength and name. It is possible to
create malicious image which will cause panic if root
directory entry have incorrect name.

PR:			259068
Reported by:		Robert Morris
Reviewed by:		pfg
MFC after:		2 weeks
Differential Revision:  https://reviews.freebsd.org/D38502
2023-03-18 09:16:22 +03:00
Kyle Evans
6b49a630f4 daemon: kill off some stray blank lines
Overlooked in review; mea culpa.

Reported by:	jrtc27
2023-03-18 01:05:43 -05:00
Ihor Antonov
8117ea0a41 daemon: remove unnecessary memset in daemon_state_init()
Pull Request:	https://github.com/freebsd/freebsd-src/pull/694
2023-03-18 00:52:59 -05:00
Ihor Antonov
cf6356fd47 daemon: repace goto exit with daemon_terminate()
Start breaking down big main()
Remove goto exit label and replace it with a function that does cleanup.

Comment re-worded by kevans@.

Pull Request:	https://github.com/freebsd/freebsd-src/pull/694
2023-03-18 00:52:59 -05:00
Zhenlei Huang
b754d7faaf uhci(4): Correct PCI device ID for Zhaoxin USB controller
And minor style fixes.

Tested by:	Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Fixes:		986c7be472 uhci(4): Add new USB IDs
Differential Revision:	https://reviews.freebsd.org/D38924
2023-03-18 01:30:19 +08:00
Zhenlei Huang
95b2d16b38 ehci(4): Correct PCI device ID for Zhaoxin USB 2.0 controller
And minor style fixes.

Tested by:	Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Fixes:		f9237e1937 ehci(4): Add new USB IDs
Differential Revision:	https://reviews.freebsd.org/D38923
2023-03-18 01:30:18 +08:00
Zhenlei Huang
f50f53931e xhci(4): Correct PCI device IDs for Zhaoxin USB 3.0 controllers
And minor style fixes.

Reviewed by:	hselasky
Tested by:	Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Fixes:		0d7064d58f xhci(4): Add new USB IDs
Differential Revision:	https://reviews.freebsd.org/D38921
2023-03-18 01:30:18 +08:00