| 0a75d408 | 13-Oct-2023 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: fix data abort during ftrace
With commit c10e3fa93d24 ("core: fix race in handling TA panic") the resources of a panicked TAs are released as early as possible, including the user space mapped
core: fix data abort during ftrace
With commit c10e3fa93d24 ("core: fix race in handling TA panic") the resources of a panicked TAs are released as early as possible, including the user space mapped ftrace buffer. However, the pointer to the ftrace buffer is stored in the ts_session for quick and easy access. The ftrace buffer is always retrieved with get_fbuf() that already have a few other checks to see if the buffer is currently available. So add a check to see that the TA hasn't panicked also.
Fixes: c10e3fa93d24 ("core: fix race in handling TA panic") Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (vexpress-qemu_armv8a)
show more ...
|
| 78af2f12 | 09-Oct-2023 |
Alvin Chang <alvinga@andestech.com> |
libutils: fault_mitigation.h: Fix indentation
Indentation with tab instead of space.
Fixes: ce56605a0ede ("core: support fault mitigations in non-threaded code") Signed-off-by: Alvin Chang <alvinga
libutils: fault_mitigation.h: Fix indentation
Indentation with tab instead of space.
Fixes: ce56605a0ede ("core: support fault mitigations in non-threaded code") Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| ce56605a | 22-Sep-2023 |
Sichun Qin <sichun.qin@amlogic.com> |
core: support fault mitigations in non-threaded code
Fault mitigation won't work in non-threaded code due to the following error: assertion 'ct >= 0 && ct < CFG_NUM_THREADS' failed at core/arch/arm/
core: support fault mitigations in non-threaded code
Fault mitigation won't work in non-threaded code due to the following error: assertion 'ct >= 0 && ct < CFG_NUM_THREADS' failed at core/arch/arm/kernel /thread.c:799 <thread_get_id>
The problem is in __ftmn_get_tsd_func_arg_pp which calls thread_get_tsd which thread_get_id. The reason is that the interrupt handler is not associated with any thread, so the ct (current_thread_id) value is -1 which would cause an assert problem.
The fix is to add ftmn_arg to thread_core_local and the new variable would be used when the current thread is < 0.
Signed-off-by: Sichun Qin <sichun.qin@amlogic.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 7bd4f9b2 | 01-Sep-2023 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutils: mempool: fix unbalanced put_pool()
Prior to this patch mempool_free() unconditionally called put_pool(), but if the "ptr" argument is NULL it means that there hasn't been a corresponding c
libutils: mempool: fix unbalanced put_pool()
Prior to this patch mempool_free() unconditionally called put_pool(), but if the "ptr" argument is NULL it means that there hasn't been a corresponding call to get_pool(). Fix this only calling put_pool() for non-NULL pointers.
Fixes: a51d45b52503 ("libutils: mempool based raw malloc functions") Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 2a8dfb45 | 23-Aug-2023 |
Jerome Forissier <jerome.forissier@linaro.org> |
compiler.h: add __inhibit_loop_to_libcall
Introduce __inhibit_loop_to_libcall which allows to disable a specific compiler optimization that detects and replaces some open coded loops with standard l
compiler.h: add __inhibit_loop_to_libcall
Introduce __inhibit_loop_to_libcall which allows to disable a specific compiler optimization that detects and replaces some open coded loops with standard library calls (typically: memcpy() and memset()).
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 546e296f | 04-Jul-2023 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutils: add {high,low}32_from_64() helper
Adds two helper functions high32_from_64() and low32_from_64() used for retrieving the upper and lower halves of a uint64_t.
Signed-off-by: Jens Wiklande
libutils: add {high,low}32_from_64() helper
Adds two helper functions high32_from_64() and low32_from_64() used for retrieving the upper and lower halves of a uint64_t.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 5c2c0fb3 | 14-Jun-2023 |
Jerome Forissier <jerome.forissier@linaro.org> |
ftrace: change implementation to use binary circular buffer
The current implementation of function tracing (CFG_FTRACE_SUPPORT) produces human-readable text into the output buffer that is passed to
ftrace: change implementation to use binary circular buffer
The current implementation of function tracing (CFG_FTRACE_SUPPORT) produces human-readable text into the output buffer that is passed to tee-supplicant and ultimately saved to the Linux filesystem. Two main issues with that:
1. The string formatting code is somewhat complex. It introduces significant overhead in the execution time of the instrumented functions. 2. The various policies about how to handle a buffer full condition (CFG_FTRACE_BUF_WHEN_FULL) are not very convenient. In particular, "shift" is typically the most desirable option because it always keeps the most recent entries, but it is very inefficient to the point of not being usable in practice.
This commit addresses the above concerns by making the ftrace buffer circular one, each entry being 64-bit value. The formatting code is offloaded to a new Python script: scripts/ftrace_format.py. The output is unchanged except for an added field showing the current depth in the call stack.
Typical usage (captured on QEMUv8):
build$ mkdir -p ../tmp build$ chmod a+w ../tmp build$ make CFG_FTRACE_SUPPORT=y CFG_FTRACE_BUF_SIZE=15000 \ CFG_TA_MCOUNT=y CFG_ULIBS_MCOUNT=y CFG_SYSCALL_FTRACE=y \ QEMU_VIRTFS_AUTOMOUNT=y run $ xtest regression_1004 ... $ cp /tmp/ftrace-cb3e5ba0-adf1-11e0-998b-0002a5d5c51b.out /mnt/host/tmp build$ cd .. optee$ optee_os/scripts/ftrace_format.py \ tmp/ftrace-cb3e5ba0-adf1-11e0-998b-0002a5d5c51b.out | optee_os/scripts/symbolize.py \ -d optee_os/out/arm/core \ -d out-br/build/optee_test_ext-1.0/ta/*/out | less TEE load address @ 0x5ab04000 Function graph for TA: cb3e5ba0-adf1-11e0-998b-0002a5d5c51b @ 80085000 | 1 | __ta_entry() { | 2 | __utee_entry() { 43.840 us | 3 | ta_header_get_session() 7.216 us | 3 | tahead_get_trace_level() 14.480 us | 3 | trace_set_level() | 3 | malloc_add_pool() { | 4 | raw_malloc_add_pool() { 46.032 us | 5 | bpool() | 5 | raw_realloc() { 166.256 us | 6 | bget() 23.056 us | 6 | raw_malloc_return_hook() 267.952 us | 5 | } 398.720 us | 4 | } 426.992 us | 3 | } | 3 | TEE_GetPropertyAsU32() { 23.600 us | 4 | is_propset_pseudo_handle() | 4 | __utee_check_instring_annotation() { 26.416 us | 5 | strlen() | 5 | check_access() { | 6 | TEE_CheckMemoryAccessRights() { | 7 | _utee_check_access_rights() { | 8 | syscall_check_access_rights() { | 9 | ts_get_current_session() { 4.304 us | 10 | ts_get_current_session_may_fail() 10.976 us | 9 | } | 9 | to_user_ta_ctx() { 2.496 us | 10 | is_user_ta_ctx() 8.096 us | 9 | } | 9 | vm_check_access_rights() { | 10 | vm_buf_is_inside_um_private() { | 11 | core_is_buffer_inside() { ...
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| b59abd23 | 20-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
libutils: ftrace: Add definitions for separating architectural headers
Add definitions for separating architectural headers. In kernel mode, risc-v may include riscv.h to have the timer related func
libutils: ftrace: Add definitions for separating architectural headers
Add definitions for separating architectural headers. In kernel mode, risc-v may include riscv.h to have the timer related functions. In TA libraries, risc-v may include riscv_user_sysreg.h to have those functions.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| ae9b3ff9 | 20-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
libutils: riscv: Implement _mount() and __ftrace_return()
When the core and TA are compiled with the -pg option, the compiler inserts a call to _mcount() into every function prologue. It can be used
libutils: riscv: Implement _mount() and __ftrace_return()
When the core and TA are compiled with the -pg option, the compiler inserts a call to _mcount() into every function prologue. It can be used to trace the function calls such as ftrace.
Implement the _mount() to prepare the necessary parameters for ftrace. The __ftrace_return() is also implemented for returning from ftrace.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| 97a70d28 | 20-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
libutils: Add riscv.S to make it available for core and TA libs
Some assembly macros are necessary for both OP-TEE core and TA libraries. Therefore, we add riscv specific assembly file into libutils
libutils: Add riscv.S to make it available for core and TA libs
Some assembly macros are necessary for both OP-TEE core and TA libraries. Therefore, we add riscv specific assembly file into libutils and move some assembly related macros from riscv.h to riscv.S.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| 750c544c | 17-May-2023 |
Yuegui He <yuegui.he@amlogic.com> |
libutils: Disable stack protector for __aeabi_uidivmod/__aeabi_idivmod
Some toolchain build optee_os with "-fstack-protector-strong", But the generated codes add "check stack" operations after the "
libutils: Disable stack protector for __aeabi_uidivmod/__aeabi_idivmod
Some toolchain build optee_os with "-fstack-protector-strong", But the generated codes add "check stack" operations after the "ret_idivmod_values", which overwrite the r1 value.
So __aeabi_uidivmod/__aeabi_idivmod will got error value,
Link: https://github.com/OP-TEE/optee_os/issues/6007 Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Yuegui He <yuegui.he@amlogic.com>
show more ...
|
| 9fee17aa | 23-Jan-2023 |
Etienne Carriere <etienne.carriere@linaro.org> |
libutils: add bit_ffs_from()
Adds bitstring function bit_ffs_from() that mimics bit_ffs() but looks from a start bit position given as argument, and defines bit_ffs() based on bit_ffs_from().
Revie
libutils: add bit_ffs_from()
Adds bitstring function bit_ffs_from() that mimics bit_ffs() but looks from a start bit position given as argument, and defines bit_ffs() based on bit_ffs_from().
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| a263637d | 10-Feb-2023 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutils: add stubs for pthread functions
When building with GCC 11.3.1 [1], the linker reports undefined symbols in the C++ test TA:
$ make 2>&1 | grep -E "(in function|undefined reference)" | se
libutils: add stubs for pthread functions
When building with GCC 11.3.1 [1], the linker reports undefined symbols in the C++ test TA:
$ make 2>&1 | grep -E "(in function|undefined reference)" | sed 's@.*/@@' libstdc++.a(eh_alloc.o): in function `(anonymous namespace)::pool::free(void*) [clone .constprop.0]': gthr-default.h:749: undefined reference to `pthread_mutex_lock' gthr-default.h:779: undefined reference to `pthread_mutex_unlock' libstdc++.a(eh_alloc.o): in function `(anonymous namespace)::pool::allocate(unsigned long) [clone .constprop.0]': gthr-default.h:749: undefined reference to `pthread_mutex_lock' gthr-default.h:779: undefined reference to `pthread_mutex_unlock' libgcc_eh.a(unwind-dw2-fde-dip.o): in function `__gthread_mutex_lock': gthr-default.h:749: undefined reference to `pthread_mutex_lock' libgcc_eh.a(unwind-dw2-fde-dip.o): in function `__gthread_mutex_unlock': gthr-default.h:779: undefined reference to `pthread_mutex_unlock' [more of the same follow]
To fix that issue, introduce no-op stubs as weak symbols in libutils. Doing so is valid because TAs are single threaded and non-reentrant.
Link: [1] https://developer.arm.com/-/media/Files/downloads/gnu/11.3.rel1/binrel/arm-gnu-toolchain-11.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Sumit Garg <sumit.garg@linaro.org>
show more ...
|
| b76b2296 | 03-Feb-2023 |
Jerome Forissier <jerome.forissier@linaro.org> |
virt: rename CFG_VIRTUALIZATION to CFG_NS_VIRTUALIZATION
With the advent of virtualization support at S-EL2 in the Armv8.4-A architecture, CFG_VIRTUALIZATION has become ambiguous. Let's rename it to
virt: rename CFG_VIRTUALIZATION to CFG_NS_VIRTUALIZATION
With the advent of virtualization support at S-EL2 in the Armv8.4-A architecture, CFG_VIRTUALIZATION has become ambiguous. Let's rename it to CFG_NS_VIRTUALIZATION to indicate more clearly that it is about supporting virtualization on the non-secure side.
This commit is the result of the following command:
$ for f in $(git grep -l -w CFG_VIRTUALIZATION); do \ sed -i -e 's/CFG_VIRTUALIZATION/CFG_NS_VIRTUALIZATION/g' $f; \ done
...plus the compatibility line in mk/config.mk:
CFG_NS_VIRTUALIZATION ?= $(CFG_VIRTUALIZATION)
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
show more ...
|
| 3de5947c | 09-Jan-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
libutils: riscv: provide atomic_rv.S
Implement atomic_inc32() and atomic_dec32() in atomic_rv.S. The implementation is based on atomic addition instruction with acquire and release suffix to add add
libutils: riscv: provide atomic_rv.S
Implement atomic_inc32() and atomic_dec32() in atomic_rv.S. The implementation is based on atomic addition instruction with acquire and release suffix to add additional memory order constraints.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| d1a015fe | 08-Dec-2022 |
Etienne Carriere <etienne.carriere@linaro.org> |
libutils: IS_ENABLED2() for _CFG_* switches
Adds macro IS_ENABLED2() to be used for OP-TEE OS internal _CFG_* configuration switches to not conflict with IS_ENABLED() coding style rules inherited fr
libutils: IS_ENABLED2() for _CFG_* switches
Adds macro IS_ENABLED2() to be used for OP-TEE OS internal _CFG_* configuration switches to not conflict with IS_ENABLED() coding style rules inherited from Linux kernel coding style.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| f197f055 | 30-Nov-2022 |
liushiwei <liushiwei@eswincomputing.com> |
libutils: confine_array_index: add support for RISC-V
Add a naive C implementation for RISC-V.
Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: liushiwei <liushiwei@eswincomputin
libutils: confine_array_index: add support for RISC-V
Add a naive C implementation for RISC-V.
Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: liushiwei <liushiwei@eswincomputing.com> Reviewed-by: chenchaokai <chenchaokai@eswincomputing.com>
show more ...
|
| 7e75ca54 | 01-Apr-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
Basic fault mitigation routines
Adds basic fault mitigation routines designed to help protecting from fault injection attacks on the hardware. This is by no means bullet proof, but it should at leas
Basic fault mitigation routines
Adds basic fault mitigation routines designed to help protecting from fault injection attacks on the hardware. This is by no means bullet proof, but it should at least improve the situation.
These routines focus on verifying that a function has been called and that the returned value matches the result from the function. This is done by having a handshake between the caller and the callee where also the return value is transmitted in a separate channel.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 7eaed3a3 | 23-Nov-2022 |
Etienne Carriere <etienne.carriere@linaro.org> |
libutils: prefix system header guard with 2 underscore chars
Adds prefix "__" to standard header files implemented in libutils. This is applicable as these header guards macro are system macros. Thi
libutils: prefix system header guard with 2 underscore chars
Adds prefix "__" to standard header files implemented in libutils. This is applicable as these header guards macro are system macros. This change prevents conflicts with external component as faced with SCP-firmware [1] that implements wrapper headers with #include_next for assert.h and stdlib.h using ASSERT_H [2] and STDLIB_H [3] as header guards as in libutils.
Prior this change did stdint.h both define STDINT_H and _STDINT_H but guards only upon STDINT_H. This change removes STDINT_H.
Link: [1] https://github.com/ARM-software/SCP-firmware.git Link: [2] https://github.com/ARM-software/SCP-firmware/blob/v2.11.0/framework/include/assert.h#L8-L9 Link: [3] https://github.com/ARM-software/SCP-firmware/blob/v2.11.0/framework/include/stdlib.h#L8-L9 Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 4afd9f03 | 01-Sep-2022 |
Jorge Ramirez-Ortiz <jorge@foundries.io> |
libutils: compiler.h: introduce __alias(x)
Improve readability with an __alias definition. Supports the __weak __alias("g") use case
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Reviewed
libutils: compiler.h: introduce __alias(x)
Improve readability with an __alias definition. Supports the __weak __alias("g") use case
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| d3ed98ee | 20-Oct-2022 |
Clement Faure <clement.faure@nxp.com> |
libutils: util.h: fix the ROUNDUP_OVERFLOW() macro
Some parenthesis are missing in the ROUNDUP_OVERFLOW expression. The macro can only return false.
Fixes: 2e48af989133 ("util.h: add the macro ROUN
libutils: util.h: fix the ROUNDUP_OVERFLOW() macro
Some parenthesis are missing in the ROUNDUP_OVERFLOW expression. The macro can only return false.
Fixes: 2e48af989133 ("util.h: add the macro ROUNDUP_OVERFLOW()") Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| d9925536 | 23-Aug-2022 |
Jerome Forissier <jerome.forissier@linaro.org> |
arm32: libutils, libutee, ta: add .note.GNU-stack section to .S files
When building for arm32 with GNU binutils 2.39, the linker outputs warnings when linking Trusted Applications:
arm-unknown-lin
arm32: libutils, libutee, ta: add .note.GNU-stack section to .S files
When building for arm32 with GNU binutils 2.39, the linker outputs warnings when linking Trusted Applications:
arm-unknown-linux-uclibcgnueabihf-ld.bfd: warning: utee_syscalls_a32.o: missing .note.GNU-stack section implies executable stack arm-unknown-linux-uclibcgnueabihf-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
We could silence the warning by adding the '--no-warn-execstack' option to the TA link flags, like we did in the parent commit for the TEE core and ldelf. Indeed, ldelf always allocates a non-executable piece of memory for the TA to use as a stack.
However it seems preferable to comply with the common ELF practices in this case. A better fix is therefore to add the missing .note.GNU-stack sections in the assembler files.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 8dc184e5 | 18-Jul-2022 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
libutils: util.h: add get_field_u{32,64}() and set_field_u{32,64}()
This commit defines macros for getting and setting bit fields.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Revie
libutils: util.h: add get_field_u{32,64}() and set_field_u{32,64}()
This commit defines macros for getting and setting bit fields.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| ad0ae800 | 27-Dec-2021 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
riscv: create makefiles and directories tree for riscv
This commits creates the very first makefiles, directories and subdirectories for RISC-V port. It also creates a new platform flavor named plat
riscv: create makefiles and directories tree for riscv
This commits creates the very first makefiles, directories and subdirectories for RISC-V port. It also creates a new platform flavor named plat-spike. Spike is a reference functional RISC-V ISA simulator which provides full system emulation and it is developed alongside the RISC-V toolchain.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| a0e8ffe9 | 04-Apr-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add support for MTE
Adds support for the Armv8.5-A Memory Tagging Extension with CFG_MEMTAG=y.
A memtag.h API is introduced to handle this extension. If CFG_MEMTAG=n the API doesn't add any o
core: add support for MTE
Adds support for the Armv8.5-A Memory Tagging Extension with CFG_MEMTAG=y.
A memtag.h API is introduced to handle this extension. If CFG_MEMTAG=n the API doesn't add any overhead and the behaviour is unchanged. With CFG_MEMTAG=y a check is performed to see if the platform can support MTE and the API is dynamically configured accordingly. This means that it's safe to have CFG_MEMTAG=y even for platforms not supporting MTE. There will be some minimal overhead then, but likely not noticeable.
An entry is also added in the TEE_PROPSET_TEE_IMPLEMENTATION for a u32 property "org.trustedfirmware.optee.cpu.feat_memtag_implemented". The property is set to a non-zero value only if CFG_CORE_MEMTAG is configured and the underlying CPU supports FEAT_MTE.
This commit still only uses the default tag with the value 0 resulting in unchanged pointers when accessing memory. However, all plumbing is in place allowing for instance tagging of the heap in a later commit.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|