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
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
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
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
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
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
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
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
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
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
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
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
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
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
+ 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
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
> 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
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
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")
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")
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")
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")
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")
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
Fixes: 46b0db2dbe ("Remove unnecessary and now inaccurate kernel side manual page.")
Fixes: 36d68cb2dd ("Complete the removal of the MD5 manual page from section 9.")
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
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
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
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
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
- 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
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
- 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