Skip to content

dotnet-trace collect causes the target application to receive SIGBUS on armv7l #66772

Closed
@o-lek

Description

@o-lek

Description

The target process receives SIGBUS on armv7l when I try to collect trace info.
The problem occurs inside GetBytes(WCHAR* chars, ...) and GetByteCount(WCHAR* chars, ...) functions (runtime/src/coreclr/src/pal/src/locale/utf8.cpp)
Both functions receive their parameter chars as an odd address value.
This happens because of #CollectTracing2 IPC Message, which contains bool requestRundown field of 1 byte length. https://github.com/dotnet/diagnostics/blob/main/documentation/design-docs/ipc-protocol.md#collecttracing2
The following fields are all have odd addresses. The field provider_name when passed to GetBytes and GetByteCount causes SIGBUS.
Exactly this code (GetBytes):
2417 ch = *(int*)pSrc;
2418 int chc = *(int*)(pSrc + 2);
and (GetByteCount):
2757 ch = *(int*)pSrc;
2758 int chc = *(int*)(pSrc + 2);
is compiled into
ldrd r1,r2, [r3]
ARM machine instruction which requires on some ARM architectures the address to be aligned by 4 bytes.
In my opinion, this "odd alignment" will slow down access to the data on the most of all CPU architectures and sometimes, as we can see, may even cause problems.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions