Age | Commit message (Collapse) | Author |
|
Now that we have the standard function dl_iterate_phdr() in libutee, we
can use it to process the initialization and finalization arrays in the
ELF files and deprecate the ad-hoc structure __init_fini_info
introduced in commit dd655cb9906c ("ldelf, ta: add support for
DT_INIT_ARRAY and DT_FINI_ARRAY") [1].
Unfortunately, removing __init_fini_info is not an option if we want to
ensure backward compatibility. This concerns only TAs which use ELF
initialization and/or finalization functions.
[1] Released in version 3.9.0.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
Adds enough runtime Thread Local Storage (TLS) support for the GNU C++
compilers (arm-linux-gnueabihf-g++, aarch64-linux-gnu-g++) to work with
OP-TEE. That is:
- A Thread Control Block,
- The __tls_get_addr() and dl_iterate_phdr() functions.
Note that __tls_get_addr() is an ABI helper so it has no prototype in a
user-accessible header file. dl_iterate_phdr() however is defined in
<link.h> and may be used in a TA. The file lib/libutee/include/link.h is
borrowed from Android's Bionic [1] with minor changes (added the
required #include statement and named the function parameters). A
similar <link.h> header is provided by other C libraries such as GNU
libc, musl and FreeBSD/NetBSD/OpenBSD.
Link: [1] https://android.googlesource.com/platform/bionic/+/master/libc/include/link.h
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
Adds header file <elf.h> in addition to <elf32.h> and <elf64.h>. This
file defines the various Elf types depending on the current
architecture. In other words: when building for Aarch32 Elf_* is defined
as Elf32_*, but when building for Aarch64 it is defined as Elf64_*. This
will be useful for programs which need to examine their own structure
via dl_iterate_phdr() (which will come in a later commit).
Note: <elf.h> serves the same purpose as FreeBSD's <sys/elf.h> but does
it differently; the file is not imported from FreeBSD.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
Moves the ELF headers (elf32.h, elf64.h, elf_common.h) from
ldelf/include to lib/libutee/include so that they may be used
by libutee to implement the dl_iterate_phdr() function. This will be
done in a later commit.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
Adds macros to <arm64_user_sysreg.h> to access TPIDR_EL0, the EL0 Read/
Write Software Thread ID Register.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
Preserves the value of TPIDR_EL0 set by user space by saving and
restoring the register in case of syscall or foreign interrupt.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
This commit adds support for relocation type R_AARCH64_TLS_TPREL.
Although OP-TEE does not support multi-threaded TAs, introducing basic
support for multi-threading will allow binaries generated by the
aarch64-linux-gnueabihf-g++ compiler to work properly. Indeed, this
compiler is configured for a multi-threadded environment by default.
The way R_AARCH64_TLS_TPREL works is simple: the runtime library needs
to keep a per-thread copy of all the TLS segments in the application.
When the compiler needs to access a thread-specific symbol, it emits
this relocation. The loader will then replace the value by the offset
of the desired symbol in the Thread Control Block of the current thread
(the address of the TCB is obtained via the TPIDR_EL0 register).
The runtime code that sets up the TCB from the TLS segments will come
in a later commit.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
This commit adds support for Thread Local Storage (TLS) relocation
types R_ARM_TLS_DTPMOD32 and R_ARM_TLS_DTPOFF32.
OP-TEE does not support multi-threaded TAs so in principle there is no
need to handle the TLS relocations. However, this commit will allow to
run C++ TAs built with the "official" arm-linux-gnueabihf compiler
(which is built with threading support enabled), as long as no
multi-thread feature is explicitly used by the TA. In other words, it
avoids the need to re-build a toolchain with --disable-threads.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
When ldelf performs a symbol lookup in a TA, it currently considers
only global symbols that are not undefined. It turns out that g++ can
generates dynamic relocations referencing symbols that are weak and
undefined [1], in other words: weak declarations. Those should end up
resolving to zero.
This commit updates the symbol resolution to first look for global
defined symbols, then weak defined, then weak undefined.
[1] __pthread_key_create, pthread_mutex_lock, pthread_mutex_unlock,
__gnu_Unwind_Find_exidx.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
Adds a few <stdio.h> functions to libutils:
fputc() fputs() fwrite() write()
The proposed implementations are limited in the sense that they only
accept writing to stdout or stderr. The output goes directly to the
secure console and no difference is made between stdout and stderr.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
Implement sprintf() in libutils.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
Adds .eh_frame_hdr and .eh_frame sections to the TA linker script.
Those may be generated by the C++ compiler. The fragment is compied
from GCC's internal linker script (shown by -Wl,-verbose).
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
Adds a .gcc_except_table section merging the multiple entries that may
be generated by the C++ compiler. The fragment is copied from GCC's
internal linker script (shown by -Wl,-verbose).
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
TA object file generated by a thread-enabled toolchain (such as g++
built without --disable-threads) may contain .tdata* and .tbss*
sections even if the application is single threaded. Those are similar
to .data and .bss except that they are templates to be used by the
runtime code to set up Thread Local Storage data blocks.
This commit adds those two sections as well as related relocation
sections (.rel.tdata, .rel.tbss, .rela.tdata, .rela.tbss). The
fragments are copied from GCC's internal linker script (shown by
-Wl,-verbose). They are inserted next to .dynamic and .got because they
may all be part of a RELRO segment if the linker chooses to create one.
In practice there can be only one RELRO segment [1] so sections have to
be contiguous. Note that ldelf currently ignores RELRO.
[1] https://reviews.llvm.org/D40029
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Preparing for C++ support in TAs.
__exidx_start and __exidx_end are referenced by libgcc_eh.a.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Shippable has a maximum build time of 1 hour for Open Source projects.
It is usually sufficient since typical build time is currently around
35 minutes, thanks to caching (ccache). But it can happen that the code
is changed too much by a pull request in which case the cache is
ineffective and build time would exceed 1 hour. When a build times out,
the cache is NOT updated and there is no other choice than to manually
feed the cache with a partial build (by removing some steps in
.shippable.yml) so that the next build can be quicker, wait for the
build to succeed, then restore all the build steps. This is quite
impractical.
This commit replaces the Shippable built-in caching mechanism with our
own cache on a cloud server (currently a Digital Ocean [1] VM).
Automatic upload is triggered after 50 minutes of build time (or at the
end of the build). Therefore, if the build times out we have a
significant amount of data in the cache and restarting the build is
usually all it takes to deal with the issue.
Cache data are transferred using SSH and the cache server is configured
with the public key of the official OP-TEE OS Shippable project (the
one that is used to build pull requests).
In addition to being tolerant to time outs, this new method is usually
faster too, because the archive is streamed directly to/from the server
whereas Shippable creates a local .tar.gz file first.
For all intents and purposes I am documenting the security configuration
of the VM:
- Ubuntu 20.04 with default settings
- Dedicated user account: 'shippable'
- The OP-TEE SSH key [3] is added to ~shippable/.ssh/authorized_keys
- The login shell for user 'shippable' is /usr/sbin/rush [2] with the
following /etc/rush.rc:
debug 1
rule default
acct on
limits t10r20
umask 002
env - USER LOGNAME HOME PATH
fall-through
rule cat-to
command ^cat >[a-zA-Z0-9_\.-]+$
chdir /home/shippable
transform s@(.*)@/usr/bin/bash -c "\\1"@
rule cat-from
command ^cat [a-zA-Z0-9_\.-]+$
chdir /home/shippable
transform s@(.*)@/usr/bin/bash -c "\\1"@
[1] https://digitalocean.com/
[2] https://www.gnu.org/software/rush/
[3] https://app.shippable.com/subs/github/OP-TEE/settings
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Symbols defined in a linker script are assigned type STT_NOTYPE, but
the __resolve_sym() function in ldelf only supports STT_OBJECT and
STT_FUNCTION. As a result, it is impossible to resolve STT_NOTYPE
symbols at runtime. This causes an error in shared libraries when
ftrace is enabled:
# Platform: QEMU
$ make CFG_FTRACE_SUPPORT=y CFLAGS_ta_arm32=-pg run
$ xtest 1019
D/LD: ldelf:134 Loading TA 5b9e0e40-2636-11e1-ad9e-0002a5d5c51b
E/LD: __resolve_sym:61 Symbol type not supported
E/TC:? 0 init_with_ldelf:232 ldelf failed with res: 0xffff000a
* regression_1019 Test dynamically linked TA
regression_1000.c:1502: [...] TEEC_ERROR_NOT_SUPPORTED
This commit adds STT_NOTYPE to the supported types, handled the same way
as STT_OBJECT and STT_FUNCTION.
Fixes: 97c5ac19427b ("ldelf: check ranges in __resolve_sym()")
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
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>
|
|
Similar fix to commit 19b3fe6c5a72 ("core: arm: fix the unwind stack
failure with __no_return function") for user space.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
The value of CFG_TEE_TA_LOG_LEVEL used at optee_os build time is
exported to the TA dev kit ($O/export_ta_arm{32,64}/mk/conf.mk). The
purpose is to provide a default value to the TA build environment,
which can easily be changed from the command line ("make
CFG_TEE_TA_LOG_LEVEL=3" for example).
However the following TA Makefile won't behave as expected:
BINARY := <somme uuid>
CFG_TEE_TA_LOG_LEVEL := 3 # Ignored!
include $(TA_DEV_KIT_DIR)/mk/ta_dev_kit.mk
This commit changes := to ?= so that ta_dev_kit.mk won't override any
value that may have been set previously in the TA Makefile or the
environment.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
User can call TEE_AsymmetricSignDigest with a NULL signature and a valid
zero signatureLen in order to discover the size of the required
signature buffer (function should then return TEE_ERROR_SHORT_BUFFER and
update signatureLen with the required amount).
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
When CFG_TEE_CORE_LOG_LEVEL=4 and CFG_RPMB_FS=y, the TEE core crashes
with a dead stack canary message:
E/TC:0 0 Dead canary at end of 'stack_abt[3]'
E/TC:0 0 Panic at core/arch/arm/kernel/thread.c:192 <thread_check_canaries>
E/TC:0 0 TEE load address @ 0x1bd0f000
E/TC:0 0 Call stack:
E/TC:0 0 0x1bd17b3d print_kernel_stack at optee_os/core/arch/arm/kernel/unwind_arm32.c:452
E/TC:0 0 0x1bd23a07 __do_panic at optee_os/core/kernel/panic.c:32 (discriminator 1)
E/TC:0 0 0x1bd120cb thread_check_canaries at optee_os/core/arch/arm/kernel/thread.c:188 (discriminator 2)
E/TC:0 0 0x1bd12c1f thread_state_suspend at optee_os/core/arch/arm/kernel/thread.c:754
E/TC:0 0 0x1bd14610 thread_rpc at optee_os/core/arch/arm/kernel/thread_optee_smc_a32.S:227
The issue happens to be with the debug function dump_fat() which causes
infinite recursion. Fix it by doing nothing until after RPMB
initialization has completed.
Fixes: 5f68d7848fe8 ("core: RPMB FS: Caching for FAT FS entries")
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
This patch fixes the following error triggered by a heavily parallel build:
echo sm := ta_arm64 > .../export-ta_arm64/mk/conf.mk.tmp
/bin/bash: .../export-ta_arm64/mk/conf.mk.tmp: No such file or directory
Fixes: https://github.com/OP-TEE/optee_os/issues/3999
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Tested-by: Ross Burton <ross.burton@arm.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
unwind operation use LR instead of PC to locate unwind data. In some
case, the compiler removes all the extra instrustions after a branch to
__no_return function, and then LR saves the address of next function,
rather than the caller of the __no_return function, leading to unwind
failure.
The fix manually adjust the LR value to match the search algorithm so
as to locate the correct caller in unwind stack operation.
Signed-off-by: Angelina Zhao <xuemingzhao@asrmicro.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
[jf: reformat the commit description]
Signed-off-by: Jerome Forissier <jerome@forissier.org>
|
|
Removes the PM stubs and all references to CFG_PM_STUBS.
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
The thread_*_handler_ptr function pointers only holds the same constant
value. Instead of loading the function pointer from the entry functions
call the handler functions directly and remove these
thread_*_handler_ptr function pointers.
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
struct thread_handlers is used to pass the entry functions
for different power management events. In practice only .cpu_on is used
and with the default function at that. In the ARMv7 case where the
secure monitor replaces TF-A not even that function entry is used.
Remove struct thread_handlers and boot_get_handlers(). When configured
with TF-A initialize thread_*_handler_ptr with __weak default functions.
The __weak default PM functions
- thread_cpu_off_handler()
- thread_cpu_suspend_handler()
- thread_cpu_resume_handler()
- thread_system_off_handler()
- thread_system_reset_handler()
can be overridden by platforms when needed.
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
When CFG_REE_FS and CFG_RPMB_FS are both 'y', the data stored by OP-TEE
in the REE filesystem (typically, under /data/tee) are protected by
hashes stored in the RPMB. Any modifications to the REE files via
external means are therefore detected and TEE_ERROR_SECURITY is
returned. However, no error or debug message is printed to the secure
console which makes troubleshooting more difficult than needed. This
commit adds a debug message.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
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>
|
|
io_write32() would replace the settings bits while writing the lock
bits, replace the setting of the lock bits with io_setbits32() to ensure
that the access bits won't be overwritten. The lock bit mask also
contained access value bits, remove those.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Acked-by: Clement Faure <clement.faure@nxp.com>
|
|
In __thread_std_smc_entry() for the legacy SMC interface the RPC SHM
cache is cleared when a thread is done. Add the same handling to the
FF-A case.
Acked-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Replaces tee_fs_rpc_cache_alloc() with thread_rpc_shm_alloc() which also
takes a shared memory type as argument. This allows allocating an kernel
private RPC buffer when needed.
Acked-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
OP-TEE doesn't support "global" shm allocations with FF-A yet. Provide
dummy implementations of the functions to simplify configuration.
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Request shared memory allocation of TYPE_KERNEL memory
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
[jw: add spmc counter part]
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Adds support for using FF-A as transport instead of using the
proprietary SMCs defined in optee_smc.h.
The configuration support the case where SPM Core is implementation at
S-EL1, that is, inside OP-TEE. This configuration is also know as "S-EL1
SPMC" in the FF-A 1.0 specification [1].
Compile with CFG_CORE_SEL1_SPMC=y
Note that this is an experimental feature, ABIs etc may have
incompatible changes
Link: [1] https://static.docs.arm.com/den0077/a/DEN0077A_PSA_Firmware_Framework_Arm_v8-A_1.0_EAC.pdf
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
PSCI_CPU_ON
This patch adds support to use the PSCI_CPU_ON function to register the
entry point for each OP-TEE context on a secondary CPU. This function is
invoked on the boot CPU during initialisation. When the physical CPU is
turned on by the Normal world, the SPMD in EL3 arranges for the entry
point to be invoked to perform OP-TEE initialisation.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Achin Gupta <achin.gupta@arm.com>
[jw: small edits + AAarch32 support]
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Adds a new mobj, mobj_ffa, tailored to handle shared memory
registrations over FF-A.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Adds optee_ffa.h which defines the OP-TEE ABI when Arm Platform Security
Architecture Firmware Framework for Arm V8-A [1] is used as transport
instead of raw proprietary SMCs. This ABI where OP-TEE specific
implementation is used to fill the implementation specific gaps in the
specification is called OP-TEE FF-A, or sometimes just FF-A.
A new memref type, struct optee_msg_param_fmem, is added to carry
information needed to create new shared memory mobjs.
Link: [1] https://static.docs.arm.com/den0077/a/DEN0077A_PSA_Firmware_Framework_Arm_v8-A_1.0_EAC.pdf
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
This patch adds FF-A 1.0 definitions based on [1] and an earlier version
of this .h file [2] from TF-A.
Link: [1] https://static.docs.arm.com/den0077/a/DEN0077A_PSA_Firmware_Framework_Arm_v8-A_1.0_EAC.pdf
Link: [2] https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/plain/include/services/spci_beta0.h?h=topics/spci_beta0_spmd&id=c5afe561f653449f4fd9df1d50cf70c60fc0d343
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Co-developed-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Adds PSCI_CPU_ON_SMC64 which is using the 64-bit calling convention as a
complement to define PSCI_CPU_ON using the 32-bit calling convention.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Fix typo in function label: init_devive_from_hw_config() is renamed
init_device_from_hw_config().
Fix also a typo in source file inline comment.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
After processing a sub.mk by subdir.mk also clear aflags-remove-y
together with the rest of the variables to clear.
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
The mempool code can be simplified by using a recursive mutex.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Adds support for recursive mutex objects. A recursive mutex may be
locked several times by the same thread without causing a deadlock.
The implementation is copied from the get_pool()/put_pool() functions
in lib/libutils/ext/mempool.c, which will be updated to use the new
mutex type in a later commit.
In order to avoid the overhead associated with recursive mutexes when
not needed, a new struct recursive_mutex is introduced as well as
specific functions: mutex_init_recursive(), mutex_destroy_recursive(),
mutex_lock_recursive() and mutex_unlock_recursive(). A static initializer
is also available (RECURSIVE_MUTEX_INITIALIZER).
mutex_get_recursive_lock_depth() returns the current lock depth (only
valid to call from the thread holding the lock).
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Adds atomic functions operating on the 'short int' type.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Code cleanup: use THREAD_ID_INVALID rather that its value (-1).
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Changes thread_get_id() and thread_get_id_may_fail() to return 'short
int' instead of 'int'. That is, 16 bits instead of 32 on all supported
architectures which is more than enough since the largest thread ID
value is (CFG_NUM_THREADS - 1). Note, struct wait_queue_elem::handle
is already a short int.
trace_ext_get_thread_id() is not changed (still returns an int) because
it is part of the TA API and modifying it would needlessly introduce
incompatibilities.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
A persistent object (token object in PKCS#11 spec) is stored as
a binary blob of attribute list identified by a UUID.
The persistent database stores the UUIDs of the persistent objects
of the token.
Reviewed-by: Ricardo Salveti <ricardo@foundries.io>
Co-developed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
Implement commands PKCS11_CMD_CREATE_OBJECT and PKCS11_CMD_DESTROY_OBJECT.
Reviewed-by: Ricardo Salveti <ricardo@foundries.io>
Co-developed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|
|
* Helper functions for object attributes management.
* Helper functions to safely parse client attributes template
to create a list of attributes for a object in the PKCS11 ta.
* Helper functions for assigning or checking object attributes
according to PKCS#11 specification.
* Add id-to-string conversion for attribute/class/key types.
* Helper functions to analyze object attributes.
Reviewed-by: Ricardo Salveti <ricardo@foundries.io>
Co-developed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
|