1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-20 15:43:16 +00:00
Commit Graph

293053 Commits

Author SHA1 Message Date
Konstantin Belousov
3f3ec4b99f exit(3): make it thread-safe
It was explained by Rich Felker <dalias@libc.org> on libc-coord.
See https://austingroupbugs.net/view.php?id=1845.

Reviewed by:	imp, markj
Tested by:	antoine (exp-run)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D46108
2024-07-30 02:57:34 +03:00
Konstantin Belousov
31f688a26d rtld: avoid division in __thr_map_stacks_exec()
The function is called by rtld with the rtld bind lock write-locked,
when fixing the stack permission during dso load.  Not every ARMv7 CPU
supports the div, which causes the recursive entry into rtld to resolve
the  __aeabi_uidiv symbol, causing self-lock.

Workaround the problem by using roundup2() instead of open-coding less
efficient formula.

Diagnosed by:	mmel
Based on submission by:	John F Carr <jfc@mit.edu>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-07-30 02:57:33 +03:00
Konstantin Belousov
860c4d94ac rtld: add LD_NO_DL_ITERATE_PHDR_AFTER_FORK env var
which makes threaded fork ignore the phdr rtld lock, in particular
allowing the dl_iterate_phdr() to block in callback.  The cost is that
the image started in this mode cannot use dl_iterate_phdr() after fork.

PR:	280318
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-07-30 02:57:33 +03:00
Konstantin Belousov
47315d6d35 rtld: make ld_get_env_var() usable for all rtld source files
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-07-30 02:57:33 +03:00
Konstantin Belousov
bc25bc6850 rtld(1): Spell value as VALUE, not NAME
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-07-30 02:57:33 +03:00
Warner Losh
0eac99f76e stand: Add "Loader needs updating" to the first menu item"
When the boot loader version is too old, add a warning to the boot menu
to maybe catch people's attention.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D45890
2024-07-29 16:57:37 -06:00
Warner Losh
a2fd7ae879 stand: Print a warning of the loader is too old
If the loader is < 3.0, print a warning that it's too old and needs to
be upgraded.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D45889
2024-07-29 16:57:30 -06:00
Warner Losh
9f7f905075 loader: Bump all versions to 3.0
Each incompatible change we make, we bump the major version. We've not
done the bump in a while, so sync everybody to 3.0. Anything older than
3.0 will be given a warning that their boot loader is too old. We check
only the major version, though, so minor versions can still be bumped
for individual loaders (though I honestly doubt we'll ever need to do
that again).

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D45888
2024-07-29 16:57:22 -06:00
Warner Losh
809edb3636 Revert "loader/lua: Remove workaround for command_error"
This reverts commit 552f3072af.

loader.command_error was added just after 11.2, but appears to not have
been back ported to 11.x. 11.0 was the first lua loader release, so keep
this compat shim until we sort out what to do.

MFC After:		3 days
Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D45883
2024-07-29 16:57:13 -06:00
Warner Losh
522a65a8d9 Revert "loader/lua: Remove compat shim for loader.lua_path"
This reverts commit ab97d42add.

There's too many people in the field with FreeBSD 12.0 loader.efi that
stubbed their toe on upgrading to 14.1 since they'd not updated
loader.efi. While we sort out that mess, add back this workaround.  Can
revisit after 14.2 maybe.

MFC After: 		3 days
Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D45882
2024-07-29 16:57:04 -06:00
Warner Losh
b38a82c77a Revert "loader/lua: Remove pager shim"
This reverts commit 8b9178cd0d.

Really old loader.efi files persist in the field. Revert this to support
it. We need to support this through at least 14.2 now, alas.

MFC After:		3 days
Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D45881
2024-07-29 16:56:55 -06:00
Warner Losh
65300ca729 stand: Kill commented out line
This line is no longer needed as fallback, and should have been deleted
in 7870a52598 instead of commented out, but 26 years later, I have a
high degree of confidence that old change was right and we won't need
this line as a fallback.

Sponsored by:		Netflix
Reviewed by:		kevans, jhb
Differential Revision:	https://reviews.freebsd.org/D45880
2024-07-29 16:56:48 -06:00
Warner Losh
8165650389 stand: Remove obsolete junk
We long ago changed newvers.sh to make these comments bogus.  Remove
them since every single one of them is broken after the $FreeBSD$
removal.

Sponsored by:		Netflix
Reviewed by:		kevans, jhb
Differential Revision:	https://reviews.freebsd.org/D45879
2024-07-29 16:56:28 -06:00
Mark O'Donovan
e40474f3de siphash: minor improvements to siphash unit test
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp, cperciva
Pull Request: https://github.com/freebsd/freebsd-src/pull/1324
2024-07-29 14:44:41 -06:00
Mark O'Donovan
882a725bdf siphash: allow zero values for final & len in SipBuf()
Currently the assert checks for XOR of final and len.
This assert fails when running the unit tests in siphash_test.c.
We need to allow the case where both values are zero.

Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp, cperciva
Pull Request: https://github.com/freebsd/freebsd-src/pull/1324
2024-07-29 14:44:27 -06:00
John Baldwin
0244e0a177 openssl: Add <sys/random.h> include for getrandom()
GCC 14 (but not earlier versions) warns about a missing prototype
for getrandom().  Include <sys/random.h> explicitly to bring in the
prototype rather than depending on a nested include.  While here,
stop defining sysctl_random() since it is no longer used.

Reviewed by:	brooks
Fixes:		838b6caaba openssl: use getrandom(2) instead of probing for getentropy(2)
Differential Revision:	https://reviews.freebsd.org/D45995
2024-07-29 16:38:49 -04:00
Jose Luis Duran
d573295659 pw: Clarify groupadd/groupmod memberlist formats
Clarify in which formats the memberlist for groupadd/groupmod can be
accepted for '-M', '-m', or '-d' flag.

Related commit:	40ab104eaa.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1352
2024-07-29 14:14:14 -06:00
Jose Luis Duran
1c8a45b554 mtree: Fix the sort order in BSD.tests.dist
Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1351
2024-07-29 14:13:02 -06:00
Jose Luis Duran
68bcf53ea2 mtree: Fix the sort order in BSD.include.dist
Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1351
2024-07-29 14:12:58 -06:00
Ahmad Khalifa
969484b532 bytgpio: expose PNP info
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1349
2024-07-29 14:09:08 -06:00
Daniel Tameling
5f659bb0b6 test(1): quote closing bracket in error message
If test is called as [ and one forgets to close the bracket, the error
message is currently
[: missing ]

To make it obvious that this is not something printed in brackets,
quote the closing bracket in the message, which is what everybody else
is doing:
[: missing ']'

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1346
2024-07-29 14:08:33 -06:00
Bram
1d551845f3 netstat.1: Clarify -d argument
The man page states that the -d flag can be used to show the dropped
packets. But, the number of dropped input packets are always shown,
independent of the -d flag. This commit clarifies that the -d flag will
add the number of dropped output packets to the output.

MFC after: 3 days
Reviewed by: imp, Alexander Ziaee
Pull Request: https://github.com/freebsd/freebsd-src/pull/1332
2024-07-29 14:07:11 -06:00
Alexander Ziaee
ad57cea9e6 adjkerntz.8: minor cleanup (markup, spdx, reflow)
+ real-time and rtc added to search keywords
- local dropped from search keywords
+ ntpd added to see also
+ use machine independent language

Reported by: emaste (MI language)
MFC after: 3 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1326
2024-07-29 14:06:06 -06:00
Simon J. Gerraty
a2b67d4a6e Update dirdeps.mk to latest
Also add meta2deps.{py,sh} to FILES so they get installed/staged

Reviewed by: stevek
2024-07-29 12:48:56 -07:00
Robert Clausecker
9082398090 lib/libc/amd64/string: fix overread condition in memccpy
An overread condition in memccpy(dst, src, c, len) would occur if
src does not cross a 16 byte boundary and there is no instance of
c between *src and the next 16 byte boundary.  This could cause a
read fault if src is just before the end of a page and the next page
is unmapped or unreadable.

The bug is a consequence of basing memccpy() on the strlcpy() code:
whereas strlcpy() assumes that src is a nul-terminated string and
hence a terminator is always present, c may not be present at all in
the source string.  It was not caught earlier due to insufficient
unit test design.

As a part of the fix, the function is refactored such that the runt
case (buffer length from last alignment boundary between 1 and 32 B)
is handled separately.  This reduces the number of conditional
branches on all code paths and simplifies the handling of early
matches in the non-runt case.  Performance is improved slightly.

os: FreeBSD
arch: amd64
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
        │ memccpy.unfixed.out │        memccpy.fixed.out           │
        │       sec/op        │   sec/op     vs base               │
Short             66.76µ ± 0%   62.45µ ± 1%  -6.44% (p=0.000 n=20)
Mid               7.938µ ± 0%   7.967µ ± 0%  +0.36% (p=0.001 n=20)
Long              3.577µ ± 0%   3.577µ ± 0%       ~ (p=0.429 n=20)
geomean           12.38µ        12.12µ       -2.08%

        │ memccpy.unfixed.out │         memccpy.fixed.out           │
        │         B/s         │     B/s       vs base               │
Short            1.744Gi ± 0%   1.864Gi ± 1%  +6.89% (p=0.000 n=20)
Mid              14.67Gi ± 0%   14.61Gi ± 0%  -0.36% (p=0.001 n=20)
Long             32.55Gi ± 0%   32.55Gi ± 0%       ~ (p=0.429 n=20)
geomean          9.407Gi        9.606Gi       +2.12%

Reported by:	getz
Reviewed by:	getz
Approved by:	mjg (blanket, via IRC)
See also:	D46051
MFC:		stable/14
Event:		GSoC 2024
Differential Revision:	https://reviews.freebsd.org/D46052
2024-07-29 21:36:10 +02:00
Ed Maste
4a06d14937 depend-cleanup: remove entries from 2020 and 2021
> These tests increase the build time (albeit by a small amount), so
> they should be removed once enough time has passed and it is extremely
> unlikely anyone would try a NO_CLEAN build against an object tree from
> before the related change.

The comment suggests a year is a reasonable period but we'll be somewhat
more conservative for now, in part so that we retain different examples
of special cases.

Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46178
2024-07-29 14:57:32 -04:00
Doug Moore
4113ea3403 vm_object: speed up page collect flush
vm_pageout_cluster prepares an array for passing to vm_pageout_flush
by starting in the middle of a double-sized array and working out from
the middle. Using the same technique in vm_object_page_collect_flush
saves one loop that traverses a piece of linked list, and 80 bytes of
amd64 binary code.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46173
2024-07-29 13:02:13 -05:00
Kristof Provost
b9f0dbc3d0 pf tests: ensure we don't confuse different ICMP types
When creating a state for ICMP (v4 or v6) packets we only used the ID, which
means that we could confuse different ICMP types. For example, if we allowed
neighbour discovery but not ICMPv6 echo requests an ND packet could create a
state that the echo request would match.

Test that this is now fixed.

Reported by:	Enrico Bassetti <e.bassetti@tudelft.nl>
MFC after:	1 day
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-07-29 19:42:26 +02:00
Kristof Provost
1afe4da75d pf: allow MLD LR to be sent without state
Change PF behavior to allow MLD Listener Report packets to be sent
without needing a previously created state by MLD Listener Query. It
wasn't working because: (1) you might not have a previous MLD Listener
Query and (2) the addresses of the Query and Report don't match.

ok mikeb@, sashan@

MFC after:	1 day
Obtained From:	OpenBSD, rzalamena <rzalamena@openbsd.org>, 5c526dbdb0f2
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-07-29 19:42:26 +02:00
Kristof Provost
46755f5224 pf: split ICMP/ICMPv6 number space in pf_icmp_mapping()
In pf_icmp_mapping() the ICMP and ICMPv6 types shared the same
number space.  In fact they are independent and must be handled
separately.  Fix traceroute via pf by splitting pf_icmp_mapping()
into IPv4 and IPv6 sections.
ok henning@ mcbride@; tested mcbride@; sure deraadt@

MFC after:      1 day
Obtained From:  OpenBSD, bluhm <bluhm@openbsd.org> ef4bccd7509e
Sponsored by:   Rubicon Communications, LLC ("Netgate")
2024-07-29 19:42:26 +02:00
Kristof Provost
e296b0de9e pf: some ICMP types that also have icmp_id, pointed out by markus@
ok henning markus

MFC after:	1 day
Obtained From:	OpenBSD, mcbride <mcbride@openbsd.org> 8c0632cd274b
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-07-29 19:42:26 +02:00
Kristof Provost
534ee17e61 pf: stricter state checking for ICMP and ICMPv6 packets
Include
the ICMP type in one port of the state key, using the type to determine which
side should be the id, and which should be the type.

Also:
- Handle ICMP6 messages which are typically sent to multicast addresses but
 recieve unicast replies, by doing fallthrough lookups against the correct
 multicast address.
- Clear up some mistaken assumptions in the PF code:
  - Not all ICMP packets have an icmp_id, so simulate one based on other
    data if we can, otherwise set it to 0.
 - Don't modify the icmp id field in NAT unless it's echo
 - Use the full range of possible id's when NATing icmp6 echoy

ok henning marco
testing matthieu todd

MFC after:	1 day
Obtained From:	OpenBSD, mcbride <mcbride@openbsd.org> 70bf7555ef4c
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-07-29 19:42:26 +02:00
Kristof Provost
375aaa299f pfctl: improve error reporting
libpfctl doesn't set errno, instead it returns error codes. Take that into
account when handling errors so that we report the actual error.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-07-29 19:42:25 +02:00
Ed Maste
ba373fca78 Do not clean (in buildworld/buildkernel) by default
As discussed on the freebsd-arch mailing list[1].  For historical
reasons FreeBSD's buildworld and buildkernel targets started by cleaning
the object tree, for traditional (non-metamode) builds.

Cleaning is not necessary when dependencies are properly tracked, and we
have a somewhat kludgey script[2] to handle some known cases where deps
were mishandled by traditional builds.  Be consistent with the vast
majority of open source build systems by default, and do not clean at
the beginning of buildworld or buildkernel.

Users may set WITH_CLEAN in src.conf(5) to restore the previous
behaviour, or run `make cleanworld` and/or `make cleankernel` before
starting a build.

[1] https://lists.freebsd.org/archives/freebsd-arch/2024-July/000727.html
[2] tools/build/depend-cleanup.sh

Reviewed by:	jhb, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46172
2024-07-29 13:16:52 -04:00
Mark Johnston
f933363a81 ObsoleteFiles.inc: Include the default compression suffix for man pages
Reported by:	yuripv
Fixes:	801c452795 ("man9: Really complete the removal of MD5.9")
2024-07-29 16:36:17 +00:00
Mark Johnston
801c452795 man9: Really complete the removal of MD5.9
Fixes:	46b0db2dbe ("Remove unnecessary and now inaccurate kernel side manual page.")
Fixes:	36d68cb2dd ("Complete the removal of the MD5 manual page from section 9.")
2024-07-29 14:17:04 +00:00
George V. Neville-Neil
36d68cb2dd Complete the removal of the MD5 manual page from section 9. 2024-07-29 21:14:40 +07:00
Dag-Erling Smørgrav
9f080f17a6 ifnet(9): Remove mention of defunct ifaddr_byindex(9).
Fixes:		964b8f8b99
MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D46174
2024-07-29 16:02:33 +02:00
Dag-Erling Smørgrav
9317242469 diff: Fix integer overflow.
The legacy Stone algorithm uses `int` to represent line numbers, array
indices, and array lengths.  If given inputs approaching `INT_MAX` lines,
it would overflow and attempt to allocate ridiculously large amounts of
memory.  To avoid this without penalizing non-pathological inputs,
switch a few variables to `size_t` and add checks while and immediately
after reading both inputs.

MFC after:	3 days
PR:		280371
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D46169
2024-07-29 16:02:29 +02:00
Dag-Erling Smørgrav
ca75b7dac8 sdiff: Fix usage message.
The `--ignore-all-space` option was incorrectly documented as
`--ignore-all-spaces`.

MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	0mp, markj
Differential Revision:	https://reviews.freebsd.org/D46161
2024-07-29 16:02:25 +02:00
Dag-Erling Smørgrav
ab830de9f5 diff: Fix usage message and documentation.
The `--ignore-all-space` option was incorrectly documented as
`--ignore-all-blanks` in some (but not all) places.

MFC after:	3 days
PR:		280434
Sponsored by:	Klara, Inc.
Reviewed by:	0mp, markj
Differential Revision:	https://reviews.freebsd.org/D46160
2024-07-29 16:02:21 +02:00
George V. Neville-Neil
46b0db2dbe Remove unnecessary and now inaccurate kernel side manual page. 2024-07-29 20:47:24 +07:00
Mark Johnston
a1740cb936 sys: Bump __FreeBSD_version to mark stack swapout removal
This is meant to cover the corresponding changes to various proc/thread
flags and sleepqueue/scheduler KPIs.
2024-07-29 01:43:59 +00:00
Mark Johnston
6aa98f78cc conf: Remove kernel stack swapping support, part 12
Remove the NO_SWAPPING option.  There is still some code in
vm_swapout.c, but it relates to RACCT handling.  Remove the option and
make compilation of vm_swapout.c conditional on RACCT.

Tested by:	pho
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46130
2024-07-29 01:43:59 +00:00
Mark Johnston
ec84a986ba vm: Remove kernel stack swapping support, part 11
- Remove sysctls that control stack swapping, update documentation.
- Remove vm_swapout_dummy.c, which serves no purpose now.

Tested by:	pho
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46129
2024-07-29 01:43:59 +00:00
Mark Johnston
01518f5eed sleepqueue: Remove kernel stack swapping support, part 10
- Remove kick_proc0().
- Make the return type of sleepq_broadcast(), sleepq_signal(), etc.,
  void.
- Fix up callers.

Tested by:	pho
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46128
2024-07-29 01:43:59 +00:00
Mark Johnston
d4c4ca856b proc: Remove kernel stack swapping support, part 9
setrunnable() no longer needs to return a value.  Make its return type
void and fix up callers.  Now a number of other interfaces no longer
need to return a value, they will be fixed up subsequently.

Tested by:	pho
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46127
2024-07-29 01:43:59 +00:00
Mark Johnston
235750ee51 vm: Remove kernel stack swapping support, part 8
- The kernel stack objects do not need to be pageable, so use OBJT_PHYS
  objects instead.  The main difference is that mappings do not require
  PV entries.
- Make some externally visible functions, relating to kernel thread
  stack internals, private to vm_glue.c, as their external consumers are
  now gone.

Tested by:	pho
Reviewed by:	alc, kib
Differential Revision:	https://reviews.freebsd.org/D46119
2024-07-29 01:43:59 +00:00
Mark Johnston
d37286b9bf proc: Remove kernel stack swapping support, part 7
Remove some uses of PHOLD which were there only to prevent the process'
threads from being swapped out.

Tested by:	pho
Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D46118
2024-07-29 01:43:49 +00:00
Mark Johnston
472888018c proc: Remove kernel stack swapping support, part 6
- Remove most checks of the P_INMEM flag.
- Some uses remain since a few userspace tools, e.g., ps(1) and top(1)
  expect the flag to be set.  These can be cleaned up but the code has
  most likely been copy-pasted elsewhere and while linger for a long
  time.

Tested by:	pho
Reviewed by:	alc, imp, kib
Differential Revision:	https://reviews.freebsd.org/D46117
2024-07-29 01:43:18 +00:00