HBSD: Apply style(9) to helper function
We provide a `jailed()` function in libjail to make it easier to
determine whether the calling code is running within a jailed context.
However, that function didn't follow style(9) too well.
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>
[CodeGen] Generalize scalarization of vector intrinsics to extra arguments (#237973)
This is a preparatory patch for #237980.
lowerUnaryVectorIntrinsicAsLoop only handled intrinsics with a single
vector argument. Generalize it into lowerVectorIntrinsicAsLoop, which
extracts only the vector arguments from the current lane and passes
scalar arguments through unchanged. This lets the helper handle
intrinsics like powi with a scalar exponent. #237980 adds scalable powi
lowering to the pre-ISel pass and includes the corresponding regression
tests.
While generalizing, fix the scalar return type used to look up the
scalar declaration. For multi-result intrinsics it previously passed the
vector struct type straight to Intrinsic::getOrInsertDeclaration, which
fails the signature check. Build a struct of the scalar element types
instead.
Assisted-by: Claude
HBSD: Fix setting hardening.prohibit_ptrace_capsicum as a jail param
I missed fetching the jail parameter upon jail creation. This commit
does just that.
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>
Radicle-issue: 187e40515749fcb384935a2eeb24f0122e05eddb
Reported-by: 0x1eef
MFC-to: 15-STABLE
[RISCV][GISel] Replace hasStdExtA() with hasStdExtZalrsc(). (#246495)
SelectionDAG supports using only LR/SC instructions so we should do the
same in GISel.
Assisted-by: Claude
[SelectionDAG] Look through freeze in CombineExtLoad
Folding an extend of an illegally-wide vector into extending loads only
matched when the extend operand was the load itself. A boolean select is
combined to an OR of a frozen operand and the freeze is pushed down to the
load, so the fold was skipped: the load stayed a plain vector load and each
half of the widened result needed an extract and a register-form extend.
Look through a single-use freeze and re-apply it to the split result.
Freeze is element-wise and extends are deterministic, so freezing the split
loads is equivalent to freezing the extended value.
For the loop in #245064 this replaces four 512-bit loads with their extracts
and register-form vpmovzxwd by memory-form vpmovzxwd, going from 57 to 49
instructions per 128 elements.
Adds llvm/test/CodeGen/X86/vector-extload-freeze.ll and updates the
existing avx512-ext.ll checks.
Fixes #245064
tzcode: Avoid integer truncation resulting in wrong weekday
From a report[1] on the tz mailing list:
In timesub() the weekday is stored in (int) tm_wday before reduction
modulo seven (DAYSPERWEEK). Previously this could overflow a 32-bit
int, resulting in an incorrect weekday calculation.
Calculate two additional intermediate terms modulo seven to avoid an
intermediate value that does not fit in 32 bits.
We're committing this patch now so we can have something in place for
FreeBSD 15.2. If a different change is committed upstream we will
replace this.
[1] https://lists.iana.org/hyperkitty/list/tz@iana.org/thread/O3RZGBKSO5GXBFDZKW2JXO3OQIIGYBF3/
Approved by: re (cperciva)
PR: 300977
[6 lines not shown]
tcp: count only the SACK blocks that fit in tcp_maxseg()
tcp_addoptions() sends only the SACK blocks that fit in TCP_MAXOLEN.
tcp_maxseg() counted every pending block and clamped the total, so
without timestamps and with five or more blocks pending it came out 4
bytes below the segment tcp_output() sends. Limited transmit after an
RTO then sent one full segment and failed the "sent too much" KASSERT.
Approved by: re (cperciva)
PR: 282605
Approved by: adrian (mentor)
Signed-off-by: Nick Price <nprice at FreeBSD.org>
Reviewed by: tuexen, glebius, adrian
Differential Revision: https://reviews.freebsd.org/D60460
(cherry picked from commit d3b02115d4b373c719d9a716da38d94511de3f07)
(cherry picked from commit aacae7b35a22a56e187a0a41db231d63ca9cefb6)
tcp: improve consistency
Use an inline function tcp_adapt_iss_check() to perform the check
consistently instead of replicating the code multiple times. These
checks already became inconsistent.
A fix for PR 298560 requires more calls to tcp_adapt_iss_check().
Approved by: re (cperciva)
Reviewed by: Peter Lei
Fixes: fa2ad70a4511 ("tcp: make ghost ACK handling more conformant")
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D61685
(cherry picked from commit e3483dbc91b59b5b2c73a4bc792fbb834c3dc111)
(cherry picked from commit 73929d1dc3b4116ca12cc3fe08fa3a9b66bf3318)
tcp: make ghost ACK handling more conformant
The latest version of draft-ietf-tcpm-tcp-ghost-acks changed
a condition. This should make no substantial difference, but makei
it compliant to the latest version of the specification.
Approved by: re (cperciva)
Reviewed by: rscheff, Peter Lei
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D58411
(cherry picked from commit fa2ad70a4511e7b379e81de82c9e51b2e0994295)
(cherry picked from commit a170546cb8d13a67ee3062114228d3df4744bbee)
tcp: improve sender side SWS avoidance
When checking for a full sized segment, take all TCP options that will
be included into account. This fixes a bug which can trigger the
"sent too much" KASSERT related to limited transmit.
Approved by: re (cperciva)
Reported by: olivier
Reviewed by: rscheff, Peter Lei
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D61605
(cherry picked from commit d174085f9f895ed444bd95120da3eff481a58f1a)
(cherry picked from commit 13357c1ee34f9f8655375714c60da8bf4881493a)
tcp bbr: improve handling of retransmissions in LAST-ACK
When performing a timer based retransmission, clear the
BBR_RWND_COLLAPSED flag. If it sticks, t_rxtshift is never incremented
resulting in unlimited retransmissions in the LAST-ACK state.
Approved by: re (cperciva)
Reported by: Illia Vynohradov
Reviewed by: Peter Lei
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D61586
(cherry picked from commit 3c6fd437b1824caeddb5f0d4570d43cf0c999c14)
(cherry picked from commit cbd17b66e64e9bdf025200c4993b8aeae6a0ebe9)
tcp bbr: improve retransmit timout calculation
The retransmission timeout should the srtt + 4 * rttvar.
The srtt is using 5 bits of fractions and rttvar is using 4 bits of
fractions, some specific shifting is required.
Approved by: re (cperciva)
Reviewed by: Peter Lei
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D61581
(cherry picked from commit 2f98793a13fe3e69cf6b698fa469550b4ba0fea1)
(cherry picked from commit ccf8e3762c3948446263ae3ef0dd98391ef9f97e)
tzcode: Avoid integer truncation resulting in wrong weekday
From a report[1] on the tz mailing list:
In timesub() the weekday is stored in (int) tm_wday before reduction
modulo seven (DAYSPERWEEK). Previously this could overflow a 32-bit
int, resulting in an incorrect weekday calculation.
Calculate two additional intermediate terms modulo seven to avoid an
intermediate value that does not fit in 32 bits.
We're committing this patch now so we can have something in place for
FreeBSD 15.2. If a different change is committed upstream we will
replace this.
[1] https://lists.iana.org/hyperkitty/list/tz@iana.org/thread/O3RZGBKSO5GXBFDZKW2JXO3OQIIGYBF3/
PR: 300977
Requested by: re (cperciva)
[4 lines not shown]
acpica: Fix SRAT memory region insertion sort
The SRAT table can list memory regions in any order, but we need them
sorted. There is an insertion sort to accomplish this when building
the mem_info array, but instead of inserting the new region before
the *first* higher-base-address region, it was inserting the new
region before the *last* higher-base-address region; i.e. if the array
already held "1 3 4" then inserting "2" would produce "1 3 2 4".
Break out of the insertion-location-finding loop when we find the right
spot to insert the new memory region into the list, rather than looking
further.
Approved by: re (cperciva)
Reviewed by: jhb
Fixes: dd540b46236b ("Add a parser for the ACPI SRAT table...")
MFC after: 1 day
Sponsored by: Amazon
Tested on: c5n.9xlarge, c6a.24xlarge, c6a.metal, c7a.metal-48xl
[7 lines not shown]