forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Dev utils tokyo 5 dm perms #13
Open
ryoqun
wants to merge
186
commits into
dm-cpi-memory-perm
Choose a base branch
from
dev-utils-tokyo-5-dm-perms
base: dm-cpi-memory-perm
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+170
−161
Open
Changes from all commits
Commits
Show all changes
186 commits
Select commit
Hold shift + click to select a range
eb69052
save 2023y07m28d06h21m43s433313277ns
ryoqun 5d4541d
save 2023y07m28d06h22m01s774904507ns
ryoqun 8bb70e3
save 2023y07m28d06h23m57s444273856ns
ryoqun 58b3891
save 2023y07m28d06h24m17s178500970ns
ryoqun abf452a
save 2023y07m28d06h28m17s811365537ns
ryoqun bdd5fc4
save 2023y07m28d06h28m36s072576954ns
ryoqun a4283b1
save 2023y07m28d06h28m54s504500751ns
ryoqun 4643079
save 2023y07m28d06h31m15s379322004ns
ryoqun 848bcf9
save 2023y07m28d06h31m23s250190331ns
ryoqun a47cf91
save 2023y07m28d06h31m32s714918387ns
ryoqun 247da4b
save 2023y07m28d06h31m43s277634046ns
ryoqun 2e634c2
save 2023y07m28d06h33m24s345954860ns
ryoqun 12af21f
save 2023y07m28d06h36m12s840661418ns
ryoqun a6991ab
save 2023y07m28d06h43m43s720651718ns
ryoqun 888b888
save 2023y07m28d06h44m33s956829950ns
ryoqun 15a9be8
save 2023y07m28d06h52m21s595520387ns
ryoqun 36d3504
save 2023y07m28d06h53m31s882195368ns
ryoqun f434fe8
save 2023y07m28d06h57m39s857877030ns
ryoqun 4b1a69c
save 2023y07m28d07h04m16s041315668ns
ryoqun 44c246a
save 2023y07m28d07h04m50s142936784ns
ryoqun 06ff98b
save 2023y07m28d07h05m50s365005184ns
ryoqun d47a96b
save 2023y07m28d07h07m34s719597562ns
ryoqun 2057a54
save 2023y07m28d07h09m32s699809534ns
ryoqun 609e283
save 2023y07m28d07h13m44s663107003ns
ryoqun dc22236
save 2023y07m28d07h14m06s413878210ns
ryoqun 231cb5f
save 2023y07m28d07h14m15s366534391ns
ryoqun f46a34d
save 2023y07m28d07h15m07s643802352ns
ryoqun c4cea00
save 2023y07m28d07h15m14s986987519ns
ryoqun 1f386d0
save 2023y07m28d07h15m26s331213456ns
ryoqun 4dfe2ee
save 2023y07m28d07h16m22s073538886ns
ryoqun 6aaa633
save 2023y07m28d07h16m47s639532354ns
ryoqun 4aa787b
save 2023y07m28d07h18m21s765467994ns
ryoqun 2a55276
save 2023y07m28d07h19m27s721246461ns
ryoqun 7db94ce
save 2023y07m28d07h21m21s403730565ns
ryoqun 0a0c2e6
save 2023y07m28d07h22m50s480100921ns
ryoqun 5a1677c
save 2023y07m28d07h24m09s782253297ns
ryoqun 1b5213f
save 2023y07m28d07h26m30s880125815ns
ryoqun c183ceb
save 2023y07m28d07h48m17s158502671ns
ryoqun 86c20b9
save 2023y07m28d07h49m31s313402035ns
ryoqun 1c5df8b
save 2023y07m28d07h51m33s470611560ns
ryoqun 5f4f10e
save 2023y07m28d07h54m53s328950385ns
ryoqun 4e5574b
save 2023y07m28d07h55m05s097453443ns
ryoqun ce33c08
save 2023y07m28d07h56m51s251528037ns
ryoqun 83d423d
save 2023y07m28d14h26m33s021709965ns
ryoqun 2e61c81
save 2023y07m28d14h31m10s265768122ns
ryoqun fcffc14
save 2023y07m28d14h31m29s277650768ns
ryoqun c320db7
save 2023y07m28d14h32m00s989804023ns
ryoqun ae44b7e
save 2023y07m28d14h34m09s858490056ns
ryoqun 197909f
save 2023y07m28d14h37m55s220367008ns
ryoqun 192f22c
save 2023y07m28d14h38m01s206181808ns
ryoqun 176490a
save 2023y07m28d14h39m17s843699112ns
ryoqun fc30904
save 2023y07m28d14h43m00s378715264ns
ryoqun 5452b09
save 2023y07m28d14h43m49s647796971ns
ryoqun 265ad59
save 2023y07m28d14h47m26s152761169ns
ryoqun 09093c1
save 2023y07m28d14h47m43s184468519ns
ryoqun c742398
save 2023y07m28d14h48m34s065914751ns
ryoqun d82993b
save 2023y07m28d14h48m47s894117491ns
ryoqun 363caac
save 2023y07m28d14h50m27s595947293ns
ryoqun 08a42fd
save 2023y07m28d14h51m30s430084864ns
ryoqun 8bb49e7
save 2023y07m28d14h58m34s697149087ns
ryoqun 911bd8d
save 2023y07m28d15h04m59s790937103ns
ryoqun 913b148
save 2023y07m28d15h06m56s664800377ns
ryoqun b7dd2e5
save 2023y07m28d15h08m08s894261156ns
ryoqun ffc735f
save 2023y07m28d15h08m52s347902675ns
ryoqun e45ff00
save 2023y07m28d15h10m04s575800548ns
ryoqun 38d8f57
save 2023y07m28d15h11m57s441985952ns
ryoqun a36f6da
save 2023y07m28d15h13m05s480327664ns
ryoqun 311c0cf
save 2023y07m28d15h14m06s691729257ns
ryoqun 4004754
save 2023y07m28d15h16m01s806365628ns
ryoqun d95ec2c
save 2023y07m28d15h19m14s280571385ns
ryoqun 4651777
save 2023y07m28d15h20m40s283731336ns
ryoqun face419
save 2023y07m28d15h22m17s703241697ns
ryoqun bbebfbd
save 2023y07m28d15h26m07s197002617ns
ryoqun 2b4a930
save 2023y07m28d15h26m16s036402748ns
ryoqun dcc789f
save 2023y07m28d15h26m34s164569768ns
ryoqun 7361077
save 2023y07m28d15h28m13s135645866ns
ryoqun efbffcd
save 2023y07m28d15h28m25s248069264ns
ryoqun a6dab92
save 2023y07m28d15h30m57s523298572ns
ryoqun 6142f20
save 2023y07m28d15h31m05s536543493ns
ryoqun 0a979ee
save 2023y07m28d15h32m11s349568642ns
ryoqun fb0ef00
save 2023y07m28d15h34m21s120854871ns
ryoqun 3ad6e8f
save 2023y07m28d15h35m32s664771489ns
ryoqun 5bb7e32
save 2023y07m28d15h36m14s293724809ns
ryoqun d6acfd5
save 2023y07m29d03h15m26s515490719ns
ryoqun 3cbb731
save 2023y07m29d03h19m16s262632523ns
ryoqun 051d758
save 2023y07m29d03h20m02s947161821ns
ryoqun 70f2140
save 2023y07m29d03h20m47s900064623ns
ryoqun eaf4f63
save 2023y07m29d03h26m13s732453308ns
ryoqun 419febd
save 2023y07m29d03h28m51s199572136ns
ryoqun cd457bd
save 2023y07m29d03h29m57s535576656ns
ryoqun 9d45b15
save 2023y07m29d03h32m46s480629421ns
ryoqun 53e97ef
save 2023y07m29d03h39m59s552675321ns
ryoqun 77a144d
save 2023y07m29d03h49m55s322566792ns
ryoqun ef33831
save 2023y07m29d03h57m36s896099263ns
ryoqun e47a4b6
save 2023y07m29d03h57m44s996575542ns
ryoqun afc3b5a
save 2023y07m29d03h57m52s333221527ns
ryoqun 3101b0f
save 2023y07m29d04h01m25s149686370ns
ryoqun d252023
save 2023y07m29d04h04m15s183490291ns
ryoqun 926361a
save 2023y07m29d04h05m20s524598720ns
ryoqun 6a36666
save 2023y07m29d04h05m40s300406377ns
ryoqun bcefcf0
save 2023y07m29d04h06m44s459445828ns
ryoqun 03a2491
save 2023y07m29d04h07m07s824230324ns
ryoqun 32249dd
save 2023y07m29d04h07m15s158145708ns
ryoqun da5e17f
save 2023y07m29d04h09m32s094823844ns
ryoqun 42cf40e
save 2023y07m29d04h10m45s622104513ns
ryoqun ce98c18
save 2023y07m29d04h12m27s061307524ns
ryoqun 4c06ced
save 2023y07m29d04h12m44s133806986ns
ryoqun 56ff291
save 2023y07m29d04h14m50s713251620ns
ryoqun a3e2e02
save 2023y07m29d04h14m56s526890934ns
ryoqun f10ded8
save 2023y07m29d04h16m57s984454602ns
ryoqun da3af85
save 2023y07m29d04h17m08s358119513ns
ryoqun 32eca01
save 2023y07m29d04h17m17s110655691ns
ryoqun 683107e
save 2023y07m29d04h17m24s501854806ns
ryoqun 1fa6e2a
save 2023y07m29d04h18m55s305135587ns
ryoqun 6be3287
save 2023y07m29d04h24m54s028484002ns
ryoqun 169321b
save 2023y07m29d04h25m38s479016646ns
ryoqun 0a6c47c
save 2023y07m29d04h27m56s440728820ns
ryoqun 3cb8618
save 2023y07m29d04h31m45s835102161ns
ryoqun 0c5b846
save 2023y07m29d04h34m00s121600960ns
ryoqun e801f76
save 2023y07m29d04h35m02s863095700ns
ryoqun eff583b
save 2023y07m29d04h38m36s982285284ns
ryoqun 4fcf795
save 2023y07m29d04h44m09s180979571ns
ryoqun 2f30979
save 2023y07m29d04h45m22s147275765ns
ryoqun 3cfc6ff
save 2023y07m29d04h50m29s951144809ns
ryoqun 0df3dab
save 2023y07m29d04h59m43s106675487ns
ryoqun dece191
save 2023y07m29d05h03m03s924250288ns
ryoqun aa9db90
save 2023y07m29d05h03m56s877114598ns
ryoqun 7c779db
save 2023y07m29d05h05m38s854166460ns
ryoqun 4aff53e
save 2023y07m29d05h05m55s878226577ns
ryoqun fbd195b
save 2023y07m29d05h06m05s845686312ns
ryoqun f806bb8
save 2023y07m29d05h10m39s228849039ns
ryoqun c0966f8
save 2023y07m29d05h12m04s554536668ns
ryoqun 1367f22
save 2023y07m29d05h13m11s390465585ns
ryoqun 6752a1f
save 2023y07m29d05h21m52s707752200ns
ryoqun b856535
save 2023y07m29d05h23m31s362436474ns
ryoqun 5e77461
save 2023y07m29d05h24m39s493437732ns
ryoqun 6d4d237
save 2023y07m30d12h26m49s485069832ns
ryoqun 6936148
save 2023y07m30d12h27m31s377171416ns
ryoqun f794fca
save 2023y07m30d12h27m58s039202454ns
ryoqun b9156d9
save 2023y07m30d12h30m43s368143054ns
ryoqun 9fc8006
save 2023y07m30d12h31m16s935532633ns
ryoqun 83c4938
save 2023y07m30d12h31m35s352132040ns
ryoqun ba88847
save 2023y07m30d12h31m50s285861618ns
ryoqun 957e9aa
save 2023y07m30d12h33m08s162151536ns
ryoqun 404c259
save 2023y07m30d12h33m22s809343687ns
ryoqun e1f4e17
save 2023y07m30d12h39m23s759879640ns
ryoqun 134b381
save 2023y07m30d12h40m57s978214723ns
ryoqun cb86113
save 2023y07m30d12h50m43s742550615ns
ryoqun 94827d9
save 2023y07m30d12h53m07s861866926ns
ryoqun 90b0b06
save 2023y07m30d13h21m58s795732065ns
ryoqun 37a9ea6
save 2023y07m30d13h22m56s520766994ns
ryoqun b04796f
save 2023y07m30d13h28m54s081454446ns
ryoqun 8f3a91c
save 2023y07m30d13h29m44s561188110ns
ryoqun f58d887
save 2023y07m30d13h30m27s070592043ns
ryoqun fcfa15f
save 2023y07m30d13h36m34s719666960ns
ryoqun 02fa3fe
save 2023y07m30d13h36m49s580302919ns
ryoqun cf11cb7
save 2023y07m30d13h40m58s403543668ns
ryoqun c9121d3
save 2023y07m30d13h41m59s970323501ns
ryoqun ee3e4d0
save 2023y07m30d13h42m35s289849316ns
ryoqun 9947405
save 2023y07m30d13h42m48s096463155ns
ryoqun 7100a23
save 2023y07m30d13h43m01s007515332ns
ryoqun 9429f3c
save 2023y07m30d13h53m18s973116575ns
ryoqun 22e8227
save 2023y07m30d14h30m23s756293207ns
ryoqun d0aabfa
save 2023y07m30d14h31m45s110978040ns
ryoqun 127b358
save 2023y07m30d14h35m04s717428954ns
ryoqun 70c2c78
save 2023y07m30d14h35m30s316172500ns
ryoqun 834a571
save 2023y07m30d14h36m04s981984327ns
ryoqun 0be322c
save 2023y07m30d14h38m11s864492304ns
ryoqun 0774cf2
save 2023y07m30d14h41m37s341844633ns
ryoqun e45e905
save 2023y07m30d14h43m38s130706543ns
ryoqun 64323ef
save 2023y07m30d14h47m21s270680202ns
ryoqun a8b1b58
save 2023y07m30d14h52m28s294434791ns
ryoqun e7035d3
save 2023y07m30d14h53m32s565872330ns
ryoqun 1549b4b
save 2023y07m30d14h54m11s588581990ns
ryoqun 3f34a55
save 2023y07m30d14h54m30s675311600ns
ryoqun 672ffd3
save 2023y07m30d14h56m07s826695479ns
ryoqun 974a00f
save 2023y07m30d15h01m27s793036654ns
ryoqun 81ac180
save 2023y07m30d15h06m18s649309037ns
ryoqun 645aa3d
save 2023y07m31d05h59m59s341460720ns
ryoqun 0208cdd
save 2023y07m31d06h43m06s060132190ns
ryoqun fad3d49
save 2023y07m31d06h44m06s000579771ns
ryoqun 2c2043b
save 2023y07m31d06h46m45s571531256ns
ryoqun 4f85812
save 2023y07m31d06h53m27s425813924ns
ryoqun f87729b
save 2023y07m31d06h54m47s711776014ns
ryoqun 0beb96f
save 2023y07m31d06h57m07s634894577ns
ryoqun 975a6f0
save 2023y07m31d06h59m40s891440918ns
ryoqun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -851,56 +851,112 @@ fn process_instruction( | |
let target_account = &accounts[target_account_index]; | ||
let realloc_program_id = accounts[REALLOC_PROGRAM_INDEX].key; | ||
let invoke_program_id = accounts[INVOKE_PROGRAM_INDEX].key; | ||
account.realloc(0, false).unwrap(); | ||
account.assign(realloc_program_id); | ||
target_account.realloc(0, false).unwrap(); | ||
target_account.assign(realloc_program_id); | ||
//account.realloc(0, false).unwrap(); | ||
//account.assign(realloc_program_id); | ||
//target_account.realloc(50, false).unwrap(); | ||
let target_len = target_account.data.borrow().len(); | ||
//msg!("target realloc to {}", target_len); | ||
//target_account.data.borrow_mut()[2] = 0; | ||
//target_account.assign(realloc_program_id); | ||
let orig_target_account_data = target_account.data.clone(); | ||
msg!("data+spare: {:02x?}", unsafe { slice::from_raw_parts(account.data.borrow().as_ptr(), 100) }); | ||
msg!("data+spare: {:02x?}", unsafe { slice::from_raw_parts(target_account.data.borrow().as_ptr(), 100) }); | ||
//msg!("data+spare: {:02x?}", unsafe { slice::from_raw_parts(orig_target_account_data.borrow().as_ptr(), 100) }); | ||
msg!("len: {}", account.data.borrow().len()); | ||
//msg!("len: {}", target_account.data.borrow().len()); | ||
//msg!("len: {}", orig_target_account_data.borrow().len()); | ||
|
||
let rc_box_addr = | ||
target_account.data.borrow_mut().as_mut_ptr() as *mut RcBox<RefCell<&mut [u8]>>; | ||
let rc_box_size = mem::size_of::<RcBox<RefCell<&mut [u8]>>>(); | ||
account.data.borrow_mut().as_mut_ptr() as *mut RcBox<RefCell<&mut [u8]>>; | ||
let rc_box = RcBox { | ||
strong: 1, | ||
weak: 0, | ||
// The difference with | ||
// TEST_FORBID_LEN_UPDATE_AFTER_OWNERSHIP_CHANGE_MOVING_DATA_POINTER | ||
// is that we don't move the data pointer past the | ||
// RcBox. This is needed to avoid the "Invalid account | ||
// info pointer" check when direct mapping is enabled. | ||
// This also means we don't need to update the | ||
// serialized len like we do in the other test. | ||
value: unsafe { RefCell::new(slice::from_raw_parts_mut( | ||
target_account.data.borrow_mut().as_mut_ptr(), | ||
target_len, | ||
)) }, | ||
}; | ||
unsafe { | ||
std::ptr::write( | ||
rc_box_addr, | ||
RcBox { | ||
strong: 1, | ||
weak: 0, | ||
// The difference with | ||
// TEST_FORBID_LEN_UPDATE_AFTER_OWNERSHIP_CHANGE_MOVING_DATA_POINTER | ||
// is that we don't move the data pointer past the | ||
// RcBox. This is needed to avoid the "Invalid account | ||
// info pointer" check when direct mapping is enabled. | ||
// This also means we don't need to update the | ||
// serialized len like we do in the other test. | ||
value: RefCell::new(slice::from_raw_parts_mut( | ||
account.data.borrow_mut().as_mut_ptr(), | ||
0, | ||
)), | ||
}, | ||
); | ||
} | ||
rc_box, | ||
) | ||
}; | ||
|
||
let rc_box2 = RcBox { | ||
strong: 1, | ||
weak: 0, | ||
// The difference with | ||
// TEST_FORBID_LEN_UPDATE_AFTER_OWNERSHIP_CHANGE_MOVING_DATA_POINTER | ||
// is that we don't move the data pointer past the | ||
// RcBox. This is needed to avoid the "Invalid account | ||
// info pointer" check when direct mapping is enabled. | ||
// This also means we don't need to update the | ||
// serialized len like we do in the other test. | ||
value: unsafe { RefCell::new(slice::from_raw_parts_mut( | ||
target_account.data.borrow_mut().as_mut_ptr(), | ||
target_len, | ||
)) }, | ||
}; | ||
let rc_box_size = mem::size_of::<RcBox<RefCell<&mut [u8]>>>(); | ||
|
||
let serialized_len_ptr = | ||
unsafe { account.data.borrow_mut().as_mut_ptr().offset(-8) as *mut u64 }; | ||
let serialized_len_ptr2 = | ||
unsafe { target_account.data.borrow_mut().as_mut_ptr().offset(-8) as *mut u64 }; | ||
// Place a RcBox<RefCell<&mut [u8]>> in the account data. This | ||
// allows us to test having CallerAccount::ref_to_len_in_vm in an | ||
// account region. | ||
unsafe { | ||
std::ptr::write( | ||
&account.data as *const _ as usize as *mut Rc<RefCell<&mut [u8]>>, | ||
&target_account.data as *const _ as usize as *mut Rc<RefCell<&mut [u8]>>, | ||
Rc::from_raw(((rc_box_addr as usize) + mem::size_of::<usize>() * 2) as *mut _), | ||
); | ||
} | ||
//msg!("ptr: {:p}", &rc_box); | ||
/* | ||
unsafe { | ||
std::ptr::write( | ||
&account.data as *const _ as usize as *mut Rc<RefCell<&mut [u8]>>, | ||
Rc::from_raw(((&rc_box as *const _) as usize + mem::size_of::<usize>() * 2) as *mut _), | ||
); | ||
} | ||
*/ | ||
/* | ||
unsafe { | ||
std::ptr::write( | ||
&target_account.data as *const _ as usize as *mut Rc<RefCell<&mut [u8]>>, | ||
Rc::from_raw(((&rc_box as *const _) as usize + mem::size_of::<usize>() * 2) as *mut _), | ||
); | ||
} | ||
*/ | ||
/* | ||
unsafe { | ||
std::ptr::write( | ||
&target_account.data as *const _ as usize as *mut Rc<RefCell<&mut [u8]>>, | ||
Rc::from_raw(((&rc_box as *const _) as usize + mem::size_of::<usize>() * 2) as *mut _), | ||
); | ||
} | ||
*/ | ||
|
||
let mut instruction_data = vec![REALLOC, 0]; | ||
instruction_data.extend_from_slice(&rc_box_size.to_le_bytes()); | ||
let mut instruction_data = vec![SELF_CPI, 0, 0, 0]; | ||
//let mut instruction_data = vec![REALLOC, 0]; | ||
//instruction_data.extend_from_slice(&rc_box_size.to_le_bytes()); | ||
|
||
// check that the account is empty before we CPI | ||
assert_eq!(account.data_len(), 0); | ||
//assert_eq!(account.data_len(), 0); | ||
|
||
invoke( | ||
&create_instruction( | ||
*realloc_program_id, | ||
*program_id, | ||
//*realloc_program_id, | ||
&[ | ||
(accounts[ARGUMENT_INDEX].key, true, false), | ||
(target_account.key, true, false), | ||
|
@@ -912,8 +968,16 @@ fn process_instruction( | |
accounts, | ||
) | ||
.unwrap(); | ||
|
||
unsafe { *serialized_len_ptr = rc_box_size as u64 }; | ||
msg!("CPI SUCCESS!"); | ||
msg!("data+spare: {:02x?}", unsafe { slice::from_raw_parts(account.data.borrow().as_ptr(), 100) }); | ||
msg!("data+spare: {:02x?}", unsafe { slice::from_raw_parts(target_account.data.borrow().as_ptr(), 100) }); | ||
//msg!("data+spare: {:02x?}", unsafe { slice::from_raw_parts(orig_target_account_data.borrow().as_ptr(), 100) }); | ||
msg!("len: {}", account.data.borrow().len()); | ||
//msg!("len: {}", target_account.data.borrow().len()); | ||
//msg!("len: {}", orig_target_account_data.borrow().len()); | ||
|
||
//unsafe { *serialized_len_ptr = 40 as u64 }; | ||
//unsafe { *serialized_len_ptr2 = rc_box_size as u64 /*+ 1*/}; | ||
// hack to avoid dropping the RcBox, which is supposed to be on the | ||
// heap but we put it into account data. If we don't do this, | ||
// dropping the Rc will cause | ||
|
@@ -925,7 +989,24 @@ fn process_instruction( | |
Rc::new(RefCell::new(&mut [])), | ||
); | ||
} | ||
} | ||
unsafe { | ||
std::ptr::write( | ||
&target_account.data as *const _ as usize as *mut Rc<RefCell<&mut [u8]>>, | ||
Rc::new(RefCell::new(&mut [])), | ||
); | ||
} | ||
}, | ||
SELF_CPI => { | ||
msg!("SELF CPI"); | ||
let account = &accounts[0]; | ||
//msg!("self-cpi-pre: {:02x?}", unsafe { slice::from_raw_parts(account.data.borrow().as_ptr(), 100) }); | ||
//account.data.borrow_mut()[32] = 0x99; | ||
account.data.borrow_mut()[32] = 0x5; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here 2/2 |
||
//msg!("self-cpi-post: {:02x?}", unsafe { slice::from_raw_parts(account.data.borrow().as_ptr(), 100) }); | ||
let target_account = &accounts[1]; | ||
target_account.data.borrow_mut()[0] = 0x88; | ||
target_account.realloc(5, false).unwrap(); | ||
}, | ||
TEST_ALLOW_WRITE_AFTER_OWNERSHIP_CHANGE_TO_CALLER => { | ||
msg!("TEST_ALLOW_WRITE_AFTER_OWNERSHIP_CHANGE_TO_CALLER"); | ||
const INVOKE_PROGRAM_INDEX: usize = 3; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
here 1/2