aboutsummaryrefslogtreecommitdiff
path: root/ta
AgeCommit message (Collapse)Author
2019-04-29gprof: define original mcount APIs inserted by compilerSumit Garg
Simplify gprof implementation via defining original mcount APIs: _mcount (for aarch64) and __gnu_mcount_nc (for arm) inserted by compiler instead of providing them via __utee_mcount API. Also remove weak definitions of mcount API that were earlier mandated by linker script via PROVIDE(). Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
2019-03-05Allow building libutils etc. as shared librariesJerome Forissier
When CFG_ULIBS_SHARED=y (default n), build libutils, libmpa/libmbedtls and libutee as shared libraries (.so). The static archives (.a) are still produced. The linker uses shared libraries by default when present so TAs just need to be re-built to use the shared libraries. For the time being, in-tree TAs are always linked statically for practical reasons. Indeed, in-tree TAs (such as ta/avb) are likely to be used as "early TAs". If such a TA was linked against shared libraries, then those libraries would need to be installed in the "early TA" area, too. While this works fine technically, it requires some more steps in the Makefiles to make sure the proper dependencies are installed and also it would mean that those libraries take precedence over the ones potentially installed in the REE FS etc. In other words, it would raise questions that we do not want nor need to address now. 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>
2019-03-05User TA: add --as-needed to link flagsJerome Forissier
Add link flag '--as-needed' to avoid adding dependencies onto shared libraries that are not actually used. This becomes particularly useful when we build the base user libraries (libutils, libmpa and libmbedtls) as shared objects. Without the flag, and because all libraries are passed to the linker by default, all TAs would need to map all the libraries at runtime resulting in a waste of memory. 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>
2019-02-08ta: link.mk: set linker max-page-size to 4KJerome Forissier
TA binaries contain a lot of zero padding (almost 64 KiB) between sections .ta_head and .text. This value can be reduced to 4 KiB by reducing the linker's max-page-size parameter. Since the OP-TEE ELF loader always aligns on small page boundaries, it does not make sense to request a larger alignment. This patch adds "-z max-page-size=4096" to the linker flags so that the alignment constraints are relaxed from 64 KiB (the default for our 32 and 64 targets as it seems) to what OP-TEE is actually expecting (4 KiB). The TA file size is reduced by 60 KiB. It changes nothing to the layout of the TA in memory. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-12-21ta: avb: add support for named persistent valuesIgor Opaniuk
Introduce support for named persistent values [1], that are mainly used to store persistent digests. Link: [1] https://android.googlesource.com/platform/external/avb/+/master/README.md#Named-Persistent-Values Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2018-12-11ta: switch to to mbedtls for bignumJens Wiklander
Adds tee_api_arith_mpi.c wrapper providing the TEE Arithmetical API around the big (mpi) routines from mbedtls. CFG_TA_MBEDTLS_MPI=y (default y) enables the usage of the bignum routines in libutee. Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-29TA: export CFG_TEE_TA_LOG_LEVEL to dev-kitJens Wiklander
Exports CFG_TEE_TA_LOG_LEVEL to TA dev-kit. It can still be overridden when compiling the TA, but it makes sense to default to the value used when compiling the dev-kit. Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-09-17ta: link.mk: evaluate $(sm) values in targetsIgor Opaniuk
$(sm) var isn't properly evalutated as the link.mk is included (final evaluation is done when the rule is triggered). Add dynamic target generation based on the current value of $(sm) Fixes: https://github.com/OP-TEE/optee_os/issues/2537 Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2018-08-27ta: link.mk: filter out dependency and command files from $(MAKEFILE_LIST)Jerome Forissier
Prevents ta.lds from being needlessly re-generated, such as in the following test case: $ make -s out/arm-plat-vexpress/ta/avb/ta.lds $ make -s out/arm-plat-vexpress/core/kernel/console.o $ make out/arm-plat-vexpress/ta/avb/ta.lds CHK out/arm-plat-vexpress/conf.mk CHK out/arm-plat-vexpress/include/generated/conf.h CPP out/arm-plat-vexpress/ta/avb/ta.lds The last line should not hapen because ta.lds exists already, and building the unrelated console.o should not trigger a re-build. The cause of the re-build is the dependency on $(MAKEFILE_LIST) which contains *all* the files that record previous build command and dependencies such as out/arm-plat-vexpress/core/kernel/.console.o.{d,cmd}. Filter out those files, thus keeping only the static Makefiles (*.mk). This is still more than needed since all the core *.mk are present, but listing only the TA-related makefiles seems tricky (has to work both inside and outside the OP-TEE build environment), and removing $(MAKEFILE_LIST) altogether presents a risk that TA developers using the TA dev kit will complain that their TA doesn't get re-built after a flag is changed in a Makefile. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-08-13Do not make in-tree TAs depend on a phony targetJerome Forissier
Commit cf903a62bc12 ("Add dependency on ta-dev-kit when building in-tree TA") introduces a dependency of the in-tree TA object files on the phony target 'ta_dev_kit'. The purpose was to make sure the dev kit files are available when make starts building the TA. Unfortunately, this introduces useless recompilation (the lines marked with >): $ make -s && make CHK out/arm-plat-vexpress/conf.mk CHK out/arm-plat-vexpress/include/generated/conf.h CHK out/arm-plat-vexpress/conf.cmake CHK out/arm-plat-vexpress/export-ta_arm32/mk/conf.mk > CC out/arm-plat-vexpress/ta/avb/entry.o > CC out/arm-plat-vexpress/ta/avb/user_ta_header.o > CPP out/arm-plat-vexpress/ta/avb/ta.lds > LD out/arm-plat-vexpress/ta/avb/023f8f1a-292a-432b-8fc4-de8471358067.elf > OBJDUMP out/arm-plat-vexpress/ta/avb/023f8f1a-292a-432b-8fc4-de8471358067.dmp > OBJCOPY out/arm-plat-vexpress/ta/avb/023f8f1a-292a-432b-8fc4-de8471358067.stripped.elf > SIGN out/arm-plat-vexpress/ta/avb/023f8f1a-292a-432b-8fc4-de8471358067.ta This happens because phony targets are always considered new by the make program, so they'd rather not be used as dependencies. Instead, replace 'ta-dev-kit' by the actual list of all the files in the TA dev kit. Then, the second make invocation will not rebuild anything: $ make -s && make CHK out/arm-plat-vexpress/conf.mk CHK out/arm-plat-vexpress/include/generated/conf.h CHK out/arm-plat-vexpress/conf.cmake CHK out/arm-plat-vexpress/export-ta_arm32/mk/conf.mk Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-08-10Add dependency on ta-dev-kit when building in-tree TAJerome Forissier
Fixes the following errors which may reportedly be triggered by plain "make" too [1]: $ make -s clean && make -s out/arm-plat-vexpress/ta/avb/entry.o cc1: warning: out/arm-plat-vexpress/export-ta_arm32/include: No such file or directory [-Wmissing-include-dirs] ta/avb/entry.c:5:30: fatal error: tee_internal_api.h: No such file or directory compilation terminated. mk/compile.mk:146: recipe for target 'out/arm-plat-vexpress/ta/avb/entry.o' failed make: *** [out/arm-plat-vexpress/ta/avb/entry.o] Error 1 $ make -s clean && make -s out/arm-plat-vexpress/ta/avb/user_ta_header.o cc1: warning: out/arm-plat-vexpress/export-ta_arm32/include: No such file or directory [-Wmissing-include-dirs] out/arm-plat-vexpress/export-ta_arm32/src/user_ta_header.c:5:22: fatal error: compiler.h: No such file or directory compilation terminated. mk/compile.mk:154: recipe for target 'out/arm-plat-vexpress/ta/avb/user_ta_header.o' failed make: *** [out/arm-plat-vexpress/ta/avb/user_ta_header.o] Error 1 Link: [1] https://github.com/OP-TEE/build/issues/285 Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-08-06Replace 'echo' commands with '$(cmd-echo-silent)'Jerome Forissier
Since commit b29b419506fa ("ta: add AVB TA"), "make -s" is not totally silent anymore. The following line is always printed: SIGN out/ta/avb/023f8f1a-292a-432b-8fc4-de8471358067.ta The AVB commit just revealed a simple mistake in the TA makefile. Fix it. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
2018-08-06In-tree TAs: prevent double slash in object pathsJerome Forissier
When processing the source files for an in-tree user TA (ta/*/user_ta.mk), make sure not to insert a double slash in the object file path. Fixes the following error: $ make -s $ make clean CLEAN out/arm-plat-vexpress rmdir: failed to remove 'out/arm-plat-vexpress/ta/avb': No such file or directory Makefile:98: recipe for target 'clean' failed make: *** [clean] Error 1 The error results from the fact that we have two kinds of object files in the in-tree TAs: - The object files built from ta/*/user_ta.mk. For AVB, we have out/arm-plat-vexpress/ta/avb//entry.o (notice the repeated slash). - The object files that correspond to "specified source files", i.e., constructed from $(spec-out-dir) and $(spec-srcs). For AVB we have out/arm-plat-vexpress/ta/avb/user_ta_header.o. When "make clean" creates the list of directories to be removed, it strips the /filename part and keeps only the directory part, resulting in: rmdir ... out/arm-plat-vexpress/ta/avb/ out/arm-plat-vexpress/ta/avb Trying to remove the same directory twice: "No such file or directory". Fixes: https://github.com/OP-TEE/optee_os/issues/2484 Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Andrew F. Davis <afd@ti.com> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
2018-08-01ta: mk: make sign tool configurablePengguang Zhu
Since custom load and verification methods for user TA is supported, the sign tool also should be configurable. Signed-off-by: Pengguang Zhu <zpghao@163.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
2018-07-18ta: add AVB TAJens Wiklander
Adds an AVB TA to be used to provide required services for AVB in U-boot. Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-07-18Add support for compiling in-tree TAsJens Wiklander
Adds support for compiling in-tree TAs. Unless specified via CFG_USER_TA_TARGET_<ta-name> the TA will be built with the first TA target (aka TA dev kit, when delivered) specified in the variable ta-targets which is initialized in core/arch/arm/plat-*/conf.mk. Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-07-18ta: support variables user-ta-{uuid,ldadd}Jens Wiklander
Replaces the old variables "binary" and "ldadd" with "user-ta-uuid" and "user-ta-ldadd" respectively. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-07-18ta: prepare for in-tree ta buildingJens Wiklander
Prepare for in-tree TA building by adding $(sm) to all TA dev-kit variables that may cause conflicts either with the core linking or when linking multiple TAs. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-07-18ta: link.mk: drop support for variable LDFLAGSJens Wiklander
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-07-18ta: link.mk: discard library orderingJens Wiklander
All the static user TA libraries supplied in $(libnames) are linked in the same group using --start-group and --end-group so the order of the libraries doesn't matter any more. Remove the complexity of reordering the libraries. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-05-31TA dev kit: shared library: strip directory partJerome Forissier
The symbolic link and its target are in the same directory, so we need to make sure that there is no relative path before the target filename. The proper Make variable to use is therefore not $< but $(<F). Fixes: 01b8b5ce011d ("TA dev kit: when building a shared library, create symlink with UUID") Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-05-31ta/ta.mk: export CFG_TA_DYNLINKJerome Forissier
Allows a TA to determine at build time if the targeted OP-TEE supports run time dynamic linking. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-05-30TA dev kit: shared library: add -f argument to lnJerome Forissier
When creating a symbolic link <uuid>.elf -> libname.so, use the -f (force) argument so that the command won't fail if the link already exists. It is a very common case: the first time the library is built and the link is created. Then whenever some source file is modified, the .so is re-linked but the symbolic link is there already. Fixes: 01b8b5ce011d ("TA dev kit: when building a shared library, create symlink with UUID") Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-05-30pta: add system pTAIgor Opaniuk
Add system pTA, which provides misc. auxiliary services, extending existing GlobalPlatform Core API. Add a call for seeding entropy to the default RNG pool. Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2018-05-29TA dev kit: when building a shared library, create symlink with UUIDJerome Forissier
For convenience for use by tools such as scripts/symbolize.py, create a symbolic link <uuid>.elf -> libfoo.so. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
2018-05-22libmbedtls: configure and compile mbedtlsJens Wiklander
Configures mbedtls with a minimal user mode TA configuration and makes it compile. Adds dummy include/mbedtls_config_kernel.h to give a good error message in case mbedTLS is compiled in for kernel mode. mbedTLS is enabled for TAs with CFG_TA_MBEDTLS = y Builtin self tests are enabled with CFG_TA_MBEDTLS_SELF_TEST = y Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-05-16Remove license notice from STMicroelectronics filesEtienne Carriere
Since a while the source files license info are defined by SPDX identifiers. We can safely remove the verbose license text from the files that are owned by either only STMicroelectronics or only both Linaro and STMicroelectronics. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-05-04ta.ld.S: make .plt section of user TAs executableJerome Forissier
This patch is preparatory work for the support of dynamically linked user mode TAs. The Procedure Linkage Table (.plt) section should be executable, because it contains special code used to redirect function calls to the proper destination in external (shared) libraries. Therefore, move it into the executable segment. A couple of blank lines are removed in the hope that it will make it easier to see which sections are grouped together in the same segment. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
2018-05-04TA dev kit: add support for creating shared librariesJerome Forissier
A new Makefile include (ta/arch/arm/link_shlib.mk) is introduced, it is quite similar to the file used to generate a TA (ta/arch/arm/link.mk) except that is produces a shared object: $(SHLIBNAME).so. A signed file is also produced: $(SHLIBUUID).ta. Actual support for dynamically linked TAs in the OP-TEE ELF loader will be added in subsequent patches. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
2018-05-04TA dev kit: minor cleanupJerome Forissier
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
2018-04-20ta: export CFG_CACHE_API and CFG_SECURE_DATA_PATHJens Wiklander
Exports CFG_CACHE_API and CFG_SECURE_DATA_PATH to the dev kit conf.mk, making them available for compiled TAs. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-04-20ta: pass CFG_ variables as definesJens Wiklander
Pass all CFG_ variables as -D<varname>=<value> command line parameters for the C preprocessor. Variables set to "n" are not passed and variables set to "y" are supplied with the value "1" instead. This is the same translation as done for conf.h when compiling OP-TEE OS. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-04-20ta: only export variables containing a valueJens Wiklander
Only exports variables containing a value to the dev kit conf.mk Suggested-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-04-20ta: rework how CFG_TA_FLOAT_SUPPORT is passedJens Wiklander
Reworks how CFG_TA_FLOAT_SUPPORT is passed to the exported conf.mk Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-04-20ta: rework how ENABLE_MDBG=1 is passedJens Wiklander
Reworks how ENABLE_MDBG=1 is passed when compiling the TA. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-04-20ta/ta.mk: make sure exported conf.mk is updatedJens Wiklander
Makes sure that conf.mk exported to TA dev kit is updated even if the change isn't due to a change in mk/config.mk Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-04-05core: deprecate TA property flags EXEC_DDR and USER_MODEEtienne Carriere
TA property flags TA_FLAG_EXEC_DDR and TA_FLAG_USER_MODE were not really useful in the OP-TEE and now they are meaningless. Define the mask of flags a TA may pretend to and assert loaded TAs do not expect flags set outside of the defined supported bit flags. Fix gmon.h against duplicate round macros. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
2018-02-21ta_dev_kit.mk: define ENABLE_MDBG when CFG_TEE_TA_MALLOC_DEBUG is setJerome Forissier
In order to use the memory leak detection code, a user-mode TA needs two things: - A version of libutils.a that was built with malloc debug code. This is taken care of by ta/ta.mk which sets ENABLE_MDBG=1 when CFG_TEE_TA_MALLOC_DEBUG is 'y'. - The proper declarations for mdbg_malloc(), mdbg_free(), mdbg_check() etc. as well as the macro redefinitions for malloc(), free() etc. in the header files when the TA is built. This patch adds the missing definition of ENABLE_MDBG in ta/mk/ta_dev_kit.mk when CFG_TEE_TA_MALLOC_DEBUG is 'y'. In addition, the usage of CFG_TEE_TA_MALLOC_DEBUG and CFG_TEE_CORE_MALLOC_DEBUG is better documented in mk/conf.mk. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
2018-02-08Generate conf.cmake for TA dev kitJens Wiklander
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-01-10Add SPDX license identifiersJerome Forissier
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>
2017-12-15trace: make output more compactJoakim Bech
The new format for traces are: <type>/<where>:<thread_id> [<func:line>] <message> <type>: D = DEBUG E = ERROR I = INFO F = FLOW <where>: TA = Trusted Application TC = TEE Core I.e, it outputs messages like this: D/TC:00 ta_load:316 ELF load address 0x101000 etc Thread ID will either take a single or two digits depending on the number of threads in use. Signed-off-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
2017-12-07Sign TAs as bootstrap TAsJens Wiklander
Changes to TA sign script to sign TAs as Bootstrap TAs (img_type == SHDR_BOOTSTRAP_TA) instead of the legacy TA format (img_type == SHDR_TA). Reviewed-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-10-06Dump call stack on TA panicJerome Forissier
Adds support for dumping the call stack of a user-mode TA when it panics. Stack unwinding happens in kernel mode by re-using abort_print_error() in core/arch/arm/kernel/abort.c. Like for abort dumps, the helper script scripts/symbolize.py may be used to obtain source-level information. This feature is enabled by default. Set CFG_UNWIND=n to disable it (or CFG_TEE_CORE_DEBUG=n). In libutee, the utee_panic() syscall wrapper is renamed __utee_panic() and now takes an additional parameters: a stack pointer, in addition to the panic code. utee_panic() is written in assembly and pushes some registers onto the stack before calling __utee_panic(). When it is time to return from syscall_panic(), tee_svc_sys_return_helper() uses the stack pointer to get the information needed to unwind the TA stack. A struct abort_info is created and abort_print_error() is called. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (QEMU) Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey 32/64) Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (QEMUv8)
2017-09-27libutee: remove Trusted UI codeJerome Forissier
Removes all the TUI-related code from libutee (lib/libutee/tui), as well as its dependencies: lib/libpng and lib/libzlib. Two reasons for this: 1. This is far from being a complete and testable TUI implementation. In other words, it is dead code, more or less. 2. lib/libzlib (version 1.2.8) contains several CVE vulnerabilities. Even if the code is not used, it may trigger some code analysis tools and is a problem for some projects. Reported-by: Jianhui Li <airbak.li@hisilicon.com> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
2017-09-12Update link rules for User TAPierre Peiffer
Let's use --start-group / --end-group to allow all libraries added by the user to use any symbols provided by optee-os lib without having to add that library again. For example, if one provides its own library libexample.a that use strcmp(), which is provided by libutils.a, and he want to compile its TA with libexample.a, he'll add libdirs += ... libnames += example in his TA Makefile But the linker will not find strcmp() symbol unless he adds utils lib explicitly: libnames += utils example even if it is already specified in ta_dev_kit.mk because the order matter, unless it uses -start-group / --end-group Signed-off-by: Pierre Peiffer <ppeiffer@invensense.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> [jerome.forissier@linaro.org: wrap line in commit description] Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
2017-08-25Add target ta_dev_kitJerome Forissier
Adds support for `make ta_dev_kit`, to build the user space libraries only and copy them (as well as the related header files and make files) to the export directory. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
2017-08-17ta/ta.mk: add scripts/symbolize.py to TA dev kitJerome Forissier
scripts/symbolize.py is useful to TA developers, so add it to the TA development kit. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-08-17ta/ta.mk: remove useless calls to $(wildcard)Jerome Forissier
File names passed to $(wildcard) in ta/mk contain no wildcarding token and they all exist. Therefore, $(wildcard <file>) is always equal to <file> and $(wildcard) may be omitted. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-02-28core: provide a hash tree for secure storageJens Wiklander
Provides a hash tree to be used by REE and SQL FS for the secure storage implementation. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-02-08make clean: don't fail on non-empty directoryJerome Forissier
"make clean" may report errors when trying to clean with different configuration values than the ones used during the build. For instance: $ make -s CFG_RPMB_FS=y $ make clean CLEAN out/arm-plat-vexpress rmdir: failed to remove 'out/arm-plat-vexpress/core/tee': Directory not empty rmdir: failed to remove 'out/arm-plat-vexpress/core': Directory not empty rmdir: failed to remove 'out/arm-plat-vexpress': Directory not empty Makefile:88: recipe for target 'clean' failed make: *** [clean] Error 1 The clean command should not fail, since the build tree was properly cleaned for the requested configuration. Fix this by using 'rmdir --ignore-fail-on-non-empty'. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>