Skip to content

.NET 10 SDK ARM64: Illegal instruction (SIGILL) on Apple M4 with macOS Virtualization.Framework #122608

Closed

Description

@psjamesh

Description

When building .NET 10 applications in Docker on Apple M4 hardware, the .NET 10 SDK (version 10.0.101) crashes with "Illegal instruction (core dumped)" on ARM64 images. The crash occurs intermittently during various .NET CLI operations including dotnet new, dotnet add package, and dotnet build.

Environment:

  • Host: macOS (Sequoia) on Apple M4 Pro
  • Virtualization: macOS Virtualization.Framework (VZ) via Colima
    • Colima config: vmType: vz, arch: aarch64, rosetta: false
  • VM OS: Ubuntu 24.04.1 LTS (Noble Numbat)
  • VM Architecture: aarch64 (native ARM64, not emulated)
  • .NET SDK: 10.0.101
  • Docker Image: mcr.microsoft.com/dotnet/sdk:10.0 (ARM64 variant, sha256:d1823fecac...)

Key Observations:

  • ✅ Works perfectly when using --platform linux/amd64 (via Rosetta translation)
  • ❌ Fails on native ARM64 (--platform linux/arm64)
  • The bug is intermittent but consistently reproducible with --no-cache builds
  • Multi-project solutions with references trigger it more reliably than single projects
  • Exit code: 132 (SIGILL - Illegal Instruction)

Impact:
Cannot build .NET 10 applications natively on ARM64 in macOS VZ environment. Workaround is to build for AMD64 and rely on Rosetta, but this defeats the purpose of native ARM64 support.

Reproduction Steps

docker run --rm --platform linux/arm64 mcr.microsoft.com/dotnet/sdk:10.0 \
  sh -c 'dotnet new classlib -n Test'

The above fails intermittently but regularly, see sample output below:

> docker run --rm --platform linux/arm64 mcr.microsoft.com/dotnet/sdk:10.0 \
  sh -c 'dotnet new classlib -n Test'
The template "Class Library" was created successfully.

Processing post-creation actions...
Restoring /Test/Test.csproj:
  Determining projects to restore...
  Restored /Test/Test.csproj (in 30 ms).
Restore succeeded.


> docker run --rm --platform linux/arm64 mcr.microsoft.com/dotnet/sdk:10.0 \
  sh -c 'dotnet new classlib -n Test'
Illegal instruction (core dumped)
> docker run --rm --platform linux/arm64 mcr.microsoft.com/dotnet/sdk:10.0 \
  sh -c 'dotnet new classlib -n Test'
The template "Class Library" was created successfully.

Processing post-creation actions...
Restoring /Test/Test.csproj:
  Determining projects to restore...
  Restored /Test/Test.csproj (in 33 ms).
Restore succeeded.


> docker run --rm --platform linux/arm64 mcr.microsoft.com/dotnet/sdk:10.0 \
  sh -c 'dotnet new classlib -n Test'
Illegal instruction (core dumped)

Expected behavior

Build succeeds

Actual behavior

Build fails (intermittently)

Regression?

No response

Known Workarounds

Build an AMD64 image instead

Configuration

Using SDK 10.0

Other information

System Information

# Host CPU
$ sysctl machdep.cpu.brand_string
machdep.cpu.brand_string: Apple M4 Pro

# Docker/VM architecture
$ docker info | grep Architecture
Architecture: aarch64

# .NET SDK version in container
$ docker run --rm mcr.microsoft.com/dotnet/sdk:10.0 dotnet --version
10.0.101

# CPU features visible in container
$ docker run --rm mcr.microsoft.com/dotnet/sdk:10.0 cat /proc/cpuinfo | grep Features
Features: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 flagm2 frint svei8mm svebf16 bf16 afp sme smei16i64 smef64f64 smei8i32 smef16f32 smeb16f32 smef32f32 sme2 smei16i32 smebi32i32

Activity

  1. added
    untriaged
    on Dec 17, 2025
  2. added
    needs-area-label
    on Dec 17, 2025
  3. added
    area-CodeGen-coreclr
    and removed
    needs-area-label
    on Dec 17, 2025
  4. dotnet-policy-service commented on Dec 17, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
    See info in area-owners.md if you want to be subscribed.

  5. majoer commented on Jan 9, 2026

    @majoer

    I had a very similar error when building an image with Podman, running dotnet build from inside the container on a Mac with M4.

    I always saw one of two different errors. Which one i got seemed very random:

    • error MSB6006: "csc.dll" exited with code 132.
    • Illegal instruction

    I dont know what the underlying problem is, but i found a workaround by making sure i create the Podman Machine with LibKrun instead of Apple HyperVisor:

    Image
  6. psjamesh commented on Jan 9, 2026

    @psjamesh
    Author

    For now I've resorted to using Colima with Rosetta locally which means I can build and run amd64 images instead. It does mean in Kubernetes we will also need to run on amd64 which is unfortunate as arm64 offers a cost-saving.

  7. janvorli commented on Jan 12, 2026

    @janvorli
    Member

    I will try to repro it on my M1. @psjamesh or do you already know that it repros on M4 ony?

  8. janvorli commented on Jan 12, 2026

    @janvorli
    Member

    It doesn't repro on my M1, so it seems it is likely M4 specific.

  9. janvorli commented on Jan 14, 2026

    @janvorli
    Member

    @psjamesh I've asked a colleague to repro it on his devices using your repro steps - neither M2 nor M5 reproduced the problem in about 100 runs.

  10. psjamesh commented on Jan 15, 2026

    @psjamesh
    Author

    Thanks @janvorli, I hadn't checked M1, M2 or M5 so thanks for doing that.

  11. JulieLeeMSFT commented on Feb 2, 2026

    @JulieLeeMSFT
    Member

    @janvorli, how is the test going?

  12. janvorli commented on Feb 2, 2026

    @janvorli
    Member

    @JulieLeeMSFT As I've reported above, I was unable to repro it on anything I could find. If you could find a M4 device, it would be great.

  13. JulieLeeMSFT commented on Feb 2, 2026

    @JulieLeeMSFT
    Member

    I thought a collegue with M4 was trying the repro.
    @AndyAyersMS will try it on M4.

  14. 25 remaining items

  15. AndyAyersMS commented on Apr 24, 2026

    @AndyAyersMS
    Member

    Note

    This comment was generated with Copilot.

    Analysis

    The crash stack shows a recursive SIGILL:

    sigill_handler → CONTEXTFromNativeContext → CONTEXT_GetSveLengthFromOS (rdvl → SIGILL)
      → sigill_handler → CONTEXTFromNativeContext → CONTEXT_GetSveLengthFromOS (rdvl → SIGILL)
    

    Root cause: Apple M4 has SME but not SVE. Under the macOS Virtualization Framework (Colima/Podman VZ), the Linux kernel in the VM provides an SVE_MAGIC context record in signal frames — likely because SME's "streaming SVE" mode exposes SVE-like state. However the CPU does not support standalone SVE instructions.

    When a signal fires (e.g. SIGUSR1 activation injection), CONTEXTFromNativeContext at context.cpp:1258 sees the SVE record and calls CONTEXT_GetSveLengthFromOS(), which executes rdvl x0, #1 (context2.S:304) — an SVE instruction. Since the CPU doesn't actually support SVE, this triggers SIGILL. The SIGILL handler then tries to capture context again, hitting the same rdvl, causing infinite recursion.

    The guard in context.cpp only checks that the kernel provided an SVE signal frame record (sve && sve->head.size >= ...). It does not verify that the CPU actually supports SVE instructions. By contrast, codeman.cpp:1518 properly guards with cpuFeatures & ARM64IntrinsicConstants_Sve before calling GetSveLengthFromOS().

    Possible fix: The simplest option may be to use sve->vl from the signal frame directly instead of calling rdvl, since the kernel already provides the vector length in the SVE context record. Alternatively, an AT_HWCAP / HWCAP_SVE check could guard the rdvl call.

  16. AndyAyersMS commented on Apr 24, 2026

    @AndyAyersMS
    Member

    @janvorli new hypothesis above, see if it makes sense to you.

  17. janvorli commented on Apr 24, 2026

    @janvorli
    Member

    Thanks @AndyAyersMS, it seems to make sense. Using the sve->vl sounds reasonable.

  18. AndyAyersMS commented on Apr 24, 2026

    @AndyAyersMS
    Member

    I'll work up a fix and validate it on my M4.

  19. lemourin commented on Apr 26, 2026

    @lemourin

    In case it's useful; I can 100% repro the SIGILL crashes in a linux vm running on mac with kernel version 6.18. With linux kernel 6.12 it doesn't crash ever.

  20. added a commit that references this issue on Apr 28, 2026
    d99474c
  21. locked and limited conversation to collaborators on May 29, 2026
  22. added a commit that references this issue on Jul 15, 2026
    170b347
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-VM-coreclrarm-sve

Type

No type

Projects

  • Status
    No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions