[VPlan] Strip vp_post_order_{deep,shallow} (NFC) (#192787)
Post 691a130 ([ADT] Refactor post order traversal, #191047),
PostOrderTraversal's lifetime needs to exceed the lifetime of the
iterator. The vp_post_order_{deep,shallow} helpers now have the
potential for being used incorrectly: hence, strip them, and require the
PostOrderTraversal to be constructed explictly, similar to RPOT.
Fix an unlikely possible var sorting problem
Now that CHECKSTRSPACE() is usable, use it when sorting var
names (for "set" (no args or options) and similar uses (export -p etc))
which sort the vars. The previous use of STPUTC() was unsafe, as
the buffer the name was being moved into could move that way, but nothing
was allowing for that, possibly instead using the (only part completed and
unterminated) old pre-move version of the name for use when comparing.
The only likely effect would be incorrectly sorted vars in the output,
and that would have been quite rare (and probably never happened), but
now we can safely use CHECKSTRSPACE() for an arbitrary size, use that
to ensure that the entire var name will fit without moving the string
(and use USTPUTC() to guarantee that doesn't happen - and it is faster).
While here, add lots of comments to explain what is going on, and why,
in the var name comparison function (sort_var()), as at first glance,
what it is doing looks absurd ... it just isn't.
[3 lines not shown]
Remove CHECKSTACKSTR() defect workaround
When reading the output from a command substitution, the code defers
adding embedded \n's to the result (just counting them instead) until
some other character appears - this effectively achieves the "trailing
\n's are removed" semantic without needing to actually remove anything,
as without a following char, the \n's aren't ever added.
That's fine, but the number of \n's counted, that will need to be added when
another char appears, is unbounded - and could be (and at least once, was)
more than the old CHECKSTACKSTR() could handle. To fix that, if the newline
count was "too big" (arbitrarily set at 20) the code used a slow path, which
avoided CHECKSTACKSTR() and was correct.
Now CHECKSTACKSTR() has been fixed, that workaround is no longer required,
so remove it. Since long runs of embedded \n's don't often appear in
command substitution output, avoiding the slow path is unlikely to make
any noticeable speed difference, but not having that code at all makes the
shell smaller - enough smaller to compensate for the minor increase that
the CHECKSTACKSTR() correction added, and even a bit more.
Make CHECKSTRSPACE() do what it always should have done
The CHECKSTRSPACE() macro is given a number 'n' of bytes,
which it is intended to assure are to be available on the
stack - allocating more space if needed. The old macro
checked to see if 'n' were available, and if not, allocated
more space (which sounds right) - but with no specification
of how much more space would be allocated, just a general
hope that it would be enough.
This then required additional workarounds whenever 'n' might
be larger than "just a few", because it just wasn't safe (and
had caused problems in the past).
Now CHECKSTRSPACE() works as intended, though the actual change is
to the makestrspace() function (used only from CHECKSTRSPACE()), which
now gets told how much space is needed, so it can ensure that sufficient
is provided, rather than just the generic "more".
[15 lines not shown]
rtw88: update module Makefile for v7.0 driver version
Update LINUXKPI_VERSION to reflect that the driver is based on
Linux v7.0.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
rtw88: update Realtek's rtw88 driver
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
028ef9c96e96197026887c0f092424679298aae8 ( tag: v7.0 ).
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
[flang][OpenMP] Move ALLOCATE + privatize check to semantic checks
Move the check from symbol resolution to semantic checks.
The check now seems to be more accurate, catching some cases that were
not detected before.
[clang][ssaf] Rework NestedBuildNamespaces of TU and LU summaries (#191489)
Problem:
ASTEntityMapping::getEntityName() creates EntityName with an empty
NestedBuildNamespace, but the linker expected the TU namespace to
already be present in the EntityName. This caused internal linkage
symbols to conflict during linking: since their NestedBuildNamespace was
empty, they all inherited the same LU namespace during resolution,
making internal symbols from different TUs appear identical. For
example, two "static inline" functions with the same USR in separate TUs
would be incorrectly merged into a single LU entity instead of remaining
distinct.
This is now fixed and demonstrated by the
InternalLinkageWithEmptyNamespaceAcrossTUs test, which creates two
internal linkage symbols across two TUs and verifies they remain
separate after linking.
[27 lines not shown]
[AArch64][GISel] Regbank G_BITCAST using src regbank. (#191522)
This takes the regbank of a G_BITCAST from the input srcreg that has
already been allocated, keeping the bitcast on the same bank. A copy
then might be added to the dst if needed.
onlyUsesFP is also improved for G_BITCAST, allowing operations to guess
the correct type through a onlyUsesFP too.
Originally from #177158 by Ryan Cowan with modifications.
Don't let malicious or confused scsi tape devices cause reading or writing
outside a mode sense/select buffer.
Original diff from Stanislav Fort of aisle.com with additional paranoia for
negative values.
Tweaks and ok from kettenis@
du: Set BLOCKSIZE before running tests
Several testcases assume BLOCKSIZE=K, so set it at the top of the
script. This fixes an issue where the tests would sometimes fail
when run under sudo.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D56476
routing: Use a better error number in sysctl_fibs()
ENOTCAPABLE is for capsicum and its use here is inappropriate. In
particular, note that syscallret() treats this value specially.
Reviewed by: glebius, pouria, zlei
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56481
routing: Initialize V_rt_numfibs earlier during boot
V_rt_numfibs can be set at compile time (with the ROUTETABLES kernel
config option) or boot time (with the net.fibs tunable).
vnet_rtables_init(), running during SI_PROTO_DOMAIN, was checking the
tunable and updating V_rt_numfibs accordingly, but that means that
earlier SYSINITs, such as vnet_mroute_init(), see the compile-time value
for V_rt_numfibs before it gets corrected in vnet_rtables_init().
Fix this by initializing V_rt_numfibs earlier, so that SYSINITs are less
likely to use the wrong value.
Add a comment describing the weird, preexisting semantic of resetting
rt_numfibs to 1 in VNET jails.
PR: 294510
Reviewed by: glebius, zlei, pouria
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56473
stand/common/load_elf: Do kernel module relocations for PPC
reloc_ptr() skips relocations for the kernel module, because on most
platforms the kernel is ET_EXEC and this is not required. On PPC,
the kernel is ET_DYN and we need to relocate here, otherwise the
module metadata will not be loaded properly and the kernel module
will have an incorrect version, preventing module dependencies from
resolving.
This fixes loading kernel modules from loader.conf on powerpc.
Diagnosed by: jrtc27
Reviewed by: jrtc27, adrian
Sponsored by: https://www.patreon.com/bsdivy
Differential Revision: https://reviews.freebsd.org/D56457