| f93627d9 | 14-Aug-2019 |
Sumit Garg <sumit.garg@linaro.org> |
ftrace: enable trace for utee_* assembly APIs
Enable function trace for utee_* syscall assembly APIs for better view of user-space to kernel switching.
Suggested-by: Jerome Forissier <jerome.foriss
ftrace: enable trace for utee_* assembly APIs
Enable function trace for utee_* syscall assembly APIs for better view of user-space to kernel switching.
Suggested-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| f5df167c | 09-Aug-2019 |
Sumit Garg <sumit.garg@linaro.org> |
ftrace: Add function execution time support
Add support to dump function execution time at corresponding function exit points in output ftrace buffer.
To achieve proper function execution time we n
ftrace: Add function execution time support
Add support to dump function execution time at corresponding function exit points in output ftrace buffer.
To achieve proper function execution time we need to exclude TA suspend time from timestamps, so add corresponding support in TEE core.
Also user mapping must be active to access ftrace buffer, so do that during TA resume.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (QEMU) Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 4486d586 | 04-Jul-2019 |
Sumit Garg <sumit.garg@linaro.org> |
libutee: add headers for user-space to access sysregs
User space may require to access system registers like generic timer registers in case function tracing is enabled etc. So provide headers for u
libutee: add headers for user-space to access sysregs
User space may require to access system registers like generic timer registers in case function tracing is enabled etc. So provide headers for user space to access sysregs.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| c96d7091 | 01-Jul-2019 |
Sumit Garg <sumit.garg@linaro.org> |
ftrace: Enable support for 32 bit apps
By default 32 bit trusted applications are compiled in thumb mode but thumb mode doesn't support function graph tracing due to missing frame pointer support re
ftrace: Enable support for 32 bit apps
By default 32 bit trusted applications are compiled in thumb mode but thumb mode doesn't support function graph tracing due to missing frame pointer support required to trace function call chain. So rather compile trusted applications in ARM mode in case function tracing is enabled.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 34db7172 | 12-Jun-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: pta_system: support memory remap
Adds PTA_SYSTEM_REMAP to support changing virtual address of an already established mapping in a TA.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.or
core: pta_system: support memory remap
Adds PTA_SYSTEM_REMAP to support changing virtual address of an already established mapping in a TA.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 7509ff7c | 23-May-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
Add user mode ELF loader
Adds ldelf which loads user mode TAs while in user mode. The TA ELF file is loaded and relocated by ldelf before the TA can be executed.
Reviewed-by: Jerome Forissier <jero
Add user mode ELF loader
Adds ldelf which loads user mode TAs while in user mode. The TA ELF file is loaded and relocated by ldelf before the TA can be executed.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| fd652ade | 23-May-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: support compiling for ldelf
Adds support for compiling for ldelf by excluding files not needed in or conflicting with the ldelf environment.
Reviewed-by: Jerome Forissier <jerome.forissier
libutee: support compiling for ldelf
Adds support for compiling for ldelf by excluding files not needed in or conflicting with the ldelf environment.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 0a563c6f | 23-May-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: pta_system: add PTA_SYSTEM_SET_PROT
Adds PTA_SYSTEM_SET_PROT to support changing protection of already established memory mappings.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
core: pta_system: add PTA_SYSTEM_SET_PROT
Adds PTA_SYSTEM_SET_PROT to support changing protection of already established memory mappings.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 0b414d3f | 23-May-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: pta_system: ta binary handling
Adds support to open, close and map a TA binary from a user TA.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wik
core: pta_system: ta binary handling
Adds support to open, close and map a TA binary from a user TA.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| ef305e54 | 23-May-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: allocate temp secmem for invoke
Allocates temporary secure memory for buffers in TA private memory passed to invoke_command/open_session. This offloads the logic in TEE core which until now
libutee: allocate temp secmem for invoke
Allocates temporary secure memory for buffers in TA private memory passed to invoke_command/open_session. This offloads the logic in TEE core which until now has allocated temporary secure memory as needed during TA to TA calls.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 87065172 | 23-May-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: support dynamic memory mapping
Adds tee_map_zi() and tee_unmap() as wrappers for PTA_SYSTEM_MAP_ZI and PTA_SYSTEM_UNMAP respectively.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro
libutee: support dynamic memory mapping
Adds tee_map_zi() and tee_unmap() as wrappers for PTA_SYSTEM_MAP_ZI and PTA_SYSTEM_UNMAP respectively.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| d00e014a | 23-May-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: user_ta_entry.c: {to,from}_utee_params()
Use local implementation of to_utee_params() and from_utee_params().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jen
libutee: user_ta_entry.c: {to,from}_utee_params()
Use local implementation of to_utee_params() and from_utee_params().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| b5b6225f | 23-May-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: pta_system: support dynamic memory mapping
Adds PTA_SYSTEM_MAP_ZI and PTA_SYSTEM_UNMAP to dynamically map and unmap user space memory from user space. The memory is automatically freed when th
core: pta_system: support dynamic memory mapping
Adds PTA_SYSTEM_MAP_ZI and PTA_SYSTEM_UNMAP to dynamically map and unmap user space memory from user space. The memory is automatically freed when the context of the TA is freed.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| e0e762fe | 14-Jun-2019 |
Jerome Forissier <jerome.forissier@linaro.org> |
arm32: prevent unwinding of __ta_entry()
Since commit eeb866c431db ("Add TA entry point function: __ta_entry()"), __ta_entry() is the first function in the user space call stack, not __utee_entry().
arm32: prevent unwinding of __ta_entry()
Since commit eeb866c431db ("Add TA entry point function: __ta_entry()"), __ta_entry() is the first function in the user space call stack, not __utee_entry(). Therefore, the asm(".cantunwind") declaration should be moved from __utee_entry() to __ta_entry().
When utee_return() was moved from __utee_entry() to __ta_entry() by commit fde3a7f212f8 ("Remove redundant __noreturn from __utee_entry()"), it caused a regression in xtest 1010.3. The stack unwinding would enter an infinite loop as follows:
E/TC:? 0 User TA prefetch-abort at address 0x0 (translation fault) E/TC:? 0 fsr 0x00000005 ttbr0 0x3f07906a ttbr1 0x3f06c06a cidr 0x2 E/TC:? 0 cpu #7 cpsr 0x80000110 E/TC:? 0 r0 0x00000001 r4 0x00161448 r8 0x00161438 r12 0x00152f80 E/TC:? 0 r1 0x00000002 r5 0x00152f40 r9 0x00152f30 sp 0x00152f10 E/TC:? 0 r2 0x00000000 r6 0x00152f80 r10 0x0000000a lr 0x0015498d E/TC:? 0 r3 0x00152f14 r7 0x00161458 r11 0x00245420 pc 0x00000000 E/TC:? 0 Status of TA 5b9e0e40-2636-11e1-ad9e-0002a5d5c51b (0x3f069c30) (active) E/TC:? 0 arch: arm load address: 0x00153000 ctx-idr: 2 E/TC:? 0 stack: 0x00150000 12288 E/TC:? 0 region 0: va 0x00100000 pa 0x3f000000 size 0x002000 flags ---R-X E/TC:? 0 region 1: va 0x00150000 pa 0x3f110000 size 0x003000 flags rw-RW- E/TC:? 0 region 2: va 0x00153000 pa 0x3f113000 size 0x00e000 flags r-xR-- [0] .ta_head .text .plt .rodata .ARM.extab .ARM.extab.text.unlikely .ARM.extab.text.__aeabi_ldivmod .ARM.extab.text.__aeabi_uldivmod .ARM.extab.text.utee_panic .ARM.exidx .dynsym .dynstr .hash E/TC:? 0 region 3: va 0x00161000 pa 0x3f121000 size 0x0e5000 flags rw-RW- [0] .got .rel.got .rel.plt .dynamic .data .bss .rel.dyn E/TC:? 0 region 4: va 0x00246000 pa 0x3f101000 size 0x001000 flags r-xR-- [1] .hash .dynsym .dynstr .rel.plt .plt .text .ARM.exidx E/TC:? 0 region 5: va 0x00247000 pa 0x3f102000 size 0x001000 flags rw-RW- [1] .dynamic .got E/TC:? 0 region 6: va 0x00248000 pa 0x3f100000 size 0x001000 flags r----- E/TC:? 0 [0] 5b9e0e40-2636-11e1-ad9e-0002a5d5c51b @ 0x00153000 (optee_test/out/ta/os_test/5b9e0e40-2636-11e1-ad9e-0002a5d5c51b.elf) E/TC:? 0 [1] ffd2bded-ab7d-4988-95ee-e4962fff7154 @ 0x00246000 (optee_test/out/ta/os_test_lib/libos_test.so) E/TC:? 0 Call stack: E/TC:? 0 0x00000000 ??? E/TC:? 0 0x0015c629 __ta_entry at optee_os/out/arm/export-ta_arm32/src/user_ta_header.c:41 E/TC:? 0 0x0015c62d tahead_get_trace_level at optee_os/out/arm/export-ta_arm32/src/user_ta_header.c:117 E/TC:? 0 0x0015c62d tahead_get_trace_level at optee_os/out/arm/export-ta_arm32/src/user_ta_header.c:117 ...
Moving the .cantunwind directive fixes the issue.
Fixes: fde3a7f212f8 ("Remove redundant __noreturn from __utee_entry()") Fixes: eeb866c431db ("Add TA entry point function: __ta_entry()") Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Sumit Garg <sumit.garg@linaro.org>
show more ...
|
| a30ddda9 | 29-May-2019 |
Joakim Bech <joakim.bech@linaro.org> |
PTA: add support for deriving device and TA unique keys
Enable derivation of device and Trusted Application unique keys that can be used by different Trusted Applications directly. An example of use
PTA: add support for deriving device and TA unique keys
Enable derivation of device and Trusted Application unique keys that can be used by different Trusted Applications directly. An example of use case could be when you need to encrypt some data in a Trusted App and then give it back to normal world.
By default device unique properties (HUK and TA UUID) will be used when deriving a key. However, the one calling the PTA derive key function also have the ability to provide some extra data that will be mixed in together with existing device unique properties. That gives the ability to derive keys that are not only device and Trusted Application unique, but also tied to some additional data, it could for example be a password or something similar.
Signed-off-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9d6ac097 | 10-Jun-2019 |
Sumit Garg <sumit.garg@linaro.org> |
ftrace: arm64: handle special setjmp()/longjmp() apis
setjmp()/longjmp() user-space apis are used to perform a nonlocal goto which transfer execution from one function to a predetermined location in
ftrace: arm64: handle special setjmp()/longjmp() apis
setjmp()/longjmp() user-space apis are used to perform a nonlocal goto which transfer execution from one function to a predetermined location in another function. This is a special case as compared to normal "C" function calls. So this patch enables ftrace to generate function graph for these apis.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey960)
show more ...
|
| b02ae382 | 22-May-2019 |
Sumit Garg <sumit.garg@linaro.org> |
libutee: arm64: Add support for function tracing of user TAs
Function tracing (ftrace) is a useful debugging technique to dump function call graph for in-depth analysis of program execution and also
libutee: arm64: Add support for function tracing of user TAs
Function tracing (ftrace) is a useful debugging technique to dump function call graph for in-depth analysis of program execution and also to get useful information in case of any program abort.
In case of TA, this function graph information is dumped in a buffer kept in .bss section of corresponding instrumented TA. So this buffer can be dumped to normal world in case TA session closes or in case of any abort. Also size of this ftrace buffer is configurable per TA via following config option during TA compilation:
CFG_FTRACE_BUF_SIZE=2048
Function tracing is completely optional debugging feature which could be enabled via command line config option CFG_TA_FTRACE_SUPPORT=y.
Along with this user needs to add cflag: "-pg" to the files for whom function graph is to be generated. Typically for the whole TA, it should be compiled with CFG_TA_MCOUNT=y.
And in case user wants to set "-pg" for particular file, following should go in corresponding sub.mk:
cflags-<file-name>-y+=-pg
Also, to generate function graph for user mode libraries enable CFG_ULIBS_MCOUNT=y which will set "-pg" for all library files.
Currently this patch adds support for function tracing of 64-bit TAs only.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey960)
show more ...
|
| 735565db | 16-May-2019 |
Sumit Garg <sumit.garg@linaro.org> |
Rename CFG_ULIBS_GPROF to CFG_ULIBS_MCOUNT
CFG_ULIBS_GPROF builds the user mode libraries with -pg, which adds instrumentation to all functions in the form of a call to mcount(). This was historical
Rename CFG_ULIBS_GPROF to CFG_ULIBS_MCOUNT
CFG_ULIBS_GPROF builds the user mode libraries with -pg, which adds instrumentation to all functions in the form of a call to mcount(). This was historically used by gprof, but other tools can benefit from this instrumentation. Therefore, rename the config flag as well as a couple of source files to remove the reference to gprof.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey960)
show more ...
|
| 628e1eb0 | 22-May-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: increase MPI mempool size
Increases MPI mempool size from 8Kb to 12Kb to be compensate for changes in the (future) commit "libmbedtls: mbedtls_mpi_exp_mod(): reduce stack usage" where mbedt
libutee: increase MPI mempool size
Increases MPI mempool size from 8Kb to 12Kb to be compensate for changes in the (future) commit "libmbedtls: mbedtls_mpi_exp_mod(): reduce stack usage" where mbedtls_mpi_exp_mod() is allocating an additional ~3Kb.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| fde3a7f2 | 21-May-2019 |
Sumit Garg <sumit.garg@linaro.org> |
Remove redundant __noreturn from __utee_entry()
As __ta_entry() acts as function entry point, it makes sense to logically return from this api only via utee_return(). So remove redundant __noreturn
Remove redundant __noreturn from __utee_entry()
As __ta_entry() acts as function entry point, it makes sense to logically return from this api only via utee_return(). So remove redundant __noreturn from __utee_entry().
Fixes: eeb866c431db ("Add TA entry point function: __ta_entry()") Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| a73b5878 | 07-Feb-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
Replace ta_head.entry with elf entry
Prior to this patch the entry function of the TA was stored in ta_head which is located in a read-only section of the TA. This results in the linker emitting a r
Replace ta_head.entry with elf entry
Prior to this patch the entry function of the TA was stored in ta_head which is located in a read-only section of the TA. This results in the linker emitting a relocation modifying a read-only section. This is a problem if the read-only section is mapped read-only while relocations are performed. To avoid this problematic relocation the ta_head.entry is removed and the ELF entry point is used instead.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| e34f6cde | 12-Apr-2019 |
Sumit Garg <sumit.garg@linaro.org> |
gprof: define original mcount APIs inserted by compiler
Simplify gprof implementation via defining original mcount APIs: _mcount (for aarch64) and __gnu_mcount_nc (for arm) inserted by compiler inst
gprof: define original mcount APIs inserted by compiler
Simplify gprof implementation via defining original mcount APIs: _mcount (for aarch64) and __gnu_mcount_nc (for arm) inserted by compiler instead of providing them via __utee_mcount API.
Also remove weak definitions of mcount API that were earlier mandated by linker script via PROVIDE().
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| c1e1e2e5 | 15-Mar-2019 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutee: fix off-by-one errors in base64_dec()
There is a possible buffer overflow in base64_dec(). Since the output buffer size is *blen, the last byte of the buffer is buf[*blen - 1] and therefore
libutee: fix off-by-one errors in base64_dec()
There is a possible buffer overflow in base64_dec(). Since the output buffer size is *blen, the last byte of the buffer is buf[*blen - 1] and therefore the buffer must not be written to when the current index m is such that (m >= *blen), not (m > *blen).
Reported-by: Naveen Thenkani <tnaveenmca@gmail.com> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 7696ab7f | 14-Mar-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: lessen dependency on mbedtls internals
Until now tee_api_arith_mpi.c assumed that for instance TEE_BigIntConvertFromOctetString() wouldn't do a mbedtls_mpi_free(mpi); mbedtls_mpi_init(mpi);
libutee: lessen dependency on mbedtls internals
Until now tee_api_arith_mpi.c assumed that for instance TEE_BigIntConvertFromOctetString() wouldn't do a mbedtls_mpi_free(mpi); mbedtls_mpi_init(mpi); sequence on the supplied mpi argument. Doing so replaces the special allocation type MBEDTLS_MPI_ALLOC_TYPE_STATIC with MBEDTLS_MPI_ALLOC_TYPE_MALLOC. This results in the value of the mpi argument isn't propagated further to the dest argument of TEE_BigIntConvertFromOctetString().
With this patch we're instead explicitly copying the value of mbedtls_mpi to a TEE_BigInt when the value should be returned.
This patch is also needed when upgrading to mbedtls-2.16 or there will be errors.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (QEMU, GP) Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 80c4fb79 | 08-Mar-2019 |
Etienne Carriere <etienne.carriere@linaro.org> |
libutee: fix deprecated TA_FLAG_REMAP_SUPPORT inline comment
Update inline comment and value for the deprecated TA flag TA_FLAG_REMAP_SUPPORT.
Signed-off-by: Etienne Carriere <etienne.carriere@lina
libutee: fix deprecated TA_FLAG_REMAP_SUPPORT inline comment
Update inline comment and value for the deprecated TA flag TA_FLAG_REMAP_SUPPORT.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|