-
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
TA from older version crashes stack unwind layer in OP-TEE (WAS Stack unwind causes data abort on Rcar M3 board) #1872
Comments
hi @lorc. same issue on my b2260. @jforissier, could be armv7 specific, but qemu does not seem to complain. |
@lorc can you reproduce the issue without dyn shm? (i.e., current optee_os master). |
@jforissier, I'll try. Problem is that I need to throw out hypervisor from my setup first, because it prevents Linux from accessing static shm region. But I'll try to prepare such setup today. @etienne-lms, my board is armv8-based, so looks like it is cross-platform bug. |
@lorc, crosscheck your build. I find the issue in mine: non-alignment of core and libutee: i was rebuilding the core but not the TA devkit, hence TAs did not fill the structure expected by the unwind layer. Full rebuilt of the core/ta devkit/test TAs => no more core panic in stack unwind trace. |
@etienne-lms, yep, I think you are right. I definetelly used some old TAs. I also can confirm this on qemu_v8. This is the good find, thank you. So, looks like it is a bug: I can crash OP-TEE using older TA. |
@lorc could you make sure you're not using older TAs / libutee.a? Because, with the introduction of the "TA stack dump on panic" feature, the user/kernel interface for syscall_panic has effectively changed. |
@jforissier, yes, this is exactly the case. But I dunno... Is this expected behavior? |
Well, that's a good question... Until now, we have not put strict requirements on maintaining compatibility at the syscall interface (contrary to what the Linux kernel does). We more or less assumed that TAs would be recompiled before they are deployed on a new version of OP-TEE. In other words, the interface between TA and TEE is the GP API. But that may not be a reasonable assumption for some use cases? If we were to enforce strict compatibility, we would need to have some test suite to check that, and it would also make our life a bit harder as optee_os developers. It's not only the syscall interface, but also the TA format for instance. On a related note: when people ask "how do I add a syscall to OP-TEE", we usually answer "you don't, you write a pseudo-TA instead" ;-) to preserve the stability of the syscall interface and avoid potential conflicts. |
You may only crash a debug version of OP-TEE. If CFG_UNWIND=n (which is the case by default when CFG_TEE_CORE_DEBUG=n), the unwind code is disabled and you shouldn't be able to crash it. |
Yes, this is an interesting topic. I think that this problem can be mitigated by changing signature key when introducing breaking changes to syscall interface. This at least would ensure that only compatible TAs will be loaded. But that would work only for generic OP-TEE. Product vendors use own keys and they shall changes keys manually. Probably we can go further and derive signature key from syscall interface version. |
Oh, right. So this is okay, then. I'll close this issue then. We can discuss syscall interface versioning problem in different issue, if you wish. |
During testing of #1631 on my RCAR M3 board I have encountered next fault:
regs = 0x44179f30
andregs->x1 = 0x15
are my debug messages using this patch:Looks like
tee_svc_sys_return_helper
receives invalid pointer in `regs->x1'The text was updated successfully, but these errors were encountered: