Stream: git-wasmtime

Topic: wasmtime / issue #5780 Use capstone to validate precise-o...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2023 at 01:43):

elliottt commented on issue #5780:

The only additional feature I'd like to suggest is that I think we can get the blockN: labels back, and maybe add a comment with their byte offsets so we can more easily see where jumps refer to. MachBuffer::label_offsets is, if I'm reading this correctly, an array indexed by block number and holding the code offset of the first instruction of that block. Since branches may have been removed there can be multiple labels at the same offset, so before each instruction you can scan that array for all blocks at that offset.

As we were discussing, we don't have access to label_offsets in MachBufferFinalized, which is unfortunate. Perhaps we can plumb that through in a future PR, as it would be really nice to get the block labels back.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2023 at 13:08):

uweigand commented on issue #5780:

I've been going through the remaining s390x changes. Looking at broad categories I see:

 ;   clgr %r2, %r3
-;   jge label1 ; jg label2
-; block1:
-;   jg label3
-; block2:
-;   jg label3
-; block3:
 ;   lghi %r2, 1
 ;   br %r14

I guess my primary question would be to what extent we're willing to rely on the quality of the capstone library here. I'm not sure exactly who is writing / maintaining this -- looking at the web site, the last official release is as of nearly three years ago, and even in the github repo (assuming I'm looking at the correct one?) the last significant change to the SystemZ directory is five years old, which presumably explains why it doesn't support z15 yet. Even X86 doesn't appear to be much more recent.

The actual disassembly implementation in capstone seems to be done primarily via files copied from LLVM, so that should likely be correct as far as it goes. But if this isn't regularly updated, we could run into issues with using recent instructions on other architectures as well ...

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2023 at 13:28):

bjorn3 commented on issue #5780:

Zydis is a disassembler for x86 with a focus on correctness (even knows the difference between how Intel and AMD cpus decode insts) and performance. It has official rust bindings: https://github.com/zyantific/zydis-rs (licensed under MIT)

BinaryNinja has an AArch64 disassembler generated from the actual ISA manual: https://binary.ninja/2021/04/05/groundup-aarch64.html, https://github.com/Vector35/arch-arm64/tree/master/disassembler (licensed under Apache-2.0) Not sure how easy it is reusable outside of BinaryNinja though.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2023 at 23:53):

elliottt commented on issue #5780:

After the discussion today, I've added a section to each test output that also includes the printed vcode. This will help spot differences between what we're assuming we're producing and what we're actually producing, as well as help identify where capstone is falling short.


Last updated: Nov 22 2024 at 16:03 UTC