History log of /optee_os/core/kernel/thread.c (Results 1 – 25 of 25)
Revision Date Author Comments
# bb538722 02-Jun-2025 Alvin Chang <alvinga@andestech.com>

core: replace CFG_DYN_STACK_CONFIG with CFG_DYN_CONFIG

This commit replaces CFG_DYN_STACK_CONFIG with CFG_DYN_CONFIG since now
RISC-V also supports CFG_DYN_STACK_CONFIG.

Signed-off-by: Alvin Chang

core: replace CFG_DYN_STACK_CONFIG with CFG_DYN_CONFIG

This commit replaces CFG_DYN_STACK_CONFIG with CFG_DYN_CONFIG since now
RISC-V also supports CFG_DYN_STACK_CONFIG.

Signed-off-by: Alvin Chang <alvinga@andestech.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 86df92b3 08-May-2025 Alvin Chang <alvinga@andestech.com>

core: kernel: Remove CFG_BOOT_INIT_CURRENT_THREAD_CORE_LOCAL

Now both ARM and RISC-V architectures support initialize
thread_core_local[current_core_pos] before calling C code. Thus, we can
deprecat

core: kernel: Remove CFG_BOOT_INIT_CURRENT_THREAD_CORE_LOCAL

Now both ARM and RISC-V architectures support initialize
thread_core_local[current_core_pos] before calling C code. Thus, we can
deprecate CFG_BOOT_INIT_CURRENT_THREAD_CORE_LOCAL and corresponding
code.

Signed-off-by: Alvin Chang <alvinga@andestech.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Yu-Chien Peter Lin <peter.lin@sifive.com>

show more ...


# aa0620cf 20-Mar-2025 Jens Wiklander <jens.wiklander@linaro.org>

core: dynamic allocation of threads and their stacks

With CFG_DYN_CONFIG enabled, use dynamic allocation of threads and their
stacks.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Revie

core: dynamic allocation of threads and their stacks

With CFG_DYN_CONFIG enabled, use dynamic allocation of threads and their
stacks.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# 91d4649d 20-Mar-2025 Jens Wiklander <jens.wiklander@linaro.org>

core: add thread_count to thread_init_threads()

Add a thread_count parameter to thread_init_threads(). This must currently
always be equal to CFG_NUM_THREADS, but may become a dynamic configuration

core: add thread_count to thread_init_threads()

Add a thread_count parameter to thread_init_threads(). This must currently
always be equal to CFG_NUM_THREADS, but may become a dynamic configuration
parameter with CFG_DYN_CONFIG=y in later patches.

The array threads[] is changed into a pointer to allow dynamic
allocation in later patches. The assembly code is updated accordingly to
handle a pointer instead of an array.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Alvin Chang <alvinga@andestech.com>
Tested-by: Alvin Chang <alvinga@andestech.com>
Reviewed-by: Yu-Chien Peter Lin <peter.lin@sifive.com>
Tested-by: Yu-Chien Peter Lin <peter.lin@sifive.com>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# 59724f22 20-Mar-2025 Jens Wiklander <jens.wiklander@linaro.org>

core: dynamic allocation of thread_core_local and its stacks

With CFG_DYN_CONFIG enabled, use dynamic allocation of thread_core_local
and the two stacks, tmp_stack and abt_stack, recorded in it.

Si

core: dynamic allocation of thread_core_local and its stacks

With CFG_DYN_CONFIG enabled, use dynamic allocation of thread_core_local
and the two stacks, tmp_stack and abt_stack, recorded in it.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>

show more ...


# a4c2e0cb 20-Mar-2025 Jens Wiklander <jens.wiklander@linaro.org>

core: add core_count to thread_init_thread_core_local()

Add a core_count parameter to thread_init_thread_core_local() to enable
dynamic configuration of the number of supported cores when configured

core: add core_count to thread_init_thread_core_local()

Add a core_count parameter to thread_init_thread_core_local() to enable
dynamic configuration of the number of supported cores when configured
with CFG_DYN_STACK_CONFIG=y, or it must be equal to
CFG_TEE_CORE_NB_CORE. This is needed in later patches where the number
of cores is configured dynamically.

The array thread_core_local[] is changed into a pointer to allow dynamic
allocation in later patches. The assembly code is updated accordingly to
handle a pointer instead of an array.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Alvin Chang <alvinga@andestech.com>
Tested-by: Alvin Chang <alvinga@andestech.com>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# 45c754ce 16-Apr-2025 Jens Wiklander <jens.wiklander@linaro.org>

core: fix crash during syscall ftrace

Syscall ftrace collects data during a syscall. get_fbuf() checks if
thread_get_id_may_fail() != -1 to see if a function is called under
normal thread execution.

core: fix crash during syscall ftrace

Syscall ftrace collects data during a syscall. get_fbuf() checks if
thread_get_id_may_fail() != -1 to see if a function is called under
normal thread execution. This can lead to an inconsistent state if a
native interrupt occur while ftrace_enter() or ftrace_return() is
recording data in the ftrace buffer. So fix this by using
thread_is_in_normal_mode() to exclude ftrace during interrupt
processing.

Reported-by: Jerome Forissier <jerome.forissier@linaro.org>
Closes: https://github.com/OP-TEE/optee_os/issues/7216
Fixes: 099918f6744c ("ftrace: Add support for syscall function tracer")
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (vexpress-qemu_armv8a)

show more ...


# 758c3687 13-Mar-2025 Jens Wiklander <jens.wiklander@linaro.org>

core: fix CFG_BOOT_INIT_THREAD_CORE_LOCAL0

CFG_BOOT_INIT_THREAD_CORE_LOCAL0 is misleading since it's concerning the
core id of the boot CPU. So rename the configuration flag to
CFG_BOOT_INIT_CURRENT

core: fix CFG_BOOT_INIT_THREAD_CORE_LOCAL0

CFG_BOOT_INIT_THREAD_CORE_LOCAL0 is misleading since it's concerning the
core id of the boot CPU. So rename the configuration flag to
CFG_BOOT_INIT_CURRENT_THREAD_CORE_LOCAL and update the code as needed.
Only thread_init_thread_core_local() has a change of behaviour where the
boot CPU now can have any core id.

Fixes: b5ec8152f3e5 ("core: arm: refactor boot")
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# ad94da2a 22-Jan-2025 Jens Wiklander <jens.wiklander@linaro.org>

core: thread: initialize stack canaries from recorded end-va

Continue where "core: thread: get stacks from recorded end-va" left and
initialize the stack canaries based on the recorded end-va. This

core: thread: initialize stack canaries from recorded end-va

Continue where "core: thread: get stacks from recorded end-va" left and
initialize the stack canaries based on the recorded end-va. This is
needed in later patches where the stacks aren't statically allocated.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# 05994c76 22-Jan-2025 Jens Wiklander <jens.wiklander@linaro.org>

core: thread: get stacks from recorded end-va

Each stack has its end-va or top recorded in either thread_core_local[]
or threads[] as tmp_stack_va_end, abt_stack_va_end, or stack_va_end.
This addres

core: thread: get stacks from recorded end-va

Each stack has its end-va or top recorded in either thread_core_local[]
or threads[] as tmp_stack_va_end, abt_stack_va_end, or stack_va_end.
This address together with the known size of the stack is enough to
calculate all the other needed stack related addresses:
- start and end canaries,
- top and bottom of the stacks.

Add and use new internal functions to calculate these addresses and
remove the now unused macros. This is needed in later patches where the
stacks aren't statically allocated.

INIT_CANARY(), GET_START_CANARY(), and GET_END_CANARY() are kept for now
to see that the addresses for the canaries are calculated correctly in
the new functions.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# b5ec8152 22-Jan-2025 Jens Wiklander <jens.wiklander@linaro.org>

core: arm: refactor boot

Introduce CFG_BOOT_INIT_THREAD_CORE_LOCAL0 to indicate that
thread_core_local[0] is initialized before the boot_init_* functions are
called.

thread_init_core_local_stacks()

core: arm: refactor boot

Introduce CFG_BOOT_INIT_THREAD_CORE_LOCAL0 to indicate that
thread_core_local[0] is initialized before the boot_init_* functions are
called.

thread_init_core_local_stacks() and thread_init_thread_core_local() are
replaced by a new version of thread_init_thread_core_local() for
CFG_BOOT_INIT_THREAD_CORE_LOCAL0=y.

Move initialization of thread_core_local[] from very early to
boot_init_primary_late() where various DTBs containing run-time
configuration are available. This will be needed in later patches when
the number of configured cores can be read from DT or some other
run-time configuration.

Move the "OP-TEE version" print and following code from
boot_init_primary_late() to boot_init_primary_final()

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# 980d32c4 19-Jun-2024 Jens Wiklander <jens.wiklander@linaro.org>

core: open-code thread_init_stack()

The implementations of thread_init_stack() are identical and trivial for
both arm and riscv. So simplify code further and open-code it where it's
called from in c

core: open-code thread_init_stack()

The implementations of thread_init_stack() are identical and trivial for
both arm and riscv. So simplify code further and open-code it where it's
called from in core/kernel/thread.c.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Alvin Chang <alvinga@andestech.com>
Tested-by: Alvin Chang <alvinga@andestech.com>

show more ...


# 9b0ee59d 12-Jun-2024 Jens Wiklander <jens.wiklander@linaro.org>

core: rename tee_mm_vcore to core_virt_mem_pool

Rename tee_mm_vcore to core_virt_mem_pool to make it clear that it
handles virtual memory allocations.

Signed-off-by: Jens Wiklander <jens.wiklander@

core: rename tee_mm_vcore to core_virt_mem_pool

Rename tee_mm_vcore to core_virt_mem_pool to make it clear that it
handles virtual memory allocations.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# b89b3da2 21-Apr-2023 Vincent Chuang <Vincent.Chuang@mediatek.com>

core: thread: Add support for canary value randomization

Currently hardcoded magic number is used as thread stack canary,
an attacker with full control over the overflow can embed the
hardcoded cana

core: thread: Add support for canary value randomization

Currently hardcoded magic number is used as thread stack canary,
an attacker with full control over the overflow can embed the
hardcoded canary value on the right location to bypass the overflow
detection.

To add extra layer of security, redefine the canary value as variable,
such that the canary can be initialized during runtime.

The canaries are initialized with static values from thread_init_canaries()
during the early boot stage. The plat_get_random_stack_canaries() is
refactored to support arbitrary-length random numbers, and a new function
called thread_update_canaries() is created to fetch the random values and
update the thread canaries. For CFG_NS_VIRTUALIZATION=y, the updated
function is disabled.

Signed-off-by: Vincent Chuang <Vincent.Chuang@mediatek.com>
Signed-off-by: Randy Hsu <Randy-CY.Hsu@mediatek.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# 8577287c 17-Apr-2023 Jerome Forissier <jerome.forissier@linaro.org>

core: ftrace: mark thread_get_tsd() and thread_get_id() as __noprof

When CFG_FTRACE_SUPPORT=y CFG_SYSCALL_FTRACE=y, the following call stack
happens (QEMUv8):

_mcount()
ftrace_enter()
get_fbu

core: ftrace: mark thread_get_tsd() and thread_get_id() as __noprof

When CFG_FTRACE_SUPPORT=y CFG_SYSCALL_FTRACE=y, the following call stack
happens (QEMUv8):

_mcount()
ftrace_enter()
get_fbuf()
thread_get_tsd()
thread_get_id()

Therefore thread_get_tsd() and thread_get_id() must be tagged with
__noprof, otherwise a recursive call to _mcount() is triggered leading
to infinite recursion, stack overflow and a lockup of the TEE core.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>

show more ...


# a7a0664e 14-Apr-2023 Jerome Forissier <jerome.forissier@linaro.org>

core: mark thread_init_core_local_stacks() as __nostackcheck

As its name implies, thread_init_core_local_stacks() performs stack
initializations therefore it should not invoke the stack-checking hoo

core: mark thread_init_core_local_stacks() as __nostackcheck

As its name implies, thread_init_core_local_stacks() performs stack
initializations therefore it should not invoke the stack-checking hooks
which are enabled when CFG_CORE_DEBUG_CHECK_STACKS=y. This is done by
adding the __nostackcheck qualifier to the function. Without it, the
boot hangs early and nothing is printed on the secure console.

Note that this also fixes similar symptoms with syscall profiling
(CFG_FTRACE_SUPPORT=y CFG_SYSCALL_FTRACE=y) because the _mcount()/
__gnu_mcount_nc() hooks need the stack. Both __nostackcheck and
__noprof expand to __attribute__((no_instrument_function)).

Fixes: ca8258906949 ("core: split core/arch/arm/kernel/thread.c")
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>

show more ...


# 239420cb 13-Apr-2023 Jerome Forissier <jerome.forissier@linaro.org>

core: ftrace: mark thread_get_id_may_fail() as __noprof

With CFG_FTRACE_SUPPORT=y CFG_ULIBS_MCOUNT=y CFG_SYSCALL_FTRACE=y
(tested on QEMUv8), OP-TEE boot hangs due to infinite recursion:

ftrace_ent

core: ftrace: mark thread_get_id_may_fail() as __noprof

With CFG_FTRACE_SUPPORT=y CFG_ULIBS_MCOUNT=y CFG_SYSCALL_FTRACE=y
(tested on QEMUv8), OP-TEE boot hangs due to infinite recursion:

ftrace_enter()
get_fbuf()
thread_get_id_may_fail()
_mcount() [or __gnu_mcount_nc()]
ftrace_enter()
...

Break the cycle by tagging thread_get_id_may_fail() with __noprof so
that it doesn't call _mcount()/__gnu_mcount_nc().

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>

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 ...


# e17e7a56 07-Jun-2022 Jens Wiklander <jens.wiklander@linaro.org>

core: move pgt_cache to struct user_mode_ctx

Moves pgt_cache from struct thread_specific_data to struct
user_mode_ctx.

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome F

core: move pgt_cache to struct user_mode_ctx

Moves pgt_cache from struct thread_specific_data to struct
user_mode_ctx.

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 93dc6b29 23-Sep-2022 Jens Wiklander <jens.wiklander@linaro.org>

core: add pointer authentication support

Previously pointer authentication was only supported for TAs. With this
patch add a configuration option CFG_CORE_PAUTH to enable support for
core. Each priv

core: add pointer authentication support

Previously pointer authentication was only supported for TAs. With this
patch add a configuration option CFG_CORE_PAUTH to enable support for
core. Each privileged thread has its own APIA key. There are also a
separate APIA key for each physical core used when handling an abort or
when using the tmp stack.

Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 28d6e35a 23-Aug-2022 Jerome Forissier <jerome.forissier@linaro.org>

core: stack check: fix debug message

The lower limit for thread stacks printed by print_stack_limits()
when CFG_CORE_DEBUG_CHECK_STACKS=y is incorrect. It needs to be
increased by STACK_CHECK_EXTRA

core: stack check: fix debug message

The lower limit for thread stacks printed by print_stack_limits()
when CFG_CORE_DEBUG_CHECK_STACKS=y is incorrect. It needs to be
increased by STACK_CHECK_EXTRA to be consistent with the value
returned by get_stack_soft_limits(). While we're at it, improve
the SP out of range message to make it EMSG() rather than DMSG() and
show the stack limits. This makes it easier to identify in which
stack the pointer was supposed to be.

Here is an example of a stack overflow panic in thread 0:

D/TC:? 0 ldelf_syscall_open_bin:142 Lookup user TA ELF cb3e5ba0-adf1-11e0-998b-0002a5d5c51b (Secure Storage TA)
E/TC:? 0 Stack pointer out of range! 0x7e7bd618 not in [0x7e7bd630 .. 0x7e7bf030]
D/TC:? 0 print_stack_limits:179 tmp [0] 0x7e7c1c90..0x7e7c24b0
D/TC:? 0 print_stack_limits:179 tmp [1] 0x7e7c2ad0..0x7e7c32f0
D/TC:? 0 print_stack_limits:179 tmp [2] 0x7e7c3910..0x7e7c4130
D/TC:? 0 print_stack_limits:179 tmp [3] 0x7e7c4750..0x7e7c4f70
D/TC:? 0 print_stack_limits:184 abt [0] 0x7e7b8710..0x7e7b9330
D/TC:? 0 print_stack_limits:184 abt [1] 0x7e7b9950..0x7e7ba570
D/TC:? 0 print_stack_limits:184 abt [2] 0x7e7bab90..0x7e7bb7b0
D/TC:? 0 print_stack_limits:184 abt [3] 0x7e7bbdd0..0x7e7bc9f0
D/TC:? 0 print_stack_limits:189 thr [0] 0x7e7bd630..0x7e7bf030
D/TC:? 0 print_stack_limits:189 thr [1] 0x7e7bfc70..0x7e7c1670
E/TC:1 0 Panic at core/kernel/thread.c:207 <check_stack_limits>
E/TC:1 0 TEE load address @ 0x7e6e5000
E/TC:1 0 Call stack:
E/TC:1 0 0x7e6f1b10 print_kernel_stack at optee_os/core/arch/arm/kernel/unwind_arm64.c:80
E/TC:1 0 0x7e7071b8 __do_panic at optee_os/core/kernel/panic.c:24
E/TC:1 0 0x7e70cd14 check_stack_limits at optee_os/core/kernel/thread.c:207
E/TC:1 0 0x7e70dcd8 __cyg_profile_func_enter at optee_os/core/kernel/thread.c:237
E/TC:1 0 0x7e766b74 memset at optee_os/lib/libutils/isoc/newlib/memset.c:76
E/TC:1 0 0x7e768928 memzero_explicit at optee_os/lib/libutils/ext/memzero_explicit.c:22
E/TC:1 0 0x7e74de54 zeromem at optee_os/core/lib/libtomcrypt/src/misc/zeromem.c:26 (discriminator 2)
E/TC:1 0 0x7e74ddd8 burn_stack at optee_os/core/lib/libtomcrypt/src/misc/burn_stack.c:24
E/TC:1 0 0x7e74a32c rijndael_ecb_encrypt at optee_os/core/lib/libtomcrypt/src/ciphers/aes/aes.c:454
E/TC:1 0 0x7e743e44 crypto_aes_enc_block at optee_os/core/lib/libtomcrypt/aes.c:45 (discriminator 2)
E/TC:1 0 0x7e6fa1d0 decrypt_block at optee_os/core/crypto/aes-gcm-sw.c:98
E/TC:1 0 0x7e6fa2ec decrypt_pl at optee_os/core/crypto/aes-gcm-sw.c:118 (discriminator 3)
E/TC:1 0 0x7e6fa400 internal_aes_gcm_update_payload_blocks at optee_os/core/crypto/aes-gcm-sw.c:143
E/TC:1 0 0x7e6f93f4 __gcm_update_payload at optee_os/core/crypto/aes-gcm.c:246
E/TC:1 0 0x7e6f9504 operation_final at optee_os/core/crypto/aes-gcm.c:273
E/TC:1 0 0x7e6f9780 __gcm_dec_final at optee_os/core/crypto/aes-gcm.c:328
E/TC:1 0 0x7e6f9840 internal_aes_gcm_dec_final at optee_os/core/crypto/aes-gcm.c:342
E/TC:1 0 0x7e6f9a64 aes_gcm_dec_final at optee_os/core/crypto/aes-gcm.c:500
E/TC:1 0 0x7e6f85cc crypto_authenc_dec_final at optee_os/core/crypto/crypto.c:427
E/TC:1 0 0x7e7352d8 authenc_decrypt_final at optee_os/core/tee/fs_htree.c:511
E/TC:1 0 0x7e736094 tee_fs_htree_read_block at optee_os/core/tee/fs_htree.c:899
E/TC:1 0 0x7e732234 ree_fs_read_primitive at optee_os/core/tee/tee_ree_fs.c:340
E/TC:1 0 0x7e7334e8 read_dent at optee_os/core/tee/fs_dirfile.c:103
E/TC:1 0 0x7e734024 tee_fs_dirfile_open at optee_os/core/tee/fs_dirfile.c:143
E/TC:1 0 0x7e731ab4 open_dirh at optee_os/core/tee/tee_ree_fs.c:552
E/TC:1 0 0x7e731b50 get_dirh at optee_os/core/tee/tee_ree_fs.c:573
E/TC:1 0 0x7e732e38 ree_fs_open at optee_os/core/tee/tee_ree_fs.c:626
E/TC:1 0 0x7e72ec60 tadb_open at optee_os/core/tee/tadb.c:227
E/TC:1 0 0x7e72f3a0 tee_tadb_open at optee_os/core/tee/tadb.c:246 (discriminator 1)
E/TC:1 0 0x7e72ff7c tee_tadb_ta_open at optee_os/core/tee/tadb.c:643
E/TC:1 0 0x7e70fed8 secstor_ta_open at optee_os/core/kernel/secstor_ta.c:19
E/TC:1 0 0x7e706648 ldelf_syscall_open_bin at optee_os/core/kernel/ldelf_syscalls.c:145
E/TC:1 0 0x7e6f54c0 tee_svc_do_call at optee_os/core/arch/arm/tee/arch_svc_a64.S:140
E/TC:1 0 0x7e6ec780 thread_svc_handler at optee_os/core/arch/arm/kernel/thread.c:1104 (discriminator 4)
E/TC:1 0 0x7e6ea35c el0_svc at optee_os/core/arch/arm/kernel/thread_a64.S:825

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>

show more ...


# 5956c77e 23-Aug-2022 Jerome Forissier <jerome.forissier@linaro.org>

core: fix handling of CFG_STACK_THREAD_EXTRA and CFG_STACK_TMP_EXTRA

CFG_STACK_THREAD_EXTRA and CFG_STACK_TMP_EXTRA should be included in
STACK_THREAD_SIZE and STACK_TMP_SIZE, respectively, because

core: fix handling of CFG_STACK_THREAD_EXTRA and CFG_STACK_TMP_EXTRA

CFG_STACK_THREAD_EXTRA and CFG_STACK_TMP_EXTRA should be included in
STACK_THREAD_SIZE and STACK_TMP_SIZE, respectively, because not doing so
creates inconsistencies where some places use e.g., (STACK_THREAD_SIZE +
CFG_STACK_THREAD_EXTRA) while others use STACK_THREAD_SIZE only. Note
for example the discrepancy between the stack declaration:

DECLARE_STACK(stack_thread, CFG_NUM_THREADS,
STACK_THREAD_SIZE + CFG_STACK_THREAD_EXTRA, static);

...and the thread_stack_start() function:

vaddr_t thread_stack_start(void)
{
/* ... */

return thr->stack_va_end - STACK_THREAD_SIZE;
}

With this change, the _EXTRA values should also be properly taken into
account when pager is enabled, which was not the case before.

Fixes: cca7b5ebeb9b ("core: configuration switches to tune stack sizes")
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>
Tested-by: Jorge Ramirez-Ortiz <jorge@foundries.io> (STM32MP1, SE050, pager)

show more ...


# 528dabb2 08-Mar-2022 Jerome Forissier <jerome@forissier.org>

core: suppress text relocation on stack_tmp_export

stack_tmp_export is a pointer so it is associated with a dynamic
relocation when position-independent code is generated (ASLR). Moreover,
this symb

core: suppress text relocation on stack_tmp_export

stack_tmp_export is a pointer so it is associated with a dynamic
relocation when position-independent code is generated (ASLR). Moreover,
this symbol is in the .identity_map section, which is part of .text after
the final link. To get rid of this TEXTREL, remove stack_tmp_export and
compute the corresponding value in assembly instead from stack_tmp and
constants defined in core/arch/arm/kernel/asm-defines.c.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 891569af 01-Feb-2022 Jens Wiklander <jens.wiklander@linaro.org>

core: move thread_defs.h into thread.h

Moves the defines in core/arch/arm/include/kernel/thread_defs.h into
core/include/kernel/thread.h.

Reviewed-by: Jerome Forissier <jerome@forissier.org>
Acked-

core: move thread_defs.h into thread.h

Moves the defines in core/arch/arm/include/kernel/thread_defs.h into
core/include/kernel/thread.h.

Reviewed-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Marouene Boubakri <marouene.boubakri@nxp.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# ca825890 01-Feb-2022 Jens Wiklander <jens.wiklander@linaro.org>

core: split core/arch/arm/kernel/thread.c

Splits core/arch/arm/kernel/thread.c into one generic and one
architecture specific file.

Acked-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Marou

core: split core/arch/arm/kernel/thread.c

Splits core/arch/arm/kernel/thread.c into one generic and one
architecture specific file.

Acked-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Marouene Boubakri <marouene.boubakri@nxp.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...