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

Restore compat. with mainnet-beta #12166

Closed

Conversation

ryoqun
Copy link
Member

@ryoqun ryoqun commented Sep 10, 2020

Problem

After long bisecting, I've finally tracked down what causing master to be incompatibile with mainnet-beta (v1.2).

Summary of Changes

After spotting this, I couldn't fix this easily. So, I'm just sharing what I found...

Obviously, this is rather work-around, needs proper fix.. But, this restores compatibility at least...

Fixes #

@ryoqun ryoqun requested a review from jackcmay September 10, 2020 11:46
@@ -169,7 +169,7 @@ macro_rules! translate {
#[macro_export]
macro_rules! translate_type_mut {
($t:ty, $vm_addr:expr, $regions:expr) => {{
if ($vm_addr as u64 as *mut $t).align_offset(align_of::<$t>()) != 0 {
if false && ($vm_addr as u64 as *mut $t).align_offset(align_of::<$t>()) != 0 {
Err(SyscallError::UnalignedPointer.into())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jackcmay It seems that some of mainnet-beta's programs executes Ok on v1.2, but fails with UnalignedPointer on master.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 bank] result: 673XSffuWqYJ6TQeSYZrWXjRZmQqqGxbreUP75jo7TtJ1tk58JiHRCuNCsrEMr8vH1qB19UxQdkgzzetVSUrJRfp => Ok(())
-bank] result: 8vNyVCumvrNzdHrbRNgQkpDG1syXELCxqF9SCd5ukexhr4RgENxbZAJkbeFvWdPoEK9RzFDLJrVyf8QPN2pkroj => Ok(())
+bank] result: 8vNyVCumvrNzdHrbRNgQkpDG1syXELCxqF9SCd5ukexhr4RgENxbZAJkbeFvWdPoEK9RzFDLJrVyf8QPN2pkroj => Err(InstructionError(1, Custom(194969602)))
 bank] result: 97Teou5Ef3TZ2PiPm11ftvFqfgWpynhuMEGcCxmmHbf7wXGFbY9qdgdZUm6LpXAAL9gD8W6c1wbGXYcD6CrpBvL => Ok(())
$ printf "%016x\n" 194969602
000000000b9f0002

$ git grep -C1 b9f_0002
programs/bpf/rust/invoke/src/lib.rs-                invoke(&invoked_instruction, accounts),
programs/bpf/rust/invoke/src/lib.rs:                Err(ProgramError::Custom(0x0b9f_0002))
programs/bpf/rust/invoke/src/lib.rs-            );
--
programs/bpf/rust/invoke/src/lib.rs-                invoke(&invoked_instruction, accounts),
programs/bpf/rust/invoke/src/lib.rs:                Err(ProgramError::Custom(0x0b9f_0002))
programs/bpf/rust/invoke/src/lib.rs-            );
--
programs/bpf_loader/src/lib.rs-    #[error("virtual machine failed to run the program to completion")]
programs/bpf_loader/src/lib.rs:    VirtualMachineFailedToRunProgram = 0x0b9f_0002,
programs/bpf_loader/src/lib.rs-}
[2020-09-10T07:29:17.868465223Z INFO  solana_runtime::message_processor] BPF program 4ckmDgGdxQoPDLUkDT3vHgSAkzA3QRdNq5ywwY4sUSJn failed: Unaligned pointer

@mvines mvines added this to the v1.3.10 milestone Sep 10, 2020
@jackcmay
Copy link
Contributor

Hmm, we want to enforce aligned pointers, probably need to gate this with the new loader

@ryoqun
Copy link
Member Author

ryoqun commented Sep 15, 2020

This is surpassed by #12176

@jackcmay Thanks for fixing this!

@ryoqun ryoqun closed this Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants