| #
76d6685e |
| 17-Dec-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
tree-wide: use power-of-2 rounding macros where applicable
Use ROUNDUP2(), ROUNDUP2_OVERFLOW(), ROUNDUP2_DIV() and ROUNDDOWN2() at places where the rounding argument is a variable value and we want
tree-wide: use power-of-2 rounding macros where applicable
Use ROUNDUP2(), ROUNDUP2_OVERFLOW(), ROUNDUP2_DIV() and ROUNDDOWN2() at places where the rounding argument is a variable value and we want to leverage the implementation of these routines optimized for a power-of-2 rounding argument.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
25675979 |
| 18-Apr-2024 |
Alvin Chang <alvinga@andestech.com> |
ldelf: Fix dumping physical address of ELF segment
Fix the strange values of "pa" when TA ELF mappings is dumped. The function argument of print_seg() should be explicit physical address of mapping
ldelf: Fix dumping physical address of ELF segment
Fix the strange values of "pa" when TA ELF mappings is dumped. The function argument of print_seg() should be explicit physical address of mapping rather than offset of the segment.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Tested-by: Yu Chien Peter Lin <peterlin@andestech.com> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (vexpress-qemu_armv8a) Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| #
fa21a1fb |
| 05-Jan-2024 |
Clement Faure <clement.faure@nxp.com> |
core: check if string to uuid conversion succeed
Check return value of tee_uuid_from_str().
Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jerome Forissier <jerome.forissier@lina
core: check if string to uuid conversion succeed
Check return value of tee_uuid_from_str().
Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| #
49286073 |
| 10-Jan-2024 |
Clement Faure <clement.faure@nxp.com> |
ldelf: remove unnecessary includes
Remove unnecessary includes.
Signed-off-by: Clement Faure <clement.faure@nxp.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklande
ldelf: remove unnecessary includes
Remove unnecessary includes.
Signed-off-by: Clement Faure <clement.faure@nxp.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| #
5f7f88c6 |
| 15-Jan-2024 |
Sumit Garg <sumit.garg@linaro.org> |
ldelf: aarch32: Accept ELFOSABI_ARM as OS ABI
Rust TAs built for no-std mode targeting 32-bit Arm architecture use ELFOSABI_ARM as the OS ABI within ELF header. So allow ldelf to load those Rust TAs
ldelf: aarch32: Accept ELFOSABI_ARM as OS ABI
Rust TAs built for no-std mode targeting 32-bit Arm architecture use ELFOSABI_ARM as the OS ABI within ELF header. So allow ldelf to load those Rust TAs built for 32-bit Arm.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (vexpress-qemu_armv8a) Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
show more ...
|
| #
6cfa381e |
| 31-May-2023 |
Jens Wiklander <jens.wiklander@linaro.org> |
ldelf: look for ta_head symbol
Legacy TAs has their TA header as at the load address of the TA binary. However, in commits to follow the TA header will instead be located in the symbol ta_head locat
ldelf: look for ta_head symbol
Legacy TAs has their TA header as at the load address of the TA binary. However, in commits to follow the TA header will instead be located in the symbol ta_head located somewhere inside the ELF binary. So update the ldelf to support the updated format while still supporting legacy TAs.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
ba2a6adb |
| 02-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
ldelf: Add TA stack trace for RISC-V architecture
Implement ta_elf_stack_trace_riscv() to unwind the stack of TA. Also the RISC-V architecture string of TA ELF is added into dump information.
Signe
ldelf: Add TA stack trace for RISC-V architecture
Implement ta_elf_stack_trace_riscv() to unwind the stack of TA. Also the RISC-V architecture string of TA ELF is added into dump information.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| #
af78e1b1 |
| 24-Oct-2022 |
Imre Kis <imre.kis@arm.com> |
ldelf: Provide access to TS load address
Propagate ELF load address from ldelf to user mode context as a preparation for load address relative memory regions.
Signed-off-by: Imre Kis <imre.kis@arm.
ldelf: Provide access to TS load address
Propagate ELF load address from ldelf to user mode context as a preparation for load address relative memory regions.
Signed-off-by: Imre Kis <imre.kis@arm.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
8fab4371 |
| 30-Nov-2022 |
liushiwei <liushiwei@eswincomputing.com> |
ldelf: support RISC-V
Add 64-bit RISC-V ldelf startup assembly and parsing 64-bit ELF files.
Signed-off-by: liushiwei <liushiwei@eswincomputing.com> Tested-by: liushiwei <liushiwei@eswincomputing.c
ldelf: support RISC-V
Add 64-bit RISC-V ldelf startup assembly and parsing 64-bit ELF files.
Signed-off-by: liushiwei <liushiwei@eswincomputing.com> Tested-by: liushiwei <liushiwei@eswincomputing.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
bdf82531 |
| 06-Mar-2022 |
Jerome Forissier <jerome.forissier@linaro.org> |
ldelf: add DT_GNU_HASH support
It is possible for an ELF to be compiled with --hash-style=gnu; some distros even have that as their default. This produces an ELF with no .hash section, but with a .g
ldelf: add DT_GNU_HASH support
It is possible for an ELF to be compiled with --hash-style=gnu; some distros even have that as their default. This produces an ELF with no .hash section, but with a .gnu.hash section in its stead.
GNU-style hash sections have better performance than old SYSV-style ones. It can be expected that, as time goes on, it becomes the new default.
Use the DT_GNU_HASH table for symbol lookup when present, then fall back onto DT_HASH.
Co-developed-by: Elvira Khabirova <e.khabirova@omp.ru> Signed-off-by: Elvira Khabirova <e.khabirova@omp.ru> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
6627f23e |
| 23-Jun-2022 |
Jerome Forissier <jerome.forissier@linaro.org> |
ldelf: get DT_HASH info from section headers
Obtain the address of the DT_HASH section from the section headers rather than from the dynamic section. In addition to being simpler, this method can ea
ldelf: get DT_HASH info from section headers
Obtain the address of the DT_HASH section from the section headers rather than from the dynamic section. In addition to being simpler, this method can easily provide the size of the section. It is not needed in this case but will be useful when introducing support for DT_GNU_HASH.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
0d482f82 |
| 02-Nov-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ldelf: Add support for mapping ELF executable sections as guarded
Introduce LDELF_MAP_FLAG_BTI to indicate if ELF supports BTI. A BTI instruction is used to guard against the execution of instructio
ldelf: Add support for mapping ELF executable sections as guarded
Introduce LDELF_MAP_FLAG_BTI to indicate if ELF supports BTI. A BTI instruction is used to guard against the execution of instructions that are not the intended target of a branch. The executable pages need to be marked as guarded to ensure that BTI doesn't execute as NOP.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Acked-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
e84a7da4 |
| 02-Nov-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ldelf: Add ELF program property parsing support to check for BTI
ELF program properties will be needed for detecting whether to enable optional architecture or ABI features for a new ELF process.
T
ldelf: Add ELF program property parsing support to check for BTI
ELF program properties will be needed for detecting whether to enable optional architecture or ABI features for a new ELF process.
The PT_GNU_PROPERTY is generated by a linker to describe the .note.gnu.property section. The definition of PT_GNU_PROPERTY can be found in [1].
For AArch64, GNU_PROPERTY_AARCH64_FEATURE_1_AND program property type describes a set of processor features with which an ELF object or executable image is compatible, but does not require in order to execute correctly. These processor features are BTI and PAC.
[1] https://github.com/hjl-tools/linux-abi/wiki/linux-abi-draft.pdf
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
be501eb1 |
| 05-Oct-2021 |
Jorge Ramirez-Ortiz <jorge@foundries.io> |
util: rename ALIGNMENT_IS_OK to IS_ALIGNED_WITH_TYPE
Implement the renamed macro using the IS_ALIGNED definition.
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Reviewed-by: Etienne Carrie
util: rename ALIGNMENT_IS_OK to IS_ALIGNED_WITH_TYPE
Implement the renamed macro using the IS_ALIGNED definition.
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
e6e0ed52 |
| 19-Feb-2021 |
Jens Wiklander <jens.wiklander@linaro.org> |
ldelf: assert result in print_seg()
Adds a few assert() that snprintf() succeeds in print_seg().
This fixes coverity scan: CID 1501815 (#4 of 4): Unchecked return value (CHECKED_RETURN)
Reviewed-
ldelf: assert result in print_seg()
Adds a few assert() that snprintf() succeeds in print_seg().
This fixes coverity scan: CID 1501815 (#4 of 4): Unchecked return value (CHECKED_RETURN)
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
baa5161d |
| 11-Dec-2020 |
Balint Dobszay <balint.dobszay@arm.com> |
core: ldelf: implement separate syscalls for ldelf
Implements a separate syscall handler for ldelf to decouple it from user TAs and enable using it for all TSs. The calling convention is the same as
core: ldelf: implement separate syscalls for ldelf
Implements a separate syscall handler for ldelf to decouple it from user TAs and enable using it for all TSs. The calling convention is the same as for utee_* syscalls. To distinguish between the different SVCs, the syscall handler pointer is updated before entering ldelf and restored after returning. The step of opening a system PTA session and invoking the commands there is eliminated, the necessary functionality is implemented in the ldelf syscall functions.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
show more ...
|
| #
7f752871 |
| 03-Sep-2020 |
Jerome Forissier <jerome@forissier.org> |
ldelf: use libunw
Drop ldelf/unwind_arm32,64}.c and use common code from libunw instead.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.or
ldelf: use libunw
Drop ldelf/unwind_arm32,64}.c and use common code from libunw instead.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
01b02a16 |
| 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ldelf, libutee: rework support of DT_INIT_ARRAY/DT_FINI_ARRAY
Now that we have the standard function dl_iterate_phdr() in libutee, we can use it to process the initialization and finalization arrays
ldelf, libutee: rework support of DT_INIT_ARRAY/DT_FINI_ARRAY
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>
show more ...
|
| #
9d224046 |
| 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ldelf, libutee: add minimal Thread Local Storage support
Preparing for C++ support in TAs.
Adds enough runtime Thread Local Storage (TLS) support for the GNU C++ compilers (arm-linux-gnueabihf-g++,
ldelf, libutee: add minimal Thread Local Storage support
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>
show more ...
|
| #
fe684948 |
| 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ldelf: arm64: support R_AARCH64_TLS_TPREL relocations
Preparing for C++ support in TAs.
This commit adds support for relocation type R_AARCH64_TLS_TPREL. Although OP-TEE does not support multi-thre
ldelf: arm64: support R_AARCH64_TLS_TPREL relocations
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>
show more ...
|
| #
c88ba125 |
| 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ldelf: arm: support R_ARM_TLS_DTPMOD32 and R_ARM_TLS_DTPOFF32 relocations
Preparing for C++ support in TAs.
This commit adds support for Thread Local Storage (TLS) relocation types R_ARM_TLS_DTPMOD
ldelf: arm: support R_ARM_TLS_DTPMOD32 and R_ARM_TLS_DTPOFF32 relocations
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>
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 ...
|
| #
dcf64f87 |
| 09-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
ldelf: prints consistent with readelf
Prints names of sections consistent with names used in the readelf utility.
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander
ldelf: prints consistent with readelf
Prints names of sections consistent with names used in the readelf utility.
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
e97bbbb2 |
| 09-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
ldelf: consistent error codes
Changes error codes related to bad format or values in ELF to TEE_ERROR_BAD_FORMAT. This includes overflowing multiplications and addresses outside the range of the cur
ldelf: consistent error codes
Changes error codes related to bad format or values in ELF to TEE_ERROR_BAD_FORMAT. This includes overflowing multiplications and addresses outside the range of the current ELF being parsed.
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
c5a3ce04 |
| 05-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
ldelf: calculate correct elf->max_addr
Prior to this patch when the different load sections are mapped elf->max_addr is inceased as appropriate, except in one case, when memsz is larger than filesz.
ldelf: calculate correct elf->max_addr
Prior to this patch when the different load sections are mapped elf->max_addr is inceased as appropriate, except in one case, when memsz is larger than filesz. With this patch use memsz instead to calculate elf->max_addr in order to also cover .bss and friends.
Reviewed-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|