-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
The 1GB VA constraint #7275
Comments
Pasting the mmu fault log:
|
I'm surprised we haven't seen this before with ASLR enabled, when looking at the code I see how this can happen. I think the best fix is to add entries in the top translation tables for the "dynamic vaspace" during boot so it's replicated before the other CPUs have started. We should be careful to only add translation tables needed for the per-cpu top translation tables to avoid wasting translation tables that might not be used. Can you fix this problem or should I? |
Hi Jens, your words make sense but how to add mappings for "MEM_AREA_RES_VASPACE" and "MEM_AREA_SHM_VASPACE" when optee boots? Unlike other memory regions which already have physical addresses, these 2 memory regions don't have physical addresses allocated when optee boots. |
We'd map it with NULL entries in the lowest translation table. |
Oh, sounds good. Let me try to create a fix and test in my develop environment. If it works, I can send out a patch to review. Thanks. |
Great, thanks! |
When optee boots, the initial mapping for MEM_AREA_RES_VASPACE and MEM_AREA_SHM_VASPACE should be added into page tables and replicated to all CPU cores too. This fixes an issue when the VA of MEM_AREA_RES_VASPACE or MEM_AREA_SHM_VASPACE is not in a same 1GB region with other memory regions. Link: OP-TEE#7275 Signed-off-by: Mark Zhang <markz@nvidia.com>
When optee boots, the initial mapping for MEM_AREA_RES_VASPACE and MEM_AREA_SHM_VASPACE should be added into page tables and replicated to all CPU cores too. This fixes an issue when the VA of MEM_AREA_RES_VASPACE or MEM_AREA_SHM_VASPACE is not in a same 1GB region with other memory regions. Link: OP-TEE#7275 Signed-off-by: Mark Zhang <markz@nvidia.com>
When optee boots, the initial mapping for MEM_AREA_RES_VASPACE and MEM_AREA_SHM_VASPACE should be added into page tables and replicated to all CPU cores too. This fixes an issue when the VA of MEM_AREA_RES_VASPACE or MEM_AREA_SHM_VASPACE is not in a same 1GB region with other memory regions. Link: OP-TEE#7275 Signed-off-by: Mark Zhang <markz@nvidia.com>
When optee boots, the initial mapping for MEM_AREA_RES_VASPACE and MEM_AREA_SHM_VASPACE should be added into page tables and replicated to all CPU cores too. This fixes an issue when the VA of MEM_AREA_RES_VASPACE or MEM_AREA_SHM_VASPACE is not in a same 1GB region with other memory regions. Link: OP-TEE#7275 Signed-off-by: Mark Zhang <markz@nvidia.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
When optee boots, the initial mapping for MEM_AREA_RES_VASPACE and MEM_AREA_SHM_VASPACE should be added into page tables and replicated to all CPU cores too. This fixes an issue when the VA of MEM_AREA_RES_VASPACE or MEM_AREA_SHM_VASPACE is not in a same 1GB region with other memory regions. Link: #7275 Signed-off-by: Mark Zhang <markz@nvidia.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
We hit an issue recently. Here is the configuration info:
The issue is when optee boots up and assigns the VA addresses for different memories, the VA range may span two GBs.
Check this debug log as an example:
As you can see, the VA range in above log is 0x1fff000000 - 0x2005824000.
This causes a mmu translation fault when running xtest 1009.
Looking at the test codes, the test case does 2 things:
After some digging, we believe the root cause is the change in L1 table is not spawned to other CPU cores.
OP-TEE has a 3 level page table architecture and the L1 table(base table) is banked by CPU cores.
If the entire VA range in OP-TEE is within 1GB, then all CPU cores' L1 table are the same.
But if the VA range spans two GBs, for example in the example above, the VA range is 0x1fff000000 - 0x2005824000, when creating mapping on 0x1fff000000, that means the L1 table needs to be changed.
So for the xtest case, when step #1 happens, a 0x1fff000000 mapping is created in one CPU core's L1 table while other CPU cores are not aware of that.
When #2 happens, the mmu translation fault happens because this new CPU core doesn't have mapping for 0x1fff000000.
Please correct me if there is something wrong above.
Also if this is a known issue, please share the fix info and feel free to close this ticket.
Thanks.
The text was updated successfully, but these errors were encountered: