dotnet / dotnet/runtime

ARM32 ELT hooks forced thumb bit

Open
#127,240 4 comments 0 reactions 0 assignees View on GitHub
arch-arm32 area-Diagnostics-coreclr Priority:3
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

### Description

When calling ELT hooks provided via `ICorProfilerInfo3::SetEnterLeaveFunctionHooks3` the runtime sets the thumb bit for them, even if the the hooks refer to arm, not thumb code.

I couldn't find any documentation mentioning that ELT hooks must be thumb code.

It doesn't seem necessary - if the thumb bit wasn't added the hook would be called according to the address provided, thumb or not.

In the upcoming version 11 it seems the issue may have been (unintentionally?) fixed:
https://github.com/dotnet/runtime/commit/63d560a2b86e1c3b0d76e9162112b5378847d846#diff-98b4e379205d747e922689cb993f985be190fedb509fd486e99280c842703472L10892-R10910

### Reproduction Steps

Implement a `CorProfiler` calling `ICorProfilerInfo3::SetEnterLeaveFunctionHooks3` and compile it in arm mode. Run against .NET 10 or lower.

### Expected behavior

Hooks should be called in arm mode

### Actual behavior

Hooks are called in thumb mode, resulting in SIGSEGV or SIGILL.

### Regression?

_No response_

### Known Workarounds

_No response_

### Configuration

.NET 8 ARMv7

### Other information

The thumb bit is unconditionally set in `CEECodeGenInfo::getHelperFtn` -> `GetEEFuncEntryPoint`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.