Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide out-of-line equivalents of inline functions #302

Open
algr opened this issue Aug 30, 2023 · 0 comments
Open

Provide out-of-line equivalents of inline functions #302

algr opened this issue Aug 30, 2023 · 0 comments
Labels

Comments

@algr
Copy link

algr commented Aug 30, 2023

Inline API functions aren't directly accessible when wrapping the DLL with Python ctypes or similar. This includes some functions which set up xed_decode_inst_t before decode (xed_decoded_inst_set_input_chip etc.), and others which access fields after decode (xed_decoded_inst_get_length etc.). The libxed wrapper script in the Linux perf source tree has this:

# For now, assume the length is in byte 166
return inst.xedd[166], result

But depending on libxed build options, the offset sometimes isn't 166, so this breaks. If libxed exported out-of-line equivalents of all these functions then DLL wrappers wouldn't need to offset directly into the buffers.

It would also be useful to export (in the DLL sense) the sizes of key data types somehow. Referring to the Linux perf wrapper again, it has no idea how big a xed_decoded_inst_t is, it allocates 512 bytes to be on the safe side, but conceivably libxed could one day exceed this, leading to buffer overflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants