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

[Cache] Garbage value in shared region (NS, Realm) #146

Closed
bitboom opened this issue Aug 11, 2023 · 4 comments · Fixed by #153
Closed

[Cache] Garbage value in shared region (NS, Realm) #146

bitboom opened this issue Aug 11, 2023 · 4 comments · Fixed by #153

Comments

@bitboom
Copy link
Collaborator

bitboom commented Aug 11, 2023

I found that RMM reads dummy values (0xCFDFDFDF) with ACS tests.

  • Read failed with ACS: Params 0x88306000
  • Read succeed with TFTF: Params 0x88C01000

Originally posted by @bitboom in #145 (comment)

@jinbpark
Copy link
Collaborator

jinbpark commented Aug 11, 2023

@bitboom ,
Not sure if this PR helps solving this,
But I added some points to wipe out a page by zero in that PR.

  1. a transition from Undelegated to Delegated
  2. a transition from Delegated to Undelegated

I think it's worth a try running the same ACS test with this PR. (not that high probability though)

@bitboom
Copy link
Collaborator Author

bitboom commented Aug 11, 2023

@jinbpark Thank you for the suggestion.

I found the cause of this issue.
The issue is that ACS set the shared region as Normal, Inner/Outer WB/WA/RA, but islet map the region as Device in set_pages_for_rmi.

When i changed ACS to Device temporarily, i could read the memory.

But I think our islet should change to Normal in set_pages_for_rmi. I tried it but failed :(

@jinbpark
Copy link
Collaborator

jinbpark commented Aug 14, 2023

When i changed ACS to Device temporarily, i could read the memory.

@bitboom , This sounds like a TLB issue. (not 100% sure though)
It might be worth trying to run the below code.

pub fn set_pages_for_rmi(addr: usize, secure: bool) {
    let device_flags = helper::bits_in_reg(PTDesc::INDX, attr::mair_idx::RMM_MEM);   // try-1:  ACS (normal), RMM (normal)
    // try-2:  helper::bits_in_reg(PTDesc::INDX, attr::mair_idx::DEVICE_MEM);  --> ACS (normal), RMM (device)
    ....
    page_table.set_pages(va, phys, PAGE_SIZE, rw_flags | device_flags | secure_flags);
    ....
    unsafe {
        asm!("tlbi alle2", "dsb sy", "isb",);   // TLB flush
    }
}

@bitboom bitboom changed the title Garbage value in shared region (NS, Realm) [Cache] Garbage value in shared region (NS, Realm) Aug 17, 2023
@bitboom
Copy link
Collaborator Author

bitboom commented Aug 17, 2023

@jinbpark Thanks for the suggestion! I tried it but i does't work :(

The problem seems to relate with cache. When i turn off cache with cache_state_modelled=0 of acs's script, it work.
Since this is not the tfundamental solution, I detached this issue from origin PR #148.

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 a pull request may close this issue.

2 participants