Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

[Bug] Force move symbols to be less than 64 chars #378

Closed
brson opened this issue Sep 20, 2023 · 6 comments · Fixed by #382
Closed

[Bug] Force move symbols to be less than 64 chars #378

brson opened this issue Sep 20, 2023 · 6 comments · Fixed by #382
Labels
bug Something isn't working

Comments

@brson
Copy link
Collaborator

brson commented Sep 20, 2023

The compiler creates relocatable symbol names that are greater than 64 bytes, which rbpf doesn't support, and this is starting to impede progress (#303, https://github.com/solana-labs/move/pull/374/files#r1330706301).

Without a better solution, we could forcibly truncate any symbol names that exceed 64 bytes, probably appending a hash to the end to maintain uniqueness.

@brson brson added the bug Something isn't working label Sep 20, 2023
@dmakarov
Copy link
Collaborator

Appending hash to the end seems reasonable. Maybe we could have some fixed schema for symbols, e.g. first 16 bytes are lower 8 bytes of a module address as a hex string, next 16 bytes are 8 bytes of module name plus 8 byte hash of entire module name, final 32 bytes are first 16 bytes of function name and 16 byte hash of entire function name, or some other partitioning if it's more practical.

@brson
Copy link
Collaborator Author

brson commented Sep 20, 2023

Appending hash to the end seems reasonable. Maybe we could have some fixed schema for symbols, e.g. first 16 bytes are lower 8 bytes of a module address as a hex string, next 16 bytes are 8 bytes of module name plus 8 byte hash of entire module name, final 32 bytes are first 16 bytes of function name and 16 byte hash of entire function name, or some other partitioning if it's more practical.

Seems ok to me, though I haven't thought about this proposed scheme in detail.

@ksolana
Copy link
Collaborator

ksolana commented Sep 21, 2023

is it possible to modify rbpf into accepting longer names?

we can also have an accompanying symbol table with the real long name(for debugging purposes etc.) and only a hash representing the symbol in the original binary.

@dmakarov
Copy link
Collaborator

Yes, it’s possible, but the imposed limit is for a security issue.

@ksolana
Copy link
Collaborator

ksolana commented Sep 21, 2023

Yes, it’s possible, but the imposed limit is for a security issue.

ah never mind then.

we can also have an accompanying symbol table with the real long name(for debugging purposes etc.) and only a hash representing the symbol in the original binary.

we'll need a symbol table regardless of which hashing scheme we chose, right?

@dmakarov
Copy link
Collaborator

dmakarov commented Sep 21, 2023

For debugging we would need to have the original symbols, but we can also lift the restriction on symbol length in the VM if it's used for debugging. When compiling for debugging we could use the original symbols, and when compiling for deployment we could use hashes. For now it's probably ok to just use hashes (assuming we can avoid conflicts) so we're not impeded by the length limit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants