Commit graph

290335 commits

Author SHA1 Message Date
Stephen J. Kiernan 39f6f6f1c6 libmagic: Use HOST_CC when compiling hostprog used by build
The "mkmagic" program should be built with the host compiler.

Only use BTOOLSPATH if not building for host

Obtained from:	Juniper Networks, Inc.
Reviewed by:	sjg
Differential Revision:	https://reviews.freebsd.org/D44539
2024-03-27 19:18:43 -04:00
Stephen J. Kiernan a6d8dcb0d9 csh: Use HOST_CC when compiling hostprog used by csh build
The "gethost" program should be built with the host compiler.

Obtained from:	Juniper Networks, Inc.
Reviewed by:	sjg
Differential Revision:	https://reviews.freebsd.org/D44537
2024-03-27 18:21:50 -04:00
Stephen J. Kiernan 3abd36c68f sys.mk: Define HOST_CC as CC by default.
This allows for setting a different compiler for building hostprogs
when cross compiling.

Obtained from:	Juniper Networks, Inc.
Reviewed by:	sjg
Differential Revision:	https://reviews.freebsd.org/D44536
2024-03-27 18:21:50 -04:00
Mike Karels 970ea0b2cb bsdinstall: draw attention to new network config options
The network configuration options have changed in bsdinstall, with
an Auto option to proceed directly to DHCP and IPv6 autoconfig (which
is the default) as well as Manual (the old mode).  For users like me
that were used to hitting return automatically to select an interface,
but want manual configuration, attempt to call out the difference:
Change the menu caption to say "Please select a network interface
and configuration mode:" and not just an interface.

Reviewed by:	jrtc27
2024-03-27 15:20:26 -05:00
Jessica Clarke d5aead83df arm64: Delete stale comment
Fixes:	078a69abcb ("Use a uint64_t to store the arm64 mpidr")
2024-03-27 15:43:38 -04:00
Gleb Smirnoff 3fa9578403 sockets: define shutdown(2) constants in cpp namespace
There is software that uses SHUT_RD, SHUT_WR as preprocessor defines and
its build was broken by enum declaration.  Keep the enum, but provide
defines to propagate the constants to cpp namespace.

PR:		277994
PR:		277995
Fixes:		c3276e02be
2024-03-27 12:22:10 -07:00
Mikael Urankar c92400a6f6 dma.conf: Fix typo
Pull Request: https://github.com/freebsd/freebsd-src/pull/1150
2024-03-27 10:37:22 -04:00
Mina Galić 280085ef0c tools/git: ensure git-arc is more platform indepdendent
Summary:
Linux systems' tail doesn't have `-r`.
Instead, we can use git's own `--reverse` sorting for `rev-list`s.

Reviewed by:	markj, imp, jhibbits
Differential Revision: https://reviews.freebsd.org/D39975
2024-03-27 09:57:01 -04:00
Michael Tuexen ed505f893a tcp bblog: use correct length
The length of tldl_reason is TCP_LOG_REASON_LEN, not TCP_LOG_ID_LEN.
No functional change intended.
Reported by:		Coverity Scan
CID:			1418074
CID:			1418276
Reviewed by:		glebius, rscheff
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44510
2024-03-27 14:31:48 +01:00
Dag-Erling Smørgrav 2cab4be46b install: Prefer strsnvis() to strsvis().
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44514
2024-03-27 11:03:59 +01:00
Dag-Erling Smørgrav 2ae8d34666 ln: Add a test case for ln -sfF.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude, asomers
Differential Revision:	https://reviews.freebsd.org/D44513
2024-03-27 11:03:56 +01:00
Dag-Erling Smørgrav e0afcbc856 ln: Clean up and simplify tests.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44512
2024-03-27 11:03:52 +01:00
Dag-Erling Smørgrav 437d53daf7 ln: Use stdbool, style nits.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp, allanjude
Differential Revision:	https://reviews.freebsd.org/D44511
2024-03-27 11:03:49 +01:00
Dag-Erling Smørgrav 74a4aa9b15 touch: Add unit tests.
MFC after:	1 week
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D44505
2024-03-27 11:03:45 +01:00
Dag-Erling Smørgrav aa69e0f212 touch: Allow setting the timestamp to -1.
Note that VFS internally interprets a timestamp of -1 as “do not set”,
so this has no effect, but at least touch won't incorrectly reject the
given date / time (1969-12-31 23:59:59 UTC) as invalid.

While here, fix some style issues.

MFC after:	1 week
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44504
2024-03-27 11:03:40 +01:00
Dag-Erling Smørgrav 7534109d13 libc: Improve description of mktime() / timegm().
* Mention that mktime() and timegm() set errno on failure.
* Correctly determining whether mktime() / timegm() succeeded with
  arbitrary input (where -1 can be a valid result) is non-trivial.
  Document the recommended procedure.

PR:		277863
MFC after:	1 week
Reviewed by:	pauamma_gundo.com, gbe
Differential Revision:	https://reviews.freebsd.org/D44503
2024-03-27 11:03:37 +01:00
Dag-Erling Smørgrav d9a9f23d0b diff: Integrate libdiff from OpenBSD GoT.
This adds support for two new diff algorithms, Myers diff and Patience
diff.

These algorithms perform a different form of search compared to the
classic Stone algorithm and support escapes when worst case scenarios
are encountered.

Add the -A flag to allow selection of the algorithm, but default to
using the new Myers diff implementation.

The libdiff implementation currently only supports a subset of input and
output options supported by diff.  When these options are used, but the
algorithm is not selected, automatically fallback to the classic Stone
algorithm until support for these modes can be added.

Based on work originally done by thj@ with contributions from kevans@.

Sponsored by:	Klara, Inc.
Reviewed by:	thj
Differential Revision:	https://reviews.freebsd.org/D44302
2024-03-27 11:03:33 +01:00
Dag-Erling Smørgrav 5fbe8912d6 libdiff: Improve function prototype detection.
- Recognize ObjC methods.
- Start searching within the leading context.

Sponsored by:	Klara, Inc.
Reviewed by:	thj
Differential Revision:	https://reviews.freebsd.org/D44301
2024-03-27 11:03:29 +01:00
Baptiste Daroussin d72a37b535 pkgbase: remove post-install script for kernel
the hint file is now directly packages within the package itself.

Reported by:	jhb
2024-03-27 09:08:39 +01:00
Zhenlei Huang 1c7307cf67 kern linker: Make linker_file_add_dependency() void
The only possible return value has been zero since cee9542d51.

No functional change intended.

Reviewed by:	dfr
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44507
2024-03-27 12:02:32 +08:00
Ka Ho Ng 04b90ac0f9 epoch(9): Remove the under-development note
There has not been planned changes so far to the interface. Remove the
section as it may not be relevant anymore.

Sponsored by:	Juniper Networks, Inc.
Reviewed by:	glebius
Differential Revision:	https://reviews.freebsd.org/D44501
2024-03-26 10:38:41 -04:00
Tom Jones 73fdbfb911 netmap: Address errors on memory free in netmap_generic
netmap_generic keeps a pool of mbufs for handling transfers, these mbufs
have an external buffer attached to them.

If some cases other parts of the network stack can chain these mbufs,
when this happens the normal pool destructor function can end up
free'ing the pool mbufs twice:

- A first time if a pool mbuf has been chained with another mbuf when
  its chain is freed
- A second time when its entry in the pool is freed

Additionally, if other parts of the stack demote a pool mbuf its
interface reference will be cleared. In this case we deference a NULL
pointer when trying to free the mbuf through the destructor. Store a
reference to the adapter in ext_arg1 with the destructor callback so we
can find the correct adapter when free'ing a pool mbuf.

This change enables using netmap with epair interfaces.

Reviewed By:	vmaffione
MFC after:	1 week
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44371
2024-03-26 09:55:55 +00:00
Zhenlei Huang 39450eba8e kern linker: Do not touch userrefs of the kernel file
A nonzero `userrefs` of a linker file indicates that the file, either
loaded from kldload(2) or preloaded, can be unloaded via kldunload(2).
As for the kernel file, it can be unloaded by the loader but should not
be after initialization.

This change fixes regression from d9ce8a41ea which incidentally
increases `userrefs` of the kernel file.

Reviewed by:	dfr, dab, jhb
Fixes:	d9ce8a41ea kern_linker: Handle module-loading failures in preloaded .ko files
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D42530
2024-03-26 16:47:02 +08:00
Zhenlei Huang f43ff3e15c kern linker: Do not unload a module if it has dependants
Despite the name, linker_file_unload() will drop a reference and return
success when the module file has dependants, i.e. it has more than one
reference. When user request to unload such modules then the kernel
should reject unambiguously and immediately.

PR:		274986
Reviewed by:	dfr, dab, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D42527
2024-03-26 11:55:45 +08:00
Konstantin Belousov e0c92dd2b7 amd64: initialize td_frame stack area for init(8) main thread
Unitialized td_frame mostly does not matter since all registers are
overwritten on exec to activate init(8).  Except PSL_T bit from the
%rflags which might leak into fresh init as garbage, causing spurious
SIGTRAPs delivered to init until first syscall is executed.

Reviewed by:	emaste, jhb, jhibbits
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44498
2024-03-26 04:01:38 +02:00
Konstantin Belousov 960d151eaa x86: test the right CPUID bit when checking for XSAVEOPT support
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44497
2024-03-26 04:01:30 +02:00
Ed Maste 7dc5c6c412 bsdlabel: add BUGS section documenting 8 partition limit
PR:		276517
2024-03-25 18:26:29 -04:00
Ka Ho Ng fb860ed0c5 libfetch: parse scheme://domain:/ correctly
This improves URL-parsing compability with cURL, and unbreaks parsing of
similar kinds of URLs after commit 8d9de5b10a.

Sponsored by:	Juniper Networks, Inc.
Reviewed by:	des
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44493
2024-03-25 16:11:42 -04:00
Ed Maste 3bd637afbd boot0: remove reference to fdisk
fdisk is obsolete and there is no need to mention a specific tool used
to update the partition table.  Just refer to it as the MBR partition
table.

Sponsored by:	The FreeBSD Foundation
2024-03-25 15:59:09 -04:00
Ed Maste 3661658c76 bsdlabel: emit deprecation notice when run
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Reision: https://reviews.freebsd.org/D43586
2024-03-25 15:59:09 -04:00
Ed Maste b6f3cced15 bsdlabel: add deprecation notice
gpart is the preferred tool for managing partitions of all types,
including BSD disklabels.

Note that this is only about bsdlabel/disklabel, the tool -- there is no
current plan to remove support for MBR or BSD disk labels from the
kernel or from gpart.

Reviewed by:	imp, olce
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D43563
2024-03-25 15:43:34 -04:00
Josef 'Jeff' Sipek baab6b1954 Remove a reference to xrpu from timetc.h
It was removed in 2007, so doesn't make a good example.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44462
2024-03-25 11:53:13 -06:00
Mark Peek 3fed4f0db5 certctl: Revert to symlinks.
Unfortunately tar will not be able to extract base.txz to a system where
/etc and /usr are not on the same filesystem if the certificates are
hard links.

PR:		277828
Reviewed by:	mp
Differential Revision:	https://reviews.freebsd.org/D44496
2024-03-25 16:59:02 +01:00
Dag-Erling Smørgrav 2295cae7e6 sleep: Overhaul.
Program:

* Add a dummy getopt(3) loop to handle `--`.
* Move interval parsing out into a separate function.
* Print a diagnostic for every invalid interval.
* Check for NaN and infinity.
* Improve bounds checks.

Manual page:

* Miscellaneous markup fixes.
* Reword DESCRIPTION section.
* Move text about GNU compatibility to STANDARDS section.
* Convert examples from csh to sh.

Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D44471
2024-03-25 16:59:02 +01:00
Kristof Provost caccf6d3c0 pfsync: cope with multiple pending plus messages
It's possible for pfsync to add a plus message when one is already queued.
Append both, rather than overwriting the already pending one.

MFC after:	1 week
2024-03-25 05:44:24 +01:00
Kristof Provost 81debbd60e pfsync: fix use of invalidated stack variable
Calls to pfsync_send_plus() pass pointers to stack variables.
If pfsync_sendout() then fails it retains the pointer to these stack
variables, accesing them later.

Allocate a buffer and copy the data instead, so that we can retain the
pointer safely.

Reported by:	CI KASAN, markj
MFC after:	1 week
2024-03-25 05:44:24 +01:00
Kristof Provost a1ecbc5701 pf: fix use-after-free
If we fragment the packet in pf_route() the first transmitted packet
will free the pf_mtag we have stored in pf_pdesc (pd). Ensure we
update that pointer for every packet to avoid using a freed pointer in
pf_dummynet_route().

Reported by:	CI KASAN, markj
MFC after:	1 week
2024-03-25 05:44:23 +01:00
Gleb Smirnoff 75d15e893b netpfil tests: disable ICMPv6 rate limiting in the test jail
The dummynet test uses flood ping as source of traffic, so the rate
limiting of ICMP replies broke the test.

Fixes:	32aeee8ce7
2024-03-24 19:54:34 -07:00
Gleb Smirnoff 4399e055ea icmp: allow zero value for ICMP limits
Zero means limit is disabled, so the value doesn't need to be checked
against jitter value.

Fixes:	ac44739fd8
Fixes:	a03aff88a1
2024-03-24 19:52:03 -07:00
Mark Peek 65904399db efibootmgr: allow -u as a valid option
PR:		277907
Reported by:	vsasjason@gmail.com
MFC after:	1 week
2024-03-24 12:37:12 -07:00
Rainer Hurling eb1ca6736a usr.bin/calendar/calendars: Add myself as a committer 2024-03-24 19:57:27 +01:00
Eliot Solomon 9fabf97682 arm64: fix free queue and reservation configuration for 16KB pages
Correctly configure the free page queues and the reservation size when
the base page size is 16KB.  In particular, the reservation size was
less than the L2 Block size, making L2 promotions and mappings all but
impossible.

Reviewed by:	markj
Tested by:	gallatin
Differential Revision:	https://reviews.freebsd.org/D42737
2024-03-24 12:22:20 -05:00
Gleb Smirnoff a03aff88a1 icmp6: bring rate limiting on a par with IPv4
Use counter_ratecheck() instead of racy and slow ppsratecheck. Use a
separate counter for every currently known type of ICMPv6. Provide logging
of ratelimit events. Provide jitter to counter open UDP port detection.

Reviewed by:		tuexen, zlei
Differential Revision:	https://reviews.freebsd.org/D44482
2024-03-24 09:13:23 -07:00
Gleb Smirnoff 4f96be33fe icmp6: move ICMPv6 related tunables to the files where they are used
Most of them can be declared as static after the move out of in6_proto.c.
Keeping sysctl(9) declarations with their text descriptions next to the
variable declaration create self-documenting code.  There should be no
functional changes.

Differential Revision:	https://reviews.freebsd.org/D44481
2024-03-24 09:13:23 -07:00
Gleb Smirnoff 32aeee8ce7 icmp6: rate limit our echo replies
The generation of ICMP6_ECHO_REPLY bypasses icmp6_error(), thus rate
limit was not applied.

Reviewed by:		tuexen, zlei
Differential Revision:	https://reviews.freebsd.org/D44480
2024-03-24 09:13:23 -07:00
Gleb Smirnoff c6c96aaba8 icmp6: make icmp6_ratelimit() responsible to update the stats counter
Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D44479
2024-03-24 09:13:23 -07:00
Gleb Smirnoff ac44739fd8 icmp: improve ICMP limit jitter
Instead of fixing up invalid values set by a user in badport_bandlim()
which is a fast path function, provide a sysctl handler
sysctl_icmplim_and_jitter(), that will check that jitter is less than the
limit.

Provide jitter initilization function icmplim_new_jitter() used at boot,
in the sysctl handler and when we actually hit the limit.  This also fixes
no jitter on a fresh booted system until first limit hit.

Instead of CVE number provide link the the actual paper that explains what
and why we are doing here.  The CVE number isn't very informative, it will
just tell you what RedHat version you need to upgrade to.

Reviewed by:		kp, tuexen, zlei
Differential Revision:	https://reviews.freebsd.org/D44478
2024-03-24 09:13:23 -07:00
Gleb Smirnoff b508545ce0 icmp: when logging ICMP ratelimiting message use correct jitter value
The limiting of the very last second has been done using certain jitter
value.  We update the jitter for the next second.  But the logging should
report the jitter before the change.

Reviewed by:		kp, tuexen, zlei
Differential Revision:	https://reviews.freebsd.org/D44477
2024-03-24 09:13:23 -07:00
Gleb Smirnoff 9d7f17d746 icmp: hide icmp_bandlimit_uninit() under VIMAGE
The uninitialization may be executed only on a kernel with VIMAGE.

Reviewed by:		kp, tuexen, zlei
Differential Revision:	https://reviews.freebsd.org/D44476
2024-03-24 09:13:23 -07:00
Gleb Smirnoff 7142ab4790 icmp: do not store per-VNET identical array of strings
We need per-VNET struct counter_rate, but we don't need per-VNET set of
const char *.  Also, identical word "response" can go into the format
string instead of being stored 7 times.

Reviewed by:		kp, zlei, tuexen
Differential Revision:	https://reviews.freebsd.org/D44475
2024-03-24 09:13:23 -07:00