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

Accessing NSEC memory from within a pTA. #6126

Closed
hmimberg opened this issue Jun 19, 2023 · 3 comments
Closed

Accessing NSEC memory from within a pTA. #6126

hmimberg opened this issue Jun 19, 2023 · 3 comments
Labels

Comments

@hmimberg
Copy link

hmimberg commented Jun 19, 2023

Hi everyone,
my usecase is, that I'd like to access the part of the memory, where the Kernel Code is and read/hash that.
The Board is an iMX6.
I believe the Kernel is at 0x100000. I assume the number is correct because the symbol table System.map states:

grep -e "\_[s|e]text$" System.map  
80100000 T _stext  
80900000 D _etext 

PAGE_OFFSET being 0x80000000 for the board.

I am at the point where registering memory using register_phys_mem(MEM_AREA_IO_NSEC) works (MEM_AREA_NSEC_SHM keeps board from booting):

D/TC:0   add_phys_mem:586 0x100000 type IO_NSEC 0x00100000 size 0x00004000

where mapping the memory works:

vaddr_t src_vaddr = 0;
paddr_t address = 0x100000; // 0x80008000;
src_vaddr = (vaddr_t)phys_to_virt(address, MEM_AREA_IO_NSEC);
DMSG("Physical = 0x%X, Virtual = 0x%X\n", address, src_vaddr);

yields:

D/TC:? 0 pta_get_kernel_hash:62 Physical = 0x100000, Virtual = 0x83FFC000

but accessing 0x83FFC000 yields (similar to #3236):

E/TC:0 0 Core data-abort at address 0x83ffc000
E/TC:0 0  fsr 0x00000008  ttbr0 0x8408e46a  ttbr1 0x8408806a  cidr 0x2
E/TC:0 0  cpu #0          cpsr 0x60000133
E/TC:0 0  r0 0x00000000      r4 0x83ffc000    r8 0x83ffc013   r12 0xfffcb548
E/TC:0 0  r1 0x00000000      r5 0x8404f951    r9 0x84054511    sp 0x840909a8
E/TC:0 0  r2 0xc0000000      r6 0x840909f8   r10 0x840909f8    lr 0x840025d9
E/TC:0 0  r3 0x8402e1ef      r7 0x83ffbfff   r11 0x00000002    pc 0x84013816
D/TC:0 0 get_fault_type:508 [abort] Unhandled fault!

Putting everything together, I am now wondering, wether I am using OP-Tee incorrectly, or if my assumption regarding the memory placement of the kernel is incorrect.
In both cases every help would be greatly appreciated.

Thank you all in advance for taking the time to read this issue.
Helge

@jenswi-linaro
Copy link
Contributor

I guess this answer is relevant here too:
#6040 (comment)

@hmimberg
Copy link
Author

I guess this answer is relevant here too: #6040 (comment)

Yes it is a similar matter. Thank you for linking it.

@github-actions
Copy link

This issue has been marked as a stale issue because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment, otherwise this issue will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants