Skip to content

Enable .NET 10 CoreCLR builds on FreeBSD i386 - #138083

Closed
kdenv2604 wants to merge 5 commits into
dotnet:release/10.0from
kdenv2604:freebsd-i386-net10
Closed

kdenv2604 wants to merge 5 commits into
dotnet:release/10.0from
kdenv2604:freebsd-i386-net10

Conversation

@kdenv2604

Copy link
Copy Markdown

Related to dotnet/runtime#114705.

Description

Enable building .NET 10 CoreCLR on FreeBSD 14 i386 with the freebsd-x86 RID. The port covers the FreeBSD PAL context and native calling conventions, x86 caller-pop stack accounting in the JIT and GC unwinder, and native-width FreeBSD process fields used by System.Diagnostics.Process.

This proposal targets release/10.0, which still contains Unix x86 CoreCLR. The corresponding code was removed from main in #137008. I would appreciate maintainer guidance on the appropriate branch for the port.

Customer impact

A runtime-only distribution would let community users run .NET 10 applications on existing FreeBSD 14 i386 machines, including 32-bit hardware with SSE2/SSE3 and without SSE4.2.

Regression

This is a platform bring-up. On the physical test system the initial port built successfully but hit SIGSEGV during managed application startup. The caller-pop fixes in this series resolved the tested startup failure.

Testing

Built .NET 10.0.16 from the exact PR head fec45a4ba168936dd80b5d8145279b3b286fb354. CoreCLR, the native host, and the native libraries were built in Release on FreeBSD 14.4 i386. The managed framework was built for freebsd-x86 with .NET SDK 10.0.403. Both test runs used a fresh extraction of the resulting runtime package without an SDK or hardware-intrinsic overrides.

Environment Signed GUI application startup Input and form submission
Physical single-core Intel Celeron M 420 (1.60 GHz), FreeBSD 14.5-RELEASE i386 PASS. The Host, GUI service and worker loaded the packaged runtime. procstat reported Capsicum mode for the worker. XTEST keyboard input and button click passed. The visible response echoed the text. The server received one matching request over TLS 1.3. Window close and process cleanup passed.
VMware i386 guest with two vCPUs, FreeBSD 14.4-RELEASE i386 PASS. The Host, GUI service and worker loaded the packaged runtime. procstat reported Capsicum mode for the worker. The same XTEST input, visible response, single TLS 1.3 request, window close, and cleanup checks passed.

These are downstream RU-SAR 0.6.11 build 21 application runs against the runtime built from the PR head.

Risk

This series changes low-level stack handling on Unix x86 and process-layout marshalling on FreeBSD. I would welcome targeted review of the x86 calling convention and the FreeBSD native field widths. The validation above covers i386 on FreeBSD 14.4 and 14.5.

kdenv2604 and others added 5 commits November 20, 2026 15:06
On x86 Unix, caller-pop conventions leave argument cleanup to the caller.
Recording lvaParameterStackSize in the JIT32 GC info header made the runtime
compute the caller SP too high by that amount. Funclet parent-frame matching
(m_csfEHClause) then failed, which showed up as double GC reporting and stale
object references.

On a FreeBSD i386 box, a minimal repro (async + finally + exception under
DOTNET_GCStress=0x1) passes 5/5 with this change and fails with the stock JIT.

Co-authored-by: kdenv2604 <[email protected]>
TransitionFrame unwinding added the stack arg size to the caller SP, which
put the funclet's caller SP 4 bytes off from ExInfo.m_csfEHClause after a
prestub call inside a finally funclet. Funclet parent lookup then failed, the
parent frame got GC-reported twice (CheckDoubleReporting assert), and a stale
slot crashed after compaction. Same root cause as the previous JIT commit.

Verified on FreeBSD i386: the Host test under DOTNET_GCStress=0x1 crashes 3/3
stock and 0 fixed, and the ehrepro double-report assert reproduces 0/3 stock
and 3/3 fixed.

Co-authored-by: kdenv2604 <[email protected]>
Calls created after import (rationalizer HW-intrinsic user-call fallback,
async helpers, special copy helper, tail-call dispatcher) did not get
GTF_CALL_POP_ARGS, so the caller never popped stack args. On CPUs without
SSE4.2 (Celeron M 420), Vector128.ExtractMostSignificantBits<short> falls
back to a call in SpanHelpers.LastIndexOfValueType SimdImpl, leaving 16
bytes on the stack; the epilog then pops the compare mask into ebp and
returns to 0.

Verified on a physical Celeron M 420 with FreeBSD 14.5 i386: the packer, the
Host and the full GUI end-to-end run through the Capsicum worker pass
without DOTNET_EnableHWIntrinsic=0, and the regression on the VM is unchanged.

Co-authored-by: kdenv2604 <[email protected]>
Use the native FreeBSD widths for C long, virtual sizes, and pointers in kinfo_proc and rusage. Keep fixed-width kernel fields and the 64-bit process ABI.

(cherry picked from commit 1000e28b829bf801b796ee8652046183c7556ffc)
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Nov 21, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@jkotas

jkotas commented Nov 21, 2026

Copy link
Copy Markdown
Member

I am sorry - enabling new OS/architecture combinations does not meet a bar for release branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Infrastructure community-contribution Indicates that the PR has been added by a community member

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants