Skip to content

Use performant way to enforce handle inheritance restrictions, fail wth error if not available - #135753

Merged
adamsitnik merged 1 commit into
dotnet:mainfrom
adamsitnik:inherited-handles-fix
Oct 14, 2026
Merged

adamsitnik merged 1 commit into
dotnet:mainfrom
adamsitnik:inherited-handles-fix

Conversation

@adamsitnik

Copy link
Copy Markdown
Member

No description provided.

@azure-pipelines

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

@adamsitnik

Copy link
Copy Markdown
Member Author

/ba-g unrelated, my favorite WASM 100% failure rate

@adamsitnik
adamsitnik disabled auto-merge October 14, 2026 14:02
@adamsitnik
adamsitnik merged commit 0232cf7 into dotnet:main Oct 14, 2026
125 of 127 checks passed
springmin added a commit to springmin/runtime-ohos that referenced this pull request Oct 14, 2026
…olved)

The post-infra rehearsal ran 22 refs against upstream/main 0232cf7: 13
CLEAN-SAME, 1 EMPTY (platform-numa, discard), 2 CLEAN-DIFF (named-mutex merged,
sandbox parked), and 6 conflicts of which 4 needed folded resolutions
(pal-process/dotnet#135753, crossgen-corelib/dotnet#135397, libs-tfm+N15 keep-both, C2) and
2 are non-events (infra merged, tls discarded). All four resolutions are
verified (no markers, XML parses, slice stat SAME where applicable) with new
tips and patch-ids recorded, plus the per-branch recipes for the fork sync.
springmin added a commit to springmin/runtime-ohos that referenced this pull request Oct 14, 2026
36 conflicts: eng/common and version/pipeline files taken from upstream; the
release-branch duplicate files (Cbor, HPKE, QUIC, sockets/TLS/delegate tests,
async JIT files, Regression_ro_2 deleted upstream) taken from upstream;
NamedMutex.Unix.cs deduplicated to upstream (dotnet#135321 plus the .NET 10 layout
rework); eng/Subsets.props kept the OpenHarmony spelling fix on top of upstream.

Four folded conflicts:
- System.Native/pal_process.c: upstream dotnet#135753 shape (int32 result, ENOTSUP
  on unsupported platforms) plus the OpenHarmony branch that avoids the seccomp
  SIGSYS trap by walking /proc/self/fd (bounded, int-range checked) with an
  rlimit-scan fallback; close_range probes removed.
- coreclr/crossgen-corelib.proj: upstream dotnet#135397 task shape with the
  OpenHarmony IL-only gate kept and _CrossGenTargetOS folded into the
  _CoreLibCrossgen2Tool TargetOS metadata.
- libraries/Directory.Build.props: WASI block plus the current OpenHarmony TFM
  block (both kept).
- eng/native/gen-buildsys.sh: upstream --fresh compiler-inputs logic plus the
  -C tryrun cache moved to the front of the cmake invocation.
krwq pushed a commit that referenced this pull request Nov 13, 2026
…bit musl (#137407)

Backport of #135867 to release/11.0. The main fix was contributed by
@pcshrosbree.

/cc @krwq @pcshrosbree

## Customer Impact

- [ ] Customer reported
- [x] Found internally

The ProcessHandles descriptor-leak test fails during setup on Alpine
ARM32, adding an unrelated failure to validation of .NET 11 servicing
changes. The test declares `rlim_t` fields as `nuint`, but musl uses
64-bit fields even on 32-bit platforms. This makes its libc
`getrlimit`/`setrlimit` declarations incorrect.

This backport addresses #136327 by using the existing `System.Native`
resource-limit interop, which converts to and from the platform's native
structure. It retains the descriptor-leak check rather than disabling
ARM32 coverage. Only the test and its project file change; there is no
shipped runtime behavior, public API, package or reference-assembly
change.

## Regression

- [x] Yes
- [ ] No

Test-only regression introduced by #135753, which added
`HighNumberedFd_NotLeakedAfterLoweringRLimit`. The test's assumption
that `rlim_t` is pointer-sized does not hold on musl ARM32. This is not
a regression in shipped runtime behavior.

## Testing

The existing regression test is corrected; no test is disabled or
removed.

Validation reported on the merged main PR #135867:

- Linux x64: 44 ProcessHandles tests passed; the full Process test
project reported 675 passed, 6 skipped and 0 failed.
- Reintroducing the descriptor-leak bug caused the corrected test to
fail, confirming that it still detects the intended product regression.
- Alpine ARM32 emulation reproduced the native layout mismatch and
verified the resource-limit calls through `System.Native`. This was a
focused console repro, not the full Process test on Alpine ARM32
hardware.

Backport validation:

- [CI build
1677098](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1677098):
the `Build linux_musl-arm Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs`
job passed, but the overall runtime pipeline failed. Build Analysis is
also red; these failures have not been classified in this description
update.
- [Linker-test build
1677100](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1677100)
passed.
- A passing result for the corrected test on Alpine ARM32 has not yet
been confirmed for this backport. The passing build job alone does not
establish that the test passed.
- No local build or tests were run for this backport in this session.

## Risk

Low. The diff is limited to `ProcessHandlesTests.Unix.cs` and
`System.Diagnostics.Process.Tests.csproj`. It replaces test-local libc
resource-limit declarations with existing shared interop and preserves
the test's leak assertion and the returned hard limit. No shipped
product code or dependencies change.

The main PR's validation provides evidence that the test still catches
descriptor leaks, but the backport's failing CI and Alpine ARM32 test
result still need resolution before treating validation as complete.

**IMPORTANT**: If this backport is for a servicing release, please
verify that:

- For .NET 8 and .NET 9: The PR target branch is `release/X.0-staging`,
not `release/X.0`.
- For .NET 10+: The PR target branch is `release/X.0` (no `-staging`
suffix).

This PR targets `release/11.0`.

## Package authoring no longer needed in .NET 9

**IMPORTANT**: Starting with .NET 9, you no longer need to edit a NuGet
package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older
versions.

Fixes #136327

> [!NOTE]
> This PR description was prepared with GitHub Copilot.

Co-authored-by: Peter Shrosbree <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants