DynamoRIO / DynamoRIO/dynamorio

SVE vector length default is invalid

Open
#6,646 3 comments 0 reactions 0 assignees View on GitHub
Component-IR OpSys-AArch64 Usability
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 18h
Merged PRs (30d)
30

Description

Filed from the discussion here: https://github.com/DynamoRIO/dynamorio/pull/6603#pullrequestreview-1873015418

The SVE dynamic vector length affects the decoding of SVE SIMD register and memory operands. For standalone decoder use, the question is how to set the vector length, since the decode target does not always match the underlying machine: xref #6585 where aarch64 drmemtrace traces are routinely decoded on x86 machines; plus there are many other use cases of using drdecode to decode raw bits obtained from other sources on other machines.

There are several other attributes like that that affect decoding. E.g., on x86, whether AMD or Intel, which affects several opcodes. There we used to have a VENDOR_UNKNOWN default which led to contradictory decoding results: #5725. We changed it to default to VENDOR_INTEL to have a sane default. Other examples include AArch32 Arm vs Thumb modes, cache line sizes for certain opcodes, default processor modes for operand size overrides on x86, etc.

Currently drdecode tries to support usage without any explicit initialization call, which is why the defaults have to be reasonable. However, we have run into problems with no explicit initialization: #2499 and #6002.

Today, the SVE vector length defaults to 0, which is invalid. If drdecode continues to try to be usable with no initialization, we cannot leave this invalid value as the default: we have to provide a reasonable default (say, 128).

I do not think requiring a call to something like `dr_set_sve_vector_length` from every single user before decoding any AArch64 code is reasonable or would be considered user-friendly at all. If something is required, IMHO it can only be a general initialization call which takes in some flags setting all the attributes (maybe a struct that's easy to extend): which would help with #2499, #6002.

Contributor guide

Open the contributing guide

Research direction

Start with the drdecode standalone-decoder path and the SVE vector-length initialization behavior described in this issue. Review the linked discussion and references #6585, #5725, #2499, and #6002, then determine how decoding gets a valid default without requiring per-user setup; done means the default is valid and standalone decoding remains usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.