-
Notifications
You must be signed in to change notification settings - Fork 174
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
flamenco, vm: correctly set check_align in vm #2831
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
2addabf
to
6c6c7a4
Compare
40fb06d
to
b2e0f53
Compare
@@ -171,8 +171,7 @@ VM_SYCALL_CPI_UPDATE_CALLEE_ACC_FUNC( fd_vm_t * vm, | |||
/* FIXME: double-check these permissions, especially the callee_acc_idx */ | |||
|
|||
/* Translate and get the account data */ | |||
uchar const * caller_acc_data = FD_VM_MEM_HADDR_LD( vm, caller_acc_data_vm_addr, | |||
sizeof(ulong), caller_acc_data_len ); | |||
uchar const * caller_acc_data = FD_VM_MEM_HADDR_LD( vm, caller_acc_data_vm_addr, sizeof(uchar), caller_acc_data_len ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
align of, or better RUST_U8
@@ -237,7 +236,7 @@ VM_SYCALL_CPI_UPDATE_CALLEE_ACC_FUNC( fd_vm_t * vm, | |||
smartly look up the right region and don't need to worry about | |||
multiple region access.We just need to load in the bytes from | |||
(original len, post_len]. */ | |||
uchar const * realloc_data = FD_VM_MEM_HADDR_LD( vm, caller_acc_data_vm_addr+original_len, alignof(ulong), realloc_bytes_used ); | |||
uchar const * realloc_data = FD_VM_MEM_HADDR_LD( vm, caller_acc_data_vm_addr+original_len, alignof(uchar), realloc_bytes_used ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FD_VM_ALIGN_RUST_U8
@@ -124,8 +124,8 @@ fd_vm_syscall_sol_create_program_address( /**/ void * _vm, | |||
return FD_VM_SUCCESS; | |||
} | |||
|
|||
fd_pubkey_t * out_haddr = FD_VM_MEM_HADDR_ST( vm, out_vaddr, FD_VM_ALIGN_RUST_PUBKEY, sizeof(fd_pubkey_t) ); | |||
memcpy( out_haddr, derived->uc, sizeof(fd_pubkey_t) ); | |||
fd_pubkey_t * out_haddr = FD_VM_MEM_HADDR_ST( vm, out_vaddr, FD_VM_ALIGN_RUST_U8, FD_PUBKEY_FOOTPRINT ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FD_VM_ALIGN_RUST_PUBKEY
@@ -174,7 +174,7 @@ fd_vm_syscall_sol_try_find_program_address( void * _vm, | |||
int err = fd_vm_derive_pda( vm, program_id, seeds_vaddr, seeds_cnt, bump_seed, derived ); | |||
if ( FD_LIKELY( err == FD_VM_SUCCESS ) ) { | |||
/* Stop looking if we have found a valid PDA */ | |||
fd_pubkey_t * out_haddr = FD_VM_MEM_HADDR_ST( vm, out_vaddr, FD_VM_ALIGN_RUST_PUBKEY, sizeof(fd_pubkey_t) ); | |||
fd_pubkey_t * out_haddr = FD_VM_MEM_HADDR_ST( vm, out_vaddr, FD_VM_ALIGN_RUST_U8, sizeof(fd_pubkey_t) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FD_VM_ALIGN_RUST_PUBKEY, FD_PUBKEY_FOOTPRINT
Correctly set
check_align
in the vm based on if the deprecated loader is used.Also correctly sets alignment values for all the memory address translations in the vm.