Oopenvela-robotoptee_os/util.h: avoid the IS_ALIGNED redefined error
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
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> | 3 年前 | |
ftrace: Refactor ftrace buffer dump implementation Current implementation does a lot of tricky bits with ftrace buffer pointer. It also leads to false positive -Warray-bounds warnings with GCC 11.2 toolchain as well. So refactor it to use array indexes instead. Also, move hardcoded ftrace line sizes to macros instead for better understanding. Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (vexpress-qemu_armv8a) | 4 年前 | |
optee_os/util.h: avoid the IS_ALIGNED redefined error Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com> | 3 个月前 | |
libutils: Import isc_tsmemcmp() from NTP as consttime_memcmp() This patch imports a constant-time byte sequence comparison function from the NTP source tree [1]. Contrary to our buf_compare_ct() function, which has only two possible outcomes (zero or non-zero), the new function is a direct replacement for memcmp() because it returns three possible states (< 0, 0, > 0). Link: [1] http://bk.ntp.org/ntp-stable/lib/isc/tsmemcmp.c Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Suggested-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> | 7 年前 | |
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> | 3 年前 | |
libutils: mempool based raw malloc functions Instead of the old stack like internal memory allocator, use the raw malloc functions instead for more efficient memory usage. CFG_WITH_STATS is enabled automatically if CFG_MEMPOOL_REPORT_LAST_OFFSET is enabled to secure a new dependency in the code. Acked-by: Sahil Malhotra <sahil.malhotra@nxp.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> | 4 年前 | |
libutils: add memzero_explicit() Adds a new function: memzero_explicit(s, count) which is equivalent to memset(s, 0, count) except that it cannot be optimized away by the compiler. memset() being a built-in function, the compiler is free to perform optimizations such as simply discarding a call when it considers that the call cannot have any observable effect from the program's point of view. A typical example is clearing local data before returning from a function. memset() is likely to have no effect in this case while memzero_explicit() will work as expected. Calling memset() directly from memzero_explicit() would work as long as link time optimization (LTO) is not applied. With LTO however, the compiler could inline the call to memzero_explicit() and find out that dead store optimization applies. In order to avoid that, we use a method mentioned in [1] which consists in using a volatile function pointer. This method is considered "effective in practice" with all the commonly used compilers. Link: [1] https://www.usenix.org/system/files/conference/usenixsecurity17/sec17-yang.pdf Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> | 7 年前 | |
libutils: add nex_strdup() function This is the same as strdup() but it uses nex_malloc(), so it can be used in nexus part of OP-TEE. Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> | 7 年前 | |
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> | 3 年前 | |
external/optee_os: move the rand() implementation to lib/ext the rand() implementation should belong to lib/ext, not with tee_api_operations.c Signed-off-by: guoshichao <guoshichao@xiaomi.com> | 3 个月前 | |
external/optee_os: fix the data print format warning optee_os/lib/libutils/ext/snprintk.c: In function 'uuid2str': optee_os/lib/libutils/ext/snprintk.c:230:29: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=] 230 | "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", | ~~~^ | | | unsigned int | %08lx 231 | uuid->lo, uuid->mid, uuid->hi_ver, | ~~~~~~~~ | | | uint32_t {aka long unsigned int} CC: sched/sched_lock.c In file included from /home/guoshichao/work_profile/vela_os/vela_dev_n60_2/apps/external/optee/optee_nuttx/optee_nuttx/include/assert.h:28, from optee_os/core/kernel/tee_ta_manager.c:7: optee_os/core/kernel/tee_ta_manager.c: In function 'tee_ta_close_session': optee_os/core/kernel/tee_ta_manager.c:529:14: warning: format '%u' expects argument of type 'unsigned int', but argument 7 has type 'long unsigned int' [-Wformat=] 529 | DMSG("csess 0x%" PRIxVA " id %u", | ^~~~~~~~~~~ optee_os/lib/libutils/ext/include/trace.h:41:22: note: in definition of macro 'trace_printf_helper' 41 | __VA_ARGS__) | ^~~~~~~~~~~ optee_os/core/kernel/tee_ta_manager.c:529:9: note: in expansion of macro 'DMSG' 529 | DMSG("csess 0x%" PRIxVA " id %u", | ^~~~ optee_os/core/kernel/tee_ta_manager.c: In function 'tee_ta_open_session': optee_os/core/kernel/tee_ta_manager.c:735:22: warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'TEE_Result' {aka 'long unsigned int'} [-Wformat=] 735 | DMSG("init session failed 0x%x", res); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ | | | TEE_Result {aka long unsigned int} optee_os/lib/libutils/ext/include/trace.h:41:22: note: in definition of macro 'trace_printf_helper' 41 | __VA_ARGS__) | ^~~~~~~~~~~ optee_os/core/kernel/tee_ta_manager.c:735:17: note: in expansion of macro 'DMSG' 735 | DMSG("init session failed 0x%x", res); | ^~~~ Signed-off-by: guoshichao <guoshichao@xiaomi.com> | 3 个月前 | |
Add SPDX license identifiers Adds one SPDX-License-Identifier line [1] to each source files that contains license text. Generated by [2]: spdxify.py --add-spdx optee_os/ The scancode tool [3] was used to double check the license matching code in the Python script. All the licenses detected by scancode are either detected by spdxify.py, or have no SPDX identifier, or are false matches. Link: [1] https://spdx.org/licenses/ Link: [2] https://github.com/jforissier/misc/blob/f7b56c8/spdxify.py Link: [3] https://github.com/nexB/scancode-toolkit Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org> | 8 年前 | |
Add SPDX license identifiers Adds one SPDX-License-Identifier line [1] to each source files that contains license text. Generated by [2]: spdxify.py --add-spdx optee_os/ The scancode tool [3] was used to double check the license matching code in the Python script. All the licenses detected by scancode are either detected by spdxify.py, or have no SPDX identifier, or are false matches. Link: [1] https://spdx.org/licenses/ Link: [2] https://github.com/jforissier/misc/blob/f7b56c8/spdxify.py Link: [3] https://github.com/nexB/scancode-toolkit Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org> | 8 年前 | |
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> | 3 年前 | |
lib: libutils: trace.c: make print_core_id() architecture-independent The function print_core_id() in is calling architecture-specific routines to retrieve the core id. It is more relevant to create a new abstract function trace_ext_get_core_id() in lib/libutee/trace_ext.c that needs to be implemented in the architecture-specific code. This is similar to print_thread_id() which calls trace_ext_get_thread_id() implemented in core/arch/arm/kernel/trace_ext.c Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> | 4 年前 |