| 5500d703 | 31-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
symbolize.py: infer PC from (E)LR
When translating a call stack address to source file and line number, subtract 2 to try and reflect the PC at the time the call was made or the exception occurred.
symbolize.py: infer PC from (E)LR
When translating a call stack address to source file and line number, subtract 2 to try and reflect the PC at the time the call was made or the exception occurred. This makes the calls easier to follow and corresponds to what the GDB backtrace command (bt) does. For data or prefetch aborts it is even more important because now we report exactly the line that caused the abort instead of showing the next one, which could be misleading.
As a result of this fix, the extra "nop" instruction in __ta_entry() is not needed anymore so remove it.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| b4faf480 | 22-Jul-2020 |
Dick Olsson <hi@senzilla.io> |
mk: core: ta: Configurable Python interpreter
Build systems that manage multiple different python interpreters need explicit control over which version of the interpreter to use. This patch enables
mk: core: ta: Configurable Python interpreter
Build systems that manage multiple different python interpreters need explicit control over which version of the interpreter to use. This patch enables one to override the default interpreter with the path to a specific one.
Signed-off-by: Dick Olsson <hi@senzilla.io> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| 2c028fde | 23-Jun-2020 |
Jerome Forissier <jerome@forissier.org> |
libutee, ldelf: add leading underscore to syscall wrappers
libutee defines assembler wrapper functions for each OP-TEE system call. These wrappers have a utee_ prefix. This commit adds a leading und
libutee, ldelf: add leading underscore to syscall wrappers
libutee defines assembler wrapper functions for each OP-TEE system call. These wrappers have a utee_ prefix. This commit adds a leading underscore so that the names cannot clash with user-defined symbols. Doing so is common practice for "system" libraries, as defined by the C standard in a set of requirements that can be summarized as follows (excerpt from the GNU libc documentation [1]):
[R]eserved names include all external identifiers (global functions and variables) that begin with an underscore (‘_’) and all identifiers regardless of use that begin with either two underscores or an underscore followed by a capital letter are reserved names. This is so that the library and header files can define functions, variables, and macros for internal purposes without risk of conflict with names in user programs.
The utee_*() wrappers are internal to OP-TEE and are not supposed to be called directly by TAs so this should not have any user-visible impact.
Link: [1] https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 4d35ab6a | 28-May-2020 |
Jerome Forissier <jerome@forissier.org> |
TA dev kit: clang: link shared libraries with -z separate-loadable-segments
ldelf crashes with the following assertion when trying to load a shared library built with Clang 10 (Clang 9 works fine):
TA dev kit: clang: link shared libraries with -z separate-loadable-segments
ldelf crashes with the following assertion when trying to load a shared library built with Clang 10 (Clang 9 works fine):
E/LD: assertion 'seg->flags & PF_W' failed at ldelf/ta_elf.c:551 in adjust_segments()
The reason is, the virtual addresses of the PT_LOAD segments are always paged-aligned with Clang 9 while they are not with Clang 10. Luckily, ld.lld version 10 has introduced a new flag: -z separate-loadable-segments [1]. Let's use this flag when supported.
Link: [1] https://manpages.debian.org/experimental/lld-10/ld.lld-10.1.en.html#separate-loadable-segments Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| a03cdefb | 07-May-2020 |
Victor Chong <victor.chong@linaro.org> |
link.mk: add missing $libgcc to ldargs
Add missing $libgcc arg to ldargs for ldelf, ta link.mk and ta link_shlib.mk. This is required for the AOSP clang build to fix compile errors like below:
ld.l
link.mk: add missing $libgcc to ldargs
Add missing $libgcc arg to ldargs for ldelf, ta link.mk and ta link_shlib.mk. This is required for the AOSP clang build to fix compile errors like below:
ld.lld: error: undefined symbol: __aeabi_mem*
Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| 4a3d7558 | 27-Feb-2020 |
Jerome Forissier <jerome@forissier.org> |
ta: ta.ld.S: merge .ARM.extab* sections
Contrary to .ARM.exidx, we have no .ARM.extab entry in the TA linker script. As a result, the multiple .ARM.extab* sections gathered from the object files wil
ta: ta.ld.S: merge .ARM.extab* sections
Contrary to .ARM.exidx, we have no .ARM.extab entry in the TA linker script. As a result, the multiple .ARM.extab* sections gathered from the object files will remain in the TA. While this is perfectly valid and does not cause any functional issue, it uselessly pollutes the readelf/symbolize.py/etc. dumps.
This commit merges all the .ARM.extab* into a unique .ARM.extab.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| dd655cb9 | 14-Feb-2020 |
Jerome Forissier <jerome@forissier.org> |
ldelf, ta: add support for DT_INIT_ARRAY and DT_FINI_ARRAY
Adds support for running initialization and finalization functions in TA ELF files. Such functions are used, for instance, by C++ compilers
ldelf, ta: add support for DT_INIT_ARRAY and DT_FINI_ARRAY
Adds support for running initialization and finalization functions in TA ELF files. Such functions are used, for instance, by C++ compilers to construct and destruct global objects. They can also be used in C thanks to __attribute__((constructor)) and __attribute__((destructor)).
A global structure is added to libutee. ldelf is responsible for filling it with the addresses of the functions pointer arrays present in the ELF files whenever such a file is loaded. Since the number of arrays is unknown at compile time (it depends on how many ELF files are loaded, and whether they have constructors or destructors), memory is allocated on the TA heap.
Two helper functions are introduced: __utee_call_elf_init_fn() and __utee_call_elf_fini_fn(). They are used when the TA instance is created and torn down, as well as by dlopen().
Signed-off-by: Jerome Forissier <jerome@forissier.org> Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU, QEMUv8, HiKey960 32/64) Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| f2edd829 | 18-Feb-2020 |
Jerome Forissier <jerome@forissier.org> |
Revert "ftrace: define CFG_FTRACE_BUF_SIZE in mk/config.mk"
This reverts commit 59e8ef0dcb3773964fd133d0a9360989cb86108f.
The default value for CFG_FTRACE_BUF_SIZE needs to be in the TA link script
Revert "ftrace: define CFG_FTRACE_BUF_SIZE in mk/config.mk"
This reverts commit 59e8ef0dcb3773964fd133d0a9360989cb86108f.
The default value for CFG_FTRACE_BUF_SIZE needs to be in the TA link script ta.ld.S, because this file is *not* pre-processed before being added to the TA dev kit. Replacement of CFG_* values only happens when the TA is built, at which point mk/config.mk is irrelevant. It makes sense of course, since it allows to change TA settings and re-build only the TA.
Fixes the following TA link error:
$ make CFLAGS_ta_arm32=-pg [...] bin/arm-linux-gnueabihf-ld.bfd:out/ta.lds:57: undefined symbol `CFG_FTRACE_BUF_SIZE' referenced in expression
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
show more ...
|
| 59e8ef0d | 11-Feb-2020 |
Jerome Forissier <jerome@forissier.org> |
ftrace: define CFG_FTRACE_BUF_SIZE in mk/config.mk
The main configuration file is a better place to define the size of the ftrace buffer than the TA linker script.
Signed-off-by: Jerome Forissier <
ftrace: define CFG_FTRACE_BUF_SIZE in mk/config.mk
The main configuration file is a better place to define the size of the ftrace buffer than the TA linker script.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 682f256c | 26-Nov-2019 |
Sumit Garg <sumit.garg@linaro.org> |
TA dev kit: expose CFG_TA_VERSION build option
Allow to configure version of a TA via CFG_TA_VERSION as TA compile time option.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jerome
TA dev kit: expose CFG_TA_VERSION build option
Allow to configure version of a TA via CFG_TA_VERSION as TA compile time option.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 2de17fda | 23-Oct-2019 |
Sumit Garg <sumit.garg@linaro.org> |
TA dev kit: add support for TA encryption
Add CFG_ENCRYPT_TA as TA build time configuration option to enable encryption of TA using encryption key provided via TA_ENC_KEY build time option. The defa
TA dev kit: add support for TA encryption
Add CFG_ENCRYPT_TA as TA build time configuration option to enable encryption of TA using encryption key provided via TA_ENC_KEY build time option. The default value of TA_ENC_KEY is derived from 16 zero bytes default hardware unique key.
Also rename scripts/sign.py to scripts/sign_encrypt.py to reflect optional encryption support along with signing of TAs.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 8800b01d | 08-Nov-2019 |
Jerome Forissier <jerome@forissier.org> |
gprof: fix TEE core crash by allocating sample buffer dynamically
The gprof sample buffer is in user space memory but is also accessed by the TEE core. Currently, space is reserved by the TA linker
gprof: fix TEE core crash by allocating sample buffer dynamically
The gprof sample buffer is in user space memory but is also accessed by the TEE core. Currently, space is reserved by the TA linker script. The address and size of the buffer is passed to the TEE core via a call to the gprof PTA. After this call, the TEE core accesses the buffer periodically, such as when the TA is interrupted by a timer interrupt.
Commit ef305e54eac8 ("libutee: allocate temp secmem for invoke") modified the way that private TA memory is mapped in TA to TA invocations, so that memory is mapped only for the duration of the call. After this point, the memory is unmapped so the gprof sample buffer becomes inaccessible, resulting in a crash:
E/TC:0 0 Core data-abort at address 0x121356 (translation fault) E/TC:0 0 fsr 0x00000007 ttbr0 0x0e19206a ttbr1 0x0e18806a cidr 0x2 E/TC:0 0 cpu #0 cpsr 0x800001f2 E/TC:0 0 r0 0x00000000 r4 0x00000000 r8 0x00000000 r12 0x0017bb4b E/TC:0 0 r1 0x000021ab r5 0x00000000 r9 0x00000000 sp 0x0e1928f0 E/TC:0 0 r2 0x0011d000 r6 0x00000000 r10 0x00000000 lr 0x0e112763 E/TC:0 0 r3 0x00121356 r7 0x0e1928f0 r11 0x00000000 pc 0x0e12958e E/TC:0 0 Core data-abort at address 0x121356 .debug_info+1184598 (translation fault) E/TC:0 0 Call stack: E/TC:0 0 0x0e12958e tee_ta_gprof_sample_pc at optee_os/core/kernel/tee_ta_manager.c:897
The solution is to allocate and map the sample buffer explicitly in user space when profiling is initialized, and at the same time get rid of the reserved area in the TA linker script. The TEE core also needs to check that the sample buffer is valid before writing to it, otherwise a malicious TA could crash the core by unmapping that memory.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Sumit Garg <sumit.garg@linaro.org>
show more ...
|
| 099918f6 | 05-Sep-2019 |
Sumit Garg <sumit.garg@linaro.org> |
ftrace: Add support for syscall function tracer
This patch adds support for syscall tracing in TEE core. It complements existing ftrace support for user TAs via adding trace for syscalls that are in
ftrace: Add support for syscall function tracer
This patch adds support for syscall tracing in TEE core. It complements existing ftrace support for user TAs via adding trace for syscalls that are invoked by user TAs into the TEE core.
And after this patch ftrace will cover both TA and TEE core code. So lets rename config option from CFG_TA_FTRACE_SUPPORT to CFG_FTRACE_SUPPORT.
It is optional to enable syscall trace via CFG_SYSCALL_FTRACE=y config option in addition to CFG_FTRACE_SUPPORT=y config option.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| 2f6dffbd | 02-Sep-2019 |
Jerome Forissier <jerome@forissier.org> |
build: do not use -Wp with the preprocessor and use -o instead of a redirection
This patch cleans up the command line where we use the C preprocessor to better reflect the documented usage in the GC
build: do not use -Wp with the preprocessor and use -o instead of a redirection
This patch cleans up the command line where we use the C preprocessor to better reflect the documented usage in the GCC man page, thus preparing for Clang support.
1. When invoking the C preprocessor, there is no need for -Wp to pass arguments, so remove it.
2. -MD is not supposed to take a file name when passed to cpp. The dependency output file name is overridden with -MF.
3. Lastly, it is better to use -o to specify the output file instead of redirecting standard output, because if an error occurs during preprocessing we don't want the output file to be created.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| df7712ba | 21-Aug-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
Remove ASM define for assembly files
Removes the ASM define for assembly files now that they rely on the predefined macro __ASSEMBLER__ instead.
Reviewed-by: Jerome Forissier <jerome.forissier@lina
Remove ASM define for assembly files
Removes the ASM define for assembly files now that they rely on the predefined macro __ASSEMBLER__ instead.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 1cdd95a2 | 30-Apr-2019 |
Markus S. Wamser <markus.wamser@mixed-mode.de> |
Support offline signing of TAs.
Add generate-digest and stitch-ta support to script sign.py. One can generate a digest for the loadable TA file, sign it offline and later stitch the generated signat
Support offline signing of TAs.
Add generate-digest and stitch-ta support to script sign.py. One can generate a digest for the loadable TA file, sign it offline and later stitch the generated signature to the loadable TA binary file.
For this purpose sign.py gets an extra initial command argument to select between sign/digest/stitch operations. If no command is provided, `sign` is assumed, preserving previous usage.
Signed-off-by: Markus S. Wamser <markus.wamser@mixed-mode.de> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 0265f1e4 | 01-Aug-2019 |
Jerome Forissier <jerome.forissier@linaro.org> |
In-tree TAs: avoid recompiling when a library changes
When a library is changed (libutee.a, libutils.a, etc.) the in-tree TAs are re-built from scratch. We can easily avoid recompilation and only re
In-tree TAs: avoid recompiling when a library changes
When a library is changed (libutee.a, libutils.a, etc.) the in-tree TAs are re-built from scratch. We can easily avoid recompilation and only re-link instead.
For example, without this patch: $ make -s -j10 $ touch out/arm-plat-vexpress/export-ta_arm32/lib/libutee.a $ make out/arm-plat-vexpress/ta/avb/023f8f1a-292a-432b-8fc4-de8471358067.elf CHK out/arm-plat-vexpress/conf.mk CHK out/arm-plat-vexpress/include/generated/conf.h CHK out/arm-plat-vexpress/conf.cmake CC out/arm-plat-vexpress/ta/avb/entry.o CC out/arm-plat-vexpress/ta/avb/user_ta_header.o AS out/arm-plat-vexpress/ta/avb/ta_entry_a32.o LD out/arm-plat-vexpress/ta/avb/023f8f1a-292a-432b-8fc4-de8471358067.elf
With this patch applied: $ make -s -j10 $ touch out/arm-plat-vexpress/export-ta_arm32/lib/libutee.a $ make out/arm-plat-vexpress/ta/avb/023f8f1a-292a-432b-8fc4-de8471358067.elf CHK out/arm-plat-vexpress/conf.mk CHK out/arm-plat-vexpress/include/generated/conf.h LD out/arm-plat-vexpress/ta/avb/023f8f1a-292a-432b-8fc4-de8471358067.elf
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| c8061893 | 03-Jul-2019 |
Jerome Forissier <jerome.forissier@linaro.org> |
arm32: make __ta_entry() an assembler wrapper
Clang errors out when asm(".cantunwind") is used in a C function:
user_ta_header.c:44:6: error: .fnstart must precede .cantunwind directive
arm32: make __ta_entry() an assembler wrapper
Clang errors out when asm(".cantunwind") is used in a C function:
user_ta_header.c:44:6: error: .fnstart must precede .cantunwind directive asm(".cantunwind"); ^ Fix this by turning __ta_entry() into an assembler wrapper.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| f2a67cf8 | 15-May-2019 |
Jerome Forissier <jerome.forissier@linaro.org> |
ta: ta.ld.S: move .dynamic section next to .got
Changes the TA linker script so that the .dynamic section is adjacent to the .got section. This prepares for using the Clang compiler (more precisely:
ta: ta.ld.S: move .dynamic section next to .got
Changes the TA linker script so that the .dynamic section is adjacent to the .got section. This prepares for using the Clang compiler (more precisely: the LLVM linker, ld.lld).
Contrary to GCC, Clang enables the "RELRO" feature (RELocations Read- Only) by default. In a nutshell: RELRO causes the linker to emit an additional segment called RELRO, which tells the program loader that a part of the binary may be turned to read-only mode once the relocations are done. The goal is to increase protection against arbitrary code execution attacks. The sections that are concerned are .got and .dynamic, among others. Since there is only one RELRO segment, the sections that are supposed to be covered have to be contiguous. If they are not (which is currently the case in ta.ld.S), ld.lld shows an error:
ld.lld: error: section: .dynamic is not contiguous with other relro sections
Therefore, move .dynamic next to .got so that all the RELRO-eligible sections are contiguous.
Note: another option to fix this issue is to pass '-z norelro' to the linker, but that would obviously prevent future support of RELRO in the TA loader.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-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 ...
|
| 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 ...
|
| 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 ...
|
| abbf27a2 | 06-Jun-2019 |
Jerome Forissier <jerome@forissier.org> |
TA dev kit: always link shared libraries against OP-TEE libraries
If a TA shared library is created, and needs to call OP-TEE functions, it needs to link against the TEE libraries (libutee, libutils
TA dev kit: always link shared libraries against OP-TEE libraries
If a TA shared library is created, and needs to call OP-TEE functions, it needs to link against the TEE libraries (libutee, libutils etc.) in a similar way to TAs.
This patch adds the proper flags.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| a3fdd56c | 23-May-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
Link user libraries with 4K page size
Set the linker flag max-page-size to 4K when linking shared user libraries. This is used to avoid unnecessary large holes in the virtual memory map between segm
Link user libraries with 4K page size
Set the linker flag max-page-size to 4K when linking shared user libraries. This is used to avoid unnecessary large holes in the virtual memory map between segments with different attributes.
Acked-by: Etienne Carriere <etienne.carriere@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 ...
|