Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Restore compat. with mainnet-beta#12166

Closed
ryoqun wants to merge 2 commits intosolana-labs:masterfrom
ryoqun:incompatible-with-mainnet-beta
Closed

Restore compat. with mainnet-beta#12166
ryoqun wants to merge 2 commits intosolana-labs:masterfrom
ryoqun:incompatible-with-mainnet-beta

Conversation

@ryoqun
Copy link
Copy Markdown
Contributor

@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
($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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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
Copy Markdown
Contributor

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

@ryoqun
Copy link
Copy Markdown
Contributor 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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants